Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
name: 00-compliance-sshd-hardening-master
labels:
machineconfiguration.openshift.io/role: master
spec:
config:
ignition:
version: 3.5.0
storage:
files:
- path: /etc/ssh/sshd_config
mode: 0600
overwrite: true
contents:
source: "data:,%23%09%24OpenBSD%3A%20sshd_config%2Cv%201.104%202021%2F07%2F02%2005%3A11%3A21%20dtucker%20Exp%20%24%0A%0A%23%20This%20is%20the%20sshd%20server%20system-wide%20configuration%20file.%20%20See%0A%23%20sshd_config%285%29%20for%20more%20information.%0A%0A%23%20This%20sshd%20was%20compiled%20with%20PATH%3D%2Fusr%2Flocal%2Fbin%3A%2Fusr%2Fbin%3A%2Fusr%2Flocal%2Fsbin%3A%2Fusr%2Fsbin%0A%0A%23%20The%20strategy%20used%20for%20options%20in%20the%20default%20sshd_config%20shipped%20with%0A%23%20OpenSSH%20is%20to%20specify%20options%20with%20their%20default%20value%20where%0A%23%20possible%2C%20but%20leave%20them%20commented.%20%20Uncommented%20options%20override%20the%0A%23%20default%20value.%0A%0A%23%20Compliance%20hardening%20%28before%20Include%20for%20first-match-wins%20precedence%29%0AStrictModes%20yes%0ALogLevel%20INFO%0APermitRootLogin%20no%0AIgnoreRhosts%20yes%0AIgnoreUserKnownHosts%20yes%0APermitEmptyPasswords%20no%0APermitUserEnvironment%20no%0AGSSAPIAuthentication%20no%0APrintLastLog%20yes%0A%0A%23%20To%20modify%20the%20system-wide%20sshd%20configuration%2C%20create%20a%20%20%2A.conf%20%20file%20under%0A%23%20%20%2Fetc%2Fssh%2Fsshd_config.d%2F%20%20which%20will%20be%20automatically%20included%20below%0AInclude%20%2Fetc%2Fssh%2Fsshd_config.d%2F%2A.conf%0A%0A%23%20If%20you%20want%20to%20change%20the%20port%20on%20a%20SELinux%20system%2C%20you%20have%20to%20tell%0A%23%20SELinux%20about%20this%20change.%0A%23%20semanage%20port%20-a%20-t%20ssh_port_t%20-p%20tcp%20%23PORTNUMBER%0A%23%0A%23Port%2022%0A%23AddressFamily%20any%0A%23ListenAddress%200.0.0.0%0A%23ListenAddress%20%3A%3A%0A%0A%23HostKey%20%2Fetc%2Fssh%2Fssh_host_rsa_key%0A%23HostKey%20%2Fetc%2Fssh%2Fssh_host_ecdsa_key%0A%23HostKey%20%2Fetc%2Fssh%2Fssh_host_ed25519_key%0A%0A%23%20Ciphers%20and%20keying%0A%23RekeyLimit%20default%20none%0A%0A%23%20Logging%0A%23SyslogFacility%20AUTH%0A%0A%23%20Authentication%3A%0A%0A%23LoginGraceTime%202m%0A%23MaxAuthTries%206%0A%23MaxSessions%2010%0A%0A%23PubkeyAuthentication%20yes%0A%0A%23%20The%20default%20is%20to%20check%20both%20.ssh%2Fauthorized_keys%20and%20.ssh%2Fauthorized_keys2%0A%23%20but%20this%20is%20overridden%20so%20installations%20will%20only%20check%20.ssh%2Fauthorized_keys%0AAuthorizedKeysFile%09.ssh%2Fauthorized_keys%0A%0A%23AuthorizedPrincipalsFile%20none%0A%0A%23AuthorizedKeysCommand%20none%0A%23AuthorizedKeysCommandUser%20nobody%0A%0A%23%20For%20this%20to%20work%20you%20will%20also%20need%20host%20keys%20in%20%2Fetc%2Fssh%2Fssh_known_hosts%0A%23HostbasedAuthentication%20no%0A%23%20Change%20to%20yes%20if%20you%20don%27t%20trust%20~%2F.ssh%2Fknown_hosts%20for%0A%23%20HostbasedAuthentication%0A%0A%23%20To%20disable%20tunneled%20clear%20text%20passwords%2C%20change%20to%20no%20here%21%0A%23PasswordAuthentication%20yes%0A%0A%23%20Change%20to%20no%20to%20disable%20s%2Fkey%20passwords%0A%23KbdInteractiveAuthentication%20yes%0A%0A%23%20Kerberos%20options%0A%23KerberosAuthentication%20no%0A%23KerberosOrLocalPasswd%20yes%0A%23KerberosTicketCleanup%20yes%0A%23KerberosGetAFSToken%20no%0A%23KerberosUseKuserok%20yes%0A%0A%23%20GSSAPI%20options%0A%23GSSAPICleanupCredentials%20yes%0A%23GSSAPIStrictAcceptorCheck%20yes%0A%23GSSAPIKeyExchange%20no%0A%23GSSAPIEnablek5users%20no%0A%0A%23%20Set%20this%20to%20%27yes%27%20to%20enable%20PAM%20authentication%2C%20account%20processing%2C%0A%23%20and%20session%20processing.%20If%20this%20is%20enabled%2C%20PAM%20authentication%20will%0A%23%20be%20allowed%20through%20the%20KbdInteractiveAuthentication%20and%0A%23%20PasswordAuthentication.%20%20Depending%20on%20your%20PAM%20configuration%2C%0A%23%20PAM%20authentication%20via%20KbdInteractiveAuthentication%20may%20bypass%0A%23%20the%20setting%20of%20%22PermitRootLogin%20prohibit-password%22.%0A%23%20If%20you%20just%20want%20the%20PAM%20account%20and%20session%20checks%20to%20run%20without%0A%23%20PAM%20authentication%2C%20then%20enable%20this%20but%20set%20PasswordAuthentication%0A%23%20and%20KbdInteractiveAuthentication%20to%20%27no%27.%0A%23%20WARNING%3A%20%27UsePAM%20no%27%20is%20not%20supported%20in%20this%20build%20and%20may%20cause%20several%0A%23%20problems.%0A%23UsePAM%20no%0A%0A%23AllowAgentForwarding%20yes%0A%23AllowTcpForwarding%20yes%0A%23GatewayPorts%20no%0A%23X11Forwarding%20no%0A%23X11DisplayOffset%2010%0A%23X11UseLocalhost%20yes%0A%23PermitTTY%20yes%0A%23PrintMotd%20yes%0A%23TCPKeepAlive%20yes%0A%23Compression%20delayed%0A%23ClientAliveInterval%200%0A%23ClientAliveCountMax%203%0A%23UseDNS%20no%0A%23PidFile%20%2Fvar%2Frun%2Fsshd.pid%0A%23MaxStartups%2010%3A30%3A100%0A%23PermitTunnel%20no%0A%23ChrootDirectory%20none%0A%23VersionAddendum%20none%0A%0A%23%20no%20default%20banner%20path%0A%23Banner%20none%0A%0A%23%20override%20default%20of%20no%20subsystems%0ASubsystem%09sftp%09%2Fusr%2Flibexec%2Fopenssh%2Fsftp-server%0A%0A%23%20Example%20of%20overriding%20settings%20on%20a%20per-user%20basis%0A%23Match%20User%20anoncvs%0A%23%09X11Forwarding%20no%0A%23%09AllowTcpForwarding%20no%0A%23%09PermitTTY%20no%0A%23%09ForceCommand%20cvs%20server%0A"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
name: 00-compliance-sshd-hardening-worker
labels:
machineconfiguration.openshift.io/role: worker
spec:
config:
ignition:
version: 3.5.0
storage:
files:
- path: /etc/ssh/sshd_config
mode: 0600
overwrite: true
contents:
source: "data:,%23%09%24OpenBSD%3A%20sshd_config%2Cv%201.104%202021%2F07%2F02%2005%3A11%3A21%20dtucker%20Exp%20%24%0A%0A%23%20This%20is%20the%20sshd%20server%20system-wide%20configuration%20file.%20%20See%0A%23%20sshd_config%285%29%20for%20more%20information.%0A%0A%23%20This%20sshd%20was%20compiled%20with%20PATH%3D%2Fusr%2Flocal%2Fbin%3A%2Fusr%2Fbin%3A%2Fusr%2Flocal%2Fsbin%3A%2Fusr%2Fsbin%0A%0A%23%20The%20strategy%20used%20for%20options%20in%20the%20default%20sshd_config%20shipped%20with%0A%23%20OpenSSH%20is%20to%20specify%20options%20with%20their%20default%20value%20where%0A%23%20possible%2C%20but%20leave%20them%20commented.%20%20Uncommented%20options%20override%20the%0A%23%20default%20value.%0A%0A%23%20Compliance%20hardening%20%28before%20Include%20for%20first-match-wins%20precedence%29%0AStrictModes%20yes%0ALogLevel%20INFO%0APermitRootLogin%20no%0AIgnoreRhosts%20yes%0AIgnoreUserKnownHosts%20yes%0APermitEmptyPasswords%20no%0APermitUserEnvironment%20no%0AGSSAPIAuthentication%20no%0APrintLastLog%20yes%0A%0A%23%20To%20modify%20the%20system-wide%20sshd%20configuration%2C%20create%20a%20%20%2A.conf%20%20file%20under%0A%23%20%20%2Fetc%2Fssh%2Fsshd_config.d%2F%20%20which%20will%20be%20automatically%20included%20below%0AInclude%20%2Fetc%2Fssh%2Fsshd_config.d%2F%2A.conf%0A%0A%23%20If%20you%20want%20to%20change%20the%20port%20on%20a%20SELinux%20system%2C%20you%20have%20to%20tell%0A%23%20SELinux%20about%20this%20change.%0A%23%20semanage%20port%20-a%20-t%20ssh_port_t%20-p%20tcp%20%23PORTNUMBER%0A%23%0A%23Port%2022%0A%23AddressFamily%20any%0A%23ListenAddress%200.0.0.0%0A%23ListenAddress%20%3A%3A%0A%0A%23HostKey%20%2Fetc%2Fssh%2Fssh_host_rsa_key%0A%23HostKey%20%2Fetc%2Fssh%2Fssh_host_ecdsa_key%0A%23HostKey%20%2Fetc%2Fssh%2Fssh_host_ed25519_key%0A%0A%23%20Ciphers%20and%20keying%0A%23RekeyLimit%20default%20none%0A%0A%23%20Logging%0A%23SyslogFacility%20AUTH%0A%0A%23%20Authentication%3A%0A%0A%23LoginGraceTime%202m%0A%23MaxAuthTries%206%0A%23MaxSessions%2010%0A%0A%23PubkeyAuthentication%20yes%0A%0A%23%20The%20default%20is%20to%20check%20both%20.ssh%2Fauthorized_keys%20and%20.ssh%2Fauthorized_keys2%0A%23%20but%20this%20is%20overridden%20so%20installations%20will%20only%20check%20.ssh%2Fauthorized_keys%0AAuthorizedKeysFile%09.ssh%2Fauthorized_keys%0A%0A%23AuthorizedPrincipalsFile%20none%0A%0A%23AuthorizedKeysCommand%20none%0A%23AuthorizedKeysCommandUser%20nobody%0A%0A%23%20For%20this%20to%20work%20you%20will%20also%20need%20host%20keys%20in%20%2Fetc%2Fssh%2Fssh_known_hosts%0A%23HostbasedAuthentication%20no%0A%23%20Change%20to%20yes%20if%20you%20don%27t%20trust%20~%2F.ssh%2Fknown_hosts%20for%0A%23%20HostbasedAuthentication%0A%0A%23%20To%20disable%20tunneled%20clear%20text%20passwords%2C%20change%20to%20no%20here%21%0A%23PasswordAuthentication%20yes%0A%0A%23%20Change%20to%20no%20to%20disable%20s%2Fkey%20passwords%0A%23KbdInteractiveAuthentication%20yes%0A%0A%23%20Kerberos%20options%0A%23KerberosAuthentication%20no%0A%23KerberosOrLocalPasswd%20yes%0A%23KerberosTicketCleanup%20yes%0A%23KerberosGetAFSToken%20no%0A%23KerberosUseKuserok%20yes%0A%0A%23%20GSSAPI%20options%0A%23GSSAPICleanupCredentials%20yes%0A%23GSSAPIStrictAcceptorCheck%20yes%0A%23GSSAPIKeyExchange%20no%0A%23GSSAPIEnablek5users%20no%0A%0A%23%20Set%20this%20to%20%27yes%27%20to%20enable%20PAM%20authentication%2C%20account%20processing%2C%0A%23%20and%20session%20processing.%20If%20this%20is%20enabled%2C%20PAM%20authentication%20will%0A%23%20be%20allowed%20through%20the%20KbdInteractiveAuthentication%20and%0A%23%20PasswordAuthentication.%20%20Depending%20on%20your%20PAM%20configuration%2C%0A%23%20PAM%20authentication%20via%20KbdInteractiveAuthentication%20may%20bypass%0A%23%20the%20setting%20of%20%22PermitRootLogin%20prohibit-password%22.%0A%23%20If%20you%20just%20want%20the%20PAM%20account%20and%20session%20checks%20to%20run%20without%0A%23%20PAM%20authentication%2C%20then%20enable%20this%20but%20set%20PasswordAuthentication%0A%23%20and%20KbdInteractiveAuthentication%20to%20%27no%27.%0A%23%20WARNING%3A%20%27UsePAM%20no%27%20is%20not%20supported%20in%20this%20build%20and%20may%20cause%20several%0A%23%20problems.%0A%23UsePAM%20no%0A%0A%23AllowAgentForwarding%20yes%0A%23AllowTcpForwarding%20yes%0A%23GatewayPorts%20no%0A%23X11Forwarding%20no%0A%23X11DisplayOffset%2010%0A%23X11UseLocalhost%20yes%0A%23PermitTTY%20yes%0A%23PrintMotd%20yes%0A%23TCPKeepAlive%20yes%0A%23Compression%20delayed%0A%23ClientAliveInterval%200%0A%23ClientAliveCountMax%203%0A%23UseDNS%20no%0A%23PidFile%20%2Fvar%2Frun%2Fsshd.pid%0A%23MaxStartups%2010%3A30%3A100%0A%23PermitTunnel%20no%0A%23ChrootDirectory%20none%0A%23VersionAddendum%20none%0A%0A%23%20no%20default%20banner%20path%0A%23Banner%20none%0A%0A%23%20override%20default%20of%20no%20subsystems%0ASubsystem%09sftp%09%2Fusr%2Flibexec%2Fopenssh%2Fsftp-server%0A%0A%23%20Example%20of%20overriding%20settings%20on%20a%20per-user%20basis%0A%23Match%20User%20anoncvs%0A%23%09X11Forwarding%20no%0A%23%09AllowTcpForwarding%20no%0A%23%09PermitTTY%20no%0A%23%09ForceCommand%20cvs%20server%0A"