added common settings

This commit is contained in:
=
2020-12-22 11:46:20 +01:00
parent 864c02a77b
commit caf47ab94f
8 changed files with 361 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
nod-01,nod-01.rre.nu,10.2.0.10 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDJkbc0Q+v6EFuh8+pkmsMOPHXq0kioK2DTsQxKsa0yRbcS9yM1ONOAJGz6MZP+CpgrEHRm2Ntje/S48sIhgh2Q=
crs,crs.rre.nu,10.0.10.1 ssh-rsa AAAAB3NzaC1yc2EAAAABAwAAAQEAsQC+cXG2Npcpy7a5x2HW02IBY+NsMiHIefFiZzlvZqF91ru3NItgUngNc1QbvpTO26/PhufyGIOkMZ9GM7iPFLnpqLmrAfBT89eqzf7u0qXDJ33HgLNhsiXHmlmzdNaG/Ln6m2ffhu/kVz7OizATSRXaB/pjRejKz05Afss6VZghwwY4Ko6hj8rP1sEulT59WAf2rPP8GC//RDPNn0slX7GgKce/2Jn5Oe/TqPE/ZTsgYsEJirHr74g7kz+n+k5S3LAELHbdEyQlaAy03M/kI6dHQKaBPlGzDI/hrAfxARTLtMxMz+M+bkHwmV+yCvcoiNkO90jYvvinJprjar799Q==
nod-02,nod-02.rre.nu,10.2.0.11 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBH/cq0oFp9P/ehoQOwqoa3HGQ3QzHqvdXxDgAb2koJN2rg1Pn62tizpcZ4KKcmNFnCh6REQwG1Vy3sR16FPaWdQ=
rpi-01,rpi-01.rre.nu,10.0.10.10 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDGd59VmLjLDjdHfqWRz6WlZUY6/hDpR3wg/XUHS5tMki889Y3mbhRUfQBJ/eiP529FobfF5y9mxWW9z0d/SB3A=
heater,heater.rre.nu,10.0.10.11 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBL/jE4506u3kOjBCLOFta1IqQ+T+U1/4oahZJDJ8Ry5o73+gJtSzGrcRjb3tHGl7y+p1zRJ7bboO9sAkS5J5sC8=
salt,salt.rre.nu ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG8KYDPqRNrVhNi3ImirMoBTdULED82TxdvxmZg1aBge
[pepper.rre.nu]:2222,[10.2.0.102]:2222 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEjbpZ74cN+hK1Q1N2ke5h5GP7nuKqNn2ddVzsoLXqcaGJpaSaUavCNTsc9NGbapHw8mx0fuzxosCF71/jAnoYU=

149
ssh/files/sshd_config.jinja Normal file
View File

@@ -0,0 +1,149 @@
# Managed by salt
# $OpenBSD: sshd_config,v 1.98 2016/02/17 05:29:04 djm Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
Port {{ salt['pillar.get']('ssh:sshd:port', 22) }}
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
# The default requires explicit activation of protocol 1
#Protocol 2
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
# Minimum accepted size of the DH parameter p. By default this is set to 1024
# to maintain compatibility with RFC4419, but should be set higher.
# Upstream default is identical to setting this to 2048.
#KexDHMin 1024
# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024
# Ciphers and keying
#RekeyLimit default none
# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
#PermitRootLogin yes
PermitRootLogin without-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
#RSAAuthentication yes
#PubkeyAuthentication yes
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys
#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no
# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation sandbox
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none
# no default banner path
#Banner none
# override default of no subsystems
Subsystem sftp /usr/lib/ssh/sftp-server
# This enables accepting locale enviroment variables LC_* LANG, see sshd_config(5).
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server

45
ssh/init.sls Normal file
View File

@@ -0,0 +1,45 @@
# Pillar data:
#
# ssh:
# sshd:
# port: <port number>
install OpenSSH:
pkg.installed:
{% if grains['os_family'] == 'Suse' %}
- name: openssh
{% elif grains['os_family'] == 'Debian' %}
- name: ssh
{% endif %}
- refresh: False
/etc/ssh/ssh_known_hosts:
file.managed:
- source: salt://ssh/files/ssh_known_hosts
- user: root
- group: root
- mode: 0644
/etc/ssh/sshd_config:
file.managed:
- source: salt://ssh/files/sshd_config.jinja
- template: jinja
- user: root
- group: root
- mode: 0640
OpenSSH Service:
service.running:
{% if grains['os_family'] == 'Suse' %}
- name: sshd
{% elif grains['os_family'] == 'Debian' %}
- name: ssh
{% endif %}
- enable: True
- watch:
{% if grains['os_family'] == 'Suse' %}
- pkg: openssh
{% elif grains['os_family'] == 'Debian' %}
- pkg: ssh
{% endif %}
- file: /etc/ssh/sshd_config