openssh: Add SSHD_SERVICE_TYPE variable
PATCH 1/1 openssh: Add SSHD_SERVICE_TYPE variable
From: Mingli Yu <[email protected]>
There are two types of sshd server now, one is based on socket activation(sshd.socket) and another is service activation(sshd.service). And the default sshd service type is based on socket by default as below.
============================================
# systemctl status sshd.socket
* sshd.socket
Loaded: loaded (/lib/systemd/system/sshd.socket; enabled; preset: enabled)
Active: active (listening) since Mon 2023-12-04 08:34:33 UTC; 22s ago
Listen: [::]:22 (Stream)
Accepted: 0; Connected: 0;
Process: 228 ExecStartPre=/bin/mkdir -p /var/run/sshd (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 263)
Memory: 84.0K
CGroup: /system.slice/sshd.socketDec 04 08:34:33 qemux86-64 systemd[1]: Starting sshd.socket... Dec 04 08:34:33 qemux86-64 systemd[1]: Listening on sshd.socket.
============================================
And use can switch to service activation if they want as below after the device boot up.
============================================
# systemctl disable sshd.socket
Removed "/etc/systemd/system/sockets.target.wants/sshd.socket".
# systemctl stop sshd.socket
# systemctl start sshd.service
# systemctl status sshd.service
* sshd.service - OpenSSH server daemon
Loaded: loaded (/lib/systemd/system/sshd.service; enabled; preset: enabled)
Active: active (running) since Mon 2023-12-04 08:48:14 UTC; 53s ago
Process: 390 ExecStartPre=/bin/mkdir -p /var/run/sshd (code=exited, status=0/SUCCESS)
Main PID: 391 (sshd)
Tasks: 1 (limit: 263)
Memory: 2.1M
CGroup: /system.slice/sshd.service
`-391 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"Dec 04 08:48:14 qemux86-64 systemd[1]: Starting OpenSSH server daemon... Dec 04 08:48:14 qemux86-64 systemd[1]: Started OpenSSH server daemon. Dec 04 08:48:14 qemux86-64 sshd[391]: Server listening on 0.0.0.0 port 22. Dec 04 08:48:14 qemux86-64 sshd[391]: Server listening on :: port 22.
============================================
But it's more convenient to determine the service type at build time if there are so many devices.
So add SSHD_SERVICE_TYPE variable to enable sshd.socket or sshd.service at build time and we still enable sshd.socket by default now.
--- .../openssh/openssh_9.5p1.bb | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +13 -5
@@ -50,7 +50,7 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd" INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9" SYSTEMD_PACKAGES = "${PN}-sshd" -SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service" +SYSTEMD_SERVICE:${PN}-sshd = "${@bb.utils.contains('SSHD_SERVICE_TYPE', '1', 'sshd.service', 'sshd.socket', d)}" inherit autotools-brokensep ptest pkgconfig DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
@@ -125,15 +125,23 @@ do_install:append () { echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly install -d ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + if ${@bb.utils.contains('SSHD_SERVICE_TYPE','1','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} + else + install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} + install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ + ${D}${systemd_system_unitdir}/sshd.socket + fi install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_system_unitdir} sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ -e 's,@SBINDIR@,${sbindir},g' \ -e 's,@BINDIR@,${bindir},g' \ -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ - ${D}${systemd_system_unitdir}/sshd.socket ${D}${systemd_system_unitdir}/*.service + ${D}${systemd_system_unitdir}/*.service sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ ${D}${sysconfdir}/init.d/sshd
Signature · 1 line
2.25.1
Quoted 5 lines · Mingli
From: Mingli Yu <[email protected]>
There are two types of sshd server now, one is based on socket activation(sshd.socket) and another is service activation(sshd.service). And the default sshd service type is based on socket by default as below.
Firstly, I'm a little frustrated about how these changes are being proposed in pieces. The original patches made no mention that this was eventually going to be controlled by a new variable. I did wonder if something like this was going to happen but the didn't push back. Now we're "pinned" into a corner with the direction this code takes now we've already merged the on target configuration change.
Quoted 2 lines
But it's more convenient to determine the service type at build time if there are so many devices.
Why did we merge a patch which made this an on target decision then?
Quoted 2 lines
So add
SSHD_SERVICE_TYPEvariable to enable sshd.socket or sshd.service at build time and we still enable sshd.socket by default now.
No, we're not adding randomly named variables which take magic options.
I cannot look at SSHD_SERVICE_TYPE and know that "1" means socket activation and not setting it means service activation (or whatever, the fact I can't check what I've written easily proves my point). What happens if I set it to "true", or "socket", or "apples"?
I'd suggest thinking about a PACKAGECONFIG option such as systemd-sshd- socket-mode and systemd-sshd-service-mode which at least uses naming users are mode used to and says what it does.
Cheers,
Richard
Hi Richard,
Quoted 17 lines · Richard Purdie
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.Quoted 5 lines · Mingli
From: Mingli Yu <[email protected]>
There are two types of sshd server now, one is based on socket activation(sshd.socket) and another is service activation(sshd.service). And the default sshd service type is based on socket by default as below.
Firstly, I'm a little frustrated about how these changes are being proposed in pieces. The original patches made no mention that this was eventually going to be controlled by a new variable. I did wonder if something like this was going to happen but the didn't push back. Now we're "pinned" into a corner with the direction this code takes now we've already merged the on target configuration change.
Quoted 4 lines
Quoted 2 lines
But it's more convenient to determine the service type at build time if there are so many devices.
Why did we merge a patch which made this an on target decision then?
Maybe usage requirement change? sorry for noise!
Quoted 6 lines
Quoted 3 lines
So add
SSHD_SERVICE_TYPEvariable to enable sshd.socket or sshd.service at build time and we still enable sshd.socket by default now.No, we're not adding randomly named variables which take magic options.
Quoted 8 lines
I cannot look at
SSHD_SERVICE_TYPEand know that "1" means socket activation and not setting it means service activation (or whatever, the fact I can't check what I've written easily proves my point). What happens if I set it to "true", or "socket", or "apples"?I'd suggest thinking about a PACKAGECONFIG option such as systemd-sshd- socket-mode and systemd-sshd-service-mode which at least uses naming users are mode used to and says what it does.
Will sent v2 to use the common PACKAGECONFIG option to control the sshd type.
Thanks,
Quoted 4 lines
Cheers,
Richard
PATCH v2 1/1 openssh: Add PACKAGECONFIG option to customize sshd mode
From: Mingli Yu <[email protected]>
Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket and systemd-sshd-service-mode PACKAGECONFIG option to choose installing sshd.service.
The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default and user can customize the above two PACKAGECONFIG option to choose the sshd mode.
--- .../openssh/openssh_9.5p1.bb | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-)
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +18 -6
@@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd" INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9" SYSTEMD_PACKAGES = "${PN}-sshd" -SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service" +SYSTEMD_SERVICE:${PN}-sshd = "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket', '', d)} ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service', '', d)}" inherit autotools-brokensep ptest pkgconfig DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" -PACKAGECONFIG ??= "" +# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode +# corresponding to sshd.service +PACKAGECONFIG ??= " systemd-sshd-socket-mode" PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" +PACKAGECONFIG[systemd-sshd-socket-mode] = "" +PACKAGECONFIG[systemd-sshd-service-mode] = "" EXTRA_AUTORECONF += "--exclude=aclocal"
@@ -125,15 +129,23 @@ do_install:append () { echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly install -d ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} + install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ + ${D}${systemd_system_unitdir}/sshd.socket + elif ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} + fi install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_system_unitdir} sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ -e 's,@SBINDIR@,${sbindir},g' \ -e 's,@BINDIR@,${bindir},g' \ -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ - ${D}${systemd_system_unitdir}/sshd.socket ${D}${systemd_system_unitdir}/*.service + ${D}${systemd_system_unitdir}/*.service sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ ${D}${sysconfdir}/init.d/sshd
Signature · 1 line
2.25.1
Re: [OE-core] [PATCH v2] openssh: Add PACKAGECONFIG option to customize sshd mode
Hello,
Quoted 10 lines · Mingli
From: Mingli Yu <[email protected]>
Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket and systemd-sshd-service-mode PACKAGECONFIG option to choose installing sshd.service.
The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default and user can customize the above two PACKAGECONFIG option to choose the sshd mode.
This doesn't apply after https://lore.kernel.org/all/[email protected]/
Can you synchronize and provide a working series?
Quoted 73 lines
Signed-off-by Mingli Yu <[email protected]>--- .../openssh/openssh_9.5p1.bb | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-)meta/recipes-connectivity/openssh/openssh_9.5p1.bb +18
-6@@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd" INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9" SYSTEMD_PACKAGES = "${PN}-sshd" -SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service" +SYSTEMD_SERVICE:${PN}-sshd = "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket', '', d)} ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service', '', d)}" inherit autotools-brokensep ptest pkgconfig DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" -PACKAGECONFIG ??= "" +# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode +# corresponding to sshd.service +PACKAGECONFIG ??= " systemd-sshd-socket-mode" PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" +PACKAGECONFIG[systemd-sshd-socket-mode] = "" +PACKAGECONFIG[systemd-sshd-service-mode] = "" EXTRA_AUTORECONF += "--exclude=aclocal"@@ -125,15 +129,23 @@ do_install:append () { echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly install -d ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} + install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ + ${D}${systemd_system_unitdir}/sshd.socket + elif ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} + fi install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_system_unitdir} sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ -e 's,@SBINDIR@,${sbindir},g' \ -e 's,@BINDIR@,${bindir},g' \ -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ - ${D}${systemd_system_unitdir}/sshd.socket ${D}${systemd_system_unitdir}/*.service + ${D}${systemd_system_unitdir}/*.service sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ ${D}${sysconfdir}/init.d/sshdSignature · 11 lines
2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#191794): https://lists.openembedded.org/g/openembedded-core/message/191794 Mute This Topic: https://lists.openembedded.org/mt/102987153/3617179 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v3 1/1 openssh: Add PACKAGECONFIG option to customize sshd mode
From: Mingli Yu <[email protected]>
Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket and systemd-sshd-service-mode PACKAGECONFIG option to choose installing sshd.service.
The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default and user can customize the above two PACKAGECONFIG option to choose the sshd mode.
--- .../openssh/openssh_9.5p1.bb | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-)
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +18 -6
@@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd" INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9" SYSTEMD_PACKAGES = "${PN}-sshd" -SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service" +SYSTEMD_SERVICE:${PN}-sshd = "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket', '', d)} ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service', '', d)}" inherit autotools-brokensep ptest pkgconfig -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" +# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode +# corresponding to sshd.service +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} systemd-sshd-socket-mode" PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd" +PACKAGECONFIG[systemd-sshd-socket-mode] = "" +PACKAGECONFIG[systemd-sshd-service-mode] = "" EXTRA_AUTORECONF += "--exclude=aclocal"
@@ -124,15 +128,23 @@ do_install:append () { echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly install -d ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} + install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ + ${D}${systemd_system_unitdir}/sshd.socket + elif ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} + fi install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_system_unitdir} sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ -e 's,@SBINDIR@,${sbindir},g' \ -e 's,@BINDIR@,${bindir},g' \ -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ - ${D}${systemd_system_unitdir}/sshd.socket ${D}${systemd_system_unitdir}/*.service + ${D}${systemd_system_unitdir}/*.service sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ ${D}${sysconfdir}/init.d/sshd
Signature · 1 line
2.25.1
PATCH v4 1/1 openssh: Add PACKAGECONFIG option to customize sshd mode
In reply to Alexandre BelloniFrom: Mingli Yu <[email protected]>
Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket and systemd-sshd-service-mode PACKAGECONFIG option to choose installing sshd.service.
The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default and user can customize the above two PACKAGECONFIG option to choose the sshd mode.
---
Changed in v3:
rebase based on https://lore.kernel.org/all/[email protected]/
Changed in v4:
make it possible to install both sshd.socket and sshd.service
.../openssh/openssh_9.5p1.bb | 25 ++++++++++++++-----
1 file changed, 19 insertions(+), 6 deletions(-)
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +19 -6
@@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd" INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9" SYSTEMD_PACKAGES = "${PN}-sshd" -SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service" +SYSTEMD_SERVICE:${PN}-sshd = "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket', '', d)} ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service', '', d)}" inherit autotools-brokensep ptest pkgconfig -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" +# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode +# corresponding to sshd.service +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} systemd-sshd-socket-mode" PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd" +PACKAGECONFIG[systemd-sshd-socket-mode] = "" +PACKAGECONFIG[systemd-sshd-service-mode] = "" EXTRA_AUTORECONF += "--exclude=aclocal"
@@ -124,15 +128,24 @@ do_install:append () { echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly install -d ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} + install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ + ${D}${systemd_system_unitdir}/sshd.socket + fi + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} + fi install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_system_unitdir} sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ -e 's,@SBINDIR@,${sbindir},g' \ -e 's,@BINDIR@,${bindir},g' \ -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ - ${D}${systemd_system_unitdir}/sshd.socket ${D}${systemd_system_unitdir}/*.service + ${D}${systemd_system_unitdir}/*.service sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ ${D}${sysconfdir}/init.d/sshd
Signature · 1 line
2.25.1
Re: [OE-core] [PATCH v4] openssh: Add PACKAGECONFIG option to customize sshd mode
Quoted 11 lines · Mingli
From: Mingli Yu <[email protected]>
Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket and systemd-sshd-service-mode PACKAGECONFIG option to choose installing sshd.service.
The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default and user can customize the above two PACKAGECONFIG option to choose the sshd mode.
Quoted 7 lines
Signed-off-by Mingli Yu <[email protected]>---
Changed in v3:
rebase based on https://lore.kernel.org/all/[email protected]/Changed in v4:
make it possible to install both sshd.socket and sshd.service
I'm wondering if we should make SYSTEMD_AUTO_ENABLE settable per service, so you could then install both and manage which one is active with a preset.
Quoted 71 lines
.../openssh/openssh_9.5p1.bb | 25 ++++++++++++++-----
1 file changed, 19 insertions(+), 6 deletions(-)meta/recipes-connectivity/openssh/openssh_9.5p1.bb +19
-7@@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd" INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9" SYSTEMD_PACKAGES = "${PN}-sshd" -SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service" +SYSTEMD_SERVICE:${PN}-sshd = "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket', '', d)} ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service', '', d)}" inherit autotools-brokensep ptest pkgconfig -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" +# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode +# corresponding to sshd.service +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} systemd-sshd-socket-mode" PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd" +PACKAGECONFIG[systemd-sshd-socket-mode] = "" +PACKAGECONFIG[systemd-sshd-service-mode] = "" EXTRA_AUTORECONF += "--exclude=aclocal"@@ -124,15 +128,24 @@ do_install:append () { echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly install -d ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} + install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ + ${D}${systemd_system_unitdir}/sshd.socket + fi + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} + fi install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_system_unitdir} sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ -e 's,@SBINDIR@,${sbindir},g' \ -e 's,@BINDIR@,${bindir},g' \ -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ - ${D}${systemd_system_unitdir}/sshd.socket ${D}${systemd_system_unitdir}/*.service + ${D}${systemd_system_unitdir}/*.service sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ ${D}${sysconfdir}/init.d/sshd --2.25.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#191874): https://lists.openembedded.org/g/openembedded-core/message/191874
Mute This Topic: https://lists.openembedded.org/mt/103009646/3618097
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 1 line
Alex Kiernan
Re: [OE-core] [PATCH v4] openssh: Add PACKAGECONFIG option to customize sshd mode
Hi Alex,
Thanks for your suggestion!
Both sshd.socket and sshd.service belong to openssh-sshd package, so using SYSTEMD_AUTO_ENABLE can't enable one of them, it just can enable both or disable both.
Thanks,
________________________________
From: Alex Kiernan <[email protected]>
Sent: Wednesday, December 6, 2023 18:37
To: Yu, Mingli <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: [OE-core] [PATCH v4] openssh: Add PACKAGECONFIG option to customize sshd mode
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.
Quoted 11 lines · Mingli
From: Mingli Yu <[email protected]>
Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket and systemd-sshd-service-mode PACKAGECONFIG option to choose installing sshd.service.
The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default and user can customize the above two PACKAGECONFIG option to choose the sshd mode.
Quoted 7 lines
Signed-off-by Mingli Yu <[email protected]>---
Changed in v3:
rebase based on https://lore.kernel.org/all/[email protected]/Changed in v4:
make it possible to install both sshd.socket and sshd.service
I'm wondering if we should make SYSTEMD_AUTO_ENABLE settable per service, so you could then install both and manage which one is active with a preset.
Quoted 63 lines
.../openssh/openssh_9.5p1.bb | 25 ++++++++++++++-----
1 file changed, 19 insertions(+), 6 deletions(-)meta/recipes-connectivity/openssh/openssh_9.5p1.bb +19
-7@@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd" INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9" SYSTEMD_PACKAGES = "${PN}-sshd" -SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service" +SYSTEMD_SERVICE:${PN}-sshd = "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket', '', d)} ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service', '', d)}" inherit autotools-brokensep ptest pkgconfig -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" +# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode +# corresponding to sshd.service +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} systemd-sshd-socket-mode" PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd" +PACKAGECONFIG[systemd-sshd-socket-mode] = "" +PACKAGECONFIG[systemd-sshd-service-mode] = "" EXTRA_AUTORECONF += "--exclude=aclocal"@@ -124,15 +128,24 @@ do_install:append () { echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly install -d ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} + install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ + ${D}${systemd_system_unitdir}/sshd.socket + fi + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} + fi install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_system_unitdir} sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ -e 's,@SBINDIR@,${sbindir},g' \ -e 's,@BINDIR@,${bindir},g' \ -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ - ${D}${systemd_system_unitdir}/sshd.socket ${D}${systemd_system_unitdir}/*.service + ${D}${systemd_system_unitdir}/*.service sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ ${D}${sysconfdir}/init.d/sshd --2.25.1
Quoted 8 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#191874): https://lists.openembedded.org/g/openembedded-core/message/191874
Mute This Topic: https://lists.openembedded.org/mt/103009646/3618097
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
--
Alex Kiernan
Re: [OE-core] [PATCH v4] openssh: Add PACKAGECONFIG option to customize sshd mode
Quoted 7 lines · Mingli
Hi Alex,
Thanks for your suggestion!
Both sshd.socket and sshd.service belong to openssh-sshd package, so using
SYSTEMD_AUTO_ENABLEcan't enable one of them, it just can enable both or disable both.
Yes, it would need changes to support per-service presets, which I suspect would be generally useful.
Quoted 110 lines
Thanks,
________________________________
From: Alex Kiernan <[email protected]>
Sent: Wednesday, December 6, 2023 18:37
To: Yu, Mingli <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: [OE-core] [PATCH v4] openssh: Add PACKAGECONFIG option to customize sshd modeCAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.Quoted 11 lines · Mingli
From: Mingli Yu <[email protected]>
Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket and systemd-sshd-service-mode PACKAGECONFIG option to choose installing sshd.service.
The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default and user can customize the above two PACKAGECONFIG option to choose the sshd mode.
Quoted 7 lines
Signed-off-by Mingli Yu <[email protected]>---
Changed in v3:
rebase based on https://lore.kernel.org/all/[email protected]/Changed in v4:
make it possible to install both sshd.socket and sshd.serviceI'm wondering if we should make
SYSTEMD_AUTO_ENABLEsettable per service, so you could then install both and manage which one is active with a preset.Quoted 63 lines
.../openssh/openssh_9.5p1.bb | 25 ++++++++++++++-----
1 file changed, 19 insertions(+), 6 deletions(-)meta/recipes-connectivity/openssh/openssh_9.5p1.bb +19
-7@@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd" INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9" SYSTEMD_PACKAGES = "${PN}-sshd" -SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service" +SYSTEMD_SERVICE:${PN}-sshd = "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket', '', d)} ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service', '', d)}" inherit autotools-brokensep ptest pkgconfig -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" +# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode +# corresponding to sshd.service +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} systemd-sshd-socket-mode" PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd" +PACKAGECONFIG[systemd-sshd-socket-mode] = "" +PACKAGECONFIG[systemd-sshd-service-mode] = "" EXTRA_AUTORECONF += "--exclude=aclocal"@@ -124,15 +128,24 @@ do_install:append () { echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly install -d ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} + install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ + ${D}${systemd_system_unitdir}/sshd.socket + fi + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} + fi install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_system_unitdir} sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ -e 's,@SBINDIR@,${sbindir},g' \ -e 's,@BINDIR@,${bindir},g' \ -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ - ${D}${systemd_system_unitdir}/sshd.socket ${D}${systemd_system_unitdir}/*.service + ${D}${systemd_system_unitdir}/*.service sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ ${D}${sysconfdir}/init.d/sshd --2.25.1
Quoted 8 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#191874): https://lists.openembedded.org/g/openembedded-core/message/191874
Mute This Topic: https://lists.openembedded.org/mt/103009646/3618097
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=---
Alex Kiernan
Signature · 1 line
Alex Kiernan
Re: [OE-core] [PATCH v4] openssh: Add PACKAGECONFIG option to customize sshd mode
Hi Alex,
The SYSTEMD_SERVICE variable is used to control per-service preset now and we use PACKAGECONFIG to help define the variable for SYSTEMD_SERVICE as below.SYSTEMD_PACKAGES = "${PN}-sshd"
SYSTEMD_SERVICE:${PN}-sshd = "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket', '', d)} ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service', '', d)}"
Thanks,
________________________________
From: Alex Kiernan <[email protected]>
Sent: Thursday, December 7, 2023 20:11
To: Yu, Mingli <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: [OE-core] [PATCH v4] openssh: Add PACKAGECONFIG option to customize sshd mode
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.
Quoted 7 lines · Mingli
Hi Alex,
Thanks for your suggestion!
Both sshd.socket and sshd.service belong to openssh-sshd package, so using
SYSTEMD_AUTO_ENABLEcan't enable one of them, it just can enable both or disable both.
Yes, it would need changes to support per-service presets, which I suspect would be generally useful.
Quoted 98 lines
Thanks,
________________________________
From: Alex Kiernan <[email protected]>
Sent: Wednesday, December 6, 2023 18:37
To: Yu, Mingli <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: [OE-core] [PATCH v4] openssh: Add PACKAGECONFIG option to customize sshd modeCAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.Quoted 11 lines · Mingli
From: Mingli Yu <[email protected]>
Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket and systemd-sshd-service-mode PACKAGECONFIG option to choose installing sshd.service.
The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default and user can customize the above two PACKAGECONFIG option to choose the sshd mode.
Quoted 7 lines
Signed-off-by Mingli Yu <[email protected]>---
Changed in v3:
rebase based on https://lore.kernel.org/all/[email protected]/Changed in v4:
make it possible to install both sshd.socket and sshd.serviceI'm wondering if we should make
SYSTEMD_AUTO_ENABLEsettable per service, so you could then install both and manage which one is active with a preset.Quoted 63 lines
.../openssh/openssh_9.5p1.bb | 25 ++++++++++++++-----
1 file changed, 19 insertions(+), 6 deletions(-)meta/recipes-connectivity/openssh/openssh_9.5p1.bb +19
-7@@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd" INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9" SYSTEMD_PACKAGES = "${PN}-sshd" -SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service" +SYSTEMD_SERVICE:${PN}-sshd = "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket', '', d)} ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service', '', d)}" inherit autotools-brokensep ptest pkgconfig -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" +# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode +# corresponding to sshd.service +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} systemd-sshd-socket-mode" PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd" +PACKAGECONFIG[systemd-sshd-socket-mode] = "" +PACKAGECONFIG[systemd-sshd-service-mode] = "" EXTRA_AUTORECONF += "--exclude=aclocal"@@ -124,15 +128,24 @@ do_install:append () { echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly install -d ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} + install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ + ${D}${systemd_system_unitdir}/sshd.socket + fi + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} + fi install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_system_unitdir} sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ -e 's,@SBINDIR@,${sbindir},g' \ -e 's,@BINDIR@,${bindir},g' \ -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ - ${D}${systemd_system_unitdir}/sshd.socket ${D}${systemd_system_unitdir}/*.service + ${D}${systemd_system_unitdir}/*.service sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ ${D}${sysconfdir}/init.d/sshd --2.25.1
Quoted 12 lines
Quoted 8 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#191874): https://lists.openembedded.org/g/openembedded-core/message/191874
Mute This Topic: https://lists.openembedded.org/mt/103009646/3618097
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=---
Alex Kiernan
--
Alex Kiernan
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [OE-core] [PATCH v4] openssh: Add PACKAGECONFIG option to customize sshd mode
Ping.
Thanks,
Quoted 87 lines · Mingli
From: Mingli Yu <[email protected]>
Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket and systemd-sshd-service-mode PACKAGECONFIG option to choose installing sshd.service.
The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default and user can customize the above two PACKAGECONFIG option to choose the sshd mode.
Signed-off-by Mingli Yu <[email protected]>---
Changed in v3:
rebase based on https://lore.kernel.org/all/[email protected]/Changed in v4:
make it possible to install both sshd.socket and sshd.service
.../openssh/openssh_9.5p1.bb | 25 ++++++++++++++-----1 file changed, 19 insertions(+), 6 deletions(-)meta/recipes-connectivity/openssh/openssh_9.5p1.bb +19
-7@@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd" INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9" SYSTEMD_PACKAGES = "${PN}-sshd" -SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service" +SYSTEMD_SERVICE:${PN}-sshd = "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket', '', d)} ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service', '', d)}" inherit autotools-brokensep ptest pkgconfig -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" +# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode +# corresponding to sshd.service +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} systemd-sshd-socket-mode" PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd" +PACKAGECONFIG[systemd-sshd-socket-mode] = "" +PACKAGECONFIG[systemd-sshd-service-mode] = "" EXTRA_AUTORECONF += "--exclude=aclocal"@@ -124,15 +128,24 @@ do_install:append () { echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly install -d ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} + install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ + ${D}${systemd_system_unitdir}/sshd.socket + fi + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} + fi install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_system_unitdir} sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ -e 's,@SBINDIR@,${sbindir},g' \ -e 's,@BINDIR@,${bindir},g' \ -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ - ${D}${systemd_system_unitdir}/sshd.socket ${D}${systemd_system_unitdir}/*.service + ${D}${systemd_system_unitdir}/*.service sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ ${D}${sysconfdir}/init.d/sshd -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group.
View/Reply Online (#191874): https://lists.openembedded.org/g/openembedded-core/message/191874
Mute This Topic: https://lists.openembedded.org/mt/103009646/3618448
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
RE: [OE-core] [PATCH v2] openssh: Add PACKAGECONFIG option to customize sshd mode
In reply to [email protected]Quoted 29 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Yu, Mingli
Sent: den 5 december 2023 06:52
To: [email protected]
Subject: [OE-core] [PATCH v2] openssh: Add PACKAGECONFIG option to customize sshd modeFrom: Mingli Yu <[email protected]>
Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket and systemd-sshd-service-mode PACKAGECONFIG option to choose installing sshd.service.
The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default and user can customize the above two PACKAGECONFIG option to choose the sshd mode.
Signed-off-by Mingli Yu <[email protected]>--- .../openssh/openssh_9.5p1.bb | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-)meta/recipes-connectivity/openssh/openssh_9.5p1.bb +0
-0@@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd" INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9" SYSTEMD_PACKAGES = "${PN}-sshd"
meta/recipes-connectivity/openssh/openssh_9.5p1.bb INITSCRIPT_NAME:${PN}-sshd = "sshd" · line 60
Quoted 10 lines
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +4
-2-SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service" +SYSTEMD_SERVICE:${PN}-sshd = "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket', '', d)} ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service', '', d)}" inherit autotools-brokensep ptest pkgconfig DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" -PACKAGECONFIG ??= "" +# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode +# corresponding to sshd.service +PACKAGECONFIG ??= " systemd-sshd-socket-mode"
Unnecessary leading space after the first quote.
Quoted 14 lines
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +2
-1PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" +PACKAGECONFIG[systemd-sshd-socket-mode] = "" +PACKAGECONFIG[systemd-sshd-service-mode] = "" EXTRA_AUTORECONF += "--exclude=aclocal"@@ -125,15 +129,23 @@ do_install:append () { echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly install -d ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir}
meta/recipes-connectivity/openssh/openssh_9.5p1.bb do_install:append () { · line 139
Quoted 10 lines
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +8
-2- install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} + install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ + ${D}${systemd_system_unitdir}/sshd.socket
There is no need to duplicate the sed command here. The original command below would take care of all the files that are actually installed.
meta/recipes-connectivity/openssh/openssh_9.5p1.bb do_install:append () { · line 140
Quoted 1 line
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +1
-0+ elif ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)}; then
Are the PACKAGECONFIGs mutually exclusive? The elif indicates that this is the case. If so, they should be marked as mutually exclusive by changing them to:
PACKAGECONFIG[systemd-sshd-socket-mode] = ",,,,, systemd-sshd-service-mode" PACKAGECONFIG[systemd-sshd-service-mode] = ",,,,, systemd-sshd-socket-mode"
Alternatively, if it is useful to be able to install both the sshd.socket file and the sshd.service file at the same time, then the elif should be changed to a fi and an if.
meta/recipes-connectivity/openssh/openssh_9.5p1.bb do_install:append () { · line 148
Quoted 9 lines
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +3
-1+ install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} + fi install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_system_unitdir} sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ -e 's,@SBINDIR@,${sbindir},g' \ -e 's,@BINDIR@,${bindir},g' \ -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ - ${D}${systemd_system_unitdir}/sshd.socket ${D}${systemd_system_unitdir}/*.service + ${D}${systemd_system_unitdir}/*.service
Keep it as it was.
Quoted 5 lines
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +0
-1sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ ${D}${sysconfdir}/init.d/sshd --2.25.1
//Peter
Re: [OE-core] [PATCH v2] openssh: Add PACKAGECONFIG option to customize sshd mode
Hi Peter,
Thanks very much for your comments!
Please use v4([OE-core] [PATCH v4] openssh: Add PACKAGECONFIG option to customize sshd mode) to track the series.
Thanks,
________________________________
From: Peter Kjellerstedt <[email protected]>
Sent: Thursday, December 7, 2023 06:34
To: Yu, Mingli <[email protected]>; [email protected] <[email protected]>
Subject: RE: [OE-core] [PATCH v2] openssh: Add PACKAGECONFIG option to customize sshd mode
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.
Quoted 29 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Yu, Mingli
Sent: den 5 december 2023 06:52
To: [email protected]
Subject: [OE-core] [PATCH v2] openssh: Add PACKAGECONFIG option to customize sshd modeFrom: Mingli Yu <[email protected]>
Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket and systemd-sshd-service-mode PACKAGECONFIG option to choose installing sshd.service.
The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default and user can customize the above two PACKAGECONFIG option to choose the sshd mode.
Signed-off-by Mingli Yu <[email protected]>--- .../openssh/openssh_9.5p1.bb | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-)meta/recipes-connectivity/openssh/openssh_9.5p1.bb +0
-0@@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd" INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9" SYSTEMD_PACKAGES = "${PN}-sshd"
meta/recipes-connectivity/openssh/openssh_9.5p1.bb INITSCRIPT_NAME:${PN}-sshd = "sshd" · line 60
Quoted 10 lines
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +4
-2-SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service" +SYSTEMD_SERVICE:${PN}-sshd = "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket', '', d)} ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service', '', d)}" inherit autotools-brokensep ptest pkgconfig DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" -PACKAGECONFIG ??= "" +# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode +# corresponding to sshd.service +PACKAGECONFIG ??= " systemd-sshd-socket-mode"
Unnecessary leading space after the first quote.
Quoted 14 lines
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +2
-1PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" +PACKAGECONFIG[systemd-sshd-socket-mode] = "" +PACKAGECONFIG[systemd-sshd-service-mode] = "" EXTRA_AUTORECONF += "--exclude=aclocal"@@ -125,15 +129,23 @@ do_install:append () { echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly install -d ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir}
meta/recipes-connectivity/openssh/openssh_9.5p1.bb do_install:append () { · line 139
Quoted 10 lines
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +8
-2- install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} - install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then + install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir} + install -c -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ + ${D}${systemd_system_unitdir}/sshd.socket
There is no need to duplicate the sed command here. The original command below would take care of all the files that are actually installed.
meta/recipes-connectivity/openssh/openssh_9.5p1.bb do_install:append () { · line 140
Quoted 1 line
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +1
-0+ elif ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)}; then
Are the PACKAGECONFIGs mutually exclusive? The elif indicates that this is the case. If so, they should be marked as mutually exclusive by changing them to:
PACKAGECONFIG[systemd-sshd-socket-mode] = ",,,,, systemd-sshd-service-mode" PACKAGECONFIG[systemd-sshd-service-mode] = ",,,,, systemd-sshd-socket-mode"
Alternatively, if it is useful to be able to install both the sshd.socket file and the sshd.service file at the same time, then the elif should be changed to a fi and an if.
meta/recipes-connectivity/openssh/openssh_9.5p1.bb do_install:append () { · line 148
Quoted 9 lines
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +3
-1+ install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir} + fi install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_system_unitdir} sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ -e 's,@SBINDIR@,${sbindir},g' \ -e 's,@BINDIR@,${bindir},g' \ -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ - ${D}${systemd_system_unitdir}/sshd.socket ${D}${systemd_system_unitdir}/*.service + ${D}${systemd_system_unitdir}/*.service
Keep it as it was.
Quoted 5 lines
meta/recipes-connectivity/openssh/openssh_9.5p1.bb +0
-1sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \ ${D}${sysconfdir}/init.d/sshd --2.25.1
//Peter