view ssh.py @ 305:58d8e6072dcc

update syncthing
author drewp@bigasterisk.com
date Sat, 24 Aug 2024 15:06:51 -0700
parents 65e28d2e0cd8
children 5b88b38f2471
line wrap: on
line source

from pyinfra import host
from pyinfra.facts.server import LinuxDistribution
from pyinfra.operations import files, systemd


systemd.service(
    service='ssh',
    running=True,
    enabled=True,
)

files.line(path='/etc/ssh/ssh_config', line="HashKnownHosts", replace="HashKnownHosts no")

if 'pi' not in host.groups:
    files.line(path='/etc/ssh/sshd_config', line="^UseDNS\b", replace="UseDNS no")
    # MAYBE plus needs this fix: adding ListenAddress 0.0.0.0 to /etc/ssh/sshd_config
    systemd.service(service='sshd', reloaded=True)