Page MenuHomeFreeBSD

nuageinint: implement ssh_pwauth
ClosedPublic

Authored by bapt on Thu, Apr 17, 4:06 PM.
Tags
None
Referenced Files
F115417175: D49875.diff
Wed, Apr 23, 2:31 PM
F115412289: D49875.diff
Wed, Apr 23, 1:14 PM
F115404753: D49875.diff
Wed, Apr 23, 11:22 AM
Unknown Object (File)
Mon, Apr 21, 6:16 PM
Unknown Object (File)
Mon, Apr 21, 5:05 PM
Unknown Object (File)
Mon, Apr 21, 3:04 PM
Unknown Object (File)
Mon, Apr 21, 7:13 AM
Unknown Object (File)
Mon, Apr 21, 7:00 AM
Subscribers

Details

Summary

ssh_pwauth sets the value in sshd_config for the password authentication
This implementation tries to avoid touching the file if cloudinit
request for what is already the default value.

Sponsored by: OVHCloud

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bapt requested review of this revision.Thu, Apr 17, 4:06 PM

Looks fine to me. I'll tag @kevans for Lua review.

libexec/nuageinit/tests/nuageinit.sh
497
510
bapt edited the summary of this revision. (Show Details)
bapt marked 2 inline comments as done.Wed, Apr 23, 7:15 AM

Pedantically, to be on the same page in sshd_config(5):

  1. The first configured value is the one that counts.
  2. Some OSs (macOS)/Linux distros (Debian-based) just add Include /etc/ssh/sshd_config.d/* at the very top of the configuration file, so cloudinit should just create a new file under this directory with the desired settings, and call it a day. I only mention this option, as it is becoming popular (in case anyone has friends in openssh-portable ;-).
  3. I would have rather/also liked to see something like:
# ssh_pwauth: true
printf "#PasswordAuthentication no # Should be ignored\n" > etc/ssh/sshd_config
printf "PasswordAuthentication no # Should change\n" >> etc/ssh/sshd_config
atf_check -o empty -e empty /usr/libexec/nuageinit "${PWD}"/media/nuageinit nocloud
atf_check -o match:"^#PasswordAuthentication no # Should be ignored$" \
    -o match:"^PasswordAuthentication yes$" cat etc/ssh/sshd_config

Regardless, the implementation seems correct.

libexec/nuageinit/nuage.lua
138

Tangentially, to silence luacheck, remove local, as f was already defined on line 92.

This revision is now accepted and ready to land.Wed, Apr 23, 2:23 PM
This revision was automatically updated to reflect the committed changes.