This guide presents a catalog of security-relevant
configuration settings for Ubuntu 1604. It is a rendering of
content structured in the eXtensible Configuration Checklist Description Format (XCCDF)
in order to support security automation. The SCAP content is
is available in the Providing system administrators with such guidance informs them how to securely configure systems under their control in a variety of network roles. Policy makers and baseline creators can use this catalog of settings, with its associated references to higher-level security control catalogs, in order to assist them in security baseline creation. This guide is a catalog, not a checklist, and satisfaction of every item is not likely to be possible or sensible in many operational scenarios. However, the XCCDF format enables granular selection and adjustment of settings, and their association with OVAL and OCIL content provides an automated checking capability. Transformations of this document, and its associated automated checking content, are capable of providing baselines that meet a diverse set of policy objectives. Some example XCCDF Profiles, which are selections of items that form checklists and can be used as baselines, are available with this guide. They can be processed, in an automated fashion, with tools that support the Security Content Automation Protocol (SCAP). The DISA STIG for Ubuntu 1604, which provides required settings for US Department of Defense systems, is one example of a baseline created from this guidance. Applicable platforms
|
Version: 0.1.31 Revision history
|
1. Remediation functions used by the SCAP Security Guide Project
XCCDF form of the various remediation functions as used by remediation scripts from the SCAP Security Guide Project
2. Introduction
The purpose of this guidance is to provide security configuration recommendations and baselines for the Ubuntu 1604 operating system. Recommended settings for the basic operating system are provided, as well as for many network services that the system can provide to other systems. The guide is intended for system administrators. Readers are assumed to possess basic system administration skills for Unix-like systems, as well as some familiarity with the product's documentation and administration conventions. Some instructions within this guide are complex. All directions should be followed completely and with understanding of their effects in order to avoid serious adverse effects on the system and its security.
Table of Contents
link | previous | next | up | toc | home
2.1. General Principles
The following general principles motivate much of the advice in this guide and should also influence any configuration decisions that are not explicitly covered.
link | previous | next | up | toc | home
2.1.1. Encrypt Transmitted Data Whenever Possible
Data transmitted over a network, whether wired or wireless, is susceptible to passive monitoring. Whenever practical solutions for encrypting such data exist, they should be applied. Even if data is expected to be transmitted only over a local network, it should still be encrypted. Encrypting authentication data, such as passwords, is particularly important. Networks of Ubuntu 1604 machines can and should be configured so that no unencrypted authentication data is ever transmitted between machines.
2.1.2. Minimize Software to Minimize Vulnerability
The simplest way to avoid vulnerabilities in software is to avoid installing that software. On Ubuntu 1604, allows for careful management of the set of software packages installed on a system. Installed software contributes to system vulnerability in several ways. Packages that include setuid programs may provide local attackers a potential path to privilege escalation. Packages that include network services may give this opportunity to network-based attackers. Packages that include programs which are predictably executed by local users (e.g. after graphical login) may provide opportunities for trojan horses or other attack code to be run undetected. The number of software packages installed on a system can almost always be significantly pruned to include only the software for which there is an environmental or operational need.
2.1.3. Run Different Network Services on Separate Systems
Whenever possible, a server should be dedicated to serving exactly one network service. This limits the number of other services that can be compromised in the event that an attacker is able to successfully exploit a software flaw in one network service.
2.1.4. Configure Security Tools to Improve System Robustness
Several tools exist which can be effectively used to improve a system's resistance to and detection of unknown attacks. These tools can improve robustness against attack at the cost of relatively little configuration effort. In particular, this guide recommends and discusses the use of host-based firewalling, SELinux for protection against vulnerable services, and a logging and auditing infrastructure for detection of problems.
2.1.5. Least Privilege
Grant the least privilege necessary for user accounts and software to perform tasks.
For example, sudo
can be implemented to limit authorization to super user
accounts on the system only to designated personnel. Another example is to limit
logins on server systems to only those administrators who need to log into them in
order to perform administration tasks. Using SELinux also follows the principle of
least privilege: SELinux policy can confine software to perform only actions on the
system that are specifically allowed. This can be far more restrictive than the
actions permissible by the traditional Unix permissions model.
2.2. How to Use This Guide
Readers should heed the following points when using the guide.
link | previous | next | up | toc | home
2.2.1. Read Sections Completely and in Order
Each section may build on information and recommendations discussed in prior sections. Each section should be read and understood completely; instructions should never be blindly applied. Relevant discussion may occur after instructions for an action.
2.2.2. Test in Non-Production Environment
This guidance should always be tested in a non-production environment before deployment. This test environment should simulate the setup in which the system will be deployed as closely as possible.
2.2.3. Root Shell Environment Assumed
Most of the actions listed in this document are written with the
assumption that they will be executed by the root user running the
/bin/bash
shell. Commands preceded with a hash mark (#)
assume that the administrator will execute the commands as root, i.e.
apply the command via sudo
whenever possible, or use
su
to gain root privileges if sudo
cannot be
used. Commands which can be executed as a non-root user are are preceded
by a dollar sign ($) prompt.
2.2.4. Formatting Conventions
Commands intended for shell execution, as well as configuration file text,
are featured in a monospace font
. Italics are used
to indicate instances where the system administrator must substitute
the appropriate information into a command or configuration file.
2.2.5. Reboot Required
A system reboot is implicitly required after some actions in order to complete the reconfiguration of the system. In many cases, the changes will not take effect until a reboot is performed. In order to ensure that changes are applied properly and to test functionality, always reboot the system after applying a set of recommendations from this guide.
3. System Settings
Contains rules that check correct system settings.
Table of Contents
- 3.1. Installing and Maintaining Software
- 3.2. File Permissions and Masks
-
3.3. Hardening the filesystem
-
3.3.1. Partitioning
- 3.3.1.a. Ensure /tmp Located On Separate Partition
- 3.3.1.b. Ensure /var Located On Separate Partition
- 3.3.1.c. Ensure /var/log Located On Separate Partition
- 3.3.1.d. Ensure /var/log/audit Located On Separate Partition
- 3.3.1.e. Ensure /home Located On Separate Partition
- 3.3.1.f. Ensure /srv Located On Separate Partition
- 3.3.2. filesystem rights management
-
3.3.1. Partitioning
- 3.4. Account and Access Control
- 3.5. Configure Syslog
link | previous | next | up | toc | home
3.1. Installing and Maintaining Software
The following sections contain information on security-relevant choices during the initial operating system installation process and the setup of software updates.
3.2. File Permissions and Masks
Traditional Unix security relies heavily on file and
directory permissions to prevent unauthorized users from reading or
modifying files to which they should not have access.
Several of the commands in this section search filesystems
for files or directories with certain characteristics, and are
intended to be run on every local partition on a given system.
When the variable PART appears in one of the commands below,
it means that the command is intended to be run repeatedly, with the
name of each local partition substituted for PART in turn.
The following command prints a list of all xfs partitions on the local
system, which is the default filesystem for Red Hat Enterprise Linux
7 installations:
$ mount -t xfs | awk '{print $3}'
For any systems that use a different
local filesystem type, modify this command as appropriate.
link | previous | next | up | toc | home
3.2.1. Verify Permissions on Important Files and Directories
Permissions for many files on a system must be set restrictively to ensure sensitive information is properly protected. This section discusses important permission restrictions which can be verified to ensure that no harmful discrepancies have arisen.
link | previous | next | up | toc | home
3.2.1.1. Verify permissions on files containing sensitive informations about the system
Various files contains sensitive informations that can leads to specific weaknesses or give structural informations for local exploits.
link | previous | next | up | toc | home
3.2.1.1.a. Verify that local System.map file (if exists) is readable only by root
Files containing sensitive informations should be protected by restrictive
permissions. Most of the time, there is no need that these files need to be read by any non-root user
To properly set the permissions of /boot/System.map-*
, run the command:
$ sudo chmod 0600 /boot/System.map-*
To properly set the owner of /boot/System.map-*
, run the command:
$ sudo chown root /boot/System.map-*
The System.map
file contains information about kernel symbols and
can give some hints to generate local exploitation.
References
- NT28(R13). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.2.1.2. Verify Permissions on Files with Local Account Information and Credentials
The default restrictive permissions for files which act as
important security databases such as passwd
, shadow
,
group
, and gshadow
files must be maintained. Many utilities
need read access to the passwd
file in order to function properly, but
read access to the shadow
file allows malicious attacks against system
passwords, and should never be enabled.
link | previous | next | up | toc | home
3.2.1.2.a. Verify Permissions and ownership on shadow File
To properly set the permissions of /etc/shadow
, run the command:
$ sudo chmod 0640 /etc/shadow
To properly set the owner of /etc/shadow
, run the command:
$ sudo chown root /etc/shadow
To properly set the group owner of /etc/shadow
, run the command:
$ sudo chgrp shadow /etc/shadow
The /etc/shadow
file contains the list of local
system accounts and stores password hashes. Protection of this file is
critical for system security. Failure to give ownership of this file
to root provides the designated owner with access to sensitive information
which could weaken the system security posture.
Remediation script
chmod 0640 /etc/shadow
References
- AC-6. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- . URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- Req-8.7.c. URL: <https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-1.pdf>.
- NT28(R36). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.2.1.2.b. Verify Permissions and ownership on gshadow File
To properly set the permissions of /etc/gshadow
, run the command:
$ sudo chmod 0640 /etc/gshadow
To properly set the owner of /etc/gshadow
, run the command:
$ sudo chown root /etc/gshadow
To properly set the group owner of /etc/gshadow
, run the command:
$ sudo chgrp shadow /etc/gshadow
The /etc/shadow
file contains group password hashes. Protection of this file
is critical for system security.
Remediation script
chmod 0640 /etc/gshadow
References
- AC-6. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- . URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- NT28(R36). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.2.1.2.c. Verify Permissions and ownership on passwd File
To properly set the permissions of /etc/passwd
, run the command:
$ sudo chmod 0644 /etc/passwd
To properly set the owner of /etc/passwd
, run the command:
$ sudo chown root /etc/passwd
To properly set the group owner of /etc/passwd
, run the command:
$ sudo chgrp root /etc/passwd
The /etc/shadow
file contains information about the users that are configured on
the system. Protection of this file is critical for system security.
Remediation script
chmod 0644 /etc/passwd
References
3.2.1.2.d. Verify Permissions and ownership on group File
To properly set the permissions of /etc/passwd
, run the command:
$ sudo chmod 0644 /etc/passwd
To properly set the owner of /etc/passwd
, run the command:
$ sudo chown root /etc/passwd
To properly set the group owner of /etc/passwd
, run the command:
$ sudo chgrp root /etc/passwd
The /etc/shadow
file contains information about the groups that are configured on
the system. Protection of this file is critical for system security.
Remediation script
chmod 0644 /etc/group
References
3.2.2. Restrict Programs from Dangerous Execution Patterns
The recommendations in this section are designed to ensure that the system's features to protect against potentially dangerous program execution are activated. These protections are applied at the system initialization or kernel level, and defend against certain types of badly-configured or compromised programs.
link | previous | next | up | toc | home
3.2.2.1. Disable Core Dumps
A core dump file is the memory image of an executable
program when it was terminated by the operating system due to
errant behavior. In most cases, only software developers
legitimately need to access these files. The core dump files may
also contain sensitive information, or unnecessarily occupy large
amounts of disk space.
Once a hard limit is set in /etc/security/limits.conf
, a
user cannot increase that limit within his or her own session. If access
to core dumps is required, consider restricting them to only
certain users or groups. See the limits.conf
man page for more
information.
The core dumps of setuid programs are further protected. The
sysctl
variable fs.suid_dumpable
controls whether
the kernel allows core dumps from these programs at all. The default
value of 0 is recommended.
link | previous | next | up | toc | home
3.2.2.1.a. Disable Core Dumps for SUID programs
To set the runtime status of the fs.suid_dumpable
kernel parameter,
run the following command:
$ sudo sysctl -w fs.suid_dumpable=0
If this is not the system's default value, add the following line to /etc/sysctl.conf
:
fs.suid_dumpable = 0
The core dump of a setuid program is more likely to contain wve data, as the program itself runs with greater privileges than the user who initiated execution of the program. Disabling the ability for any setuid program to write a core file decreases the risk of unauthorized access of such data.
References
- SI-11. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 1.6.1. fixme.
- NT28(R23). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.2.2.2. Enable ExecShield
ExecShield describes kernel features that provide
protection against exploitation of memory corruption errors such as buffer
overflows. These features include random placement of the stack and other
memory regions, prevention of execution in memory that should only hold data,
and special handling of text buffers. These protections are enabled by default
on 32-bit systems and controlled through sysctl
variables
kernel.exec-shield
and kernel.randomize_va_space
. On the latest
64-bit systems, kernel.exec-shield
cannot be enabled or disabled with
sysctl
.
link | previous | next | up | toc | home
3.2.2.2.a. Enable Randomized Layout of Virtual Address Space
To set the runtime status of the kernel.randomize_va_space
kernel parameter,
run the following command:
$ sudo sysctl -w kernel.randomize_va_space=2
If this is not the system's default value, add the following line to /etc/sysctl.conf
:
kernel.randomize_va_space = 2
Address space layout randomization (ASLR) makes it more difficult for an attacker to predict the location of attack code they have introduced into a process's address space during an attempt at exploitation. Additionally, ASLR makes it more difficult for an attacker to know the location of existing code in order to re-purpose it using return oriented programming (ROP) techniques.
References
- SC-30(2). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 1.6.1. fixme.
- NT28(R23). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.2.2.2.b. Restrict exposed kernel pointers addresses access
To set the runtime status of the kernel.kptr_restrict
kernel parameter,
run the following command:
$ sudo sysctl -w kernel.kptr_restrict=1
If this is not the system's default value, add the following line to /etc/sysctl.conf
:
kernel.kptr_restrict = 1
Exposing kernel pointers (through procfs or seq_printf()
) exposes
kernel writeable structures that can contain functions pointers. If a write vulnereability occurs
in the kernel allowing a write access to any of this structure, the kernel can be compromise. This
option disallow any program withtout the CAP_SYSLOG capability from getting the kernel pointers addresses,
replacing them with 0.
References
- NT28(R23). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.3. Hardening the filesystem
Hardening the filesystem and its usage is an efficient way to ensure an efficient separation of services, data and configurations while ensuring a more precise management of filesystem level access rights, enabling deactivation of some specific rights at the filesystem level. Moreover, the Linux Virtual file system support various hardening mechanisms that can be set using sysctl.
link | previous | next | up | toc | home
3.3.1. Partitioning
Separating various locations of the file systems in different partitions allows a more restrictive segregation, distinctly from one location to another. Moreover, some native restrictions can be made by partitioning, such as no hard link between different filesystems, and reduce the corruption impact to the affected filesystem instead of the entire system. The last gain is to allow a differenciated usage of storage media, depending on the operational needs (speed, resilience, etc.).
References
- Filesystem Hierarchy Standard. URL: <http://www.pathname.com/fhs/>.
link | previous | next | up | toc | home
3.3.1.a. Ensure /tmp Located On Separate Partition
The /tmp
directory is a world-writable directory used
for temporary file storage. Ensure it has its own partition or
logical volume at installation time, or migrate it using LVM (when non-ephemeral is needed) or use tmpfs if possible.
The /tmp
partition is used as temporary storage by many programs.
Placing /tmp
in its own partition enables the setting of more
restrictive mount options, which can help protect programs which use it.
References
- SC-32. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- NT28(R12). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.3.1.b. Ensure /var Located On Separate Partition
The /var
directory is used by daemons and other system
services to store frequently-changing data. Ensure that /var
has its own partition
or logical volume at installation time, or migrate it using LVM.
Ensuring that /var
is mounted on its own partition enables the
setting of more restrictive mount options. This helps protect
system services such as daemons or other programs which use it.
It is not uncommon for the /var
directory to contain
world-writable directories installed by other software packages.
References
- SC-32. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- NT28(R12). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.3.1.c. Ensure /var/log Located On Separate Partition
System logs are stored in the /var/log
directory.
Ensure that it has its own partition or logical
volume at installation time, or migrate it using LVM.
Placing /var/log
in its own partition
enables better separation between log files
and other files in /var/
.
References
- AU-9. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- SC-32. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- . URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- NT28(R12). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
- NT28(R47). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.3.1.d. Ensure /var/log/audit Located On Separate Partition
Audit logs are stored in the /var/log/audit
directory. Ensure that it
has its own partition or logical volume at installation time, or migrate it
later using LVM. Make absolutely certain that it is large enough to store all
audit logs that will be created by the auditing daemon.
Placing /var/log/audit
in its own partition
enables better separation between audit files
and other files, and helps ensure that
auditing cannot be halted due to the partition running out
of space.
References
- AU-4. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- AU-9. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- SC-32. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- . URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
3.3.1.e. Ensure /home Located On Separate Partition
If user home directories will be stored locally, create a separate partition
for /home
at installation time (or migrate it later using LVM). If
/home
will be mounted from another system such as an NFS server, then
creating a separate partition is not necessary at installation time, and the
mountpoint can instead be configured later.
Ensuring that /home
is mounted on its own partition enables the
setting of more restrictive mount options, and also helps ensure that
users cannot trivially fill partitions used for log or audit data storage.
References
- SC-32. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 1208. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- NT28(R12). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.3.1.f. Ensure /srv Located On Separate Partition
If a file server (FTP, TFTP...) is hosted locally, create a separate partition
for /srv
at installation time (or migrate it later using LVM). If
/srv
will be mounted from another system such as an NFS server, then
creating a separate partition is not necessary at installation time, and the
mountpoint can instead be configured later.
Srv deserves files for local network file server such as FTP. Ensuring
that /srv
is mounted on its own partition enables the setting of
more restrictive mount options, and also helps ensure that
users cannot trivially fill partitions used for log or audit data storage.
References
- NT28(R12). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.3.2. filesystem rights management
Adding filesystem specific hardening seriously limits various exploitation vectors based on filesystem invalid usage, such as invalid file types in invalid places (devices or setuid root files in external media, executable file in insecure filesystems, etc.). Some of these hardening require an efficient system partitioning.
link | previous | next | up | toc | home
3.3.2.a. Disallow creating symlinks to a file you not own
To set the runtime status of the fs.protected_symlinks
kernel parameter,
run the following command:
$ sudo sysctl -w fs.protected_symlinks=1
If this is not the system's default value, add the following line to /etc/sysctl.conf
:
fs.protected_symlinks = 1
Disallowing such symlink mitigate vulnerabilities based on insecure file system
accessed by privilegied programs, avoiding an exploitation vector exploiting unsafe use of
open()
or creat()
.
References
- SI-11. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 1.6.1. fixme.
- NT28(R23). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.3.2.b. Disallow creating symlinks to a file you not own
To set the runtime status of the fs.protected_hardlinks
kernel parameter,
run the following command:
$ sudo sysctl -w fs.protected_hardlinks=1
If this is not the system's default value, add the following line to /etc/sysctl.conf
:
fs.protected_hardlinks = 1
Disallowing such hardlink mitigate vulnerabilities based on insecure file system
accessed by privilegied programs, avoiding an exploitation vector exploiting unsafe use of
open()
or creat()
.
References
- SI-11. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 1.6.1. fixme.
- NT28(R23). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.4. Account and Access Control
In traditional Unix security, if an attacker gains shell access to a certain login account, they can perform any action or access any file to which that account has access. Therefore, making it more difficult for unauthorized people to gain shell access to accounts, particularly to privileged accounts, is a necessary part of securing a system. This section introduces mechanisms for restricting access to accounts under Ubuntu 1604.
link | previous | next | up | toc | home
3.4.1. Protect Accounts by Restricting Password-Based Login
Conventionally, Unix shell accounts are accessed by
providing a username and password to a login program, which tests
these values for correctness using the /etc/passwd
and
/etc/shadow
files. Password-based login is vulnerable to
guessing of weak passwords, and to sniffing and man-in-the-middle
attacks against passwords entered over a network or at an insecure
console. Therefore, mechanisms for accessing accounts by entering
usernames and passwords should be restricted to those which are
operationally necessary.
3.5. Configure Syslog
The syslog service has been the default Unix logging mechanism for
many years. It has a number of downsides, including inconsistent log format,
lack of authentication for received messages, and lack of authentication,
encryption, or reliable transport for messages sent over a network. However,
due to its long history, syslog is a de facto standard which is supported by
almost all Unix applications.
In Ubuntu 1604, rsyslog has replaced syslog as the syslog daemon of choice,
and it includes some additional security features such as reliable,
connection-oriented (i.e. TCP) transmission of logs, the option to log to
database formats, and the encryption of log data en route to
a central logging server. This section discusses how to configure rsyslog for
best effect, and how to use tools provided with the system to maintain and
monitor logs.
link | previous | next | up | toc | home
3.5.a. Ensure rsyslog is Installed
Rsyslog is installed by default.
The rsyslog
package can be installed with the following command:
# apt-get install rsyslog
The rsyslog package provides the rsyslog daemon, which provides system logging services.
Remediation script
# Include source function library.
apt-get install rsyslog
References
- AU-9(2). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 1311. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 1312. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 5.1.1. fixme.
- NT28(R46). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.5.b. Enable rsyslog Service
The rsyslog
service provides syslog-style logging by default on Ubuntu 1604.
The rsyslog
service can be enabled with the following command:
$ sudo chkconfig --level 2345 rsyslog on
The rsyslog
service must be running in order to provide
logging services, which are essential to system administration.
References
- AU-4(1). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- AU-12. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 1311. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 1312. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 1557. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 1851. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 5.1.2. fixme.
- NT28(R46). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.5.3. Ensure Proper Configuration of Log Files
The file /etc/rsyslog.conf
controls where log message are written.
These are controlled by lines called rules, which consist of a
selector and an action.
These rules are often customized depending on the role of the system, the
requirements of the environment, and whatever may enable
the administrator to most effectively make use of log data.
The default rules in Ubuntu 1604 are:
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none -/var/log/syslog
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
mail.info -/var/log/mail.info
mail.warn -/var/log/mail.warn
mail.err /var/log/mail.err
news.crit /var/log/news/news.crit
news.err /var/log/news/news.err
news.notice -/var/log/news/news.notice
See the man page rsyslog.conf(5)
for more information.
Note that the rsyslog
daemon is configured to use traditional timestamping
to be understood by any log processing program. For high precision timestamping,
comment the following line in /etc/rsyslog.conf
:
$ ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
link | previous | next | up | toc | home
3.5.3.a. Ensure Log Files Are Owned By Appropriate User
The owner of all log files written by
rsyslog
should be root.
These log files are determined by the second part of each Rule line in
/etc/rsyslog.conf
and typically all appear in /var/log
.
For each log file LOGFILE referenced in /etc/rsyslog.conf
,
run the following command to inspect the file's owner:
$ ls -l LOGFILE
If the owner is not root
, run the following command to
correct this:
$ sudo chown root LOGFILE
The log files generated by rsyslog contain valuable information regarding system configuration, user authentication, and other such information. Log files should be protected from unauthorized access.
References
- AC-6. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- SI-11. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 1314. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- Req-10.5.1. URL: <https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-1.pdf>.
- Req-10.5.2. URL: <https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-1.pdf>.
- NT28(R46). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.5.3.b. Ensure Log Files Are Owned By Appropriate Group
The group-owner of all log files written by
rsyslog
should be root.
These log files are determined by the second part of each Rule line in
/etc/rsyslog.conf
and typically all appear in /var/log
.
For each log file LOGFILE referenced in /etc/rsyslog.conf
,
run the following command to inspect the file's group owner:
$ ls -l LOGFILE
If the owner is not adm
, run the following command to
correct this:
$ sudo chgrp adm LOGFILE
The log files generated by rsyslog contain valuable information regarding system configuration, user authentication, and other such information. Log files should be protected from unauthorized access.
References
- AC-6. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- SI-11. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 1314. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- Req-10.5.1. URL: <https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-1.pdf>.
- Req-10.5.2. URL: <https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-1.pdf>.
- NT28(R46). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.5.3.c. Ensure System Log Files Have Correct Permissions
The file permissions for all log files written by
rsyslog
should be set to 640, or more restrictive.
These log files are determined by the second part of each Rule line in
/etc/rsyslog.conf
and typically all appear in /var/log
.
For each log file LOGFILE referenced in /etc/rsyslog.conf
,
run the following command to inspect the file's permissions:
$ ls -l LOGFILE
If the permissions are not 640 or more restrictive,
run the following command to correct this:
$ sudo chmod 0640 LOGFILE
Log files can contain valuable information regarding system configuration. If the system log files are not protected unauthorized users could change the logged data, eliminating their forensic value.
References
- SI-11. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 1314. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- Req-10.5.1. URL: <https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-1.pdf>.
- Req-10.5.2. URL: <https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-1.pdf>.
- 5.1.4. fixme.
- NT28(R36). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
3.5.4. Rsyslog Logs Sent To Remote Host
If system logs are to be useful in detecting malicious
activities, it is necessary to send logs to a remote server. An
intruder who has compromised the root account on a machine may
delete the log entries which indicate that the system was attacked
before they are seen by an administrator.
However, it is recommended that logs be stored on the local
host in addition to being sent to the loghost, especially if
rsyslog
has been configured to use the UDP protocol to send
messages over a network. UDP does not guarantee reliable delivery,
and moderately busy sites will lose log messages occasionally,
especially in periods of high traffic which may be the result of an
attack. In addition, remote rsyslog
messages are not
authenticated in any way by default, so it is easy for an attacker to
introduce spurious messages to the central log server. Also, some
problems cause loss of network connectivity, which will prevent the
sending of messages to the central server. For all of these reasons, it is
better to store log messages both centrally and on each host, so
that they can be correlated if necessary.
link | previous | next | up | toc | home
3.5.4.a. Ensure Logs Sent To Remote Host
To configure rsyslog to send logs to a remote log server,
open /etc/rsyslog.conf
and read and understand the last section of the file,
which describes the multiple directives necessary to activate remote
logging.
Along with these other directives, the system can be configured
to forward its logs to a particular log server by
adding or correcting one of the following lines,
substituting loghost.example.com
appropriately.
The choice of protocol depends on the environment of the system;
although TCP and RELP provide more reliable message delivery,
they may not be supported in all environments.
To use UDP for log message delivery:
*.* @loghost.example.com
To use TCP for log message delivery:
*.* @@loghost.example.com
To use RELP for log message delivery:
*.* :omrelp:loghost.example.com
A log server (loghost) receives syslog messages from one or more systems. This data can be used as an additional log source in the event a system is compromised and its local logs are suspect. Forwarding log messages to a remote loghost also provides system administrators with a centralized place to view the status of multiple hosts within the enterprise.
References
- AU-3(2). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- AU-4(1). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- AU-9. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 1348. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 136. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 1851. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 5.1.5. fixme.
3.5.5. Configure rsyslogd to Accept Remote Messages If Acting as a Log Server
By default, rsyslog
does not listen over the network
for log messages. If needed, modules can be enabled to allow
the rsyslog daemon to receive messages from other systems and for the system
thus to act as a log server.
If the machine is not a log server, then lines concerning these modules
should remain commented out.
link | previous | next | up | toc | home
3.5.5.a. Enable rsyslog to Accept Messages via TCP, if Acting As Log Server
The rsyslog
daemon should not accept remote messages
unless the system acts as a log server.
If the system needs to act as a central log server, add the following lines to
/etc/rsyslog.conf
to enable reception of messages over TCP:
$ModLoad imtcp
$InputTCPServerRun 514
If the system needs to act as a log server, this ensures that it can receive messages over a reliable TCP connection.
References
- AU-9. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 5.1.6. fixme.
3.5.5.b. Enable rsyslog to Accept Messages via UDP, if Acting As Log Server
The rsyslog
daemon should not accept remote messages
unless the system acts as a log server.
If the system needs to act as a central log server, add the following lines to
/etc/rsyslog.conf
to enable reception of messages over UDP:
$ModLoad imudp
$UDPServerRun 514
Many devices, such as switches, routers, and other Unix-like systems, may only support the traditional syslog transmission over UDP. If the system must act as a log server, this enables it to receive their messages as well.
References
- AU-9. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 5.1.6. fixme.
3.5.6. Ensure All Logs are Rotated by logrotate
Edit the file /etc/logrotate.d/rsyslog
. Find the first
line, which should look like this (wrapped for clarity):
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler \
/var/log/boot.log /var/log/cron {
Edit this line so that it contains a one-space-separated
listing of each log file referenced in /etc/rsyslog.conf
.
All logs in use on a system must be rotated regularly, or the log files will consume disk space over time, eventually interfering with system operation. The file
/etc/logrotate.d/syslog
is the
configuration file used by the logrotate
program to maintain all
log files written by syslog
. By default, it rotates logs weekly and
stores four archival copies of each log. These settings can be
modified by editing /etc/logrotate.conf
, but the defaults are
sufficient for purposes of this guide.
Note that
logrotate
is run nightly by the cron job
/etc/cron.daily/logrotate
. If particularly active logs need to be
rotated more often than once a day, some other mechanism must be
used.
link | previous | next | up | toc | home
3.5.6.a. Ensure Logrotate Runs Periodically
The logrotate
utility allows for the automatic rotation of
log files. The frequency of rotation is specified in /etc/logrotate.conf
,
which triggers a cron task. To configure logrotate to run daily, add or correct
the following line in /etc/logrotate.conf
:
# rotate log files frequency
daily
Log files that are not properly rotated run the risk of growing so large that they fill up the /var/log partition. Valuable logging information could be lost if the /var/log partition becomes full.
References
- AU-9. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 366. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- Req-10.7. URL: <https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-1.pdf>.
4. Services
The best protection against vulnerable software is running less software. This section describes how to review
the software which Ubuntu 1604 installs on a system and disable software which is not needed. It
then enumerates the software packages installed on a default Ubuntu 1604 system and provides guidance about which
ones can be safely disabled.
Ubuntu 1604 provides a convenient minimal install option that essentially installs the bare necessities for a functional
system. When building Ubuntu 1604 systems, it is highly recommended to select the minimal packages and then build up
the system from there.
Table of Contents
link | previous | next | up | toc | home
4.1. Deprecated services
Some deprecated software services impact the overall system security due to their behavior (leak of confidentiality in network exchange, usage as uncontrolled communication channel, risk associated with the service due to its old age, etc.
link | previous | next | up | toc | home
4.1.a. Uninstall the telnet server
The telnet daemon should be uninstalled.
telnet allows clear text communications, and does not protect any data transmission between client and server. Any confidential data can be listened and no integrity checking is made.
Remediation script
# CAUTION: This remediation script will remove telnetd
# from the system, and may remove any packages
# that depend on telnetd. Execute this
# remediation AFTER testing on a non-production
# system!
apt-get remove --purge telnetd
Security identifiers
- CCE-
References
- AC-17(8). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- CM-7. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- . URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- NT007(R03). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
4.1.b. Uninstall the inet-based telnet server
The inet-based telnet daemon should be uninstalled.
telnet allows clear text communications, and does not protect any data transmission between client and server. Any confidential data can be listened and no integrity checking is made.
Remediation script
# CAUTION: This remediation script will remove inetutils-telnetd
# from the system, and may remove any packages
# that depend on inetutils-telnetd. Execute this
# remediation AFTER testing on a non-production
# system!
apt-get remove --purge inetutils-telnetd
Security identifiers
- CCE-
References
- AC-17(8). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- CM-7. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- . URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- NT007(R03). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
4.1.c. Uninstall the ssl compliant telnet server
The telnet daemon, even with ssl support, should be uninstalled.
telnet, even with ssl support, should not be installed. When remote shell is required, up-to-date ssh daemon can be used.
Remediation script
# CAUTION: This remediation script will remove telnetd-ssl
# from the system, and may remove any packages
# that depend on telnetd-ssl. Execute this
# remediation AFTER testing on a non-production
# system!
apt-get remove --purge telnetd-ssl
Security identifiers
- CCE-
References
- AC-17(8). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- CM-7. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- NT007(R02). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
4.1.d. Uninstall the nis package
The support for Yellowpages should not be installed unless it is required.
NIS is the historical SUN service for central account management, more and more replaced by LDAP. NIS does not support efficiently security constraints, ACL, etc. and should not be used.
Remediation script
# CAUTION: This remediation script will remove nis
# from the system, and may remove any packages
# that depend on nis. Execute this
# remediation AFTER testing on a non-production
# system!
apt-get remove --purge nis
Security identifiers
- CCE-
4.1.e. Uninstall the ntpdate package
ntpdate is a historical ntp synchronization client for unixes. It sould be uninstalled.
ntpdate is an old not security-compliant ntp client. It should be replaced by modern ntp clients such as ntpd, able to use cryptographic mechanisms integrated in NTP.
Remediation script
# CAUTION: This remediation script will remove ntpdate
# from the system, and may remove any packages
# that depend on ntpdate. Execute this
# remediation AFTER testing on a non-production
# system!
apt-get remove --purge ntpdate
Security identifiers
- CCE-
4.2. Generic required services
Some services need to be deployed in order to ensure basic verifications and reporting on GNU/Linux operating systems. Each of these service take part in the administrability of the system.
link | previous | next | up | toc | home
4.2.a. install the auditd service
The auditd service should be installed.
The auditd service is an access monitoring and accounting daemon, watching system calls to audit any access, in comparision with potential local access control policy such as SELinux policy.
Remediation script
# Include source function library.
apt-get install auditd
Security identifiers
- CCE-
References
- NT28(R50). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
4.2.b. Enable the auditd service
The auditd service should be enabled.
The auditd service is an access monitoring and accounting daemon, watching system calls to audit any access, in comparision with potential local access control policy such as SELinux policy.
Security identifiers
- CCE-
References
- NT28(R50). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
- AC-17(1). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- AU-1(b). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- AU-10. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- AU-12(a). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- AU-12(c). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- IR-5. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 347. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 157. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 172. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 880. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 1353. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 1462. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 1487. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 1115. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 1454. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 067. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 158. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 831. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 1190. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 1312. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 1263. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 130. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 120. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- 1589. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- Req-10. URL: <https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-1.pdf>.
4.2.c. Install the cron service
The Cron service should be installed.
The cron service allow periodic job execution, needed for almost all administrative tasks and services (software update, log rotating, etc.). Access to cron service should be restricted to administrative accounts only.
Remediation script
# Include source function library.
apt-get install cron
Security identifiers
- CCE-
References
- CM-7. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- NT28(R50). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
4.2.d. Enable the cron service
The Cron service should be enabled.
The cron service allow periodic job execution, needed for almost all administrative tasks and services (software update, log rotating, etc.). Access to cron service should be restricted to administrative accounts only.
Security identifiers
- CCE-
References
4.2.e. Install the ntp service
The ntpd service should be installed.
Time synchronization (using NTP) is required by almost all network and administrative tasks (syslog, cryptographic based services (authentication, etc.), etc.). Ntpd is regulary maintained and updated, supporting security features such as RFC 5906.
Remediation script
# Include source function library.
apt-get install ntp
Security identifiers
- CCE-
References
- AU-8(1). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 160. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- Req-10.4. URL: <https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-1.pdf>.
- NT012(R03). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
4.2.f. Enable the ntpd service
The ntpd service should be enabled.
Time synchronization (using NTP) is required by almost all network and administrative tasks (syslog, cryptographic based services (authentication, etc.), etc.). Ntpd is regulary maintained and updated, supporting security features such as RFC 5906.
Security identifiers
- CCE-
References
- AU-8(1). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- 160. URL: <http://iase.disa.mil/stigs/cci/Pages/index.aspx>.
- Req-10.4. URL: <https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-1.pdf>.
- NT012(R03). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
4.3. SSH Server
The SSH protocol is recommended for remote access (remote login and secure remote file transfer).
SSH provides both confidentiality and integrity for exchanged data but needs to be configured properly in term of:
Cryptography usage, according to the current CVEs associated to the various cryptographic modes
Authentication and autorization, depending on your needs but requiring some specific initial generic security
consideration in the OpenSSH configuration writing
More detailed information is available from the OpenSSH project's website http://www.openssh.org. The Ubuntu package for
server side implementation is called openssh-server
.
link | previous | next | up | toc | home
4.3.a. Disable SSH Server if possible (unusual cases)
Most of the time, the SSH server is needed. However, it can be disabled, do so.
The ssh
service can be disabled with the following command:
$ sudo chkconfig ssh off
This is unusual, as SSH is a common method for encrypted and authenticated
remote access.
4.3.2. Configure OpenSSH Server if deployed
If the system needs to act as an SSH server, then
certain changes should be made to the OpenSSH daemon configuration
file /etc/ssh/sshd_config
. The following recommendations can be
applied to this file. See the sshd_config(5)
man page for more
detailed information.
link | previous | next | up | toc | home
4.3.2.a. Allow Only SSH Protocol 2
Only SSH protocol version 2 connections should be
permitted. The default setting in
/etc/ssh/sshd_config
is correct, and can be
verified by ensuring that the following
line appears:
Protocol 2
SSH protocol version 1 suffers from design flaws that result in security vulnerabilities and should not be used.
Security identifiers
- CCE-
References
- AC-17(7). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- IA-5(1)(c). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- NT007(R1). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
4.3.2.b. Set SSH Idle Timeout Interval
SSH allows administrators to set an idle timeout interval.
After this interval has passed, the idle user will be automatically logged out.
To set an idle timeout interval, edit the following line in /etc/ssh/sshd_config
as
follows:
ClientAliveInterval interval
The timeout interval is given in seconds. To have a timeout
of 15 minutes, set interval to 900.
If a shorter timeout has already been set for the login shell, that value will preempt any SSH setting made here. Keep in mind that some processes may stop SSH from correctly detecting that the user is idle.
Causing idle users to be automatically logged out guards against compromises one system leading trivially to compromises on another.
Security identifiers
- CCE-
References
4.3.2.c. Set SSH Client Alive Count
To ensure the SSH idle timeout occurs precisely when the ClientAliveCountMax
is set,
edit /etc/ssh/sshd_config
as
follows:
ClientAliveCountMax 0
This ensures a user login will be terminated as soon as the ClientAliveCountMax
is reached.
Security identifiers
- CCE-
References
4.3.2.d. Disable SSH Root Login
The root user should never be allowed to login to a
system directly over a network.
To disable root login via SSH, add or correct the following line
in /etc/ssh/sshd_config
:
PermitRootLogin no
Permitting direct root login reduces auditable information about who ran privileged commands on the system and also allows direct attack attempts on root's password.
Security identifiers
- CCE-
References
- AC-3. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- AC-6(2). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- IA-2(1). URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- NT007(R21). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
4.3.2.e. Disable SSH Access via Empty Passwords
To explicitly disallow remote login from accounts with
empty passwords, add or correct the following line in
/etc/ssh/sshd_config
:
PermitEmptyPasswords no
Any accounts with empty passwords should be disabled immediately, and PAM configuration
should prevent users from being able to assign themselves empty passwords.
Configuring this setting for the SSH daemon provides additional assurance that remote login via SSH will require a password, even in the event of misconfiguration elsewhere.
Security identifiers
- CCE-
References
- AC-3. URL: <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf>.
- NT007(R17). URL: <http://www.ssi.gouv.fr/administration/bonnes-pratiques/>.
Colophon
Red Hat and Red Hat Enterprise Linux are either registered trademarks or trademarks of Red Hat, Inc. in the United States and other countries. All other names are registered trademarks or trademarks of their respective companies.