CIS Amazon Linux 2014.09-2015.03 Benchmark v1.1.0
CIS Amazon Linux 2014.09-2015.03 Benchmark v1.1.0
CIS Amazon Linux 2014.09-2015.03 Benchmark v1.1.0
03
v1.1.0 - 07-06-2015
Benchmark
http://benchmarks.cisecurity.org
The CIS Security Benchmarks division provides consensus-oriented information security products, services, tools, metrics, suggestions, and
recommendations (the SB Products) as a public service to Internet users worldwide. Downloading or using SB Products in any way signifies
and confirms your acceptance of and your binding agreement to these CIS Security Benchmarks Terms of Use.
Download, install, and use each of the SB Products on a single computer, and/or
Print one or more copies of any SB Product that is in a .txt, .pdf, .doc, .mcw, or .rtf format, but only if each such copy is printed in
its entirety and is kept intact, including without limitation the text of these CIS Security Benchmarks Terms of Use.
SB Products Provided As Is. CIS is providing the SB Products as is and as available without: (1) any representations,
warranties, or covenants of any kind whatsoever (including the absence of any warranty regarding: (a) the effect or lack of effect
of any SB Product on the operation or the security of any network, system, software, hardware, or any component of any of them,
and (b) the accuracy, utility, reliability, timeliness, or completeness of any SB Product); or (2) the responsibility to make or notify
you of any corrections, updates, upgrades, or fixes.
Intellectual Property and Rights Reserved. You are not acquiring any title or ownership rights in or to any SB Product, and full
title and all ownership rights to the SB Products remain the exclusive property of CIS. All rights to the SB Products not expressly
granted in these Terms of Use are hereby reserved.
Restrictions. You acknowledge and agree that you may not: (1) decompile, dis-assemble, alter, reverse engineer, or otherwise
attempt to derive the source code for any software SB Product that is not already in the form of source code; (2) distribute,
redistribute, sell, rent, lease, sublicense or otherwise transfer or exploit any rights to any SB Product in any way or for any
purpose; (3) post any SB Product on any website, bulletin board, ftp server, newsgroup, or other similar mechanism or device;
(4) remove from or alter these CIS Security Benchmarks Terms of Use on any SB Product; (5) remove or alter any proprietary
notices on any SB Product; (6) use any SB Product or any component of an SB Product with any derivative works based directly
on an SB Product or any component of an SB Product; (7) use any SB Product or any component of an SB Product with other
products or applications that are directly and specifically dependent on such SB Product or any component for any part of their
functionality; (8) represent or claim a particular level of compliance or consistency with any SB Product; or (9) facilitate or
otherwise aid other individuals or entities in violating these CIS Security Benchmarks Terms of Use.
Your Responsibility to Evaluate Risks. You acknowledge and agree that: (1) no network, system, device, hardware, software,
or component can be made fully secure; (2) you have the sole responsibility to evaluate the risks and benefits of the SB Products
to your particular circumstances and requirements; and (3) CIS is not assuming any of the liabilities associated with your use of
any or all of the SB Products.
CIS Liability. You acknowledge and agree that neither CIS nor any of its employees, officers, directors, agents or other service
providers has or will have any liability to you whatsoever (whether based in contract, tort, strict liability or otherwise) for any
direct, indirect, incidental, consequential, or special damages that arise out of or are connected in any way with your use of any
SB Product.
Indemnification. You agree to indemnify, defend, and hold CIS and all of CIS's employees, officers, directors, agents and other
service providers harmless from and against any liabilities, costs and expenses incurred by any of them in connection with your
violation of these CIS Security Benchmarks Terms of Use.
Jurisdiction. You acknowledge and agree that: (1) these CIS Security Benchmarks Terms of Use will be governed by and
construed in accordance with the laws of the State of Maryland; (2) any action at law or in equity arising out of or relating to
these CIS Security Benchmarks Terms of Use shall be filed only in the courts located in the State of Maryland; and (3) you hereby
consent and submit to the personal jurisdiction of such courts for the purposes of litigating any such action.
U.S. Export Control and Sanctions laws. Regarding your use of the SB Products with any non-U.S. entity or country, you
acknowledge that it is your responsibility to understand and abide by all U.S. sanctions and export control laws as set from time
to time by the U.S. Bureau of Industry and Security (BIS) and the U.S. Office of Foreign Assets Control (OFAC).
SPECIAL RULES FOR CIS MEMBER ORGANIZATIONS: CIS reserves the right to create special rules for: (1) CIS Members; and (2) NonMember organizations and individuals with which CIS has a written contractual relationship. CIS hereby grants to each CIS Member
Organization in good standing the right to distribute the SB Products within such Member's own organization, whether by manual or
electronic means. Each such Member Organization acknowledges and agrees that the foregoing grants in this paragraph are subject to the
terms of such Member's membership arrangement with CIS and may, therefore, be modified or terminated by CIS at any time.
1|Page
Table of Contents
Table of Contents ..........................................................................................................................................................2
Overview ...........................................................................................................................................................................4
Intended Audience ..................................................................................................................................................4
Consensus Guidance ...............................................................................................................................................4
Typographical Conventions ................................................................................................................................5
Scoring Information................................................................................................................................................5
Profile Definitions....................................................................................................................................................6
Acknowledgements.................................................................................................................................................7
Recommendations........................................................................................................................................................8
1 Install Updates, Patches and Additional Security Software ............................................................8
1.1 Filesystem Configuration ........................................................................................................................8
1.2 Configure Software Updates ............................................................................................................... 25
1.3 Advanced Intrusion Detection Environment (AIDE) .............................................................. 29
1.4 Configure SELinux ................................................................................................................................... 31
1.5 Secure Boot Settings ............................................................................................................................... 37
1.6 Additional Process Hardening ........................................................................................................... 39
2 OS Services ........................................................................................................................................................... 42
2.1 Remove Legacy Services ....................................................................................................................... 42
3 Special Purpose Services ............................................................................................................................... 54
4 Network Configuration and Firewalls .................................................................................................... 66
4.1 Modify Network Parameters (Host Only) .................................................................................... 66
4.2 Modify Network Parameters (Host and Router)....................................................................... 68
4.3 IPv6 ................................................................................................................................................................. 76
4.4 Install TCP Wrappers ............................................................................................................................. 79
4.5 Uncommon Network Protocols ......................................................................................................... 83
5 Logging and Auditing ...................................................................................................................................... 87
5.1 Configure rsyslog...................................................................................................................................... 88
5.2 Configure System Accounting (auditd).......................................................................................... 94
2|Page
3|Page
Overview
This document, CIS Amazon Linux Benchmark, provides prescriptive guidance for
establishing a secure configuration posture for Amazon Linux version 2014.09-2015.03
running on x86 and x64 platforms. To obtain the latest version of this guide, please visit
http://benchmarks.cisecurity.org. If you have questions, comments, or have identified
ways to improve this guide, please write us at feedback@cisecurity.org.
Intended Audience
This benchmark is intended for system and application administrators, security specialists,
auditors, help desk, and platform deployment personnel who plan to develop, deploy,
assess, or secure solutions that incorporate Amazon Linux.
Consensus Guidance
This benchmark was created using a consensus review process comprised subject matter
experts. Consensus participants provide perspective from a diverse set of backgrounds
including consulting, software development, audit and compliance, security research,
operations, government, and legal.
Each CIS benchmark undergoes two phases of consensus review. The first phase occurs
during initial benchmark development. During this phase, subject matter experts convene
to discuss, create, and test working drafts of the benchmark. This discussion occurs until
consensus has been reached on benchmark recommendations. The second phase begins
after the benchmark has been published. During this phase, all feedback provided by the
Internet community is reviewed by the consensus team for incorporation in the
benchmark. If you are interested in participating in the consensus process, please visit
https://community.cisecurity.org.
4|Page
Typographical Conventions
The following typographical conventions are used throughout this guide:
Convention
Meaning
Monospace font
Italic font
Note
Scoring Information
A scoring status indicates whether compliance with the given recommendation impacts the
assessed target's benchmark score. The following scoring statuses are used in this
benchmark:
Scored
Failure to comply with "Scored" recommendations will decrease the final benchmark score.
Compliance with "Scored" recommendations will increase the final benchmark score.
Not Scored
Failure to comply with "Not Scored" recommendations will not decrease the final
benchmark score. Compliance with "Not Scored" recommendations will not increase the
final benchmark score.
5|Page
Profile Definitions
The following configuration profiles are defined by this Benchmark:
Level 1
Items in this profile intend to:
o
o
o
Level 2
This profile extends the "Level 1" profile. Items in this profile exhibit one or more of
the following characteristics:
o
o
o
6|Page
Acknowledgements
This benchmark exemplifies the great things a community of users, vendors, and subject matter
experts can accomplish through consensus collaboration. The CIS community thanks the entire
consensus team with special recognition to the following individuals who contributed greatly to
the creation of this guide:
Editor
Rael Daruszka , Center for Internet Security
Additionally, the CIS community thanks the following individuals for their contributions to
previous CIS Red Hat Linux Benchmarks, which were used in the development of this
benchmark: Carole Fennelly, Jonathan Klein, Samuel Apperson, Robert Aspinall, Bill
Munyan, Michael Boelen, Frank Breedijk, Schuberg Philis, Than Thi Cham, Mike Cross,
Ralph Durkee, William Eckler, Wallace Epperson , Philippe Eveque , Howard Farmer, AJ
Fasano, Victor Forno, Blake Frantz, Jason Frisvold, Vladimir Giszpenc, Alex Gockmann,
Hilary Holz, Duncan Innes, Roger Kennedy, David Kennel, Heinrich Wilhelm , Christophe
Lafaille, Lucky Leavell, Rodney McKee, Nikhil Mittal, Jason Morgan, Alexei Nazario, Delvin
Nelson , Mihai Nitulescu, Tom Pietschmann, Ely Pinto, Alexey Rogozhkin, Keith Schincke,
Bruno Silva, Stephen Smoogen, Laura Stitely, Andrew Stueve, Tran Thanh Chien, Robert
Thomas, Stephen Tihor, George Toft, Sven Vermeulen, Vytautas Vysniauskas, Don Williams,
Joe Wulf, Steve Grubb, Margaret Garland, Paul Frederick, Michelle Vogeler, Wei Chea Ang,
Onn Chee Wong, Craig Sayler, Kevin Simmons, and Jonathon Brandt Buckley.
7|Page
Recommendations
1 Install Updates, Patches and Additional Security Software
1.1 Filesystem Configuration
Directories that are used for system-wide functions can be further protected by placing
them on separate partitions. This provides protection for resource exhaustion and enables
the use of mounting options that are applicable to the directory's intended use. User's data
can be stored on separate partitions and have stricter mount options. A user partition is a
filesystem that has been established for use by the users and does not contain software for
system operations. The directives in this section are easier to perform during initial system
installation. If the system is already installed, it is recommended that a full backup be
performed before repartitioning the system.
Note: If you are repartitioning a system that has already been installed, make sure the data
has been copied over to the new partition, unmount it and then remove the data from the
directory that was in the old partition. Otherwise it will still consume space in the old
partition that will be masked when the new filesystem is mounted. For example, if a system
is in single-user mode with no filesystems mounted and the administrator adds a lot of data
to the /tmp directory, this data will still consume space in / once the /tmp filesystem is
mounted unless it is removed first.
useless for an attacker to install executable code. It would also prevent an attacker from
establishing a hardlink to a system setuid program and wait for it to be updated. Once the
program was updated, the hardlink would be broken and the attacker would have his own
copy of the program. If the program happened to have a security vulnerability, the attacker
could continue to exploit the known flaw.
Audit:
Verify that there is a /tmp file partition in the /etc/fstab file.
# grep "[[:space:]]/tmp[[:space:]]" /etc/fstab
Remediation:
For new installations, check the box to "Review and modify partitioning" and create a
separate partition for /tmp.
For systems that were previously installed, use the Logical Volume Manager (LVM) to
create partitions.
References:
1. AJ Lewis, "LVM HOWTO", http://tldp.org/HOWTO/LVM-HOWTO/
If either command emits no output then the system is not configured as recommended.
9|Page
Remediation:
Edit the /etc/fstab file and add nodev to the fourth field (mounting options). See the
fstab(5) manual page for more information.
# mount -o remount,nodev /tmp
Audit:
Run the following commands to determine if the system is configured as recommended.
# grep "[[:space:]]/tmp[[:space:]]" /etc/fstab | grep nosuid
# mount | grep "[[:space:]]/tmp[[:space:]]" | grep nosuid
If either command emits no output then the system is not configured as recommended.
Remediation:
Edit the /etc/fstab file and add nosuid to the fourth field (mounting options). See the
fstab(5) manual page for more information.
10 | P a g e
The noexec mount option specifies that the filesystem cannot contain executable binaries.
Rationale:
Since the /tmp filesystem is only intended for temporary file storage, set this option to
ensure that users cannot run executable binaries from /tmp.
Audit:
Run the following commands to determine if the system is configured as recommended.
# grep "[[:space:]]/tmp[[:space:]]" /etc/fstab | grep noexec
# mount | grep "[[:space:]]/tmp[[:space:]]" | grep noexec
If either command emits no output then the system is not configured as recommended.
Remediation:
Edit the /etc/fstab file and add noexec to the fourth field (mounting options). See the
fstab(5) manual page for more information.
# mount -o remount,noexec /tmp
Remediation:
For new installations, check the box to "Review and modify partitioning" and create a
separate partition for /var.
11 | P a g e
For systems that were previously installed, use the Logical Volume Manager (LVM) to
create partitions.
References:
1. AJ Lewis, "LVM HOWTO", http://tldp.org/HOWTO/LVM-HOWTO/
If the above commands emit no output then the system is not configured as recommended.
Remediation:
# mount --bind /tmp /var/tmp
Profile Applicability:
Level 1
Description:
The /var/log directory is used by system services to store log data .
Rationale:
There are two important reasons to ensure that system logs are stored on a separate
partition: protection against resource exhaustion (since logs can grow quite large) and
protection of audit data.
Audit:
# grep "[[:space:]]/var/log[[:space:]]" /etc/fstab
<volume> /var/log <fstype> <options>
Remediation:
For new installations, check the box to "Review and modify partitioning" and create a
separate partition for /var/log.
For systems that were previously installed, use the Logical Volume Manager (LVM) to
create partitions.
References:
1. AJ Lewis, "LVM HOWTO", http://tldp.org/HOWTO/LVM-HOWTO/
space is left and performs actions based on the results. If other processes (such as syslog)
consume space in the same partition as auditd, it may not perform as desired.
Audit:
# grep "[[:space:]]/var/log/audit[[:space:]]" /etc/fstab
<volume> /var/log/audit <fstype> <options>
Remediation:
For new installations, check the box to "Review and modify partitioning" and create a
separate partition for /var/log/audit. For systems that were previously installed, use the
Logical Volume Manager (LVM) to create partitions.
References:
1. AJ Lewis, "LVM HOWTO", http://tldp.org/HOWTO/LVM-HOWTO/
Remediation:
For new installations, check the box to "Review and modify partitioning" and create a
separate partition for /home.
For systems that were previously installed, use the Logical Volume Manager (LVM) to
create partitions.
14 | P a g e
References:
1. AJ Lewis, "LVM HOWTO", http://tldp.org/HOWTO/LVM-HOWTO/
Set nodev on removable media to prevent character and block special devices that are
present on the removable be treated as these device files.
Rationale:
Removable media containing character and block special devices could be used to
circumvent security controls by allowing non-root users to access sensitive device files
such as /dev/kmem or the raw disk partitions.
Audit:
# grep <each removable media mountpoint> /etc/fstab
Verify that nodev is an option
Remediation:
Edit the /etc/fstab file and add "nodev" to the fourth field (mounting options). Look for
entries that have mount points that contain words such as floppy or cdrom. See the
fstab(5) manual page for more information.
16 | P a g e
Edit the /etc/fstab file and add noexec to the fourth field (mounting options). Look for
entries that have mount points that contain words such as floppy or cdrom. See the
fstab(5) manual page for more information.
Remediation:
Edit the /etc/fstab file and add nosuid to the fourth field (mounting options). Look for
entries that have mount points that contain words such as floppy or cdrom. See the
fstab(5) manual page for more information.
17 | P a g e
Since the /dev/shm filesystem is not intended to support devices, set this option to ensure
that users cannot attempt to create special devices in /dev/shm partitions.
Audit:
Run the following commands to determine if the system is in configured as recommended:
# grep /dev/shm /etc/fstab | grep nodev
# mount | grep /dev/shm | grep nodev
If either command emits no output then the system is not configured as recommended.
Remediation:
Edit the /etc/fstab file and add nodev to the fourth field (mounting options of entries
that have mount points that contain /dev/shm. See the fstab(5) manual page for more
information.
# mount -o remount,nodev /dev/shm
If either command emits no output then the system is not configured as recommended.
Remediation:
18 | P a g e
Edit the /etc/fstab file and add nosuid to the fourth field (mounting options). Look for
entries that have mount points that contain /dev/shm. See the fstab(5) manual page for
more information.
# mount -o remount,nosuid /dev/shm
If either command emits no output then the system is not configured as recommended.
Remediation:
Edit the /etc/fstab file and add noexec to the fourth field (mounting options). Look for
entries that have mount points that contain /dev/shm. See the fstab(5) manual page for
more information.
# mount -o remount,noexec /dev/shm
Setting the sticky bit on world writable directories prevents users from deleting or
renaming files in that directory that are not owned by them.
Rationale:
This feature prevents the ability to delete or rename files in world writable directories
(such as /tmp) that are owned by another user.
Audit:
# df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type d
\( -perm -0002 -a ! -perm -1000 \) 2>/dev/null
Remediation:
# df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type d
\( -perm -0002 -a ! -perm -1000 \) 2>/dev/null | xargs chmod a+t
Remediation:
Edit or create the file /etc/modprobe.d/CIS.conf and add the following line:
install cramfs /bin/true
20 | P a g e
Remediation:
Edit or create the file /etc/modprobe.d/CIS.conf and add the following line:
install freevxfs /bin/true
# /sbin/modprobe -n -v jffs2
install /bin/true
# /sbin/lsmod | grep jffs2
<No output>
Remediation:
Edit or create the file /etc/modprobe.d/CIS.conf and add the following line:
install jffs2 /bin/true
Remediation:
Edit or create the file /etc/modprobe.d/CIS.conf and add the following line:
install hfs /bin/true
22 | P a g e
The hfsplus filesystem type is a hierarchical filesystem designed to replace hfs that
allows you to mount Mac OS filesystems.
Rationale:
Removing support for unneeded filesystem types reduces the local attack surface of the
server. If this filesystem type is not needed, disable it.
Audit:
# /sbin/modprobe -n -v hfsplus
install /bin/true
# /sbin/lsmod | grep hfsplus
<No output>
Remediation:
Edit or create the file /etc/modprobe.d/CIS.conf and add the following line:
install hfsplus /bin/true
Remediation:
Edit or create the file /etc/modprobe.d/CIS.conf and add the following line:
23 | P a g e
Remediation:
Edit or create the file /etc/modprobe.d/CIS.conf and add the following line:
install udf /bin/true
24 | P a g e
Remediation:
Compare the GPG key with the one from Amazon. The following command can be used to
print the installed release key's fingerprint, which is actually contained in the file
referenced below:
# gpg --quiet --with-fingerprint /etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-ga
25 | P a g e
References:
1. More information on package signing is also available at
https://access.redhat.com/security/team/key
Remediation:
Edit the /etc/yum.conf file and set the gpgcheck to 1 as follows:
gpgcheck=1
Rationale:
The yum update utility is the preferred method to update software since it checks for
dependencies and ensures that the software is installed correctly. Refer to your local patch
management procedures for the method used to perform yum updates.
Audit:
Perform the following command to determine if there are any packages that need to be
updated:
# yum check-update
Remediation:
# yum update
Note: Actions in other areas of the benchmark change permissions on some files to make
them more secure than the default, which would cause this check to fail. It is important to
validate the packages either have the permissions they were intended to have, or have been
intentionally altered. It is recommended that any output generated in the audit step be
investigated to justify the discrepancy.
Remediation:
27 | P a g e
28 | P a g e
Remediation:
Use yum to install AIDE (-y option may be used to assume yes at all prompts):
# yum install aide
<Output messages from Yum install>
aide.<hardware platform> <package version> installed
Initialize AIDE:
# /usr/sbin/aide --init -B 'database_out=file:/var/lib/aide/aide.db.gz'
Note: The prelinking feature can interfere with AIDE because it alters binaries to speed up
their start up times. Set PRELINKING=no in /etc/sysconfig/prelink and run
/usr/sbin/prelink -ua to restore the binaries to their prelinked state, thus avoiding false
positives from AIDE.
29 | P a g e
Remediation:
Execute the following command:
# crontab -u root -e
Note: The checking in this instance occurs every day at 5am. Alter the frequency and time
of the checks in compliance with site policy.
30 | P a g e
targeted: consists mostly of Type Enforcement (TE) rules, and a small number of
Role-Based Access Control (RBAC) rules. Targeted restricts the actions of many
types of programs, but leaves interactive users largely unaffected.
mls: implements Multi-Level Security (MLS), which introduces even more kinds of
labels (sensitivity and category) and rules that govern access based on these.
This section provides guidance for the configuration of the targeted policy.
References:
1. NSA SELinux resources:
1. http://www.nsa.gov/research/selinux
2. http://www.nsa.gov/research/selinux/list.shtml
2. Fedora SELinux resources:
1. FAQ: http://docs.fedoraproject.org/selinux-faq
2. User Guide: http://docs.fedoraproject.org/selinux-user-guide
3. Managing Services Guide: http://docs.fedoraproject.org/selinux-managingconfined-services-guide
3. SELinux Project web page and wiki:
1. http://www.selinuxproject.org
4. Chapters 43-45 of Red Hat Enterprise Linux 5: Deployment Guide (Frank Mayer,
Karl MacMillan and David Caplan),
5. SELinux by Example: Using Security Enhanced Linux (Prentice Hall, August 6, 2006)
31 | P a g e
Remediation:
Remove all instances of selinux=0 and enforcing=0 from /etc/grub.conf.
Remediation:
Edit the /etc/selinux/config file to set the SELINUX parameter:
SELINUX=enforcing
Note: If your organization requires stricter policies, verify that they are selected by using
the "grep" command on the /etc/selinux/config file.
33 | P a g e
Remediation:
Edit the /etc/selinux/config file to set the SELINUXTYPE parameter:
SELINUXTYPE=targeted
Note: If your organization requires stricter policies, make sure they are added to the
/etc/selinux/config file.
Remediation:
# yum erase setroubleshoot
Since this service is not used very often, disable it to reduce the amount of potentially
vulnerable code running on the system.
Audit:
Perform the following to determine if mctrans is disabled:
# rpm -q mcstrans
mcstrans.<package version>.<hardware platform>
Remediation:
# yum erase mcstrans
Remediation:
Investigate any unconfined daemons found during the audit action.
Level 2
Description:
The libselinux, libselinux-utils, and policycoreutils packages contain the libraries
and utilities needed to administer SELinux.
Rationale:
If the SELinux libraries and tools are not installed SELinux will not function and cannot be
administered.
Audit:
Perform the following command to verify that the selinux packages are installed.
# rpm -q libselinux
libselinux.<package version>.<hardware platform>
# rpm -q libselinux-utils
libselinux-utils.<package version>.<hardware platform>
# rpm -q policycoreutils
policycoreutils.<package version>.<hardware platform>
Remediation:
Install the selinux packages:
yum install libselinux libselinux-utils policycoreutils
36 | P a g e
If the above command emits no output then the system is not configured as recommended.
Remediation:
# chown root:root /etc/grub.conf
Audit:
Perform the following to determine if the /etc/grub.conf file permissions are correct:
# stat -L -c "%a" /etc/grub.conf | egrep ".00"
If the above command emits no output then the system is not configured as recommended.
Remediation:
# chmod og-rwx /etc/grub.conf
Remediation:
Use grub-md5-crypt to produce an encrypted password:
# grub-md5-crypt
Password:
Retype password:
[Encrypted Password]
38 | P a g e
Remediation:
Add the following line to the /etc/security/limits.conf file.
* hard core 0
Level 1
Description:
Set the system flag to force randomized virtual memory region placement.
Rationale:
Randomly placing virtual memory regions will make it difficult for to write memory page
exploits as the memory placement will be consistently shifting.
Audit:
Perform the following to determine if virtual memory is randomized.
# /sbin/sysctl kernel.randomize_va_space
kernel.randomize_va_space = 2
Remediation:
Add the following line to the /etc/sysctl.conf file.
kernel.randomize_va_space = 2
or
# cat /etc/system-release
Remediation:
Use the latest update when installing new systems and upgrade to or reinstall with the
latest update as appropriate for existing systems.
41 | P a g e
2 OS Services
While applying system updates and patches helps correct known vulnerabilities, one of the
best ways to protect the system against as yet unreported vulnerabilities is to disable all
services that are not required for normal system operation. This prevents the exploitation
of vulnerabilities discovered at a later date. If a service is not enabled, it cannot be
exploited. The actions in this section of the document provide guidance on what services
can be safely disabled and under which circumstances, greatly reducing the number of
possible threats to the resulting system.
Remediation:
# yum erase telnet-server
Remediation:
# yum erase telnet
Rationale:
These legacy service contain numerous security exposures and have been replaced with
the more secure SSH package.
Audit:
Perform the following to determine if rsh-server is installed on the system.
# rpm -q rsh-server
package rsh-server is not installed
Remediation:
# yum erase rsh-server
Remediation:
# yum erase rsh
Profile Applicability:
Level 1
Description:
The Network Information Service (NIS), formerly known as Yellow Pages, is a client-server
directory service protocol used to distribute system configuration files. The NIS client
(ypbind) was used to bind a machine to an NIS server and receive the distributed
configuration files.
Rationale:
The NIS service is inherently an insecure system that has been vulnerable to DOS attacks,
buffer overflows and has poor authentication for querying NIS maps. NIS generally has
been replaced by such protocols as Lightweight Directory Access Protocol (LDAP). It is
recommended that the service be removed.
Audit:
Perform the following to determine if ypbind is installed on the system.
# rpm -q ypbind
package ypbind is not installed
Remediation:
# yum erase ypbind
Remediation:
# yum erase ypserv
Remediation:
# yum erase tftp
Level 1
Description:
Trivial File Transfer Protocol (TFTP) is a simple file transfer protocol, typically used to
automatically transfer configuration or boot machines from a boot server. The package
tftp-server is the server package used to define and support a TFTP server.
Rationale:
TFTP does not support authentication nor does it ensure the confidentiality of integrity of
data. It is recommended that TFTP be removed, unless there is a specific need for TFTP. In
that case, extreme caution must be used when configuring the services.
Audit:
Perform the following to determine if tftp-server is installed on the system.
# rpm -q tftp-server
package tftp-server is not installed
Remediation:
# yum erase tftp-server
47 | P a g e
Remediation:
# yum erase talk
Remediation:
# yum erase talk-server
48 | P a g e
If there are no xinetd services required, it is recommended that the daemon be deleted
from the system.
Audit:
Perform the following to determine if xinetd is installed on the system.
# rpm -q xinetd
package xinetd is not installed
Remediation:
# yum erase xinetd
datagram it receives. This service is intended for debugging and testing purposes. It is
recommended that this service be disabled.
Rationale:
Disabling this service will reduce the remote attack surface of the system.
Audit:
# chkconfig --list chargen-dgram
chargen-dgram: off
Remediation:
Disable the chargen-dgram service by running the following command:
# chkconfig chargen-dgram off
49 | P a g e
Description:
chargen-stream is a network service that responds with 0 to 512 ASCII characters for each
connection it receives. This service is intended for debugging and testing purposes. It is
recommended that this service be disabled.
Rationale:
Disabling this service will reduce the remote attack surface of the system.
Audit:
# chkconfig --list chargen-stream
chargen-stream: off
Remediation:
Disable the chargen-stream service by running the following command:
# chkconfig chargen-stream off
This service is intended for debugging and testing purposes. It is recommended that this
service be disabled.
Rationale:
Disabling this service will reduce the remote attack surface of the system.
Audit:
# chkconfig --list daytime-dgram
daytime-dgram: off
Remediation:
Disable the daytime-dgram service by running the following command:
# chkconfig daytime-dgram off
50 | P a g e
time. This service is intended for debugging and testing purposes. It is recommended that
this service be disabled.
Rationale:
Disabling this service will reduce the remote attack surface of the system.
Audit:
# chkconfig --list daytime-stream
daytime-stream: off
Remediation:
Disable the daytime-stream service by running the following command:
# chkconfig daytime-stream off
client. This service is intended for debugging and testing purposes. It is recommended that
this service be disabled.
Rationale:
Disabling this service will reduce the remote attack surface of the system.
Audit:
51 | P a g e
Remediation:
Disable the echo-dgram service by running the following command:
# chkconfig echo-dgram off
client. This service is intended for debugging and testing purposes. It is recommended that
this service be disabled.
Rationale:
Disabling this service will reduce the remote attack surface of the system.
Audit:
# chkconfig --list echo-stream
echo-stream: off
Remediation:
Disable the echo-stream service by running the following command:
# chkconfig echo-stream off
52 | P a g e
Rationale:
tcpmux-server can be abused to circumvent the server's host based firewall. Additionally,
tcpmux-server can be leveraged by an attacker to effectively port scan the server.
Audit:
# chkconfig --list tcpmux-server
tcpmux-server: off
Remediation:
Disable the tcpmux-server service by running the following command:
# chkconfig tcpmux-server off
53 | P a g e
Remediation:
Add the following line to the /etc/sysconfig/init file.
umask 027
54 | P a g e
The X Window system provides a Graphical User Interface (GUI) where users can have
multiple windows in which to run programs and various add on. The X Window system is
typically used on desktops where users login, but not on servers where users typically do
not login.
Rationale:
Unless your organization specifically requires graphical login access via the X Window
System, remove the server to reduce the potential attack surface.
Audit:
Perform the following to ensure the system is not booting into graphical mode:
# grep "^id:" /etc/inittab
id:3:initdefault
Perform the following to determine if the X Window server is installed on the system:
# rpm -q xorg-x11-server-common
package xorg-x11-server-common is not installed
Remediation:
Edit the /etc/inittab file to set the default runlevel as follows:
id:3:initdefault
55 | P a g e
Since servers are not normally used for printing, this service is not needed unless
dependencies require it. If this is the case, disable the service to reduce the potential attack
surface. If for some reason the service is required on the server, follow the
recommendations in sub-sections 3.2.1 - 3.2.5 to secure it.
Audit:
Perform the following to determine if Avahi is disabled.
# chkconfig --list avahi-daemon
avahi-daemon: 0:off 1:off 2:off 3:off 4:off 5:off 6:off
Remediation:
# chkconfig avahi-daemon off
Remediation:
# chkconfig cups off
References:
56 | P a g e
Remediation:
# yum erase dhcp
References:
1. More detailed documentation on DHCP is available at
http://www.isc.org/software/dhcp.
Perform the following to determine if the system is configured to use an NTP Server and
that the ntp daemon is running as an unprivileged user.
# grep "^server" /etc/ntp.conf
server
# grep "ntp:ntp" /etc/sysconfig/ntpd
OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid"
Remediation:
Set the following restrict parameters in /etc/ntp.conf:
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
References:
1. For more information on configuring NTP servers, go to the NTP homepage at
http://www.ntp.org.
58 | P a g e
Remediation:
If LDAP is running on the system and is not needed, remove it as follows:
# yum erase openldap-servers
# yum erase openldap-clients
References:
1. For more detailed documentation on OpenLDAP, go to the project homepage at
http://www.openldap.org.
59 | P a g e
The Network File System (NFS) is one of the first and most widely distributed file systems
in the UNIX environment. It provides the ability for systems to mount file systems of other
servers through the network.
Rationale:
If the server does not export NFS shares or act as an NFS client, it is recommended that
these services be disabled to reduce remote attack surface.
Audit:
Perform the following to determine if NFS is disabled.
# chkconfig --list nfslock
nfslock: 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# chkconfig --list rpcgssd
rpcgssd: 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# chkconfig --list rpcbind
rpcbind: 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# chkconfig --list rpcidmapd
rpcidmapd: 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# chkconfig --list rpcsvcgssd
rpcsvcgssd: 0:off 1:off 2:off 3:off 4:off 5:off 6:off
Remediation:
#
#
#
#
#
chkconfig
chkconfig
chkconfig
chkconfig
chkconfig
nfslock off
rpcgssd off
rpcbind off
rpcidmapd off
rpcsvcgssd off
Remediation:
# yum erase bind
Remediation:
# yum erase vsftpd
61 | P a g e
HTTP or web servers provide the ability to host web site content. The default HTTP server
shipped with Amazon Linux is Apache.
Rationale:
Unless there is a need to run the system as a web server, it is recommended that the
package be deleted to reduce the potential attack surface.
Audit:
Perform the following to determine if apache is disabled.
# rpm -q httpd
package httpd is not installed
Remediation:
# yum erase httpd
Remediation:
# yum erase dovecot
References:
1. http://www.dovecot.org
62 | P a g e
Remediation:
# yum erase samba
Remediation:
# yum erase squid
Remediation:
# yum erase net-snmp
64 | P a g e
Mail Transfer Agents (MTA), such as sendmail and Postfix, are used to listen for incoming
mail and transfer the messages to the appropriate user or mail server. If the system is not
intended to be a mail server, it is recommended that the MTA be configured to only process
local mail. By default, the MTA is set to loopback mode on Amazon Linux.
Rationale:
The software for all Mail Transfer Agents is complex and most have a long history of
security issues. While it is important to ensure that the system can process local mail
messages, it is not necessary to have the MTA's daemon listening on a port unless the
server is intended to be a mail server that receives and processes mail from other systems.
Audit:
Perform the following command and make sure that the MTA is listening on the loopback
address (127.0.0.1):
# netstat -an | grep LIST | grep ":25[[:space:]]"
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
Remediation:
Edit /etc/postfix/main.cf and add the following line to the RECEIVING MAIL section. If
the line already exists, change it to look like the line below.
inet_interfaces = localhost
# Execute the following command to restart postfix
# service postfix restart
65 | P a g e
Remediation:
Set the net.ipv4.ip_forward parameter to 0 in /etc/sysctl.conf:
net.ipv4.ip_forward=0
Level 1
Description:
ICMP Redirects are used to send routing information to other hosts. As a host itself does
not act as a router (in a host only configuration), there is no need to send redirects.
Rationale:
An attacker could use a compromised host to send invalid ICMP redirects to other router
devices in an attempt to corrupt routing and have users access a system set up by the
attacker as opposed to a valid system.
Audit:
Perform the following to determine if send packet redirects is disabled.
# /sbin/sysctl net.ipv4.conf.all.send_redirects
net.ipv4.conf.all.send_redirects = 0
# /sbin/sysctl net.ipv4.conf.default.send_redirects
net.ipv4.conf.default.send_redirects = 0
Remediation:
Set the net.ipv4.conf.all.send_redirects and
net.ipv4.conf.default.send_redirects parameters to 0 in /etc/sysctl.conf:
net.ipv4.conf.all.send_redirects=0
net.ipv4.conf.default.send_redirects=0
67 | P a g e
Remediation:
68 | P a g e
Remediation:
Set the net.ipv4.conf.all.accept_redirects and
net.ipv4.conf.default.accept_redirects parameters to 0 in /etc/sysctl.conf:
net.ipv4.conf.all.accept_redirects=0
net.ipv4.conf.default.accept_redirects=0
# /sbin/sysctl -w net.ipv4.conf.all.accept_redirects=0
# /sbin/sysctl -w net.ipv4.conf.default.accept_redirects=0
# /sbin/sysctl -w net.ipv4.route.flush=1
Remediation:
Set the net.ipv4.conf.all.secure_redirects and
net.ipv4.conf.default.secure_redirects parameters to 0 in /etc/sysctl.conf:
net.ipv4.conf.all.secure_redirects=0
net.ipv4.conf.default.secure_redirects=0
Level 1
Description:
When enabled, this feature logs packets with un-routable source addresses to the kernel
log.
Rationale:
Enabling this feature and logging these packets allows an administrator to investigate the
possibility that an attacker is sending spoofed packets to their server.
Audit:
Perform the following to determine if suspicious packets are logged.
# /sbin/sysctl net.ipv4.conf.all.log_martians
net.ipv4.conf.all.log_martians = 1
# /sbin/sysctl net.ipv4.conf.default.log_martians
net.ipv4.conf.default.log_martians = 1
Remediation:
Set the net.ipv4.conf.all.log_martians and net.ipv4.conf.default.log_martians
parameters to 1 in /etc/sysctl.conf:
net.ipv4.conf.all.log_martians=1
net.ipv4.conf.default.log_martians=1
Accepting ICMP echo and timestamp requests with broadcast or multicast destinations for
your network could be used to trick your host into starting (or participating) in a Smurf
attack. A Smurf attack relies on an attacker sending large amounts of ICMP broadcast
messages with a spoofed source address. All hosts receiving this message and responding
would send echo-reply messages back to the spoofed address, which is probably not
routable. If many hosts respond to the packets, the amount of traffic on the network could
be significantly multiplied.
Audit:
Perform the following to determine if all ICMP echo and timestamp requests to broadcast
and multicast addresses will be ignored.
# /sbin/sysctl net.ipv4.icmp_echo_ignore_broadcasts
net.ipv4.icmp_echo_ignore_broadcasts = 1
Remediation:
Set the net.ipv4.icmp_echo_ignore_broadcasts parameter to 1 in /etc/sysctl.conf:
net.ipv4.icmp_echo_ignore_broadcasts=1
# /sbin/sysctl net.ipv4.icmp_ignore_bogus_error_responses
net.ipv4.icmp_ignore_bogus_error_responses = 1
Remediation:
Set the net.ipv4.icmp_ignore_bogus_error_responses parameter to 1 in
/etc/sysctl.conf:
net.ipv4.icmp_ignore_bogus_error_responses=1
Remediation:
73 | P a g e
Remediation:
74 | P a g e
75 | P a g e
4.3 IPv6
IPv6 is a networking protocol that supersedes IPv4. It has more routable addresses and has
built in security
Remediation:
Set the net.ipv6.conf.all.accept_ra and net.ipv6.conf.default.accept_ra parameter
to 0 in /etc/sysctl.conf:
net.ipv6.conf.all.accept_ra=0
net.ipv6.conf.default.accept_ra=0
76 | P a g e
Remediation:
Set the net.ipv6.conf.all.accept_redirects and
net.ipv6.conf.default.accept_redirects parameters to 0 in /etc/sysctl.conf:
net.ipv6.conf.all.accept_redirects=0
net.ipv6.conf.default.accept_redirects=0
Rationale:
If IPv6 is not to be used, it is recommended that it be disabled to reduce the attack surface
of the system.
Audit:
Perform the following to determine if IPv6 is enabled
# grep net.ipv6.conf.all.disable_ipv6 /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6=1
# /sbin/sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6=1
Remediation:
Ensure net.ipv6.conf.all.disable_ipv6 is set to 1 in /etc/sysctl.conf:
net.ipv6.conf.all.disable_ipv6=1
78 | P a g e
<release>
<installed>
Remediation:
# yum install tcp_wrappers
The /etc/hosts.allow file specifies which IP addresses are permitted to connect to the
host. It is intended to be used in conjunction with the /etc/hosts.deny file.
Rationale:
The /etc/hosts.allow file supports access control by IP and helps ensure that only
authorized systems can connect to the server.
Audit:
Run the following command to verify the contents of the /etc/hosts.allow file.
# cat /etc/hosts.allow
[contents will vary, depending on your network configuration]
Remediation:
Create /etc/hosts.allow:
# echo "ALL: <net>/<mask>, <net>/<mask>, " >/etc/hosts.allow
80 | P a g e
# /bin/ls -l /etc/hosts.allow
-rw-r--r-- 1 root root 2055 Jan 30 16:30 /etc/hosts.allow
Remediation:
If the permissions of the /etc/hosts.allow file are incorrect, run the following command
to correct them:
# /bin/chmod 644 /etc/hosts.allow
Remediation:
Create /etc/hosts.deny:
# echo "ALL: ALL" >> /etc/hosts.deny
The /etc/hosts.deny file contains network information that is used by many system
applications and therefore must be readable for these applications to operate.
Rationale:
It is critical to ensure that the /etc/hosts.deny file is protected from unauthorized write
access. Although it is protected by default, the file permissions could be changed either
inadvertently or through malicious actions.
Audit:
Run the following command to determine the permissions on the /etc/hosts.deny file.
# /bin/ls -l /etc/hosts.deny
-rw-r--r-- 1 root root 2055 Jan 30 16:30 /etc/hosts.deny
Remediation:
If the permissions of the /etc/hosts.deny file are incorrect, run the following command to
correct them:
# /bin/chmod 644 /etc/hosts.deny
82 | P a g e
Remediation:
# echo "install dccp /bin/true" >> /etc/modprobe.d/CIS.conf
message-oriented like UDP, and ensures reliable in-sequence transport of messages with
congestion control like TCP.
Rationale:
If the protocol is not being used, it is recommended that kernel module not be loaded,
disabling the service to reduce the potential attack surface.
Audit:
Perform the following to determine if SCTP is disabled.
# grep "install sctp /bin/true" /etc/modprobe.d/CIS.conf
install sctp /bin/true
Remediation:
# echo "install sctp /bin/true" >> /etc/modprobe.d/CIS.conf
Remediation:
# echo "install rds /bin/true" >> /etc/modprobe.d/CIS.conf
84 | P a g e
Remediation:
# echo "install tipc /bin/true" >> /etc/modprobe.d/CIS.conf
Remediation:
# service iptables restart
# chkconfig iptables on
86 | P a g e
87 | P a g e
Remediation:
# yum install rsyslog
Rationale:
If the rsyslog service is not activated the system will not have a syslog service running.
Audit:
Perform the following to determine if rsyslog is enabled.
# chkconfig --list syslog
syslog 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# chkconfig --list rsyslog
rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Remediation:
# chkconfig syslog off
# chkconfig rsyslog on
Remediation:
Edit the following lines in the /etc/rsyslog.conf file as appropriate for your
environment:
89 | P a g e
auth,user.* /var/log/messages
kern.* /var/log/kern.log
daemon.* /var/log/daemon.log
syslog.* /var/log/syslog
lpr,news,uucp,local0,local1,local2,local3,local4,local5,local6.* /var/log/unused.log
# Execute the following command to restart rsyslogd
# pkill -HUP rsyslogd
References:
1. See the rsyslog.conf(5) man page for more information.
Remediation:
For sites that have not implemented a secure admin group:
Create the /var/log/ directory and for each <logfile> listed in the /etc/rsyslog.conf file,
perform the following commands:
# touch <logfile>
# chown root:root <logfile>
# chmod og-rwx <logfile>
Create the /var/log/ directory and for each <logfile> listed in the /etc/rsyslog.conf file,
perform the following commands (where is the name of the security group):
# touch <logfile>
# chown root:<securegrp> <logfile>
# chmod g-wx,o-rwx<logfile>
References:
1. See the rsyslog.conf(5) man page for more information.
Remediation:
Edit the /etc/rsyslog.conf file and add the following line (where logfile.example.com is
the name of your central log host).
*.* @@loghost.example.com
# Execute the following command to restart rsyslogd
# pkill -HUP rsyslogd
Note: The double "at" sign (@@) directs rsyslog to use TCP to send log messages to the
server, which is a more reliable transport mechanism than the default UDP protocol.
91 | P a g e
References:
1. See the rsyslog.conf(5) man page for more information.
Remediation:
On hosts that are designated as log hosts edit the /etc/rsyslog.conf file and un-comment
the following lines:
$ModLoad imtcp.so
$InputTCPServerRun 514
Note: On hosts that are not designated log hosts these lines should be commented out
instead.
92 | P a g e
References:
1. See the rsyslog(8) man page for more information.
93 | P a g e
94 | P a g e
Remediation:
Set the max_log_file parameter in /etc/audit/auditd.conf
max_log_file = <MB>
Remediation:
Add the following lines to the /etc/audit/auditd.conf file.
space_left_action = email
action_mail_acct = root
admin_space_left_action = halt
95 | P a g e
Description:
Normally, auditd will hold 4 logs of maximum log file size before deleting older log files.
Rationale:
In high security contexts, the benefits of maintaining a long audit history exceed the cost of
storing the audit history.
Audit:
Perform the following to determine if audit logs are retained.
# grep max_log_file_action /etc/audit/auditd.conf
max_log_file_action = keep_logs
Remediation:
Add the following line to the /etc/audit/auditd.conf file.
max_log_file_action = keep_logs
Remediation:
# chkconfig auditd on
96 | P a g e
5.2.3 Enable Auditing for Processes That Start Prior to auditd (Scored)
Profile Applicability:
Level 2
Description:
Configure grub so that processes that are capable of being audited can be audited even if
they start up prior to auditd startup.
Rationale:
Audit events need to be captured on processes that start up prior to auditd, so that
potential malicious activity cannot go undetected.
Audit:
Perform the following to determine if /etc/grub.conf is configured to log processes that
start prior to auditd.
# grep "kernel" /etc/grub.conf
Make sure each line that starts with kernel has the audit=1 parameter set.
Remediation:
Edit /etc/grub.conf to include audit=1 on each kernel line
5.2.4 Record Events That Modify Date and Time Information (Scored)
Profile Applicability:
Level 2
Description:
Capture events where the system date and/or time has been modified. The parameters in
this section are set to determine if the adjtimex (tune kernel clock), settimeofday (Set
time, using timeval and timezone structures) stime (using seconds since 1/1/1970) or
clock_settime (allows for the setting of several internal clocks and timers) system calls
have been executed and always write an audit record to the /var/log/audit.log file upon
exit, tagging the records with the identifier "time-change"
Rationale:
97 | P a g e
Unexpected changes in system date and/or time could be a sign of malicious activity on the
system.
Audit:
Perform the following to determine if events where the system date and/or time has been
modified are captured.
On a 64 bit system, perform the following command and ensure the output is as
shown. Note: "-a always,exit" may be specified as "-a exit,always".
# grep time-change /etc/audit/audit.rules
-a always,exit -F arch=b64 -S adjtimex -S settimeofday -k time-change
-a always,exit -F arch=b32 -S adjtimex -S settimeofday -S stime -k time-change
-a always,exit -F arch=b64 -S clock_settime -k time-change
-a always,exit -F arch=b32 -S clock_settime -k time-change
-w /etc/localtime -p wa -k time-change
# Execute the following command to restart auditd
# pkill -P 1-HUP auditd
On a 32 bit system, perform the following command and ensure the output is as
shown. Note: "-a always,exit" may be specified as "-a exit,always".
# grep time-change /etc/audit/audit.rules
-a always,exit -F arch=b32 -S adjtimex -S settimeofday -S stime -k time-change
-a always,exit -F arch=b32 -S clock_settime -k time-change
-w /etc/localtime -p wa -k time-change
# Execute the following command to restart auditd
# pkill -P 1-HUP auditd
Remediation:
For 64 bit systems, add the following lines to the /etc/audit/audit.rules file.
-a
-a
-a
-a
-w
always,exit -F
always,exit -F
always,exit -F
always,exit -F
/etc/localtime
arch=b64
arch=b32
arch=b64
arch=b32
-p wa -k
For 32 bit systems, add the following lines to the /etc/audit/audit.rules file.
-a always,exit -F arch=b32 -S adjtimex -S settimeofday -S stime -k time-change
-a always,exit -F arch=b32 -S clock_settime -k time-change
-w /etc/localtime -p wa -k time-change
# Execute the following command to restart auditd
# pkill -P 1-HUP auditd
Profile Applicability:
Level 2
Description:
Record events affecting the group, passwd (user IDs), shadow and gshadow (passwords) or
/etc/security/opasswd (old passwords, based on remember parameter in the PAM
configuration) files. The parameters in this section will watch the files to see if they have
been opened for write or have had attribute changes (e.g. permissions) and tag them with
the identifier "identity" in the audit log file.
Rationale:
Unexpected changes to these files could be an indication that the system has been
compromised and that an unauthorized user is attempting to hide their activities or
compromise additional accounts.
Audit:
Perform the following to determine if events that modify user/group information are
recorded.
# grep identity /etc/audit/audit.rules
-w /etc/group -p wa -k identity
-w /etc/passwd -p wa -k identity
-w /etc/gshadow -p wa -k identity
-w /etc/shadow -p wa -k identity
-w /etc/security/opasswd -p wa -k identity
Remediation:
Add the following lines to the /etc/audit/audit.rules file.
-w
-w
-w
-w
-w
/etc/group -p wa -k identity
/etc/passwd -p wa -k identity
/etc/gshadow -p wa -k identity
/etc/shadow -p wa -k identity
/etc/security/opasswd -p wa -k identity
99 | P a g e
Level 2
Description:
Record changes to network environment files or system calls. The below parameters
monitor the sethostname (set the system's host name) or setdomainname (set the system's
domainname) system calls, and write an audit event on system call exit. The other
parameters monitor the /etc/issue and /etc/issue.net files (messages displayed prelogin), /etc/hosts (file containing host names and associated IP addresses) and
/etc/sysconfig/network (directory containing network interface scripts and
configurations) files.
Rationale:
Monitoring sethostname and setdomainname will identify potential unauthorized changes
to host and domainname of a system. The changing of these names could potentially break
security parameters that are set based on those names. The /etc/hosts file is monitored
for changes in the file that can indicate an unauthorized intruder is trying to change
machine associations with IP addresses and trick users and processes into connecting to
unintended machines. Monitoring /etc/issue and /etc/issue.net is important, as
intruders could put disinformation into those files and trick users into providing
information to the intruder. Monitoring /etc/sysconfig/network is important as it can
show if network interfaces or scripts are being modified in a way that can lead to the
machine becoming unavailable or compromised. All audit records will be tagged with the
identifier "system-locale."
Audit:
On a 64 bit system, perform the following command and ensure the output is as shown
to determine if events that modify the system's environment are recorded. Note: "-a
always,exit" may be specified as "-a exit,always".
# grep system-locale /etc/audit/audit.rules
-a always,exit -F arch=b64 -S sethostname -S setdomainname -k system-locale
-a always,exit -F arch=b32 -S sethostname -S setdomainname -k system-locale
-w /etc/issue -p wa -k system-locale
-w /etc/issue.net -p wa -k system-locale
-w /etc/hosts -p wa -k system-locale
-w /etc/sysconfig/network -p wa -k system-locale
For 32 bit systems, perform the following command and ensure the output is as shown to
determine if events that modify the system's environment are recorded. Note: "-a
always,exit" may be specified as "-a exit,always".
# grep system-locale /etc/audit/audit.rules
-a always,exit -F arch=b32 -S sethostname -S setdomainname -k system-locale
100 | P a g e
-w
-w
-w
-w
/etc/issue -p wa -k system-locale
/etc/issue.net -p wa -k system-locale
/etc/hosts -p wa -k system-locale
/etc/sysconfig/network -p wa -k system-locale
Remediation:
For 64 bit systems, add the following lines to the /etc/audit/audit.rules file.
-a
-a
-w
-w
-w
-w
For 32 bit systems, add the following lines to the /etc/audit/audit.rules file.
-a
-w
-w
-w
-w
101 | P a g e
Perform the following to determine if events that modify the system's mandatory access
controls are recorded
# grep MAC-policy /etc/audit/audit.rules
-w /etc/selinux/ -p wa -k MAC-policy
Remediation:
Add the following lines to the /etc/audit/audit.rules file.
-w /etc/selinux/ -p wa -k MAC-policy
Remediation:
Add the following lines to the /etc/audit/audit.rules file.
102 | P a g e
-w /var/log/faillog -p wa -k logins
-w /var/log/lastlog -p wa -k logins
-w /var/log/tallylog -p wa -k logins
# Execute the following command to restart auditd
# pkill -HUP -P 1 auditd
Remediation:
Add the following lines to the /etc/audit/audit.rules file.
-w /var/run/utmp -p wa -k session
-w /var/log/wtmp -p wa -k session
-w /var/log/btmp -p wa -k session
# Execute the following command to restart auditd
# pkill -HUP -P 1 auditd
Note: Use the last command to read /var/log/wtmp (last with no parameters) and
/var/run/utmp (last -f /var/run/utmp)
103 | P a g e
For 32 bit systems, perform the following command and ensure the output is as shown to
determine if permission modifications are being recorded. Note: "-a always,exit" may be
specified as "-a exit,always".
104 | P a g e
Remediation:
For 64 bit systems, add the following lines to the /etc/audit/audit.rules file.
-a always,exit -F arch=b64 -S chmod -S fchmod -S fchmodat -F auid>=500 \
-F auid!=4294967295 -k perm_mod
-a always,exit -F arch=b32 -S chmod -S fchmod -S fchmodat -F auid>=500 \
-F auid!=4294967295 -k perm_mod
-a always,exit -F arch=b64 -S chown -S fchown -S fchownat -S lchown -F auid>=500 \
-F auid!=4294967295 -k perm_mod
-a always,exit -F arch=b32 -S chown -S fchown -S fchownat -S lchown -F auid>=500 \
-F auid!=4294967295 -k perm_mod
-a always,exit -F arch=b64 -S setxattr -S lsetxattr -S fsetxattr -S removexattr -S \
lremovexattr -S fremovexattr -F auid>=500 -F auid!=4294967295 -k perm_mod
-a always,exit -F arch=b32 -S setxattr -S lsetxattr -S fsetxattr -S removexattr -S \
lremovexattr -S fremovexattr -F auid>=500 -F auid!=4294967295 -k perm_mod
# Execute the following command to restart auditd
# pkill -HUP -P 1 auditd
For 32 bit systems, add the following lines to the /etc/audit/audit.rules file.
-a always,exit -F arch=b32 -S chmod -S fchmod -S fchmodat -F auid>=500 \
-F auid!=4294967295 -k perm_mod
-a always,exit -F arch=b32 -S chown -S fchown -S fchownat -S lchown -F auid>=500 \
-F auid!=4294967295 -k perm_mod
-a always,exit -F arch=b32 -S setxattr -S lsetxattr -S fsetxattr -S removexattr -S \
lremovexattr -S fremovexattr -F auid>=500 -F auid!=4294967295 -k perm_mod
# Execute the following command to restart auditd
# pkill -HUP -P 1 auditd
error associated with the specific system call). All audit records will be tagged with the
identifier "access."
Rationale:
Failed attempts to open, create or truncate files could be an indication that an individual or
process is trying to gain unauthorized access to the system.
Audit:
On 64 bit systems, perform the following command and ensure the output is as shown to
determine if there are unsuccessful attempts to access files. Note: "-a always,exit" may
be specified as "-a exit,always".
# grep access /etc/audit/audit.rules
-a always,exit -F arch=b64 -S creat -S open -S openat -S truncate
-F exit=-EACCES -F auid>=500 -F auid!=4294967295 -k access
-a always,exit -F arch=b32 -S creat -S open -S openat -S truncate
-F exit=-EACCES -F auid>=500 -F auid!=4294967295 -k access
-a always,exit -F arch=b64 -S creat -S open -S openat -S truncate
-F exit=-EPERM -F auid>=500 -F auid!=4294967295 -k access
-a always,exit -F arch=b32 -S creat -S open -S openat -S truncate
-F exit=-EPERM -F auid>=500 -F auid!=4294967295 -k access
-S ftruncate \
-S ftruncate \
-S ftruncate \
-S ftruncate \
On 32 bit systems, perform the following command and ensure the output is as shown to
determine if there are unsuccessful attempts to access files. Note: "-a always,exit" may
be specified as "-a exit,always".
# grep access /etc/audit/audit.rules
-a always,exit -F arch=b32 -S creat -S open -S openat -S truncate -S ftruncate \
-F exit=-EACCES -F auid>=500 -F auid!=4294967295 -k access
-a always,exit -F arch=b32 -S creat -S open -S openat -S truncate -S ftruncate \
-F exit=-EPERM -F auid>=500 -F auid!=4294967295 -k access
Remediation:
For 64 bit systems, add the following lines to the /etc/audit/audit.rules file.
-a
-F
-a
-F
-a
-F
-a
-F
-S ftruncate \
-S ftruncate \
-S ftruncate \
-S ftruncate \
For 32 bit systems, add the following lines to the /etc/audit/audit.rules file.
-a always,exit -F arch=b32 -S creat -S open -S openat -S truncate -S ftruncate \
-F exit=-EACCES -F auid>=500 -F auid!=4294967295 -k access
-a always,exit -F arch=b32 -S creat -S open -S openat -S truncate -S ftruncate \
106 | P a g e
processed by awk.
-F perm=x - will write an audit record if the file is executed.
-F auid>=500 - will write a record if the user executing the command is not a privileged
user.
-F auid!= 4294967295 - will ignore Daemon events
All audit records will be tagged with the identifier "privileged."
# find PART -xdev \( -perm -4000 -o -perm -2000 \) -type f | awk '{print \
"-a always,exit -F path=" $1 " -F perm=x -F auid>=500 -F auid!=4294967295 \
-k privileged" }'
107 | P a g e
For 32 bit systems perform the following command and ensure the output is as shown to
determine if filesystem mounts are recorded. Note: "-a always,exit" may be specified as
"-a exit,always".
# grep mounts /etc/audit/audit.rules
-a always,exit -F arch=b32 -S mount -F auid>=500 -F auid!=4294967295 -k mounts
108 | P a g e
Remediation:
For 64 bit systems, add the following lines to the /etc/audit/audit.rules file.
-a always,exit -F arch=b64 -S mount -F auid>=500 -F auid!=4294967295 -k mounts
-a always,exit -F arch=b32 -S mount -F auid>=500 -F auid!=4294967295 -k mounts
# Execute the following command to restart auditd
# pkill -HUP -P 1 auditd
For 32 bit systems, add the following lines to the /etc/audit/audit.rules file.
-a always,exit -F arch=b32 -S mount -F auid>=500 -F auid!=4294967295 -k mounts
# Execute the following command to restart auditd
# pkill -HUP -P 1 auditd
109 | P a g e
For 32 bit systems, perform the following command and ensure the output is as shown to
determine if file deletion events by user are recorded.
# grep delete /etc/audit/audit.rules
-a always,exit -F arch=b32 -S unlink -S unlinkat -S rename -S renameat -F auid>=500 \
-F auid!=4294967295 -k delete
Remediation:
At a minimum, configure the audit system to collect file deletion events for all users and
root.
For 64 bit systems, add the following to the /etc/audit/audit.rules file.
-a
-F
-a
-F
Audit:
Perform the following to determine if changes to /etc/sudoers are recorded.
# grep scope /etc/audit/audit.rules
-w /etc/sudoers -p wa -k scope
Remediation:
Add the following lines to the /etc/audit/audit.rules file.
-w /etc/sudoers -p wa -k scope
# Execute the following command to restart auditd
# pkill -HUP -P 1 auditd
Remediation:
111 | P a g e
Note: The system must be configured with su disabled (See Item 7.6 Restrict Access to the
su Command) to force all command execution through sudo. This will not be effective on
the console, as administrators can log in as root.
112 | P a g e
Remediation:
Add the following lines to the /etc/audit/audit.rules file.
-w /sbin/insmod -p x -k modules
-w /sbin/rmmod -p x -k modules
-w /sbin/modprobe -p x -k modules
For 32 bit systems, add
-a always,exit -F arch=b32 -S init_module -S delete_module -k modules
For 64 bit systems, add
-a always,exit -F arch=b64 -S init_module -S delete_module -k modules
Remediation:
Add the following lines to the /etc/audit/audit.rules file.
-e 2
Profile Applicability:
Level 1
Description:
The system includes the capability of rotating log files regularly to avoid filling up the
system with logs or making the logs unmanageable large. The file
/etc/logrotate.d/syslog is the configuration file used to rotate log files created by
syslog or rsyslog. These files are rotated on a weekly basis via a cron job and the last 4
weeks are kept.
Rationale:
By keeping the log files smaller and more manageable, a system administrator can easily
archive these files to another system and spend less time looking through inordinately
large log files.
Audit:
Perform the following to determine if the appropriate system logs are rotated.
# grep '{' /etc/logrotate.d/syslog
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log
/var/log/cron {
Remediation:
Edit the /etc/logrotate.d/syslog file to include appropriate system logs:
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log
/var/log/cron {
114 | P a g e
Remediation:
# yum install cronie-anacron
Note: NSA Guidance recommends disabling anacron for systems that are intended to be up
24X7, with the rationale that unnecessary software should be disabled to reduce risk.
However, even systems that are designed to be up at all times can experience downtime
that could prevent important system maintenance jobs from running. Review the
requirements for your site to determine your appropriate risk level.
Profile Applicability:
Level 1
Description:
The crond daemon is used to execute batch jobs on the system.
Rationale:
While there may not be user jobs that need to be run on the system, the system does have
maintenance jobs that may include security monitoring that have to run and crond is used
to execute them.
Audit:
Perform the following to determine if cron is enabled.
# chkconfig --list crond
crond: 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Remediation:
# chkconfig crond on
Perform the following to determine if the /etc/anacrontab file has the correct
permissions.
# stat -L -c "%a %u %g" /etc/anacrontab | egrep ".00 0 0"
If the above command emits no output then the system is not configured as recommended.
Remediation:
# chown root:root /etc/anacrontab
# chmod og-rwx /etc/anacrontab
If the above command emits no output then the system is not configured as recommended.
Remediation:
# chown root:root /etc/crontab
# chmod og-rwx /etc/crontab
117 | P a g e
Level 1
Description:
This directory contains system cron jobs that need to run on an hourly basis. The files in
this directory cannot be manipulated by the crontab command, but are instead edited by
system administrators using a text editor. The commands below restrict read/write and
search access to user and group root, preventing regular users from accessing this
directory.
Rationale:
Granting write access to this directory for non-privileged users could provide them the
means for gaining unauthorized elevated privileges. Granting read access to this directory
could give an unprivileged user insight in how to gain elevated privileges or circumvent
auditing controls.
Audit:
Perform the following to determine if the /etc/cron.hourly file has the correct
permissions.
# stat -L -c "%a %u %g" /etc/cron.hourly | egrep ".00 0 0"
If the above command emits no output then the system is not configured as recommended.
Remediation:
# chown root:root /etc/cron.hourly
# chmod og-rwx /etc/cron.hourly
Granting write access to this directory for non-privileged users could provide them the
means for gaining unauthorized elevated privileges. Granting read access to this directory
could give an unprivileged user insight in how to gain elevated privileges or circumvent
auditing controls.
Audit:
Perform the following to determine if the /etc/cron.daily directory has the correct
permissions.
# stat -L -c "%a %u %g" /etc/cron.daily | egrep ".00 0 0"
If the above command emits no output then the system is not configured as recommended.
Remediation:
# chown root:root /etc/cron.daily
# chmod og-rwx /etc/cron.daily
If the above command emits no output then the system is not configured as recommended.
Remediation:
# chown root:root /etc/cron.weekly
# chmod og-rwx /etc/cron.weekly
If the above command emits no output then the system is not configured as recommended.
Remediation:
# chown root:root /etc/cron.monthly
# chmod og-rwx /etc/cron.monthly
Profile Applicability:
Level 1
Description:
The /etc/cron.d directory contains system cron jobs that need to run in a similar manner
to the hourly, daily weekly and monthly jobs from /etc/crontab, but require more
granular control as to when they run. The files in this directory cannot be manipulated by
the crontab command, but are instead edited by system administrators using a text editor.
The commands below restrict read/write and search access to user and group root,
preventing regular users from accessing this directory.
Rationale:
Granting write access to this directory for non-privileged users could provide them the
means for gaining unauthorized elevated privileges. Granting read access to this directory
could give an unprivileged user insight in how to gain elevated privileges or circumvent
auditing controls.
Audit:
Perform the following to determine if the /etc/cron.d directory has the correct
permissions.
# stat -L -c "%a %u %g" /etc/cron.d | egrep ".00 0 0"
If the above command emits no output then the system is not configured as recommended.
Remediation:
# chown root:root /etc/cron.d
# chmod og-rwx /etc/cron.d
user on the system, with the exception of those listed in /etc/at.deny, are allowed to
execute at jobs. An empty /etc/at.deny file allows any user to create at jobs. If neither
/etc/at.allow nor /etc/at.deny exist, then only superuser can create at jobs. The
commands below remove the /etc/at.deny file and create an empty /etc/at.allow file
that can only be read and modified by user and group root.
Rationale:
Granting write access to this directory for non-privileged users could provide them the
means to gain unauthorized elevated privileges. Granting read access to this directory
could give an unprivileged user insight in how to gain elevated privileges or circumvent
auditing controls. In addition, it is a better practice to create a white list of users who can
execute at jobs versus a blacklist of users who can't execute at jobs as a system
administrator will always know who can create jobs and does not have to worry about
remembering to add a user to the blacklist when a new user id is created.
Audit:
Perform the following to determine if at jobs are restricted.
# stat -L /etc/at.deny > /dev/null
# stat -L -c "%a %u %g" /etc/at.allow | egrep ".00 0 0"
If the above command emits no output then the system is not configured as recommended.
Remediation:
#
#
#
#
rm /etc/at.deny
touch /etc/at.allow
chown root:root /etc/at.allow
chmod og-rwx /etc/at.allow
122 | P a g e
cron.allow, cron jobs can still be run as that user. The cron.allow file only controls
administrative access to the crontab command for scheduling and modifying cron jobs.
Rationale:
On many systems, only the system administrator is authorized to schedule cron jobs. Using
the cron.allow file to control who can run cron jobs enforces this policy. It is easier to
manage an allow list than a deny list. In a deny list, you could potentially add a user ID to
the system and forget to add it to the deny files.
Audit:
Perform the following to determine if the remediation in the section has been performed:
# ls -l /etc/cron.deny
[no output returned]
# ls -l /etc/at.deny
[no output returned]
# ls -l /etc/cron.allow
-rw------- 1 root root /etc/cron.allow
# ls -l /etc/at.allow
-rw------- 1 root root /etc/at.allow
Remediation:
If /etc/cron.allow or /etc/at.allow do not exist on your system create them.
Run the following to ensure cron.deny and at.deny are removed and permissions are set
correctly:
#
#
#
#
#
#
/bin/rm /etc/cron.deny
/bin/rm /etc/at.deny
chmod og-rwx /etc/cron.allow
chmod og-rwx /etc/at.allow
chown root:root /etc/cron.allow
chown root:root /etc/at.allow
123 | P a g e
Remediation:
Edit the /etc/ssh/sshd_config file to set the parameter as follows:
Protocol 2
Rationale:
SSH provides several logging levels with varying amounts of verbosity. DEBUG is specifically
not recommended other than strictly for debugging SSH communications since it provides
so much data that it is difficult to identify important security information. INFO level is the
basic level that only records login activity of SSH users. In many situations, such as Incident
Response, it is important to determine when a particular user was active on a system. The
logout record can eliminate those users who disconnected, which helps narrow the field.
Audit:
To verify the correct SSH setting, run the following command and verify that the output is
as shown:
# grep "^LogLevel" /etc/ssh/sshd_config
LogLevel INFO
Remediation:
Edit the /etc/ssh/sshd_config file to set the parameter as follows:
LogLevel INFO
125 | P a g e
# /bin/ls -l /etc/ssh/sshd_config
-rw------- 1 root root 762 Sep 23 002 /etc/ssh/sshd_config
Remediation:
If the user and group ownership of the /etc/ssh/sshd_config file are incorrect, run the
following command to correct them:
# chown root:root /etc/ssh/sshd_config
If the permissions are incorrect, run the following command to correct them:
# chmod 600 /etc/ssh/sshd_config
Remediation:
Edit the /etc/ssh/sshd_config file to set the parameter as follows:
X11Forwarding no
Profile Applicability:
Level 1
Description:
The MaxAuthTries parameter specifies the maximum number of authentication attempts
permitted per connection. When the login failure count reaches half the number, error
messages will be written to the syslog file detailing the login failure.
Rationale:
Setting the MaxAuthTries parameter to a low number will minimize the risk of successful
brute force attacks to the SSH server. While the recommended setting is 4, it is set the
number based on site policy.
Audit:
To verify the correct SSH setting, run the following command and verify that the output is
as shown:
# grep "^MaxAuthTries" /etc/ssh/sshd_config
MaxAuthTries 4
Remediation:
Edit the /etc/ssh/sshd_config file to set the parameter as follows:
MaxAuthTries 4
To verify the correct SSH setting, run the following command and verify that the output is
as shown:
# grep "^IgnoreRhosts" /etc/ssh/sshd_config
IgnoreRhosts yes
Remediation:
Edit the /etc/ssh/sshd_config file to set the parameter as follows:
IgnoreRhosts yes
Remediation:
Edit the /etc/ssh/sshd_config file to set the parameter as follows:
HostbasedAuthentication no
Level 1
Description:
The PermitRootLogin parameter specifies if the root user can log in using ssh(1). The
default is no.
Rationale:
Disallowing root logins over SSH requires server admins to authenticate using their own
individual account, then escalating to root via sudo or su. This in turn limits opportunity
for non-repudiation and provides a clear audit trail in the event of a security incident
Audit:
To verify the correct SSH setting, run the following command and verify that the output is
as shown:
# grep "^PermitRootLogin" /etc/ssh/sshd_config
PermitRootLogin no
Remediation:
Edit the /etc/ssh/sshd_config file to set the parameter as follows:
PermitRootLogin no
129 | P a g e
To verify the correct SSH setting, run the following command and verify that the output is
as shown:
# grep "^PermitEmptyPasswords" /etc/ssh/sshd_config
PermitEmptyPasswords no
Remediation:
Edit the /etc/ssh/sshd_config file to set the parameter as follows:
PermitEmptyPasswords no
Remediation:
Edit the /etc/ssh/sshd_config file to set the parameter as follows:
PermitUserEnvironment no
Level 1
Description:
This variable limits the types of ciphers that SSH can use during communication.
Rationale:
Based on research conducted at various institutions, it was determined that the symmetric
portion of the SSH Transport Protocol (as described in RFC 4253) has security weaknesses
that allowed recovery of up to 32 bits of plaintext from a block of ciphertext that was
encrypted with the Cipher Block Chaining (CBC) method. From that research, new Counter
mode algorithms (as described in RFC4344) were designed that are not vulnerable to these
types of attacks and these algorithms are now recommended for standard use.
Audit:
To verify the correct SSH setting, run the following command and verify that the output is
as shown:
# grep "Ciphers" /etc/ssh/sshd_config
Ciphers aes128-ctr,aes192-ctr,aes256-ctr
Remediation:
Edit the /etc/ssh/sshd_config file to set the parameter as follows:
Ciphers aes128-ctr,aes192-ctr,aes256-ctr
References:
1. For more information on the Counter mode algorithms, read RFC4344 at
http://www.ietf.org/rfc/rfc4344.txt.
variable is set, sshd will send client alive messages at every ClientAliveInterval
interval. When the number of consecutive client alive messages are sent with no response
from the client, the ssh session is terminated. For example, if the ClientAliveInterval is
set to 15 seconds and the ClientAliveCountMax is set to 3, the client ssh session will be
terminated after 45 seconds of idle time.
Rationale:
Having no timeout value associated with a connection could allow an unauthorized user
access to another user's ssh session (e.g. user walks away from their computer and doesn't
lock the screen). Setting a timeout value at least reduces the risk of this happening..
While the recommended setting is 300 seconds (5 minutes), set this timeout value based on
site policy. The recommended setting for ClientAliveCountMax is 0. In this case, the client
session will be terminated after 5 minutes of idle time and no keepalive messages will be
sent.
Audit:
To verify the correct SSH setting, run the following command and verify that the output is
as shown:
# grep "^ClientAliveInterval" /etc/ssh/sshd_config
ClientAliveInterval 300
# grep "^ClientAliveCountMax" /etc/ssh/sshd_config
ClientAliveCountMax 0
Remediation:
Edit the /etc/ssh/sshd_config file to set the parameter as follows:
ClientAliveInterval 300
ClientAliveCountMax 0
132 | P a g e
The AllowUsers variable gives the system administrator the option of allowing specific
users to ssh into the system. The list consists of comma separated user names. Numeric
userIDs are not recognized with this variable. If a system administrator wants to restrict
user access further by only allowing the allowed users to log in from a particular host, the
entry can be specified in the form of user@host.
AllowGroups
The AllowGroups variable gives the system administrator the option of allowing specific
groups of users to ssh into the system. The list consists of comma separated user names.
Numeric groupIDs are not recognized with this variable.
DenyUsers
The DenyUsers variable gives the system administrator the option of denying specific
users to ssh into the system. The list consists of comma separated user names. Numeric
userIDs are not recognized with this variable. If a system administrator wants to restrict
user access further by specifically denying a user's access from a particular host, the entry
can be specified in the form of user@host.
DenyGroups
The DenyGroups variable gives the system administrator the option of denying specific
groups of users to ssh into the system. The list consists of comma separated group names.
Numeric groupIDs are not recognized with this variable.
Rationale:
Restricting which users can remotely access the system via SSH will help ensure that only
authorized users access the system.
Audit:
To verify the correct SSH setting, run the following command and verify that the output is
as shown:
# grep "^AllowUsers" /etc/ssh/sshd_config
AllowUsers <userlist>
# grep "^AllowGroups" /etc/ssh/sshd_config
AllowGroups <grouplist>
# grep "^DenyUsers" /etc/ssh/sshd_config
DenyUsers <userlist>
# grep "^DenyGroups" /etc/ssh/sshd_config
DenyGroups <grouplist>
Remediation:
133 | P a g e
Edit the /etc/ssh/sshd_config file to set one or more of the parameter as follows:
AllowUsers <userlist>
AllowGroups <grouplist>
DenyUsers <userlist>
DenyGroups <grouplist>
Remediation:
Edit the /etc/ssh/sshd_config file to set the parameter as follows:
Banner /etc/issue.net
134 | P a g e
If the above command emits no output then the system is not configured as recommended
Remediation:
Perform the following to configure the system as recommended:
# authconfig --passalgo=sha512 --update
Note: If it is determined that the password algorithm being used is not SHA-512, once it is
changed, it is recommended that all userID's be immediately expired and forced to change
their passwords on next login. To accomplish that, the following commands can be used.
135 | P a g e
Any system accounts that need to be expired should be carefully done separately by the
system administrator to prevent any potential problems.
# cat /etc/passwd | awk -F: '( $3 >=500 && $1 != "nfsnobody" ) { print $1 }' | xargs n 1 chage -d 0
The setting shown above is one possible policy. Alter these values to conform to your own
organization's password policies.
Rationale:
Strong passwords protect systems from being hacked through brute force methods.
Audit:
Perform the following to determine the current settings in the pam_cracklib.so file.
# grep pam_cracklib.so /etc/pam.d/system-auth
password required pam_cracklib.so try_first_pass retry=3 minlen=14 dcredit=-1
ucredit=-1 ocredit=-1 lcredit=-1
Remediation:
136 | P a g e
Remediation:
Edit the /etc/pam.d/password-auth and /etc/pam.d/system-auth files and add the
"auth" lines as highlighted below:
137 | P a g e
# cat /etc/pam.d/password-auth
#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth required pam_env.so
auth required pam_faillock.so preauth audit silent deny=5 unlock_time=900
auth [success=1 default=bad] pam_unix.so
auth [default=die] pam_faillock.so authfail audit deny=5 unlock_time=900
auth sufficient pam_faillock.so authsucc audit deny=5 unlock_time=900
auth required pam_deny.so
# cat /etc/pam.d/system-auth
#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth required pam_env.so
auth required pam_faillock.so preauth audit silent deny=5 unlock_time=900
auth [success=1 default=bad] pam_unix.so
auth [default=die] pam_faillock.so authfail audit deny=5 unlock_time=900
auth sufficient pam_faillock.so authsucc audit deny=5 unlock_time=900
auth required pam_deny.so
Note: If a user has been locked out because they have reached the maximum consecutive
failure count defined by deny= in the pam_faillock.so module, the user can be unlocked
by issuing the command /usr/sbin/faillock -u --reset. This command sets the failed
count to 0, effectively unlocking the userid.
138 | P a g e
Remediation:
Set the pam_unix.so remember parameter to 5 in /etc/pam.d/system_auth:
password sufficient pam_unix.so remember=5
Remediation:
Remove entries for any consoles that are not in a physically secure location.
139 | P a g e
Rationale:
Restricting the use of su, and using sudo in its place, provides system administrators better
control of the escalation of user privileges to execute privileged commands. The sudo utility
also provides a better logging and audit mechanism, as it can log each command executed
via sudo, whereas su can only record that a user executed the su program.
Audit:
# grep pam_wheel.so /etc/pam.d/su
auth required pam_wheel.so use_uid
# grep wheel /etc/group
wheel:x:10:root, <user list>
Remediation:
Set the pam_wheel.so parameters as follows in /etc/pam.d/su:
auth required pam_wheel.so use_uid
Set the proper list of users to be included in the wheel group in /etc/groups.
140 | P a g e
90
Remediation:
Set the PASS_MAX_DAYS parameter to 90 in /etc/login.defs:
PASS_MAX_DAYS 90
Remediation:
Set the PASS_MIN_DAYS parameter to 7 in /etc/login.defs:
PASS_MIN_DAYS 7
Rationale:
Providing an advance warning that a password will be expiring gives users time to think of
a secure password. Users caught unaware may choose a simple password or write it down
where it may be discovered.
Audit:
# grep PASS_WARN_AGE /etc/login.defs
PASS_WARN_AGE 7
# chage --list <user>
Number of days of warning before password expires:
Remediation:
Set the PASS_WARN_AGE parameter to 7 in /etc/login.defs:
PASS_WARN_AGE 7
Remediation:
Accounts that have been locked are prohibited from running commands on the
system. Such accounts are not able to login to the system nor are they able to use
scheduled execution facilities such as cron. To make sure system accounts cannot be
accessed, using the following script:
#!/bin/bash
for user in `awk -F: '($3 < 500) {print $1 }' /etc/passwd`; do
if [ $user != "root" ]
then
/usr/sbin/usermod -L $user
if [ $user != "sync" ] && [ $user != "shutdown" ] && [ $user != "halt" ]
then
/usr/sbin/usermod -s /sbin/nologin $user
fi
fi
done
Remediation:
# usermod -g 0 root
Description:
The default umask determines the permissions of files created by users. The user creating
the file has the discretion of making their files and directories readable by others via the
chmod command. Users who wish to allow their files and directories to be readable by
others by default may choose a different default umask by inserting the umask command
into the standard shell configuration files (.profile, .cshrc, etc.) in their home directories.
Rationale:
Setting a very secure default value for umask ensures that users make a conscious choice
about their file permissions. A default umask setting of 077 causes files and directories
created by users to not be readable by any other user on the system. A umask of 027 would
make files and directories readable by users in the same Unix group, while a umask of 022
would make files readable by every user on the system.
Note: The directives in this section apply to bash and shell. If other shells are supported on
the system, it is recommended that their configuration files also are checked.
Audit:
# grep "^umask 077" /etc/bashrc
umask 077
# grep "^umask 077" /etc/profile.d/*
umask 077
Remediation:
Edit the /etc/bashrc and /etc/profile.d/cis.sh files (and the appropriate files for any
other shell supported on your system) and add the following the UMASK parameter as
shown:
umask 77
Rationale:
Inactive accounts pose a threat to system security since the users are not logging in to
notice failed login attempts or other anomalies.
Audit:
# useradd -D | grep INACTIVE
Remediation:
# useradd -D -f 35
146 | P a g e
8 Warning Banners
Presenting a warning message prior to the normal user login may assist the prosecution of
trespassers on the computer system. Changing some of these login banners also has the
side effect of hiding OS version information and other detailed system information from
attackers attempting to target specific exploits at a system.
Guidelines published by the US Department of Defense require that warning messages
include at least the name of the organization that owns the system, the fact that the system
is subject to monitoring and that such monitoring is in compliance with local statutes, and
that use of the system implies consent to such monitoring. It is important that the
organization's legal counsel review the content of all messages before any system
modifications are made, as these warning messages are inherently site-specific. More
information (including citations of relevant case law) can be found at
http://www.justice.gov/criminal/cybercrime/
Note: The text provided in the remediation actions for these items is intended as an
example only. Please edit to include the specific text for your organization as approved by
your legal department.
Run the following commands and ensure that the files exist and have the correct
permissions.
# /bin/ls -l /etc/motd
-rw-r--r-- 1 root root 2055 Jan 30 16:30 /etc/motd
# ls /etc/issue
-rw-r--r-- 1 root root 2055 Jan 30 16:30 /etc/issue
# ls /etc/issue.net
-rw-r--r-- 1 root root 2055 Jan 30 16:30 /etc/issue.net
The commands above simply validate the presence of the /etc/motd, /etc/issue and
/etc/issue.net files. Review the contents of these files with the " cat" command and
ensure that it is appropriate for your organization.
Remediation:
# touch /etc/motd
# echo "Authorized uses only. All activity may be \
monitored and reported." > /etc/issue
# echo "Authorized uses only. All activity may be \
monitored and reported." > /etc/issue.net
#
#
#
#
#
#
chown
chmod
chown
chmod
chown
chmod
root:root /etc/motd
644 /etc/motd
root:root /etc/issue
644 /etc/issue
root:root /etc/issue.net
644 /etc/issue.net
Rationale:
148 | P a g e
Displaying OS and patch level information in login banners also has the side effect of
providing detailed system information to attackers attempting to target specific exploits of
a system. Authorized users can easily get this information by running the "uname -a"
command once they have logged in.
Audit:
Perform the following commands to check if OS information is set to be displayed in the
system login banners:
# egrep '(\\v|\\r|\\m|\\s)' /etc/issue
# egrep '(\\v|\\r|\\m|\\s)' /etc/motd
# egrep'(\\v|\\r|\\m|\\s)' /etc/issue.net
Remediation:
Edit the /etc/motd, /etc/issue and /etc/issue.net files and remove any lines
containing \m, \r, \s or \v.
Remediation:
# /bin/su -s /bin/sh gdm
# gconftool-2 --direct --config-source=xml:readwrite:$HOME/.gconf --type bool --set
149 | P a g e
/apps/gdm/simple-greeter/banner_message_enable true
# gconftool-2 --direct --config-source=xml:readwrite:$HOME/.gconf --type string --set
/apps/gdm/simple-greeter/banner_message_text "Your-Login-Banner"
150 | P a g e
9 System Maintenance
No matter how securely a system has been installed and hardened, administrator and user
activity over time can introduce security exposures. The section describes tasks to be
performed on a regular, ongoing basis - perhaps in an automated fashion via the cron
utility.
Note: unlike other sections, the items in this section specify an Audit action followed by a
Remediation action since it is necessary to determine what the current setting is before
determining remediation measures, which will vary depending on the site's policy.
The rpm -qf command can be used to determine which package a particular file belongs
to. For example the following command determines which package the /etc/passwd file
belongs to:
# rpm -qf /etc/passwd
setup-2.5.58-7.el5
To verify the settings for the package that controls the /etc/passwd file, run the following:
151 | P a g e
# rpm -V setup-2.5.58-7.el5
.M...... c /etc/passwd
S.5....T c /etc/printcap
Note that you can feed the output of the rpm -qf command to the rpm -V command:
# rpm -V `rpm -qf /etc/passwd`
.M...... c /etc/passwd
S.5....T c /etc/printcap
Rationale:
It is important to confirm that packaged system files and directories are maintained with
the permissions they were intended to have from the OS vendor.
Note: Since packages and important files may change with new updates and releases, it is
recommended to verify everything, not just a finite list of files. This can be a time
consuming task and is therefore not a scored benchmark item, but is provided for those
interested in additional security measures.
Audit:
Run the following command to review all installed packages. Note that this may be very
time consuming and may be best scheduled via the cron utility. It is recommended that the
output of this command be redirected to a file that can be reviewed later.
# rpm -Va --nomtime --nosize --nomd5 --nolinkto > <filename>
Remediation:
Correct any discrepancies found and rerun the command until output is clean or risk is
mitigated or accepted.
References:
1. http://docs.fedoraproject.org/enUS/Fedora_Draft_Documentation/0.1/html/RPM_Guide/index.html
Rationale:
It is critical to ensure that the /etc/passwd file is protected from unauthorized write
access. Although it is protected by default, the file permissions could be changed either
inadvertently or through malicious actions.
Audit:
Run the following command to determine the permissions on the /etc/passwd file.
# /bin/ls -l /etc/passwd
-rw-r--r-- 1 root root 2055 Jan 30 16:30 /etc/passwd
Remediation:
If the permissions of the /etc/passwd file are incorrect, run the following command to
correct them:
# /bin/chmod 644 /etc/passwd
153 | P a g e
Remediation:
If the permissions of the /etc/shadow file are incorrect, run the following command to
correct them:
# /bin/chmod 000 /etc/shadow
Remediation:
If the permissions of the /etc/gshadow file are incorrect, run the following command to
correct them:
# /bin/chmod 000 /etc/gshadow
The /etc/group file contains a list of all the valid groups defined in the system. The
command below allows read/write access for root and read access for everyone else.
Rationale:
The /etc/group file needs to be protected from unauthorized changes by non-privileged
users, but needs to be readable as this information is used with many non-privileged
programs.
Audit:
Run the following command to determine the permissions on the /etc/group file.
# /bin/ls -l /etc/group
-rw-r--r-- 1 root root 762 Sep 23 002 /etc/group
Remediation:
If the permissions of the /etc/group file are incorrect, run the following command to
correct them:
# /bin/chmod 644 /etc/group
155 | P a g e
# /bin/ls -l /etc/passwd
-rw-r--r-- 1 root root 762 Sep 23 002 /etc/passwd
Remediation:
If the user and group ownership of the /etc/passwd file are incorrect, run the following
command to correct them:
# /bin/chown root:root /etc/passwd
Remediation:
If the ownership of the /etc/shadow file are incorrect, run the following command to
correct them:
# /bin/chown root:root /etc/shadow
Level 1
Description:
The /etc/gshadow file contains information about group accounts that is critical to the
security of those accounts, such as the hashed password and other security information.
Rationale:
If attackers can gain read access to the /etc/gshadow file, they can easily run a password
cracking program against the hashed password to break it. Other security information that
is stored in the /etc/gshadow file (such as expiration) could also be useful to subvert the
group accounts.
Audit:
Run the following command to determine the permissions on the /etc/gshadow file.
# /bin/ls -l /etc/gshadow
---------- 1 root root 633 Sep 23 2002 /etc/gshadow
Remediation:
If the ownership of the /etc/gshadow file are incorrect, run the following command to
correct them:
# /bin/chown root:root /etc/gshadow
Run the following command to determine the permissions on the /etc/group file.
# /bin/ls -l /etc/group
-rw-r--r-- 1 root root 762 Sep 23 002 /etc/group
Remediation:
If the ownership of the /etc/group file are incorrect, run the following command to
correct them:
# /bin/chown root:root /etc/group
Remediation:
Removing write access for the "other" category (chmod o-w <filename>) is advisable, but
always consult relevant vendor documentation to avoid breaking any application
dependencies on a given file.
Description:
Sometimes when administrators delete users from the password file they neglect to
remove all files owned by those users from the system.
Rationale:
A new user who is assigned the deleted user's user ID or group ID may then end up
"owning" these files, and thus have more access on the system than was intended.
Audit:
#!/bin/bash
df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -nouser ls
Remediation:
Locate files that are owned by users or groups not listed in the system configuration files,
and reset the ownership of these files to some active user on the system as appropriate.
Remediation:
Locate files that are owned by users or groups not listed in the system configuration files,
and reset the ownership of these files to some active user on the system as appropriate.
159 | P a g e
Remediation:
Ensure that no rogue set-UID programs have been introduced into the system. Review the
files returned by the action in the Audit section and confirm the integrity of these binaries
as described below:
# rpm -V `rpm -qf /usr/bin/sudo`
.......T /usr/bin/sudo
SM5....T /usr/bin/sudoedit
Rationale:
There are valid reasons for SGID programs, but it is important to identify and review such
programs to ensure they are legitimate. Review the files returned by the action in the audit
section and check to see if system binaries have a different md5 checksum than what from
the package. This is an indication that the binary may have been replaced. The following is
an example of checking the "sudo" executable:
# rpm -V `rpm -qf /usr/bin/sudo`
.......T /usr/bin/sudo
SM5....T /usr/bin/sudoedit
Audit:
#!/bin/bash
df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type f perm -2000 -print
Remediation:
Ensure that no rogue set-GID programs have been introduced into the system
# /bin/rpm -V `/bin/rpm -qf sudo`
161 | P a g e
Remediation:
If any accounts in the /etc/shadow file do not have a password, run the following
command to lock the account until it can be determined why it does not have a password:
# /usr/bin/passwd -l <username>
Also, check to see if the account is logged in and investigate what it is being used for to
determine if it needs to be forced off.
162 | P a g e
The character + in various files used to be markers for systems to insert data from NIS
maps at a certain point in a system configuration file. These entries are no longer required
on Amazon Linux systems, but may exist in files that have been imported from other
platforms.
Rationale:
These entries may provide an avenue for attackers to gain privileged access on the system.
Audit:
Run the following command and verify that no output is returned:
# /bin/grep '^+:' /etc/passwd
Remediation:
Delete these entries if they exist.
Remediation:
Delete these entries if they exist.
163 | P a g e
Remediation:
Delete these entries if they exist.
Remediation:
Delete any other entries that are displayed.
!= "" ]; then
165 | P a g e
Remediation:
Correct or justify any items discovered in the Audit step.
Remediation:
166 | P a g e
Making global modifications to user home directories without alerting the user community
can result in unexpected outages and unhappy users. Therefore, it is recommended that a
monitoring policy be established to report user file permissions and determine the action
to be taken in accordance with site policy.
]; then
$file"
]; then
$file"
fi
done
done
Remediation:
Making global modifications to users' files without alerting the user community can result
in unexpected outages and unhappy users. Therefore, it is recommended that a monitoring
policy be established to report user dot file permissions and determine the action to be
taken in accordance with site policy.
167 | P a g e
systems.
Audit:
#!/bin/bash
for dir in `/bin/cat /etc/passwd | /bin/egrep -v '(root|sync|halt|shutdown)' |\
/bin/awk -F: '($7 != "/sbin/nologin") { print $6 }'`; do
for file in $dir/.netrc; do
if [ ! -h "$file" -a -f "$file" ]; then
fileperm=`/bin/ls -ld $file | /bin/cut -f1 -d" "`
if [ `echo $fileperm | /bin/cut -c5 ` != "-" ]
then
echo "Group Read set on $file"
fi
if [ `echo $fileperm | /bin/cut -c6 ` != "-" ]
then
echo "Group Write set on $file"
fi
if [ `echo $fileperm | /bin/cut -c7 ` != "-" ]
then
echo "Group Execute set on $file"
fi
if [ `echo $fileperm | /bin/cut -c8 ` != "-" ]
then
echo "Other Read set on $file"
fi
if [ `echo $fileperm | /bin/cut -c9 ` != "-" ]
then
echo "Other Write set on $file"
fi
if [ `echo $fileperm | /bin/cut -c10 ` != "-" ]
then
echo "Other Execute set on $file"
fi
fi
done
done
Remediation:
168 | P a g e
Making global modifications to users' files without alerting the user community can result
in unexpected outages and unhappy users. Therefore, it is recommended that a monitoring
policy be established to report user .netrc file permissions and determine the action to be
taken in accordance with site policy.
Remediation:
If any users have .rhosts files determine why they have them.
Rationale:
Groups defined in the /etc/passwd file but not in the /etc/group file pose a threat to
system security since group permissions are not properly managed.
Audit:
Create a script as shown below and run it:
#!/bin/bash
for i in $(cut -s -d: -f4 /etc/passwd | sort -u ); do
grep -q -P "^.*?:x:$i:" /etc/group
if [ $? -ne 0 ]; then
echo "Group $i is referenced by /etc/passwd but does not exist in /etc/group"
fi
done
Remediation:
Analyze the output of the Audit step above and perform the appropriate action to correct
any discrepancies found.
9.2.12 Check That Users Are Assigned Valid Home Directories (Scored)
Profile Applicability:
Level 1
Description:
Users can be defined in /etc/passwd without a home directory or with a home directory
does not actually exist.
Rationale:
If the user's home directory does not exist or is unassigned, the user will be placed in "/"
and will not be able to write any files or have local environment variables set.
Audit:
This script checks to make sure that home directories assigned in the /etc/passwd file
exist.
#!/bin/bash
cat /etc/passwd | awk -F: '{ print $1 " " $3 " " $6 }' | while read user uid dir; do
if [ $uid -ge 1000 -a ! -d "$dir" -a $user != "nfsnobody" ]; then
echo "The home directory ($dir) of user $user does not exist."
170 | P a g e
fi
done
Remediation:
If any users' home directories do not exist, create them and make sure the respective user
owns the directory. Users without assigned should be removed or assigned a home
directory as appropriate.
Remediation:
Change the ownership any home directories that are not owned by the defined user to the
correct user.
Profile Applicability:
Level 1
Description:
Although the useradd program will not let you create a duplicate User ID (UID), it is
possible for an administrator to manually edit the /etc/passwd file and change the UID
field.
Rationale:
Users must be assigned unique UIDs for accountability and to ensure appropriate access
protections.
Audit:
This script checks to make sure all UIDs in the /etc/passwd file are unique.
#!/bin/bash
echo "The Output for the Audit of Control 9.2.15 - Check for Duplicate UIDs is"
/bin/cat /etc/passwd | /bin/cut -f3 -d":" | /bin/sort -n | /usr/bin/uniq -c |\
while read x ; do
[ -z "${x}" ] && break
set - $x
if [ $1 -gt 1 ]; then
users=`/bin/gawk -F: '($3 == n) { print $1 }' n=$2 \
/etc/passwd | /usr/bin/xargs`
echo "Duplicate UID ($2): ${users}"
fi
done
Remediation:
Based on the results of the script, establish unique UIDs and review all files owned by the
shared UID to determine which UID they are supposed to belong to.
Rationale:
User groups must be assigned unique GIDs for accountability and to ensure appropriate
access protections.
Note: In the case of extremely large groups it can become necessary to split a GID across
group names due to character limits per line. Any such instances should be carefully
audited, unless absolutely necessary such instances should be avoided.
Audit:
This script checks to make sure all GIDs in the /etc/group file are unique. You can also use
the /usr/sbin/grpck command to check for other inconsistencies in the /etc/group file.
#!/bin/bash
echo "The Output for the Audit of Control 9.2.16 - Check for Duplicate GIDs is"
/bin/cat /etc/group | /bin/cut -f3 -d":" | /bin/sort -n | /usr/bin/uniq -c |\
while read x ; do
[ -z "${x}" ] && break
set - $x
if [ $1 -gt 1 ]; then
grps=`/bin/gawk -F: '($3 == n) { print $1 }' n=$2 \
/etc/group | xargs`
echo "Duplicate GID ($2): ${grps}"
fi
done
Remediation:
Based on the results of the script, establish unique GIDs and review all files owned by the
shared GID to determine which group they are supposed to belong to.
173 | P a g e
If a user is assigned a UID that is in the reserved range, even if it is not presently in use,
security exposures can arise if a subsequently installed application uses the same UID.
Audit:
This script checks to make sure that "reserved" UIDs (0-499 range) are not assigned to
non-system (default) accounts.
#!/bin/bash
echo "The Output for the Audit of Control 9.2.17 - Check That Reserved UIDS Are
Assigned to System Accounts is"
defUsers="root bin daemon adm lp sync shutdown halt mail news uucp operator games
gopher ftp nobody nscd vcsa rpc mailnull smmsp pcap ntp dbus avahi sshd rpcuser
nfsnobody haldaemon avahi-autoipd distcache apache oprofile webalizer dovecot squid
named xfs gdm sabayon usbmuxd rtkit abrt saslauth pulse postfix tcpdump"
/bin/cat /etc/passwd |\
/bin/awk -F: '($3 < 500) { print $1" "$3 }' |\
while read user uid; do
found=0
for tUser in ${defUsers}
do
if [ ${user} = ${tUser} ]; then
found=1
fi
done
if [ $found -eq 0 ]; then
echo "User $user has a reserved UID ($uid)."
fi
done
Remediation:
Based on the results of the script, change any UIDs that are in the reserved range to one
that is in the user range. Review all files owned by the reserved UID to determine which
UID they are supposed to belong to.
174 | P a g e
If a user is assigned a duplicate user name, it will create and have access to files with the
first UID for that username in /etc/passwd. For example, if "test4" has a UID of 1000 and a
subsequent "test4" entry has a UID of 2000, logging in as "test4" will use UID 1000.
Effectively, the UID is shared, which is a security problem.
Audit:
This script checks to make sure all user names in the /etc/passwd file are unique.
#!/bin/bash
echo "The Output for the Audit of Control 9.2.18 - Check for Duplicate User Names is"
cat /etc/passwd | cut -f1 -d":" | /bin/sort -n | /usr/bin/uniq -c |\
while read x ; do
[ -z "${x}" ] && break
set - $x
if [ $1 -gt 1 ]; then
uids=`/bin/gawk -F: '($1 == n) { print $3 }' n=$2 \
/etc/passwd | xargs`
echo "Duplicate User Name ($2): ${uids}"
fi
done
Remediation:
Based on the results of the script, establish unique user names for the users. File
ownerships will automatically reflect the change as long as the users have unique UIDs.
175 | P a g e
This script checks to make sure all group names in the /etc/group file are unique.
#!/bin/bash
echo "The Output for the Audit of Control 9.2.19 - Check for Duplicate Group Names is"
cat /etc/group | cut -f1 -d":" | /bin/sort -n | /usr/bin/uniq -c |\
while read x ; do
[ -z "${x}" ] && break
set - $x
if [ $1 -gt 1 ]; then
gids=`/bin/gawk -F: '($1 == n) { print $3 }' n=$2 \
/etc/group | xargs`
echo "Duplicate Group Name ($2): ${gids}"
fi
done
Remediation:
Based on the results of the script, establish unique names for the user groups. File group
ownerships will automatically reflect the change as long as the groups have unique GIDs.
Remediation:
176 | P a g e
Making global modifications to users' files without alerting the user community can result
in unexpected outages and unhappy users. Therefore, it is recommended that a monitoring
policy be established to report user .netrc files and determine the action to be taken in
accordance with site policy.
Remediation:
Making global modifications to users' files without alerting the user community can result
in unexpected outages and unhappy users. Therefore, it is recommended that a monitoring
policy be established to report user .forward files and determine the action to be taken in
accordance with site policy.
177 | P a g e
Control
1
1.1
1.1.1
1.1.2
1.1.3
1.1.4
1.1.5
1.1.6
1.1.7
1.1.8
1.1.9
1.1.10
1.1.11
1.1.12
1.1.13
1.1.14
1.1.15
1.1.16
1.1.17
1.1.18
1.1.19
1.1.20
1.1.21
1.1.22
1.1.23
1.1.24
1.2
1.2.1
1.2.2
1.2.3
1.2.4
1.3
1.3.1
1.3.2
1.4
1.4.1
1.4.2
1.4.3
1.4.4
1.4.5
Set
Correctly
Yes
No
178 | P a g e
1.4.6
1.4.7
1.5
1.5.1
1.5.2
1.5.3
1.6
1.6.1
1.6.2
1.7
2
2.1
2.1.1
2.1.2
2.1.3
2.1.4
2.1.5
2.1.6
2.1.7
2.1.8
2.1.9
2.1.10
2.1.11
2.1.12
2.1.13
2.1.14
2.1.15
2.1.16
2.1.17
2.1.18
3
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
3.10
3.11
179 | P a g e
3.12
3.13
3.14
3.15
3.16
4
4.1
4.1.1
4.1.2
4.2
4.2.1
4.2.2
4.2.3
4.2.4
4.2.5
4.2.6
4.2.7
4.2.8
4.3
4.3.1
4.3.1.1
4.3.1.2
4.3.2
4.4
4.4.1
4.4.2
4.4.3
4.4.4
4.4.5
4.5
4.5.1
4.5.2
4.5.3
4.5.4
4.6
5
5.1
5.1.1
5.1.2
5.1.3
5.1.4
5.1.5
180 | P a g e
5.1.6
5.2
5.2.1
5.2.1.1
5.2.1.2
5.2.1.3
5.2.2
5.2.3
5.2.4
5.2.5
5.2.6
5.2.7
5.2.8
5.2.9
5.2.10
5.2.11
5.2.12
5.2.13
5.2.14
5.2.15
5.2.16
5.2.17
5.2.18
5.3
6
6.1
6.1.1
6.1.2
6.1.3
6.1.4
6.1.5
6.1.6
6.1.7
181 | P a g e
6.1.8
6.1.9
6.1.10
6.1.11
6.2
6.2.1
6.2.2
6.2.3
6.2.4
6.2.5
6.2.6
6.2.7
6.2.8
6.2.9
6.2.10
6.2.11
6.2.12
6.2.13
6.2.14
6.3
6.3.1
6.3.2
6.3.3
6.3.4
6.4
6.5
7
7.1
7.1.1
7.1.2
7.1.3
7.2
7.3
7.4
7.5
8
8.1
8.2
8.3
9
9.1
182 | P a g e
9.1.1
9.1.2
9.1.3
9.1.4
9.1.5
9.1.6
9.1.7
9.1.8
9.1.9
9.1.10
9.1.11
9.1.12
9.1.13
9.1.14
9.2
9.2.1
9.2.2
9.2.3
9.2.4
9.2.5
9.2.6
9.2.7
9.2.8
9.2.9
9.2.10
9.2.11
9.2.12
9.2.13
9.2.14
9.2.15
9.2.16
9.2.17
9.2.18
9.2.19
9.2.20
183 | P a g e
Version
01-06-2015
1.0.0
Initial Release
07-06-2015
1.1.0
184 | P a g e