commit:     2069b41a2cd93fde9598508690671175b38e1cd0
Author:     Craig Andrews <candrews <AT> gentoo <DOT> org>
AuthorDate: Fri May 17 19:25:19 2024 +0000
Commit:     Craig Andrews <candrews <AT> gentoo <DOT> org>
CommitDate: Fri May 17 19:27:26 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2069b41a

net-misc/sslh: fix systemd service installation

https://bugs.gentoo.org/932015
Signed-off-by: Craig Andrews <candrews <AT> gentoo.org>

 net-misc/sslh/files/sslh.service | 28 ++++++++++++++++++++++++++++
 net-misc/sslh/sslh-2.1.2.ebuild  |  3 +--
 net-misc/sslh/sslh-9999.ebuild   |  3 +--
 3 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/net-misc/sslh/files/sslh.service b/net-misc/sslh/files/sslh.service
new file mode 100644
index 000000000000..9d58362220f0
--- /dev/null
+++ b/net-misc/sslh/files/sslh.service
@@ -0,0 +1,28 @@
+# /etc/systemd/system/sslh.service
+[Unit]
+Description=SSL/SSH multiplexer (fork mode) for %I
+After=network.target
+
+[Service]
+EnvironmentFile=/etc/conf.d/sslh
+ExecStart=/usr/sbin/sslh -f $DAEMON_OPTS
+KillMode=process
+#Hardening
+PrivateTmp=true
+CapabilityBoundingSet=CAP_NET_BIND_SERVICE
+AmbientCapabilities=CAP_NET_BIND_SERVICE
+SecureBits=noroot-locked
+ProtectSystem=strict
+ProtectHome=true
+ProtectKernelModules=true
+ProtectKernelTunables=true
+ProtectControlGroups=true
+MountFlags=private
+NoNewPrivileges=true
+PrivateDevices=true
+RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
+MemoryDenyWriteExecute=true
+DynamicUser=true
+
+[Install]
+WantedBy=multi-user.target

diff --git a/net-misc/sslh/sslh-2.1.2.ebuild b/net-misc/sslh/sslh-2.1.2.ebuild
index 1a3dc9b9f8e3..efb4eb40c48d 100644
--- a/net-misc/sslh/sslh-2.1.2.ebuild
+++ b/net-misc/sslh/sslh-2.1.2.ebuild
@@ -76,8 +76,7 @@ src_install() {
 
        if use systemd; then
                # Gentoo puts the binaries in /usr/sbin, but upstream puts them 
in /usr/bin
-               sed -i -e 's~/usr/bin/~/usr/sbin/~g' 
scripts/systemd.sslh.service || die
-               systemd_newunit scripts/systemd.sslh.service sslh.service
+               systemd_newunit "${FILESDIR}/sslh.service" sslh.service
                exeinto /usr/lib/systemd/system-generators/
                doexe systemd-sslh-generator
        fi

diff --git a/net-misc/sslh/sslh-9999.ebuild b/net-misc/sslh/sslh-9999.ebuild
index 1a3dc9b9f8e3..efb4eb40c48d 100644
--- a/net-misc/sslh/sslh-9999.ebuild
+++ b/net-misc/sslh/sslh-9999.ebuild
@@ -76,8 +76,7 @@ src_install() {
 
        if use systemd; then
                # Gentoo puts the binaries in /usr/sbin, but upstream puts them 
in /usr/bin
-               sed -i -e 's~/usr/bin/~/usr/sbin/~g' 
scripts/systemd.sslh.service || die
-               systemd_newunit scripts/systemd.sslh.service sslh.service
+               systemd_newunit "${FILESDIR}/sslh.service" sslh.service
                exeinto /usr/lib/systemd/system-generators/
                doexe systemd-sslh-generator
        fi

Reply via email to