Mercurial > code > home > repos > infra
view ssh.py @ 278:4e424a144183
for netboot pi
author | drewp@bigasterisk.com |
---|---|
date | Sat, 30 Mar 2024 00:15:46 -0700 |
parents | ff8879eed64e |
children | 65e28d2e0cd8 |
line wrap: on
line source
from pyinfra import host from pyinfra.facts.server import LinuxDistribution from pyinfra.operations import files, systemd is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux'] systemd.service( service='ssh', running=True, enabled=True, ) files.line(path='/etc/ssh/ssh_config', line="HashKnownHosts", replace="HashKnownHosts no") if not is_pi: 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)