5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 - name: Ssh protocol setting
19 regexp: '[\s]*Protocol'
20 values: "Protocol 2\n"
22 - name: Disable ssh root login
24 regexp: '[\s]*PermitRootLogin [y|n]'
25 values: "PermitRootLogin no\n"
27 - name: Listening address setting
29 regexp: '[\s]*ListenAddress'
30 values: "ListenAddress 0.0.0.0\n"
32 - name: Disable the hostbasedauthentication
34 regexp: '[\s]*HostbasedAuthentication [y|n]'
35 values: "HostbasedAuthentication no\n"
37 - name: Disable the passwordauthentication
39 regexp: '[\s]*PasswordAuthentication [y|n]'
40 values: "PasswordAuthentication yes\n"
42 - name: Disable the empty password
44 regexp: '[\s]*PermitEmptyPasswords [y|n]'
45 values: "PermitEmptyPasswords no\n"
47 - name: Ciphers setting
49 regexp: '[\s]*Ciphers'
50 values: "Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com\n"
55 values: "MACs hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com\n"
57 - name: Login Gracetime setting
59 regexp: '[\s]*LoginGraceTime'
60 values: "LoginGraceTime 60\n"
62 - name: User Alive Interval setting
64 regexp: '[\s]*ClientAliveInterval'
65 values: "ClientAliveInterval 900\n"
67 - name: Disable the X11forwarding
69 regexp: '[\s]*X11Forwarding [y|n]'
70 values: "X11Forwarding no\n"
72 - name: Disable SSH agent forwarding
74 regexp: '[\s]*AllowAgentForwarding [y|n]'
75 values: "AllowAgentForwarding no\n"
77 - name: Disable TCP forwarding
79 regexp: '[\s]*AllowTcpForwarding [y|n]'
80 values: "AllowTcpForwarding no\n"
82 - name: Activate the strict mode
84 regexp: '[\s]*StrictModes [y|n]'
85 values: "StrictModes yes\n"
92 - name: HostKeyAlgorithms setting
94 regexp: '[\s]*HostKeyAlgorithms'
95 values: "HostKeyAlgorithms ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-rsa-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-ed25519\n"
97 - name: PubkeyAcceptedKeyTypes setting
99 regexp: '[\s]*PubkeyAcceptedKeyTypes'
100 values: "PubkeyAcceptedKeyTypes ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-rsa-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-ed25519\n"
102 - name: KexAlgorithms
104 regexp: '[\s]*KexAlgorithms'
105 values: "KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256\n"
107 - name: MaxAuthTries setting
109 regexp: '[\s]*MaxAuthTries'
110 values: "MaxAuthTries 6\n"
112 - name: Banner creation
114 regexp: '[\s]*Banner'
115 values: "Banner /etc/banner\n"
117 - name: "Enable the Ipv6"
119 path: /etc/ssh/sshd_config
120 insertafter: '^[\s]*ListenAddress 0.0.0.0'
121 line: 'ListenAddress ::'
123 - name: "Disable Kerberos Authentication"
125 regexp: '[\s]*KerberosAuthentication'
126 values: "KerberosAuthentication no\n"
128 - name: "Enable Use of Privilege Separation"
130 regexp: '[\s]*UsePrivilegeSeparation'
131 values: "UsePrivilegeSeparation sandbox\n"
133 - name: "Disable Compression"
135 regexp: '[\s]*Compression'
136 values: "Compression no\n"
138 - name: "Set SSH Client Alive Count"
140 regexp: '[\s]*ClientAliveCountMax'
141 values: "ClientAliveCountMax 0\n"
143 - name: "Disable SSH Support for User Known Hosts"
145 regexp: '[\s]*IgnoreUserKnownHosts'
146 values: "IgnoreUserKnownHosts yes\n"
148 - name: "Do Not Allow SSH Environment Options"
150 regexp: '[\s]*PermitUserEnvironment'
151 values: "PermitUserEnvironment no\n"
157 - name : create a banner file
163 line: "This is a PRIVATE computer system. All unauthorized use or unauthorized access is prohibited according to local laws and may lead to prosecution. Your operations are logged."
165 - name: "Set the maximum number of days a ssh password may be used."
167 path: /etc/login.defs
168 regexp: '^PASS_MAX_DAYS[\s]*[0-9]*$'
169 line: 'PASS_MAX_DAYS 90'
171 - name: "Set the number of days warning given before a password expires."
173 path: /etc/login.defs
174 regexp: '^PASS_WARN_AGE[\s]*[0-9]*$'
175 line: 'PASS_WARN_AGE 5'
177 - name: "Set the unique last password count."
179 path: /etc/pam.d/system-auth-ac
180 regexp: '^password[\s]*sufficient.*pam_unix.so(.*)$'
181 line: 'password sufficient pam_unix.so\1 remember=12'