{"id":3547,"date":"2014-09-10T22:47:38","date_gmt":"2014-09-10T14:47:38","guid":{"rendered":"http:\/\/rmohan.com\/?p=3547"},"modified":"2014-09-10T22:47:38","modified_gmt":"2014-09-10T14:47:38","slug":"rhel6-4-course-summary","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=3547","title":{"rendered":"RHEL6.4 Course Summary"},"content":{"rendered":"<p>RHEL6.4 Course Summary<\/p>\n<p>Unit1<br \/>\nTracking Security Updates<br \/>\nUpdate the following three categories<br \/>\nRHSA<br \/>\nRHBA<br \/>\nRHEA<br \/>\nyum updateinfo list View all updates<br \/>\nyum updateinfo list &#8211;cve = CVE-2013-0755 View an update<br \/>\nyum &#8211;security list updates view security update<br \/>\nyum updateinfo list | grep &#8216;Critical&#8217; | cut -f1 -d &#8221; | sort -u | wc -l<\/p>\n<p>Unit2<br \/>\nManaging Software Updates<br \/>\nrpm -qa &gt; \/root\/pre-update-software. $ (date +% Y% m% d) all of the packages installed imported into a document<br \/>\nyum updateinfo&gt; \/root\/updateinfo-report.$(date +% Y% m% d)<br \/>\nyum update &#8211;security -y update only security package installed before gpgcheck = 1 to open<br \/>\nyum update &#8211;cve = &lt;CVE&gt; can update specific<br \/>\nrpm &#8211;import &lt;GPG-KEY-FILE&gt; Import key installation package<br \/>\nrpm -qa | grep gpg-pubkey view credible GPG keys<br \/>\nrpm -qi gpg-pubkey view package details<br \/>\nrpm -K rpm package installation package to view the md5 value is not correct<br \/>\nrpm -vvK rpm package gives debugging information<br \/>\nrpm -qp &#8211;scripts rpm package to view the installation package has no script<\/p>\n<p>Unit3<br \/>\nCreating File Systems<br \/>\nlvcreate -l 100% FREE -n lvname vgname -l, &#8211;extents LogicalExtentsNumber [% {VG | PVS | FREE | ORIGIN}]<br \/>\ncryptsetup luksFormat \/ dev \/ vgname \/ lvname type YES to start the encryption format, enter the password<br \/>\ncryptsetup luksOpen \/ dev \/ vgname \/ lvname luksname opened and named<br \/>\nmkfs -t ext4 \/ dev \/ mapper \/ luksname settings file system<br \/>\nmkdir \/ secret<br \/>\nmount \/ dev \/ mapper \/ luksname \/ secret<br \/>\numout \/ secret<br \/>\ncryptsetup luksClose luksname off encryption<\/p>\n<p>dd if = \/ dev \/ urandom of = \/ path \/ to \/ passsword \/ file bs = 4096 count = 1 can also be used to encrypt the plaintext file<br \/>\nchmod 600 \/ path \/ to \/ password \/ file<br \/>\ncryptsetup luksAddkey \/ dev \/ vdaN \/ path \/ to \/ password \/ file here also need to enter a password<br \/>\ntouch \/ etc \/ crypttab<br \/>\nluksname \/ dev \/ vgname \/ lvname \/ path \/ to \/ password \/ file<br \/>\nIn \/ etc \/ fstab to add the following<br \/>\n\/ Dev \/ mapper \/ luksname \/ secret ext4 defaults 1 2 so you can boot automatically mount the encrypted partition<\/p>\n<p>Unit4<br \/>\nManaging File Systems<br \/>\nnosuid, noexec command has no suid permissions and execute permissions<br \/>\ntune2fs -l \/dev\/vd1 | head -n 19<br \/>\ntune2fs -l \/dev\/vda1 | grep &#8216;mount options&#8217;<br \/>\ntune2fs -o user_xattr, acl \/dev\/vda1 acl permission to add partitions, you can modify \/etc\/fstab file<br \/>\nlsattr view the file special attributes<br \/>\nchattr +, &#8211; grammar<br \/>\nonly a supplementary<br \/>\nprohibit modification<\/p>\n<p>Unit5<br \/>\nManaging Special Permissions<br \/>\nsuid setUID<br \/>\nguid setGID<br \/>\nchmod u + s \/path\/to\/procedure everyone has permission to run the program<br \/>\nbelongs to the group chmod g + s \/path\/to\/dir generated files folder unchanged<br \/>\nfind \/bin -perm \/7000 Find all privileged position under the \/bin<br \/>\nfind \/bin -perm 4000 Exact Match<br \/>\nfind \/bin -perm -4000 setUID<br \/>\nfind \/bin -perm -2000 setGID<br \/>\nfind \/bin -perm -6000 setUID and setGID can also use \/6000<\/p>\n<p>Unit6<br \/>\nManaging Additional File Access Controls<br \/>\nView umask umask value<br \/>\ngetfacl somefile view the file ACLs (access control lists)<br \/>\nsetfacl -mu:bob:rwx \/path\/to\/file bob has owned and owning group permissions<br \/>\nsetfacl -md:u:smith:rx subdir d u default user permissions rx subdir subdirectories<br \/>\nsetfacl -mo::r\/path\/to\/file owner readable<\/p>\n<p>Unit7<br \/>\nMonitoring For File System Changes<br \/>\nAIDE (Advanced Intrusion Detection Environment) Advanced Intrusion Detection Environment<br \/>\nIts main function is to detect the integrity of the document<br \/>\nyum install -y aide aide to monitor file permissions<br \/>\ngrep PERMS \/etc\/aide.conf added to monitor file<br \/>\nPERMS = p + i + u + g + acl + selinux p permissions, inode, u user, g User Group<br \/>\n\/Etc PERMS<br \/>\n\/root\/\\..* PERMS<br \/>\naide &#8211;init initialize the database<br \/>\nmv \/var\/lib\/aide\/aide.db.new.gz \/var\/aide\/aide.db.gz<br \/>\naide &#8211;check on the above changes to the file, check verification<\/p>\n<p>Unit8<br \/>\nManaging User Accounts<br \/>\nchage -m 0 -M 90 -W 7 -I 14 username<br \/>\n-m min days<br \/>\n-M Max days<br \/>\n-W Warn days<br \/>\n-I Inactive days<br \/>\nchage -d 0 username user to change the password at next logon<br \/>\nchage -l username listed in the user configuration information<br \/>\nuserdel -r while *** user directory username ***<br \/>\ngrep PASS_M \/etc\/login.defs in the configuration file can be modified to add the new user to take effect<br \/>\n# PASS_MAX_DAYS Maximum number of days a password may be used.<br \/>\n# PASS_MIN_DAYS Minimum number of days allowed between password changes.<br \/>\n# PASS_MIN_LEN Minimum acceptable password length.<br \/>\nPASS_MAX_DAYS 30<br \/>\nPASS_MIN_DAYS 3<br \/>\nPASS_MIN_LEN 8<br \/>\ngetent passwd | cut -d: -f3 | sort -n | uniq -d see if the system has no duplicate account<\/p>\n<p>Unit9<br \/>\nManaging Pluggable Authentication Modules<br \/>\nFlexibility PAM Pluggable Authentication Modules can be dynamic content needed to make changes to the verification, it can greatly improve verification<br \/>\n1, authentication management (authentication management)<br \/>\nAccept the user name and password, then the user&#8217;s password for authentication, and is responsible for setting the user&#8217;s some secret information<br \/>\n2, account management (account management)<br \/>\nCheck whether the account is allowed to log into the system, whether the account has expired, account login Is there a limit period of time so<br \/>\n3, password management (password management)<br \/>\nIs mainly used to modify the user&#8217;s password<br \/>\n4, the session manager (session management)<br \/>\nIs to provide for the session management and accounting (accounting)<\/p>\n<p>Various Linux distributions, PAM authentication module used is normally stored in the \/ lib \/ security \/ directory, you can use the ls command to see what this computer validation controls to support the general PAM module names such as pam_unix.so, the module can always Add this directory and ***, which does not directly affect the program runs, the specific impact on the PAM configuration directory.<br \/>\nPAM configuration file is usually stored in the \/etc\/pam.d\/ directory.<br \/>\nCheck whether the program is to support PAM, use the command:<br \/>\nldd `which cmd` | grep libpam \/\/ cmd represents the view of the program name<br \/>\nIf you include libpam library, the program will support PAM authentication.<br \/>\nldd `which login` | grep libpam<br \/>\nlibpam.so.0 =&gt; \/lib64\/libpam.so.0 (0x000000326d200000)<br \/>\nlibpam_misc.so.0 =&gt; \/lib64\/libpam_misc.so.0 (0x000000326b600000)<br \/>\n\/etc\/pam.d Configuration File Syntax<br \/>\ntype control module [module arguments]<\/p>\n<p>grep maxlogins \/etc\/security\/limits.conf<br \/>\n# &lt;Domain&gt; &lt;type&gt; &lt;item&gt; &lt;value&gt;<br \/>\n# &#8211; Maxlogins &#8211; max number of logins for this user<br \/>\nstudent &#8211; maxlogins 4 users to simultaneously configure the maximum number of logins<br \/>\nqa hard cpu 1 configuration cpu time<br \/>\nLimit the number of times a user entered password is incorrect<br \/>\ncat \/etc\/pam.d\/system-auth same password-auth have to be changed<br \/>\n#% PAM-1.0<br \/>\n# This file is auto-generated.<br \/>\n# User changes will be destroyed the next time authconfig is run.<br \/>\nauth required pam_env.so<br \/>\nauth required pam_tally2.so onerr = fail deny = 3 unlock_time = 180 3 times wrong banned three minutes<br \/>\nauth sufficient pam_fprintd.so<br \/>\nauth sufficient pam_unix.so nullok try_first_pass<br \/>\nauth requisite pam_succeed_if.so uid&gt; = 1000 quiet_success<br \/>\nauth required pam_deny.so<\/p>\n<p>Also note the position of account required pam_tally2.so placed<br \/>\naccount required pam_unix.so<\/p>\n<p>pam_tally2 View user<br \/>\npam_tally2 &#8211;reset -u username reset release disabled users<\/p>\n<p>Unit10<br \/>\nSecuring Console Access<br \/>\nEncryption is not the same $ 6 sh256 $ 1 md5<br \/>\ngrub-crypt<br \/>\nPassword:<br \/>\nRetype password:<br \/>\n$6$01wSV5m9GBdGdQ3J<\/p>\n<p>$ oroEE6jjedQ59yQqJlxwAc1MBPSrdm6ufuUJil5rJaXmLgYNbsjz1F.kQlcrZYcrO5y9h014VkGCsH5PN7TTg.<br \/>\ngrub-md5-crypt<br \/>\nPassword:<br \/>\nRetype password:<br \/>\n$ 1$HqxBl1$DVC9jyW6HXZ8.vAlPo2QR1<br \/>\ncat \/etc\/grub.cfg<br \/>\npassword &#8211;encrypted $ 6 $ 01wSV5m9GBdGdQ3J<\/p>\n<p>$ oroEE6jjedQ59yQqJlxwAc1MBPSrdm6ufuUJil5rJaXmLgYNbsjz1F.kQlcrZYcrO5y9h014VkGCsH5PN7TTg.<br \/>\nBefore \/etc\/issue certification Show<br \/>\n\/etc\/motd Message Of The Day and historically certified display after<br \/>\n\/etc\/ssh\/sshd_config PermitRootLogin no ban ssh root user login<\/p>\n<p>Unit11<br \/>\nInstalling Central Authentication<br \/>\nIdM (Identity Management)<br \/>\nchkconfig NetworkManager off; service NetworkManager stop off NetworkManager, otherwise ipa-server installation<\/p>\n<p>Not on<br \/>\n\/etc\/sysconfig\/network-scripts\/ifcfg-eth0 NIC to configure a static IP, gateway,<br \/>\nDNS must be configured NM_CONTROLLED=no<br \/>\n\/etc\/hosts of the machine to do to resolve ip server.example.com server<br \/>\nyum -y install ipa-server<br \/>\nipa-server-install &#8211;idstart=2000 &#8211;idmax=20000 Note to uid plus a range<\/p>\n<p>The installation is complete need to open the following ports:<br \/>\nTCP Ports:<br \/>\n80,443 HTTP \/ HTTPS<br \/>\n389,636 LDAP \/ LDAPS<br \/>\n88,464 kerberos<\/p>\n<p>UDP Ports:<br \/>\n88,464 kerberos<br \/>\n123 ntp<\/p>\n<p>Can also be used to specify a specific command line parameter, so you do not need to specify in the above interactive<br \/>\nipa-server-install &#8211;hostname=server.example.com -n example.com -r EXAMPLE.COM -p RedHat123 -a<\/p>\n<p>redhat123 -U<\/p>\n<p>service sshd restart<\/p>\n<p>kinit admin initialization, if the average user to change the password the first secondary<br \/>\nipa user-find admin verification<\/p>\n<p>The remaining add users, add the group, modify the configuration information can be operating https:\/\/server.example.com login name admin password in the browser<br \/>\nredaht123<\/p>\n<p>Client installation as follows:<\/p>\n<p>yum -y install ipa-client<\/p>\n<p>ipa-client-install &#8211;mkhomedir attention to give the new user-generated directory<\/p>\n<p>During the installation to use admin redhat123 certification at You can also use non-interactive installation<\/p>\n<p>ipa-client-install &#8211;domain =example.com &#8211;server =server.example.com &#8211;realm =EXAMPLE.COM -p admin -w<br \/>\nredhat123 &#8211;mkhomedir -U<\/p>\n<p>Finally, users can idm landed on the client, the home directory is automatically generated after landing<br \/>\nUnit12<br \/>\nManaging Central Authentication<br \/>\nkinit admin<br \/>\nipa pwpolicy-show command line view policy<br \/>\nkpasswd bob for users to change passwords<br \/>\nThese can be operated in the browser, including sudoers, users can use a command such as<\/p>\n<p>Unit13<br \/>\nConfiguring System Logging<br \/>\nryslog-gnutls after installation support TLS port 6514<br \/>\nLog into the server and client service<br \/>\nServer configuration is as follows:<br \/>\n\/etc\/rsyslog.conf open port module supports TCP and UDP here to open the TCP<br \/>\n# Provides UDP syslog reception<br \/>\n#$ModLoad imudp<br \/>\n#$UDPServerRun 514<br \/>\n#Provides TCP syslog reception<br \/>\n$ModLoad imtcp<br \/>\n$InputTCPServerRun 514<br \/>\n\/etc\/rsyslog.d\/remote.conf This file is in the directory of the new rsyslog.d<br \/>\n:fromhost,isequal, &#8220;client.example.com&#8221; \/var\/log\/client\/messages<br \/>\n:fromhost,isequal, &#8220;client.example.com&#8221; ~ ~ after adding the client&#8217;s information is only stored in the above file<\/p>\n<p>Client configuration is as follows:<br \/>\nNote first of all log \/etc\/rsyslog.conf send port, the local is not retained<br \/>\n*. *@@(O) server.example.com:514 two @ is gone TCP (o) is the port number for later use<br \/>\nlogrotate log segmentation tool<\/p>\n<p>In fact, there is a logwatch tool, you can send important information to the server specified mailbox every day<\/p>\n<p>Unit14<br \/>\nConfiguring System Auditing<br \/>\n\/etc\/sysconfig\/auditd<br \/>\n\/etc\/audit\/auditd.conf default port number tcp 60<br \/>\n\/etc\/audit\/audit.rules man rules see the syntax<br \/>\nremote logging with the auditd \/etc\/audisp\/plugins.d\/syslog.conf setting active = yes and restart auditd service<\/p>\n<p>Can be used to send information to a remote syslog server<br \/>\nAfter installing audispd-plugins package (each client, which is a multi-node), you can open \/etc\/audisp\/plugins.d\/au-remote.conf<\/p>\n<p>active = yes to the audit log is sent to the log server<br \/>\nConcrete syntax can man auditctl<br \/>\n\/etc\/audit\/audit.rules<br \/>\n-w \/ path \/ to \/ file -p rwxa -k key<br \/>\n-e 2<br \/>\n-w specified audit file path<br \/>\n-p access r read w write x execute a property changes<br \/>\n-k key<br \/>\n-e setting enabled flag, 0,1,2 can be set up after 2 \/ etc other documents do not add to the mix, there are problems too restart<\/p>\n<p>Unit15<br \/>\nControlling Access to Network Services<br \/>\niptables firewall<br \/>\niptables -L<br \/>\niptables -F<br \/>\niptables -X<br \/>\niptables -Z<br \/>\niptables -A INPUT -i lo -j ACCEPT system service use<br \/>\niptables -A INPUT -m state &#8211;stat ESTABLISHED, RELATED -j ACCEPT<br \/>\niptables -A INPUT -p icmp -j ACCEPT<br \/>\niptables -A INPUT -m state &#8211;state NEW -p tcp &#8211;dport 22 -s 192.168.0.0\/24 -j ACCEPT<br \/>\niptables -A INPUT -m state &#8211;state NEW -p tcp &#8211;dport 80 -s 192.168.0.0\/24 -j ACCEPT<br \/>\niptables -A INPUT -m state &#8211;state NEW -p tcp &#8211;dport 514 -s 192.168.0.0\/24 -j ACCEPT<br \/>\niptables -A INPUT -s 192.168.0.0\/24 -j ACCEPT<br \/>\niptables -A INPUT -j LOG<br \/>\niptables -A INPUT -j REJECT<br \/>\nserver iptables save record keeping<br \/>\ncat \/etc\/sysconfig\/iptables default save location<br \/>\niptables -nvL &#8211;line-numbers view verification<br \/>\nAnother useful place for PPTP server, Internet problem -s segment after dialling into the PPTP server is automatically assigned IP<br \/>\niptables -t nat -A POSTROUTING -s 192.168.0.0\/24 -o eth0 -j MASQUERADE<\/p>\n","protected":false},"excerpt":{"rendered":"<p>RHEL6.4 Course Summary<\/p>\n<p>Unit1 Tracking Security Updates Update the following three categories RHSA RHBA RHEA yum updateinfo list View all updates yum updateinfo list &#8211;cve = CVE-2013-0755 View an update yum &#8211;security list updates view security update yum updateinfo list | grep &#8216;Critical&#8217; | cut -f1 -d &#8221; | sort -u | wc -l<\/p>\n<p>Unit2 [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3547"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3547"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3547\/revisions"}],"predecessor-version":[{"id":3548,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3547\/revisions\/3548"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}