Skip to contentSkip to conversation

openssh: Don't hardcode the dir in sshd.service

PATCH In review [email protected] 2 participants 2 messages Oct 26, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openssh: Don't hardcode the dir in sshd.service

From: Mingli Yu <[email protected]>

Don't hardcode the directory of the binary in sshd.service.

---
 meta/recipes-connectivity/openssh/openssh/sshd.service | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-connectivity/openssh/openssh/sshd.service +1 -1
index 6ace67d8ae..2a997b656a 100644
@@ -6,7 +6,7 @@ After=sshdgenkeys.service
 [Service]
 Environment="SSHD_OPTS="
 EnvironmentFile=-/etc/default/ssh
-ExecStartPre=/usr/bin/mkdir -p /var/run/sshd
+ExecStartPre=@BASE_BINDIR@/mkdir -p /var/run/sshd
 ExecStart=-@SBINDIR@/sshd -D $SSHD_OPTS
 ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID
 KillMode=process
Signature · 1 line
2.25.1
#1 lore raw
Quoted 14 lines · Mingli via lists.openembedded.org

From: Mingli Yu <[email protected]>

Don't hardcode the directory of the binary in sshd.service.

---
 meta/recipes-connectivity/openssh/openssh/sshd.service | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-connectivity/openssh/openssh/sshd.service +0 -0
index 6ace67d8ae..2a997b656a 100644

meta/recipes-connectivity/openssh/openssh/sshd.service After=sshdgenkeys.service · line 9

Quoted 5 lines
meta/recipes-connectivity/openssh/openssh/sshd.service +1 -1
@@ -6,7 +6,7 @@ After=sshdgenkeys.service
 [Service]
 Environment="SSHD_OPTS="
 EnvironmentFile=-/etc/default/ssh
-ExecStartPre=/usr/bin/mkdir -p /var/run/sshd
+ExecStartPre=@BASE_BINDIR@/mkdir -p /var/run/sshd

How about using RuntimeDirectory=sshd or don't hardcode any path and call ExecStartPre=mkdir -p …

meta/recipes-connectivity/openssh/openssh/sshd.service After=sshdgenkeys.service · line 11

Quoted 2 lines
meta/recipes-connectivity/openssh/openssh/sshd.service +0 -0
 ExecStart=-@SBINDIR@/sshd -D $SSHD_OPTS
 ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID

Same here. This would match the example in the Manual page systemd.service(5):

```
ExecReload=
    Commands to execute to trigger a configuration reload in the
service. This argument takes multiple command lines, following the same
scheme as described
    for ExecStart= above. Use of this setting is optional. Specifier and
environment variable substitution is supported here following the same
scheme as for
    ExecStart=.

    One additional, special environment variable is set: if known,
$MAINPID is set to the main process of the daemon, and may be used for
command lines like
    the following:

        ExecReload=kill -HUP $MAINPID
```

meta/recipes-connectivity/openssh/openssh/sshd.service After=sshdgenkeys.service · line 12

Quoted 1 line
meta/recipes-connectivity/openssh/openssh/sshd.service +0 -0
 KillMode=process

Kind regards

Jörg Sommer

Signature · 5 lines
Navimatix GmbH
Tatzendpromenade 2
D-07745 Jena
Geschäftsführer: Steffen Späthe, Jan Rommeley
Registergericht: Amtsgericht Jena, HRB 501480