Guide to the Secure Configuration of Debian 8

with profile Profile for ANSSI DAT-NT28 Minimal Level
This profile contains items to be applied systematically.
This guide presents a catalog of security-relevant configuration settings for Debian 8. 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 config_item="scap-security-guide" package which is developed at https://www.open-scap.org/security-policies/scap-security-guide.

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 italics="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 italics="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 Debian 8, which provides required settings for US Department of Defense systems, is one example of a baseline created from this guidance.
Do not attempt to implement any of the settings in this guide without first testing them in a non-operational environment. The creators of this guidance assume no responsibility whatsoever for its use by other parties, and makes no guarantees, expressed or implied, about its quality, reliability, or any other characteristic.

Profile Information

Profile TitleProfile for ANSSI DAT-NT28 Minimal Level
Profile IDxccdf_org.ssgproject.content_profile_anssi_np_nt28_minimal

CPE Platforms

  • cpe:/o:debianproject:debian:8

Revision History

Current version: 0.1.39

  • draft (as of 2021-07-16)

Table of Contents

  1. Services
    1. Deprecated services
    2. APT service configuration
  2. System Settings
    1. Configure Syslog
    2. Access Control using sudo
    3. File Permissions and Masks

Checklist

Group   Guide to the Secure Configuration of Debian 8   Group contains 10 groups and 16 rules
Group   Services   Group contains 2 groups and 6 rules

[ref]   The best protection against vulnerable software is running less software. This section describes how to review the software which Debian 8 installs on a system and disable software which is not needed. It then enumerates the software packages installed on a default Debian 8 system and provides guidance about which ones can be safely disabled.

Debian 8 provides a convenient minimal install option that essentially installs the bare necessities for a functional system. When building Debian 8 systems, it is highly recommended to select the minimal packages and then build up the system from there.

Group   Deprecated services   Group contains 4 rules

[ref]   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.

Rule   Uninstall the nis package   [ref]

The support for Yellowpages should not be installed unless it is required.

Rationale:

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.

Severity: 
low
Rule ID:xccdf_org.ssgproject.content_rule_package_nis_removed
Identifiers and References

Identifiers:  CCE-



Complexity:low
Disruption:low
Strategy:disable
# 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


Complexity:low
Disruption:low
Strategy:disable
- name: Ensure nis is removed
  package:
    name="{{item}}"
    state=absent
  with_items:
    - nis
  tags:
    - package_nis_removed
    - low_severity
    - disable_strategy
    - low_complexity
    - low_disruption
    - CCE-


Complexity:low
Disruption:low
Strategy:disable
include remove_nis

class remove_nis {
  package { 'nis':
    ensure => 'purged',
  }
}

Rule   Uninstall the telnet server   [ref]

The telnet daemon should be uninstalled.

Rationale:

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.

Severity: 
high
Rule ID:xccdf_org.ssgproject.content_rule_package_telnetd_removed
Identifiers and References

Identifiers:  CCE-

References:  NT007(R03), AC-17(8), CM-7



Complexity:low
Disruption:low
Strategy:disable
# 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


Complexity:low
Disruption:low
Strategy:disable
- name: Ensure telnetd is removed
  package:
    name="{{item}}"
    state=absent
  with_items:
    - telnetd
  tags:
    - package_telnetd_removed
    - high_severity
    - disable_strategy
    - low_complexity
    - low_disruption
    - CCE-
    - NIST-800-53-AC-17(8)
    - NIST-800-53-CM-7


Complexity:low
Disruption:low
Strategy:disable
include remove_telnetd

class remove_telnetd {
  package { 'telnetd':
    ensure => 'purged',
  }
}

Rule   Uninstall the ssl compliant telnet server   [ref]

The telnet daemon, even with ssl support, should be uninstalled.

Rationale:

telnet, even with ssl support, should not be installed. When remote shell is required, up-to-date ssh daemon can be used.

Severity: 
high
Rule ID:xccdf_org.ssgproject.content_rule_package_telnetd-ssl_removed
Identifiers and References

Identifiers:  CCE-

References:  NT007(R02), AC-17(8), CM-7



Complexity:low
Disruption:low
Strategy:disable
# 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


Complexity:low
Disruption:low
Strategy:disable
- name: Ensure telnetd-ssl is removed
  package:
    name="{{item}}"
    state=absent
  with_items:
    - telnetd-ssl
  tags:
    - package_telnetd-ssl_removed
    - high_severity
    - disable_strategy
    - low_complexity
    - low_disruption
    - CCE-
    - NIST-800-53-AC-17(8)
    - NIST-800-53-CM-7


Complexity:low
Disruption:low
Strategy:disable
include remove_telnetd-ssl

class remove_telnetd-ssl {
  package { 'telnetd-ssl':
    ensure => 'purged',
  }
}

Rule   Uninstall the inet-based telnet server   [ref]

The inet-based telnet daemon should be uninstalled.

Rationale:

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.

Severity: 
high
Rule ID:xccdf_org.ssgproject.content_rule_package_inetutils-telnetd_removed
Identifiers and References

Identifiers:  CCE-

References:  NT007(R03), AC-17(8), CM-7



Complexity:low
Disruption:low
Strategy:disable
# 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


Complexity:low
Disruption:low
Strategy:disable
- name: Ensure inetutils-telnetd is removed
  package:
    name="{{item}}"
    state=absent
  with_items:
    - inetutils-telnetd
  tags:
    - package_inetutils-telnetd_removed
    - high_severity
    - disable_strategy
    - low_complexity
    - low_disruption
    - CCE-
    - NIST-800-53-AC-17(8)
    - NIST-800-53-CM-7


Complexity:low
Disruption:low
Strategy:disable
include remove_inetutils-telnetd

class remove_inetutils-telnetd {
  package { 'inetutils-telnetd':
    ensure => 'purged',
  }
}
Group   APT service configuration   Group contains 2 rules

[ref]   The apt service manage the package management and update of the whole system. Its configuration need to be properly defined to ensure efficient security updates, packages and repository authentication and proper lifecycle management.

Rule   Disable unauthenticated repositories in APT configuration   [ref]

Unauthenticated repositories should not be used for updates.

Rationale:

Repositories hosts all packages that will be intsalled on the system during update. If a repository is not authenticated, the associated packages can't be trusted, and then should not be installed localy.

Severity: 
unknown
Rule ID:xccdf_org.ssgproject.content_rule_apt_conf_disallow_unauthenticated
Identifiers and References

References:  NT28(R15)

Rule   Ensure that official distribution repositories are used   [ref]

Check that official Debian repositories, including security repository, are configured in apt.

Rationale:

The Debian distribution deliver DSA (Debian Security Announce), through the official Debian security repository, to correct various vulnerabilities impacting the Debian packages. Using the official repositories is the best way to ensure that the Debian updates are integrated soon enough.

Severity: 
unknown
Rule ID:xccdf_org.ssgproject.content_rule_apt_sources_list_official
Identifiers and References

References:  NT28(R15)

Group   System Settings   Group contains 6 groups and 10 rules

[ref]   Contains rules that check correct system settings.

Group   Configure Syslog   Group contains 1 group and 4 rules

[ref]   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 Debian Jessie, 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. Yet, it is also possible to install syslog-ng to manage local and server-side logging services. Both are tested here, to let the administrator choose.

Group   Configure <tt>rsyslogd</tt> to Accept Remote Messages If Acting as a Log Server   Group contains 2 rules

[ref]   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.

Rule   Enable syslog-ng Service   [ref]

The syslog-ng service (in replacement of rsyslog) provides syslog-style logging by default on Debian 8. The syslog-ng service can be enabled with the following command:

$ sudo chkconfig --level 2345 syslog-ng on

Rationale:

The syslog-ng service must be running in order to provide logging services, which are essential to system administration.

Severity: 
medium
Rule ID:xccdf_org.ssgproject.content_rule_service_syslogng_enabled
Identifiers and References

References:  NT28(R46), NT28(R5), 5.1.2, CCI-001311, CCI-001312, CCI-001557, CCI-001851, AU-4(1), AU-12

Rule   Ensure syslog-ng is Installed   [ref]

syslog-ng can be installed in replacement of rsyslog. The syslog-ng-core package can be installed with the following command:

# apt-get install syslog-ng-core

Rationale:

The syslog-ng-core package provides the syslog-ng daemon, which provides system logging services.

Severity: 
medium
Rule ID:xccdf_org.ssgproject.content_rule_package_syslogng_installed
Identifiers and References

References:  NT28(R46), NT28(R5), 5.1.1, CCI-001311, CCI-001312, AU-9(2)

Rule   Enable rsyslog Service   [ref]

The rsyslog service provides syslog-style logging by default on Debian 8. The rsyslog service can be enabled with the following command:

$ sudo chkconfig --level 2345 rsyslog on

Rationale:

The rsyslog service must be running in order to provide logging services, which are essential to system administration.

Severity: 
medium
Rule ID:xccdf_org.ssgproject.content_rule_service_rsyslog_enabled
Identifiers and References

References:  NT28(R46), NT28(R5), 5.1.2, CCI-001311, CCI-001312, CCI-001557, CCI-001851, AU-4(1), AU-12



Complexity:low
Disruption:low
Strategy:enable
- name: Enable service rsyslog
  service:
    name="{{item}}"
    enabled="yes"
    state="started"
  with_items:
    - rsyslog
  tags:
    - service_rsyslog_enabled
    - medium_severity
    - enable_strategy
    - low_complexity
    - low_disruption
    - NIST-800-53-AU-4(1)
    - NIST-800-53-AU-12

Rule   Ensure rsyslog is Installed   [ref]

Rsyslog is installed by default. The rsyslog package can be installed with the following command:

# apt-get install rsyslog

Rationale:

The rsyslog package provides the rsyslog daemon, which provides system logging services.

Severity: 
medium
Rule ID:xccdf_org.ssgproject.content_rule_package_rsyslog_installed
Identifiers and References

References:  NT28(R46), NT28(R5), 5.1.1, CCI-001311, CCI-001312, AU-9(2)



Complexity:low
Disruption:low
Strategy:enable
- name: Ensure rsyslog is installed
  package:
    name="{{item}}"
    state=present
  with_items:
    - rsyslog
  tags:
    - package_rsyslog_installed
    - medium_severity
    - enable_strategy
    - low_complexity
    - low_disruption
    - NIST-800-53-AU-9(2)


Complexity:low
Disruption:low
Strategy:enable
include install_rsyslog

class install_rsyslog {
  package { 'rsyslog':
    ensure => 'installed',
  }
}
Group   Access Control using sudo   Group contains 2 rules

[ref]   Sudo, which stands for "su 'do'", provides the ability to delegate authority to certain users, groups of users, or system administrators. When configured for system users and/or groups, Sudo can allow a user or group to execute privileged commands that normally only root is allowed to execute.

For more information on Sudo and addition Sudo configuration options, see https://www.sudo.ws

Rule   Ensure Users Re-Authenticate for Privilege Escalation - sudo !authenticate   [ref]

The sudo !authenticate option, when specified, allows a user to execute commands using sudo without having to authenticate. This should be disabled by making sure that the !authenticate option does not exist in /etc/sudoers configuration file or any sudo configuration snippets in /etc/sudoers.d/.

Rationale:

Without re-authentication, users may access resources or perform tasks for which they do not have authorization.

When operating systems provide the capability to escalate a functional capability, it is critical that the user re-authenticate.

Severity: 
medium
Rule ID:xccdf_org.ssgproject.content_rule_sudo_remove_no_authenticate
Identifiers and References

References:  NT28(R5), CCI-002038, IA-11, SRG-OS-000373-GPOS-00156, SRG-OS-000373-GPOS-00157, SRG-OS-000373-GPOS-00158

Rule   Ensure Users Re-Authenticate for Privilege Escalation - sudo NOPASSWD   [ref]

The sudo NOPASSWD tag, when specified, allows a user to execute commands using sudo without having to authenticate. This should be disabled by making sure that the NOPASSWD tag does not exist in /etc/sudoers configuration file or any sudo configuration snippets in /etc/sudoers.d/.

Rationale:

Without re-authentication, users may access resources or perform tasks for which they do not have authorization.

When operating systems provide the capability to escalate a functional capability, it is critical that the user re-authenticate.

Severity: 
medium
Rule ID:xccdf_org.ssgproject.content_rule_sudo_remove_nopasswd
Identifiers and References

References:  NT28(R5), CCI-002038, IA-11, SRG-OS-000373-GPOS-00156, SRG-OS-000373-GPOS-00157, SRG-OS-000373-GPOS-00158

Group   File Permissions and Masks   Group contains 2 groups and 4 rules

[ref]   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.

Group   Verify Permissions on Important Files and Directories   Group contains 1 group and 4 rules

[ref]   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.

Group   Verify Permissions on Files with Local Account Information and Credentials   Group contains 4 rules

Rule   Verify Permissions and ownership on group File   [ref]

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 

Rationale:

The /etc/shadow file contains information about the groups that are configured on the system. Protection of this file is critical for system security.

Severity: 
medium
Rule ID:xccdf_org.ssgproject.content_rule_file_permissions_etc_group
Identifiers and References

References:  AC-6



Complexity:low
Disruption:low
Strategy:configure
chmod 0644 /etc/group


Complexity:low
Disruption:low
Strategy:configure
- name: Ensure permission 0644 on /etc/group
  file:
    path="{{item}}"
    mode=0644
  with_items:
    - /etc/group
  tags:
    - file_permissions_etc_group
    - medium_severity
    - configure_strategy
    - low_complexity
    - low_disruption
    - NIST-800-53-AC-6

Rule   Verify Permissions and ownership on shadow File   [ref]

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 

Rationale:

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.

Severity: 
medium
Rule ID:xccdf_org.ssgproject.content_rule_file_permissions_etc_shadow
Identifiers and References

References:  NT28(R36), AC-6, Req-8.7.c



Complexity:low
Disruption:low
Strategy:configure
chmod 0640 /etc/shadow


Complexity:low
Disruption:low
Strategy:configure
- name: Ensure permission 0640 on /etc/shadow
  file:
    path="{{item}}"
    mode=0640
  with_items:
    - /etc/shadow
  tags:
    - file_permissions_etc_shadow
    - medium_severity
    - configure_strategy
    - low_complexity
    - low_disruption
    - NIST-800-53-AC-6
    - PCI-DSS-Req-8.7.c

Rule   Verify Permissions and ownership on gshadow File   [ref]

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 

Rationale:

The /etc/shadow file contains group password hashes. Protection of this file is critical for system security.

Severity: 
medium
Rule ID:xccdf_org.ssgproject.content_rule_file_permissions_etc_gshadow
Identifiers and References

References:  NT28(R36), AC-6



Complexity:low
Disruption:low
Strategy:configure
chmod 0640 /etc/gshadow


Complexity:low
Disruption:low
Strategy:configure
- name: Ensure permission 0640 on /etc/gshadow
  file:
    path="{{item}}"
    mode=0640
  with_items:
    - /etc/gshadow
  tags:
    - file_permissions_etc_gshadow
    - medium_severity
    - configure_strategy
    - low_complexity
    - low_disruption
    - NIST-800-53-AC-6

Rule   Verify Permissions and ownership on passwd File   [ref]

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 

Rationale:

The /etc/shadow file contains information about the users that are configured on the system. Protection of this file is critical for system security.

Severity: 
medium
Rule ID:xccdf_org.ssgproject.content_rule_file_permissions_etc_passwd
Identifiers and References

References:  AC-6



Complexity:low
Disruption:low
Strategy:configure
chmod 0644 /etc/passwd


Complexity:low
Disruption:low
Strategy:configure
- name: Ensure permission 0644 on /etc/passwd
  file:
    path="{{item}}"
    mode=0644
  with_items:
    - /etc/passwd
  tags:
    - file_permissions_etc_passwd
    - medium_severity
    - configure_strategy
    - low_complexity
    - low_disruption
    - NIST-800-53-AC-6
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.