Test: exec-shield

Description

Exec-shield and virtual address randomization checking.

What is checked?

Test: firewall

Description

Simple analysis of firewall policy rules.

What is checked?

(all of the steps bellow are the same for IPv4 and IPv6)

.dsc file variables

ENABLE_IPV4=<bool> [Default value: 1]
Enable/Disable all IPv4 related tests.

ENABLE_IPV4_FWCHECK=<bool> [Default value: 1]
Enable/Disable IPv4 firewall rules analysis.

SCAN_TCP4=<bool> [Default value: 0]
Enable/Disable TCP scanning over IPv4. (Implemented, but disabled)

SCAN_UDP4=<bool> [Default value: 0]
Enable/Disable UDP scanning over IPv4. (Implemented, but disabled)

ENABLE_IPV6=<bool> [Default value: 1]
Enable/Disable all IPv6 related tests.

ENABLE_IPV6_FWCHECK=<bool> [Default value: 0]
Enable/Disable IPv6 firewall rules analysis.

SCAN_TCP6=<bool> [Default value: 0]
Enable/Disable TCP scanning over IPv4. (Not implemented)

SCAN_UDP6=<bool> [Default value: 0]
Enable/Disable TCP scanning over IPv4. (Not implemented)

DEV_BLACKLIST="<string - devname> [<string - devname]" [Default value: "virbr[0-9]* lo"]
Ignore listed devices in tests.

PARANOID=<bool> [Default value: 0]
This is only a helper variable that is set to 1 in level 5 and will be probably deleted.

Test: integrity

Description

System integrity test. Checks presence and integrity of system commands and directories. For checking the integrity of binaries the command rpmverify (rpm -Vf) is used. A search for duplicates is also done for each command.

What is checked?

.dsc file variables

CMDPATH="<string - directory>[:<string - directory> …]" [Default value: "/bin:/sbin:/root/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"]
Directories containing command executables.

RPMVERIFY="<string - filepath>" [Default value: "/usr/bin/rpmverify"]
Absolute path to the rpmverify command executable.

COREPKG="<string - name>" [Default value: "coreutils"]
Name of package containing the core commands that should be checked.

DIRECTORY_LIST="<string - directory>[\n<string - directory> …]" [Default value: "/bin\n/sbin\n/lib\n/usr/bin\n/usr/sbin\n/usr/lib\n/usr/libexec\n/tmp\n/proc\n/var"] [1]
List of directories that must exist.

Note
  1. [1] \n means that items in this list are delimited using newline character:

DIRECTORY_LIST="/bin
                /sbin
                ..."

Test: openssh

Description

OpenSSH configuration audit. Performs basic checks on default configuration files, keys and on configuration files and keys used by running openssh processes.

What is checked?

Note
  1. [1] Files in default locations and also currently used files (for example configuration file specified with the -f option) are checked.

  2. [2] If enabled and if it is not the first run.

.dsc file variables

SSHD_USER ="<string - user>" [Default value:"sshd"]
Owner of the running sshd process.

SSHD_GROUP ="<string - group>" [Default value: "sshd"]
Group of the running sshd process.

SSHD_CONFIG_PERM =<number in octal base> [Default value: 755]
Correct file permissions of sshd_config file.

SSHD_CONFIG_OWNER ="<string - user>:<string - group>" [Default value: "root:root"]
Correct owner and group of sshd_config file.

SSHD_CONFIGDIR_PERM =<number in octal base> [Default value: 755]
Correct file permissions of sshd configuration directory.

SSHD_CONFIGDIR_OWNER ="<string - user>:<string - group> [Default value: "root:root"]
Correct owner of sshd configuration directory.

SSHD_PRIVKEY_PERM =<number in octal base> [Default value: 600]
Correct permissions of sshd private key file(s).

SSHD_PRIVKEY_OWNER ="<string - user:<string - group> [Default value: "root:root"]
Correct owner of sshd private key files(s).

SSHD_PUBKEY_PERM =<number in octal base> [Default value: 644]
Correct permissions of sshd public key files(s).

SSHD_PUBKEY_OWNER ="<string - user>:<string - group> [Default value: "root:root"]
Correct owner of sshd public key files(s).

SSH_KNOWN_HOSTS_REQUIRE =<bool> [Default value: 0]
This variable controls if the presence of known_hosts file is required or not.

SSH_KNOWN_HOSTS_PERM =<number in octal base> [Default value: 644]
Correct permissions of known_hosts file.

SSH_KNOWN_HOSTS_OWNER ="<string - user>:<string - group> [Default value: "root:root"]
Correct owner of known_hosts file.

SSHD_PRIVSEP_DIR_REQUIRE =<bool> [Default value: 1]
This variable controls if the presence of the directory used in privilege separation phase is required or not. If yes and the directory does not exist, then a warning is displayed.

SSHD_PRIVSEP_DIR_PERM =<number in octal base> [Default value: 711, L5 value: 700]
Correct permissions of the privsep directory.

SSHD_PRIVSEP_DIR_OWNER ="<string - user>:<string - group> [Default value: "root:root"]
Correct owner of the directory.

SSHD_PRIVSEP_DIR ="<string - directory>" [Default value: "/var/empty/sshd"]
Location of the directory used in privilege separation phase.

SSHD_PRIVSEP_DIR_EMPTY =<bool> [Default value: 0]
If set to 1, then the privsep directory must be empty. Otherwise a warning will be displayed.

SSHD_CHECK_SHA256 =<bool> [Default value: 1]
This variable controls if the checksums of sshd related files will be checked.

SSH_CHECK_SHA256 =<bool> [Default value: 1]
This variable controls if the checksums of ssh related files will be checked.

SSHD_SHA256_LIST ="<string - filename>" [Default value: "sshd.sum"]
Name of the checksum file. This file is stored in the persistent data directory.

SSHD_SAVE_SHA256_CHANGES =<bool> [Default value: 1]
This variable controls if changes in checksums will be saved to the checksum file.

SSHD_DEFAULT_KEYS ="<string - keypath> [<string - keypath #2> …]" [Default value: "/etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_key /etc/ssh/ssh_host_rsa_key"]
Default locations of sshd keyfiles.

PARANOID =<bool> [Default value: 0, L5 value: 1]
This is only a helper variable that is set to 1 in level 5 and will be probably deleted.

default configuration database

A simple default configuration database is implemented in this test for better portability to other systems with different default values of OpenSSH configuration directives. The syntax is quite simple:

  1. A prefix must be defined. In this test, SSHD is hardcoded for the sshd daemon configuration.

  2. All directives that will have their default values listed in .dsc fuke must be added to the variable $PREFIX_defined_vars.

    For example:

    SSHD_default_vars="PermitRootLogin StrictModes"
  3. Then the default values for each listed directive must be defined. This definition includes version of sshd that it applies to. The version string must contain only characters that can be part of .dsc variable name.

    For example:

    Version = 4.7p1 -> Version string = 47p1

    The definition name is in the format $PREFIX_$VersionString_$ConfDirectiveName.
    For example:

    SSHD_47p1_PermitRootLogin="yes"

    And for all 4.x versions it would be:

    SSHD_4_PermitRootLogin="yes"

    This is also correct and applies to any version:

    SSHD__PermitRootLogin="yes"
Example: .dsc file
SSHD_defined_vars="PermitRootLogin StrictModes
                   ChallengeResponseAuthentication
                   UsePAM AllowTcpForwarding"

# 4.7p1 defaults on F9
SSHD_47p1_PermitRootLogin="yes"
SSHD_47p1_StrictModes="yes"
SSHD_47p1_ChallengeResponseAuthentication="no"
SSHD_47p1_UsePAM="no"
SSHD_47p1_AllowTcpForwarding="yes"

Test: selinux

Description

Simple test that checks if the mandatory access control architecture is enabled.

What is checked?

.dsc file variables

MODE =["Enforcing" | "Permissive"]
What selinux mode is expected by the test.

MESSAGE_TYPE =["WARNING" | "ERROR"]
What kind of message is issued.

Test: mountopt

Description

Checks for potentially insecure mount options in /etc/fstab like not having nosuid on removable devices etc.

What is checked?

The test checks removable and remote filesystems for the nodev, noexec and nosuid options. Checks local filesystems for the nodev option. Mountpoints can be blacklisted and this omitted from testing.

.dsc file variables

DEFAULTS =<list of options>
The list of options that the defaults keyword expands into. (rw suid dev exec auto nouser async by default)

FILES =<list of files>
Files to be checked. /etc/fstab by default, make it /proc/mounts if you want mounted FSs to be checked.

LOCAL_TYPES =<list of filesystem types>
Filesystem types recognized as local (ext2 ext3 by default)

REMOVABLE_TYPES =<list of filesystem types>
Filesystem types recognized as removable (floppy cdrom iso9660 vfat msdos by default)

REMOTE_TYPES =<list of filesystem types>
Filesystem types recognized as removable (nfs nfs4 smbfs cifs ncpfs by default)

BLACKLIST =<list of directories>
Mountpoints to be skipped when checking (/boot by default)

Test: suid

Description

Looks for suid binaries in the system and compares against last run. Up to level 3, it checks only binaries in $PATH, from level 3 onwards, also checks if a file belongs to a package and from level 4 onwards walks through entire / filesystem and scans for setuid files.

What is checked?

A list of suid files in locations based on .dsc file is gathered and compared against a previous run, differences are printed. The test can also report suid files not belonging to a package or check arbitrary directories.

.dsc file variables

CHECK_PATH =["1" | "0"]
If the test should check directories in the $PATH variable. This is on by default.

CHECK_FILE_PACKAGE =["1" | "0"]
Whether to check if a setuid file belongs to a package, is 1 from level 3 up

PACKAGE_CMD =<a command> (rpm -qf in rpm-based distributions)
The command used to get the package a file belongs to

CHECK_DIR =<list of directories>
A directory or a list of directories to check in addition. Set to /opt and /usr/local from level 4 up.

Test: vsftpd

Description

Vsftpd configuration audit. Performs basic checks on default configuration file of vsftpd.

What is checked?

Note
  1. By enabling ascii upload or download on some FTP servers, ASCII support allows a denial of service attack (DoS) via the command "SIZE /big/file" in ASCII mode. ASCII mangling is a horrible feature of the protocol. For disabling use ascii_upload_enable=NO and ascii_download_enable=NO

.dsc file variables

PASSWD_FILE =<string - path> [Default value:"/etc/passwd"]
Path to system passwd file

CONFIG_FILE =<string - path> [Default value:"/etc/vsftpd/vsftpd.conf"]
Path to vsftpd configuration file