|
Jakub Jelen |
4e7cde |
commit 0e22b79bfde45a7cf7a2e51a68ec11c4285f3b31
|
|
Jakub Jelen |
4e7cde |
Author: Jakub Jelen <jjelen@redhat.com>
|
|
Jakub Jelen |
4e7cde |
Date: Mon Nov 21 15:04:06 2016 +0100
|
|
Jakub Jelen |
4e7cde |
|
|
Jakub Jelen |
4e7cde |
systemd stuff
|
|
Jakub Jelen |
4e7cde |
|
|
Jakub Jelen |
4e7cde |
diff --git a/configure.ac b/configure.ac
|
|
Jakub Jelen |
4e7cde |
index 2ffc369..162ce92 100644
|
|
Jakub Jelen |
4e7cde |
--- a/configure.ac
|
|
Jakub Jelen |
4e7cde |
+++ b/configure.ac
|
|
Jakub Jelen |
4e7cde |
@@ -4265,6 +4265,30 @@ AC_ARG_WITH([kerberos5],
|
|
Jakub Jelen |
4e7cde |
AC_SUBST([GSSLIBS])
|
|
Jakub Jelen |
4e7cde |
AC_SUBST([K5LIBS])
|
|
Jakub Jelen |
4e7cde |
|
|
Jakub Jelen |
4e7cde |
+# Check whether user wants systemd support
|
|
Jakub Jelen |
4e7cde |
+SYSTEMD_MSG="no"
|
|
Jakub Jelen |
4e7cde |
+AC_ARG_WITH(systemd,
|
|
Jakub Jelen |
4e7cde |
+ [ --with-systemd Enable systemd support],
|
|
Jakub Jelen |
4e7cde |
+ [ if test "x$withval" != "xno" ; then
|
|
Jakub Jelen |
4e7cde |
+ AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
|
|
Jakub Jelen |
4e7cde |
+ if test "$PKGCONFIG" != "no"; then
|
|
Jakub Jelen |
4e7cde |
+ AC_MSG_CHECKING([for libsystemd])
|
|
Jakub Jelen |
4e7cde |
+ if $PKGCONFIG --exists libsystemd; then
|
|
Jakub Jelen |
4e7cde |
+ SYSTEMD_CFLAGS=`$PKGCONFIG --cflags libsystemd`
|
|
Jakub Jelen |
4e7cde |
+ SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
|
|
Jakub Jelen |
4e7cde |
+ CPPFLAGS="$CPPFLAGS $SYSTEMD_CFLAGS"
|
|
Jakub Jelen |
4e7cde |
+ SSHDLIBS="$SSHDLIBS $SYSTEMD_LIBS"
|
|
Jakub Jelen |
4e7cde |
+ AC_MSG_RESULT([yes])
|
|
Jakub Jelen |
4e7cde |
+ AC_DEFINE(HAVE_SYSTEMD, 1, [Define if you want systemd support.])
|
|
Jakub Jelen |
4e7cde |
+ SYSTEMD_MSG="yes"
|
|
Jakub Jelen |
4e7cde |
+ else
|
|
Jakub Jelen |
4e7cde |
+ AC_MSG_RESULT([no])
|
|
Jakub Jelen |
4e7cde |
+ fi
|
|
Jakub Jelen |
4e7cde |
+ fi
|
|
Jakub Jelen |
4e7cde |
+ fi ]
|
|
Jakub Jelen |
4e7cde |
+)
|
|
Jakub Jelen |
4e7cde |
+
|
|
Jakub Jelen |
4e7cde |
+
|
|
Jakub Jelen |
4e7cde |
# Looking for programs, paths and files
|
|
Jakub Jelen |
4e7cde |
|
|
Jakub Jelen |
4e7cde |
PRIVSEP_PATH=/var/empty
|
|
Jakub Jelen |
4e7cde |
@@ -5097,6 +5121,7 @@ echo " libedit support: $LIBEDIT_MSG"
|
|
Jakub Jelen |
4e7cde |
echo " Solaris process contract support: $SPC_MSG"
|
|
Jakub Jelen |
4e7cde |
echo " Solaris project support: $SP_MSG"
|
|
Jakub Jelen |
4e7cde |
echo " Solaris privilege support: $SPP_MSG"
|
|
Jakub Jelen |
4e7cde |
+echo " systemd support: $SYSTEMD_MSG"
|
|
Jakub Jelen |
4e7cde |
echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
|
|
Jakub Jelen |
4e7cde |
echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
|
|
Jakub Jelen |
4e7cde |
echo " BSD Auth support: $BSD_AUTH_MSG"
|
|
Jakub Jelen |
4e7cde |
diff --git a/contrib/sshd.service b/contrib/sshd.service
|
|
Jakub Jelen |
4e7cde |
new file mode 100644
|
|
Jakub Jelen |
4e7cde |
index 0000000..e0d4923
|
|
Jakub Jelen |
4e7cde |
--- /dev/null
|
|
Jakub Jelen |
4e7cde |
+++ b/contrib/sshd.service
|
|
Jakub Jelen |
4e7cde |
@@ -0,0 +1,16 @@
|
|
Jakub Jelen |
4e7cde |
+[Unit]
|
|
Jakub Jelen |
4e7cde |
+Description=OpenSSH server daemon
|
|
Jakub Jelen |
4e7cde |
+Documentation=man:sshd(8) man:sshd_config(5)
|
|
Jakub Jelen |
4e7cde |
+After=network.target
|
|
Jakub Jelen |
4e7cde |
+
|
|
Jakub Jelen |
4e7cde |
+[Service]
|
|
Jakub Jelen |
4e7cde |
+Type=notify
|
|
Jakub Jelen |
4e7cde |
+ExecStart=/usr/sbin/sshd -D $OPTIONS
|
|
Jakub Jelen |
4e7cde |
+ExecReload=/bin/kill -HUP $MAINPID
|
|
Jakub Jelen |
4e7cde |
+KillMode=process
|
|
Jakub Jelen |
4e7cde |
+Restart=on-failure
|
|
Jakub Jelen |
4e7cde |
+RestartPreventExitStatus=255
|
|
Jakub Jelen |
4e7cde |
+
|
|
Jakub Jelen |
4e7cde |
+[Install]
|
|
Jakub Jelen |
4e7cde |
+WantedBy=multi-user.target
|
|
Jakub Jelen |
4e7cde |
+
|
|
Jakub Jelen |
4e7cde |
diff --git a/sshd.c b/sshd.c
|
|
Jakub Jelen |
4e7cde |
index 816611c..b8b9d13 100644
|
|
Jakub Jelen |
4e7cde |
--- a/sshd.c
|
|
Jakub Jelen |
4e7cde |
+++ b/sshd.c
|
|
Jakub Jelen |
4e7cde |
@@ -85,6 +85,10 @@
|
|
Jakub Jelen |
4e7cde |
#include <prot.h>
|
|
Jakub Jelen |
4e7cde |
#endif
|
|
Jakub Jelen |
4e7cde |
|
|
Jakub Jelen |
4e7cde |
+#ifdef HAVE_SYSTEMD
|
|
Jakub Jelen |
4e7cde |
+#include <systemd/sd-daemon.h>
|
|
Jakub Jelen |
4e7cde |
+#endif
|
|
Jakub Jelen |
4e7cde |
+
|
|
Jakub Jelen |
4e7cde |
#include "xmalloc.h"
|
|
Jakub Jelen |
4e7cde |
#include "ssh.h"
|
|
Jakub Jelen |
4e7cde |
#include "ssh2.h"
|
|
Jakub Jelen |
b83281 |
@@ -1888,6 +1892,11 @@ main(int ac, char **av)
|
|
Jakub Jelen |
b83281 |
}
|
|
Jakub Jelen |
b83281 |
}
|
|
Jakub Jelen |
4e7cde |
|
|
Jakub Jelen |
4e7cde |
+#ifdef HAVE_SYSTEMD
|
|
Jakub Jelen |
b83281 |
+ /* Signal systemd that we are ready to accept connections */
|
|
Jakub Jelen |
b83281 |
+ sd_notify(0, "READY=1");
|
|
Jakub Jelen |
4e7cde |
+#endif
|
|
Jakub Jelen |
4e7cde |
+
|
|
Jakub Jelen |
b83281 |
/* Accept a connection and return in a forked child */
|
|
Jakub Jelen |
b83281 |
server_accept_loop(&sock_in, &sock_out,
|
|
Jakub Jelen |
b83281 |
&newsock, config_s);
|