dont multiplex to sleepers

This commit is contained in:
cronekorkn 2022-09-21 22:10:47 +02:00
parent bd118be239
commit 1ea39b8117
Signed by: cronekorkn
SSH key fingerprint: SHA256:v0410ZKfuO1QHdgKBsdQNF64xmTxOF8osF1LIqwTcVw
4 changed files with 25 additions and 4 deletions

View file

@ -4,7 +4,8 @@ Host *
GSSAPIAuthentication yes GSSAPIAuthentication yes
StrictHostKeyChecking yes StrictHostKeyChecking yes
GlobalKnownHostsFile /etc/ssh/ssh_known_hosts GlobalKnownHostsFile /etc/ssh/ssh_known_hosts
# fixme: prevents backup server from sleeping
# ControlMaster auto Host ${' '.join(sorted(multiplex_hosts))}
# ControlPath ~/.ssh/multiplex-%C ControlMaster auto
# ControlPersist 5m ControlPath ~/.ssh/multiplex-%C
ControlPersist 5m

View file

@ -1,3 +1,6 @@
from ipaddress import ip_interface
# on debian bullseye raspberry images, starting the systemd ssh # on debian bullseye raspberry images, starting the systemd ssh
# daemon seems to collide with an existing sysv daemon # daemon seems to collide with an existing sysv daemon
dont_touch_sshd = node.metadata.get('FIXME_dont_touch_sshd', False) dont_touch_sshd = node.metadata.get('FIXME_dont_touch_sshd', False)
@ -24,6 +27,13 @@ files = {
'/etc/ssh/ssh_config': { '/etc/ssh/ssh_config': {
'content_type': 'mako', 'content_type': 'mako',
'context': { 'context': {
'multiplex_hosts': set(
str(ip_interface(other_node.metadata.get('network/internal/ipv4')).ip)
for other_node in repo.nodes
if other_node.has_bundle('ssh')
and other_node.metadata.get('network/internal/ipv4', None)
and other_node.metadata.get('ssh/multiplex_incoming')
),
}, },
'triggers': [ 'triggers': [
'svc_systemd:ssh:restart' 'svc_systemd:ssh:restart'

View file

@ -1,6 +1,12 @@
from ipaddress import ip_interface from ipaddress import ip_interface
from base64 import b64decode from base64 import b64decode
defaults = {
'ssh': {
'multiplex_incoming': True,
},
}
@metadata_reactor.provides( @metadata_reactor.provides(
'ssh/allow_users', 'ssh/allow_users',

View file

@ -38,6 +38,10 @@
# 'apm': 1, # 'apm': 1,
# }, # },
# }, # },
'ssh': {
# multipling prevents server from sleeping
'multiplex_incoming': False,
},
'wol-sleeper': { 'wol-sleeper': {
'network': 'internal', 'network': 'internal',
'waker': 'home.server', 'waker': 'home.server',