{"id":3603,"date":"2014-09-25T13:14:22","date_gmt":"2014-09-25T05:14:22","guid":{"rendered":"http:\/\/rmohan.com\/?p=3603"},"modified":"2014-09-25T13:14:22","modified_gmt":"2014-09-25T05:14:22","slug":"rhel-6-security-guide","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=3603","title":{"rendered":"RHEL 6 Security Guide"},"content":{"rendered":"<p style=\"font: 14px\/28px ??, 'Arial Narrow', arial, serif; margin: 0px; padding: 0px; height: auto; color: #555555; text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: #ffffff; -webkit-text-stroke-width: 0px;\"><strong>1. GRUB password<\/strong><\/p>\n<p style=\"font: 14px\/28px ??, 'Arial Narrow', arial, serif; margin: 0px; padding: 0px; height: auto; color: #555555; text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: #ffffff; -webkit-text-stroke-width: 0px;\">i. run as root with \/sbin\/grub-md5-crypt to get a MD5 hash.<span class=\"Apple-converted-space\">\u00a0<\/span><br \/>\nii. add &#8220;password &#8211;md5 &lt;password-hash&gt;&#8221; below<span class=\"Apple-converted-space\">\u00a0<\/span><em>timeout<\/em><span class=\"Apple-converted-space\">\u00a0<\/span>line in \/boot\/grub\/grub.conf<span class=\"Apple-converted-space\">\u00a0<\/span><br \/>\niii. prees<span class=\"Apple-converted-space\">\u00a0<\/span><strong>p<\/strong><span class=\"Apple-converted-space\">\u00a0<\/span>when access grub menu<\/p>\n<p style=\"font: 14px\/28px ??, 'Arial Narrow', arial, serif; margin: 0px; padding: 0px; height: auto; color: #555555; text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: #ffffff; -webkit-text-stroke-width: 0px;\"><strong>2. Administrative Controls for Root<\/strong><\/p>\n<h6 style=\"margin: 0px; padding: 0px; color: #555555; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: ??, 'Arial Narrow', arial, serif; font-style: normal; font-variant: normal; word-spacing: 0px; white-space: normal; background-color: #ffffff; -webkit-text-stroke-width: 0px;\">Methods of Disabling the Root Account<\/h6>\n<div class=\"table-contents\" style=\"font: 14px\/28px ??, 'Arial Narrow', arial, serif; margin: 0px; padding: 0px; color: #555555; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: #ffffff; -webkit-text-stroke-width: 0px;\">\n<table border=\"1\" summary=\"Methods of Disabling the Root Account\">\n<colgroup>\n<col width=\"12%\" \/>\n<col width=\"29%\" \/>\n<col width=\"29%\" \/>\n<col width=\"29%\" \/><\/colgroup>\n<thead>\n<tr>\n<th>Method<\/th>\n<th>Description<\/th>\n<th>Effects<\/th>\n<th>Does Not Affect<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Changing the root shell.<\/td>\n<td>Edit the<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"filename\">\/etc\/passwd<\/code><span class=\"Apple-converted-space\">\u00a0<\/span>file and change the shell from<code class=\"command\">\/bin\/bash<\/code><span class=\"Apple-converted-space\">\u00a0<\/span>to<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">\/sbin\/nologin<\/code>.<\/td>\n<td>\n<table class=\"simplelist\" border=\"0\" summary=\"Simple list\">\n<tbody>\n<tr>\n<td>Prevents access to the root shell and logs any such attempts.<\/td>\n<\/tr>\n<tr>\n<td>The following programs are prevented from accessing the root account:<\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">login<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">gdm<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">kdm<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">xdm<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">su<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">ssh<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">scp<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">sftp<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<td>\n<table class=\"simplelist\" border=\"0\" summary=\"Simple list\">\n<tbody>\n<tr>\n<td>Programs that do not require a shell, such as FTP clients, mail clients, and many setuid programs.<\/td>\n<\/tr>\n<tr>\n<td>The following programs are<span class=\"emphasis\"><em>not<\/em><\/span><span class=\"Apple-converted-space\">\u00a0<\/span>prevented from accessing the root account:<\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">sudo<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7 FTP clients<\/td>\n<\/tr>\n<tr>\n<td>\u00b7 Email clients<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<tr>\n<td>Disabling root access via any console device (tty).<\/td>\n<td>An empty<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"filename\">\/etc\/securetty<\/code><span class=\"Apple-converted-space\">\u00a0<\/span>file prevents root login on any devices attached to the computer.<\/td>\n<td>\n<table class=\"simplelist\" border=\"0\" summary=\"Simple list\">\n<tbody>\n<tr>\n<td>Prevents access to the root account via the console or the network. The following programs are prevented from accessing the root account:<\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">login<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">gdm<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">kdm<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">xdm<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7 Other network services that open a tty<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<td>\n<table class=\"simplelist\" border=\"0\" summary=\"Simple list\">\n<tbody>\n<tr>\n<td>Programs that do not log in as root, but perform administrative tasks through setuid or other mechanisms.<\/td>\n<\/tr>\n<tr>\n<td>The following programs are<span class=\"emphasis\"><em>not<\/em><\/span><span class=\"Apple-converted-space\">\u00a0<\/span>prevented from accessing the root account:<\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">su<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">sudo<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">ssh<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">scp<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">sftp<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<tr>\n<td>Disabling root SSH logins.<\/td>\n<td>Edit the<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"filename\">\/etc\/ssh\/sshd_config<\/code>file and set the<code class=\"command\">PermitRootLogin<\/code><span class=\"Apple-converted-space\">\u00a0<\/span>parameter to<code class=\"command\">no<\/code>.<\/td>\n<td>\n<table class=\"simplelist\" border=\"0\" summary=\"Simple list\">\n<tbody>\n<tr>\n<td>Prevents root access via the OpenSSH suite of tools. The following programs are prevented from accessing the root account:<\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">ssh<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">scp<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">sftp<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<td>\n<table class=\"simplelist\" border=\"0\" summary=\"Simple list\">\n<tbody>\n<tr>\n<td>This only prevents root access to the OpenSSH suite of tools.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<tr>\n<td>Use PAM to limit root access to services.<\/td>\n<td>Edit the file for the target service in the<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"filename\">\/etc\/pam.d\/<\/code>directory. Make sure the<code class=\"filename\">pam_listfile.so<\/code><span class=\"Apple-converted-space\">\u00a0<\/span>is required for authentication.<\/td>\n<td>\n<table class=\"simplelist\" border=\"0\" summary=\"Simple list\">\n<tbody>\n<tr>\n<td>Prevents root access to network services that are PAM aware.<\/td>\n<\/tr>\n<tr>\n<td>The following services are prevented from accessing the root account:<\/td>\n<\/tr>\n<tr>\n<td>\u00b7 FTP clients<\/td>\n<\/tr>\n<tr>\n<td>\u00b7 Email clients<\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">login<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">gdm<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">kdm<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">xdm<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">ssh<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">scp<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7<span class=\"Apple-converted-space\">\u00a0<\/span><code class=\"command\">sftp<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u00b7 Any PAM aware services<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<td>\n<table class=\"simplelist\" border=\"0\" summary=\"Simple list\">\n<tbody>\n<tr>\n<td>Programs and services that are not PAM aware.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<\/tbody>\n<tbody class=\"footnotes\">\n<tr>\n<td colspan=\"4\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p style=\"font: 14px\/28px ??, 'Arial Narrow', arial, serif; margin: 0px; padding: 0px; height: auto; color: #555555; text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: #ffffff; -webkit-text-stroke-width: 0px;\">\u00a0<strong>3. Checking Listening Ports<\/strong><\/p>\n<pre class=\"screen\" style=\"background: #f7f7f7; margin: 0px 0px 1em; padding: 0px; width: 712.79px; color: #555555; text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: auto; font-family: 'Courier New', monospace; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">nmap -sT -O localhost ; netstat -atunp ; lsof -i<\/pre>\n<p style=\"font: 14px\/28px ??, 'Arial Narrow', arial, serif; margin: 0px; padding: 0px; height: auto; color: #555555; text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: #ffffff; -webkit-text-stroke-width: 0px;\"><strong>4. Access Control to Network Services Flowchart<\/strong><\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2014\/09\/iptables.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3604\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2014\/09\/iptables.png\" alt=\"iptables\" width=\"304\" height=\"476\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2014\/09\/iptables.png 304w, https:\/\/mohan.sg\/wp-content\/uploads\/2014\/09\/iptables-191x300.png 191w, https:\/\/mohan.sg\/wp-content\/uploads\/2014\/09\/iptables-95x150.png 95w\" sizes=\"(max-width: 304px) 100vw, 304px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p style=\"font: 14px\/28px ??, 'Arial Narrow', arial, serif; margin: 0px; padding: 0px; height: auto; color: #555555; text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: #ffffff; -webkit-text-stroke-width: 0px;\">1. GRUB password<\/p>\n<p style=\"font: 14px\/28px ??, 'Arial Narrow', arial, serif; margin: 0px; padding: 0px; height: auto; color: [...] \n\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,50],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3603"}],"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=3603"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3603\/revisions"}],"predecessor-version":[{"id":3605,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3603\/revisions\/3605"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}