comparison ssh.py @ 278:4e424a144183

for netboot pi
author drewp@bigasterisk.com
date Sat, 30 Mar 2024 00:15:46 -0700
parents ff8879eed64e
children 65e28d2e0cd8
comparison
equal deleted inserted replaced
277:ce823a167641 278:4e424a144183
10 enabled=True, 10 enabled=True,
11 ) 11 )
12 12
13 files.line(path='/etc/ssh/ssh_config', line="HashKnownHosts", replace="HashKnownHosts no") 13 files.line(path='/etc/ssh/ssh_config', line="HashKnownHosts", replace="HashKnownHosts no")
14 14
15 if is_pi:
16 auth_keys = '/home/pi/.ssh/authorized_keys'
17 files.file(path=auth_keys, user='pi', group='pi', mode=600)
18 for pubkey in [
19 'ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNlR7hereUHqw/RHQau0F7+vQZKAxduM+SD4R76FhC+4Zi078Pv04ZLe9qdM/NBlB/grLGhG58vaGmnWPpJ3QJs= drewp@plus',
20 'ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOR+iV8Qm/rAfmq0epXYfnp5ZTfBl8eidFzw1GmyZ3fPUFAshWn839fQ5DPj9xDPtMy9kTtrB5bK1SnynFzDqzQ= drewp@bang',
21 ]:
22 files.line(path=auth_keys, line=pubkey, replace=pubkey)
23
24 if not is_pi: 15 if not is_pi:
25 files.line(path='/etc/ssh/sshd_config', line="^UseDNS\b", replace="UseDNS no") 16 files.line(path='/etc/ssh/sshd_config', line="^UseDNS\b", replace="UseDNS no")
26 # MAYBE plus needs this fix: adding ListenAddress 0.0.0.0 to /etc/ssh/sshd_config 17 # MAYBE plus needs this fix: adding ListenAddress 0.0.0.0 to /etc/ssh/sshd_config
27 systemd.service(service='sshd', reloaded=True) 18 systemd.service(service='sshd', reloaded=True)