此内容没有您所选择的语言版本。
Chapter 5. Using director to configure security hardening
This chapter describes how director can apply security hardening values as part of the deployment process.
When running openstack overcloud deploy
, remember that you will always need to include all necessary environment files needed to deploy the overcloud, in addition to any changes you want to make.
5.1. Use SSH banner text 复制链接链接已复制到粘贴板!
You can set a banner that displays a console message to all users that connect over SSH. You can add banner text to /etc/issue
using the following parameters in an environment file. Consider customizing this sample text to suit your requirements.
To apply this change to your deployment, save the settings as a file called ssh_banner.yaml
, and then pass it to the overcloud deploy
command as follows. The <full environment>
indicates that you must still include all of your original deployment parameters. For example:
openstack overcloud deploy --templates \ -e <full environment> -e ssh_banner.yaml
openstack overcloud deploy --templates \
-e <full environment> -e ssh_banner.yaml
5.2. Audit for system events 复制链接链接已复制到粘贴板!
Maintaining a record of all audit events helps you establish a system baseline, perform troubleshooting, or analyze the sequence of events that led to a certain outcome. The audit system is capable of logging many types of events, such as changes to the system time, changes to Mandatory/Discretionary Access Control, and creating/deleting users or groups.
Rules can be created using an environment file, which are then injected by director into /etc/audit/audit.rules
. For example:
5.3. Manage firewall rules 复制链接链接已复制到粘贴板!
Firewall rules are automatically applied on overcloud nodes during deployment, and are intended to only expose the ports required to get OpenStack working. You can specify additional firewall rules as needed. For example, to add rules for a Zabbix monitoring system:
You can also add rules that restrict access. The number used during rule definition will determine the rule’s precedence. For example, RabbitMQ’s rule number is 109
by default. If you want to restrain it, you switch it to use a lower value:
In this example, 098
and 099
are arbitrarily chosen numbers that are lower than RabbitMQ’s rule number 109
. To determine a rule’s number, you can inspect the iptables rule on the appropriate node; for RabbitMQ, you would check the controller:
iptables-save [...] -A INPUT -p tcp -m multiport --dports 4369,5672,25672 -m comment --comment "109 rabbitmq" -m state --state NEW -j ACCEPT
iptables-save
[...]
-A INPUT -p tcp -m multiport --dports 4369,5672,25672 -m comment --comment "109 rabbitmq" -m state --state NEW -j ACCEPT
Alternatively, you can extract the port requirements from the puppet definition. For example, RabbitMQ’s rules are stored in puppet/services/rabbitmq.yaml
:
The following parameters can be set for a rule:
-
port
: The port associated to the rule. Deprecated bypuppetlabs-firewall
. -
dport
: The destination port associated to the rule. -
sport
: The source port associated to the rule. -
proto
: The protocol associated to the rule. Defaults to tcp -
action
: The action policy associated to the rule. Defaults to accept -
jump
: The chain to jump to. -
state
: Array of states associated to the rule. Default to [NEW] -
source
: The source IP address associated to the rule. -
iniface
: The network interface associated to the rule. -
chain
: The chain associated to the rule. Default to INPUT -
destination
: The destination cidr associated to the rule. -
extras
: Hash of any additional parameters supported by thepuppetlabs-firewall
module.
5.4. Intrusion detection with AIDE 复制链接链接已复制到粘贴板!
AIDE (Advanced Intrusion Detection Environment) is a file and directory integrity checker. It is used to detect incidents of unauthorized file tampering or changes. For example, AIDE can alert you if system password files are changed.
AIDE works by analyzing system files and then compiling an integrity database of file hashes. The database then serves as a comparison point to verify the integrity of the files and directories and detect changes.
The director includes the AIDE service, allowing you to add entries into an AIDE configuration, which is then used by the AIDE service to create an integrity database. For example:
The above example is not actively maintained or benchmarked, so you should select the AIDE values that suit your requirements.
-
An alias named
TripleORules
is declared to avoid having to repeatedly out the same attributes each time. -
The alias receives the attributes of
p+sha256
. In AIDE terms, this reads as the following instruction: monitor all file permissionsp
with an integrity checksum ofsha256
.
For a complete list of attributes available for AIDE’s config files, see the AIDE MAN page at http://aide.sourceforge.net/stable/manual.html#config.
To apply this change to your deployment, save the settings as a file called aide.yaml
, and then pass it to the overcloud deploy
command as follows. The <full environment>
indicates that you must still include all of your original deployment parameters. For example:
openstack overcloud deploy --templates -e <full environment> /usr/share/openstack-tripleo-heat-templates/environments/aide.yaml
openstack overcloud deploy --templates -e <full environment> /usr/share/openstack-tripleo-heat-templates/environments/aide.yaml
5.4.1. Using complex AIDE rules 复制链接链接已复制到粘贴板!
Complex rules can be created using the format described previously. For example:
MyAlias = p+i+n+u+g+s+b+m+c+sha512
MyAlias = p+i+n+u+g+s+b+m+c+sha512
The above would translate as the following instruction: monitor permissions, inodes, number of links, user, group, size, block count, mtime, ctime, using sha256 for checksum generation.
Note, the alias should always have an order position of 1
, which means that it is positioned at the top of the AIDE rules and is applied recursively to all values below.
Following after the alias are the directories to monitor. Note that regular expressions can be used. For example we set monitoring for the var
directory, but overwrite with a not clause using !
with '!/var/log.*'
and '!/var/spool.*'
.
5.4.2. Additional AIDE values 复制链接链接已复制到粘贴板!
The following AIDE values are also available:
AideConfPath
: The full POSIX path to the aide configuration file, this defaults to /etc/aide.conf
. If no requirement is in place to change the file location, it is recommended to stick with the default path.
AideDBPath
: The full POSIX path to the AIDE integrity database. This value is configurable to allow operators to declare their own full path, as often AIDE database files are stored off node perhaps on a read only file mount.
AideDBTempPath
: The full POSIX path to the AIDE integrity temporary database. This temporary files is created when AIDE initializes a new database.
AideHour
: This value is to set the hour attribute as part of AIDE cron configuration.
AideMinute
: This value is to set the minute attribute as part of AIDE cron configuration.
AideCronUser
: This value is to set the linux user as part of AIDE cron configuration.
AideEmail
: This value sets the email address that receives AIDE reports each time a cron run is made.
AideMuaPath
: This value sets the path to the Mail User Agent that is used to send AIDE reports to the email address set within AideEmail
.
5.4.3. Cron configuration for AIDE 复制链接链接已复制到粘贴板!
The AIDE director service allows you to configure a cron job. By default, it will send reports to /var/log/audit/
; if you want to use email alerts, then enable the AideEmail
parameter to send the alerts to the configured email address. Note that a reliance on email for critical alerts can be vulnerable to system outages and unintentional message filtering.
5.4.4. Considering the effect of system upgrades 复制链接链接已复制到粘贴板!
When an upgrade is performed, the AIDE service will automatically regenerate a new integrity database to ensure all upgraded files are correctly recomputed to possess an updated checksum.
If openstack overcloud deploy
is called as a subsequent run to an initial deployment, and the AIDE configuration rules are changed, the director AIDE service will rebuild the database to ensure the new config attributes are encapsulated in the integrity database.
5.5. Review SecureTTY 复制链接链接已复制到粘贴板!
SecureTTY allows you to disable root access for any console device (tty). This behavior is managed by entries in the /etc/securetty
file. For example:
5.6. CADF auditing for Identity Service 复制链接链接已复制到粘贴板!
A thorough auditing process can help you review the ongoing security posture of your OpenStack deployment. This is especially important for keystone, due to its role in the security model.
Red Hat OpenStack Platform has adopted Cloud Auditing Data Federation (CADF) as the data format for audit events, with the keystone service generating CADF events for Identity and Token operations. You can enable CADF auditing for keystone using KeystoneNotificationFormat
:
parameter_defaults: KeystoneNotificationFormat: cadf
parameter_defaults:
KeystoneNotificationFormat: cadf
5.7. Review the login.defs values 复制链接链接已复制到粘贴板!
To enforce password requirements for new system users (non-keystone), director can add entries to /etc/login.defs
by following these example parameters: