Sunday 26 April 2015

6. Redhat Linux : RHCE 6

6. Redhat Linux : RHCE 6



Apache
------

* local host send webaddres to DNS which returns IP and local host search in network for it which then returns some 
acknowledgement to the IP wich is send to DNS by the host again returns into the local host
* httpd is used for this
* port 80
* config file: /etc/httpd/conf/httpd.conf
* Document: /var/www/html
* Index directory : index.html
* service httpd start
* chkconfig httpd on

Steps to do for website:
-----------------------
 1. Goto /etc/httpd/conf/httpd.conf
  go to line 1000 and copy
   <VirtualHost nooh:80>
       ServerAdmin root@nooh
       DocumentRoot /var/www/html
       ServerName nooh
       ErrorLog logs/nooh-error_log
       CustomLog logs/nooh-access_log common
   </VirtualHost>
 2. Create html page on /var/www/html/index.html
 3. go to /etc/hosts
  ip_address hostname
 4. go to /etc/resolv.conf
  search hostname
 5. check for errors 'httpd -t'
 6. service httpd restart

Steps to do for extended website:
--------------------------------
 1. Goto /etc/httpd/conf/httpd.conf
  go to line 1000 and copy
   <VirtualHost nooh:80>
       ServerAdmin root@nooh
       DocumentRoot /var/www/html/extended/
       ServerName nooh
       ErrorLog logs/nooh-error_log
       CustomLog logs/nooh-access_log common
   </VirtualHost>

 2. Create html page on /var/www/html/extended/index.html
 3. go to /etc/hosts
  ip_address hostname
 4. go to /etc/resolv.conf
  search hostname
 5. check for errors 'httpd -t'
 6. service httpd restart

Steps to do for virtual website:
--------------------------------
 1. Goto /etc/httpd/conf/httpd.conf
  go to line 990 and copy
   NameVirtualHost ip_addres:80
  go to line 1000 and copy
   <VirtualHost ibm.com:80>
       ServerAdmin root@ibm.com
       DocumentRoot /var/www/virtual
       ServerName ibm.com
       ErrorLog logs/ibm.com-error_log
       CustomLog logs/ibm.com-access_log common
   </VirtualHost>

 2. Create html page on /var/www/virtual/index.html
 3. go to /etc/hosts
  ip_address hostname
 4. go to /etc/resolv.conf
  search hostname
 5. check for errors 'httpd -t'
 6. service httpd restart

      Samba
      -----

* config file: /etc/samba/smb.conf
* context: samba_share_t

Steps to do to setup share folder:
---------------------------------
 1. goto line 297 /etc/samba/smb.conf
         [ibm]
          comment = Public Stuff
         path = /samba_share
         public = yes
         Browseable = yes
         Valid users = Natasha
         writable = yes

 2. ls -Zd /common/
 3. chcon -t samba_share_t /common/
 4. getsebool -a | grep samba
 5. setsebool -P samba_create_home_dirs=1
 6. setsebool -P samba_enable_home_dirs=1
 7. setsebool -P samba_export_all_ro=1
 8. setsebool -P samba_export_all_rw=1
 9. setsebool -P use_samba_home_dirs=1
 10. service smb restart
 11. chkconfig smb on
     At client end:
 1. smbclient -L //server_ip
 2. smbclient //server_ip/public_name (if it is public for all)
 3. smbclient //server_ip/public_name -U username

Steps to enable a particular user alone:
---------------------------------------
 1. goto /etc/samba/smb.conf
  
 2. smbpasswd -a Username
 3. service smb restart

      Mail Server
      -----------

* Sender to MTA(Mail Transfer Agent) to n/w to MDA(Mail Delivery Agent) to Reciever
* port : 25
* config file : /etc/config/main.cf
* package : postfix
* service postfix start
* service postfix status
* chkconfig postfix on
* for mail forwarding edit /etc/postfix/virtual

      SELinux
      -------
* Security Enhanced Linux
* security + logs - enforcing mode
* no security + logs - permissive mode
* no security + no logs - disabled mode
* to switch from enforcing to permissive and viceversa set 'setenforce 0'(permissive) and 'setenforce 1'(enforcing)
* to disable goto /etc/sysconfig/selinux and edit
* getenforce to get the status
* setsebool to set booleans
* getsebool to get the status of booleans
* /var/log/audit/audit.log stores the logs on these
* context are also called as label

Steps to do:in /etc/postfix/main.cf
 1. line no 75
  myhostname host_name
 2. mydomain = domainname
 3. uncomment 98,99,112,113,114
 4. comment 115
 service postfix restart

/*to do in rescue mode
 3 
mount -o -rw vmount /
*/

/*
Commands for the day:
--------------------
* httpd -t
* chcon -t samba_share_t /common/
* getsebool -a | grep samba
* setsebool -P samba_create_home_dirs=1
* smbclient -L //server_ip
* smbclient //server_ip/public_name (if it is public for all)
* smbpasswd -a Username
* service postfix start
* service postfix status
* getenforce to get the status
* setsebool to set booleans
* getsebool to get the status of booleans
*/