Bug 1848072 - Review Request: rust-ssh-key-dir - sshd AuthorizedKeysCommand to read ~/.ssh/authorized_keys.d
Summary: Review Request: rust-ssh-key-dir - sshd AuthorizedKeysCommand to read ~/.ssh/...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Igor Raits
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-17 15:43 UTC by Benjamin Gilbert
Modified: 2020-06-24 17:02 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-06-24 17:02:48 UTC
Type: ---
Embargoed:
igor.raits: fedora-review+


Attachments (Terms of Use)

Description Benjamin Gilbert 2020-06-17 15:43:54 UTC
Spec URL: https://fedorapeople.org/~bgilbert/ssh-key-dir/rust-ssh-key-dir.spec
SRPM URL: https://fedorapeople.org/~bgilbert/ssh-key-dir/rust-ssh-key-dir-0.1.1-1.fc31.src.rpm
Description: sshd AuthorizedKeysCommand to read key files from ~/.ssh/authorized_keys.d.
Fedora Account System Username: bgilbert

Comment 1 Igor Raits 2020-06-17 19:22:45 UTC
Two small comments:

> install -D -m 644 -t %{buildroot}%{_sysconfdir}/ssh/sshd_config.d conf/40-ssh-key-dir.conf
install -Dpm0644 -t %{buildroot}%{_sysconfdir}/ssh/sshd_config.d conf/40-ssh-key-dir.conf

> if [ -x /usr/bin/systemctl ]; then
>     /usr/bin/systemctl try-reload-or-restart sshd.service
> fi
Not really happy about this one... What about %systemd_post sshd.service?

Also you'll need to have Requires(post): openssh-server Probably for postun too, but not sure.

Comment 2 Benjamin Gilbert 2020-06-17 20:36:39 UTC
Updated.  Added post/postun dependencies on systemd and openssh-server, updated install flags, and unconditionalized invocation of systemctl.

> What about %systemd_post sshd.service?

The %systemd_* macros don't do what we need here; in particular, %systemd_post activates a preset.  Since we're adding/updating/removing an sshd_config.d fragment, we need to reload sshd to pick up the changes.

Comment 3 Neal Gompa 2020-06-17 21:58:32 UTC
%systemd_postun_with_restart should do what you want for postun, which would happen on every upgrade. %systemd_post would run on initial install to preset.

Comment 4 Benjamin Gilbert 2020-06-18 01:59:30 UTC
The behavior we want is: SIGHUP sshd on initial install, SIGHUP on upgrades, and SIGHUP on removal.  We use systemctl try-reload-or-restart because we want the try- behavior (don't fail if sshd isn't running); systemctl doesn't have a try-reload.  %systemd_postun_with_restart does a restart rather than reload, and %systemd_post isn't useful because we don't need any presets applied.

I've updated the spec to avoid reloading twice on package upgrades, and also to correctly associate the scriptlets with the subpackage. :-/

Comment 5 Gwyn Ciesla 2020-06-24 13:33:29 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/rust-ssh-key-dir


Note You need to log in before you can comment on or make changes to this bug.