Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication improvements #83

Merged
merged 14 commits into from
Aug 8, 2023
Merged

Authentication improvements #83

merged 14 commits into from
Aug 8, 2023

Conversation

troglobit
Copy link
Contributor

@troglobit troglobit commented Jul 6, 2023

  • Update klish-plugin-sysrepo to get EnableNACM support so we can edit nacm rules in CLI
  • Add ietf-system augment for specifying login shell, default /bin/clish
  • Allow adding remote-only users that are not allowed password login, only SSH keys
  • Add compat symlink to ~/.ssh/authorized_keys for netopeer2-server
  • Misc fixes.

@troglobit troglobit added the enhancement New feature or request label Jul 6, 2023
@troglobit troglobit added this to the Infix v23.07 milestone Jul 6, 2023
@troglobit troglobit requested a review from wkz July 6, 2023 00:18
@troglobit troglobit force-pushed the authentication-improvements branch 3 times, most recently from 8a5d68b to e795626 Compare July 6, 2023 15:13
The existing 'adduser -D' command adds a locked user account, similar to
the Debian adduser --disabled-login'.  This patch adds support for the
'adduser -d' command, similar to Debian 'adduser --disabled-password',
meaning login is possible but using methods other than password, e.g.,
SSH keys.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The login applet did not know about shadow passwords, and could thus not
determine if a user accont was locked or passwordless.  This caused it
to return 'login: bad salt' instead of "Login incorrect", which is the
more secure path for handling brute force attempts.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Employ the new 'adduser -d' feature where users can be created with
password login disbled instead of creating them locked by default.

This allows us to create remote users that can only access the device
using public key SSH login, which until this point was not possible.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
No point in leaving unused home directories lingering on the system,
also a potential security problem.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Apparently netopeer2-server expects public keys for users to be in the
canonical place (~/.ssh/authorized_keys).  Infix use a custom location
in /var/run, maintained by the ietf-system plugin, which OpenSSH knows
but netopeer2-server doesn't.

It seems to be possible to add some sort of "pattern" to netopeer2 to
indicate where to look for public keys.  This is added when building it
but Buildroot does not expose this as a setting.  So for now, this seem
to be the least intrusive way of handling it.  The owner is root, so a
malicious user cannot change the link or contents without some other
form of privilege escalation first.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This patch bumps klish-plugin-sysrepo to get EnableNACM support.  For
this to work as expected for the admin user we also need to change the
permission for the model in sysrepo.

Note: the srp_rollback() symbol has been renamed to srp_reset() upstram.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Services have not even started up yet, so system() calls will only
unnecessarily delay the boot.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Needed when searching for unchanged data, e.g., default values when
creating new users.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
 - Add /bin/clish (symlink) to /etc/shells, as well as the traditional
   /bin/{true,false} for completeness
 - Validate shell string, with fallback to /bin/bash and /bin/sh
 - Step infix-system revision, keeping old model in tree

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Factor out a new helper function, change_get_user(), to do the bulk of
the work for the change callbacks.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit enables a basic sanity check of usernames in BusyBox that by
default is disabled (!).  The rules enabled by this are:

 - the user or group name should consist only of letters, digits,
   underscores, periods, and dashes¹, and not start with a dash (as
   defined by IEEE Std 1003.1-2001), or periods²

 - for compatibility with Samba machine accounts, $ is supported at the
   end of names

 - max length of user or group name is 256 chars

Changes in this commit also includes a sync with latest BusyBox 1.36,
which adds: tree, tsort, SHA hw acceleration, and a separate script
for udhcpc6.

_____
¹) The documentation actually mentions "and at-signs" as well, but that
   has been explicitly removed from the source code.
²) The documentation does not mention that leading periods are not
   allowed, though this is also explicitly mentioned in the source code.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
@wkz wkz force-pushed the authentication-improvements branch from 8cf6c7a to 139175d Compare August 8, 2023 12:03
@wkz wkz merged commit 2a37d90 into main Aug 8, 2023
2 checks passed
@wkz wkz deleted the authentication-improvements branch August 8, 2023 12:36
@troglobit
Copy link
Contributor Author

Thank you for taking the time up fix the conflicts! I'll have a look at #95 when I get back from vacation.

@troglobit troglobit modified the milestones: Infix v23.07, Infix v23.08 Aug 29, 2023
@troglobit troglobit mentioned this pull request Jul 2, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants