1 From 977c5b82db3659f87ef74094bb68782035fdcf17 Mon Sep 17 00:00:00 2001
2 From: Alex Wilson <alex.wilson@joyent.com>
3 Date: Fri, 7 Aug 2015 13:32:53 -0700
4 Subject: [PATCH 27/36] Add --with-key-dir configure option to place SSH host
5 keys
6
7 ---
8 Makefile.in | 12 +++++++-----
9 configure.ac | 16 ++++++++++++++++
10 pathnames.h | 16 ++++++++++------
11 3 files changed, 33 insertions(+), 11 deletions(-)
12
13 diff --git a/Makefile.in b/Makefile.in
14 index 7130542..5e05771 100644
15 --- a/Makefile.in
16 +++ b/Makefile.in
17 @@ -18,6 +18,7 @@ sysconfdir=@sysconfdir@
18 piddir=@piddir@
19 srcdir=@srcdir@
20 top_srcdir=@top_srcdir@
21 +keydir=@keydir@
22
23 DESTDIR=
24 VPATH=@srcdir@
25 @@ -132,11 +133,11 @@ PATHSUBS = \
26 -e 's|/etc/ssh/sshd_config|$(sysconfdir)/sshd_config|g' \
27 -e 's|/usr/libexec|$(libexecdir)|g' \
28 -e 's|/etc/shosts.equiv|$(sysconfdir)/shosts.equiv|g' \
29 - -e 's|/etc/ssh/ssh_host_key|$(sysconfdir)/ssh_host_key|g' \
30 - -e 's|/etc/ssh/ssh_host_ecdsa_key|$(sysconfdir)/ssh_host_ecdsa_key|g' \
31 - -e 's|/etc/ssh/ssh_host_dsa_key|$(sysconfdir)/ssh_host_dsa_key|g' \
32 - -e 's|/etc/ssh/ssh_host_rsa_key|$(sysconfdir)/ssh_host_rsa_key|g' \
33 - -e 's|/etc/ssh/ssh_host_ed25519_key|$(sysconfdir)/ssh_host_ed25519_key|g' \
34 + -e 's|/etc/ssh/ssh_host_key|$(keydir)/ssh_host_key|g' \
35 + -e 's|/etc/ssh/ssh_host_ecdsa_key|$(keydir)/ssh_host_ecdsa_key|g' \
36 + -e 's|/etc/ssh/ssh_host_dsa_key|$(keydir)/ssh_host_dsa_key|g' \
37 + -e 's|/etc/ssh/ssh_host_rsa_key|$(keydir)/ssh_host_rsa_key|g' \
38 + -e 's|/etc/ssh/ssh_host_ed25519_key|$(keydir)/ssh_host_ed25519_key|g' \
39 -e 's|/var/run/sshd.pid|$(piddir)/sshd.pid|g' \
40 -e 's|/etc/moduli|$(sysconfdir)/moduli|g' \
41 -e 's|/etc/ssh/moduli|$(sysconfdir)/moduli|g' \
42 @@ -365,6 +366,7 @@ install-files:
43 $(srcdir)/mkinstalldirs $(SMFNETMANIDIR)
44 $(INSTALL) -m 555 smf/method.sh $(SMFMETHODDIR)/sshd
45 $(INSTALL) -m 444 smf/manifest.xml $(SMFNETMANIDIR)/ssh.xml
46 + mkdir -p $(DESTDIR)$(keydir)
47
48 install-sysconf:
49 if [ ! -d $(DESTDIR)$(sysconfdir) ]; then \
50 diff --git a/configure.ac b/configure.ac
51 index b38b1b3..8c0abd6 100644
52 --- a/configure.ac
53 +++ b/configure.ac
54 @@ -4638,6 +4638,20 @@ AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
55 [Specify location of ssh.pid])
56 AC_SUBST([piddir])
57
58 +keydir=$sysconfdir
59 +AC_ARG_WITH([key-dir],
60 + [ --with-key-dir=PATH Specify location of SSH host keys],
61 + [
62 + if test -n "$withval" && test "x$withval" != "xno" && \
63 + test "x${withval}" != "xyes"; then
64 + keydir=$withval
65 + fi
66 + ]
67 +)
68 +AC_DEFINE_UNQUOTED([SSHKEYDIR], ["$keydir"],
69 + [Specify location of SSH host keys])
70 +AC_SUBST([keydir])
71 +
72 dnl allow user to disable some login recording features
73 AC_ARG_ENABLE([lastlog],
74 [ --disable-lastlog disable use of lastlog even if detected [no]],
75 @@ -4942,12 +4956,14 @@ G=`eval echo ${piddir}` ; G=`eval echo ${G}`
76 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
77 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
78 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
79 +K=`eval echo ${keydir}` ; K=`eval echo ${K}`
80
81 echo ""
82 echo "OpenSSH has been configured with the following options:"
83 echo " User binaries: $B"
84 echo " System binaries: $C"
85 echo " Configuration files: $D"
86 +echo " Keys and moduli: $K"
87 echo " Askpass program: $E"
88 echo " Manual pages: $F"
89 echo " PID file: $G"
90 diff --git a/pathnames.h b/pathnames.h
91 index ec89fc6..0b2281b 100644
92 --- a/pathnames.h
93 +++ b/pathnames.h
94 @@ -22,6 +22,10 @@
95 #define _PATH_SSH_PIDDIR "/var/run"
96 #endif
97
98 +#ifndef SSHKEYDIR
99 +#define SSHKEYDIR SSHDIR
100 +#endif
101 +
102 /*
103 * System-wide file containing host keys of known hosts. This file should be
104 * world-readable.
105 @@ -36,12 +40,12 @@
106 */
107 #define _PATH_SERVER_CONFIG_FILE SSHDIR "/sshd_config"
108 #define _PATH_HOST_CONFIG_FILE SSHDIR "/ssh_config"
109 -#define _PATH_HOST_KEY_FILE SSHDIR "/ssh_host_key"
110 -#define _PATH_HOST_DSA_KEY_FILE SSHDIR "/ssh_host_dsa_key"
111 -#define _PATH_HOST_ECDSA_KEY_FILE SSHDIR "/ssh_host_ecdsa_key"
112 -#define _PATH_HOST_ED25519_KEY_FILE SSHDIR "/ssh_host_ed25519_key"
113 -#define _PATH_HOST_RSA_KEY_FILE SSHDIR "/ssh_host_rsa_key"
114 -#define _PATH_DH_MODULI SSHDIR "/moduli"
115 +#define _PATH_HOST_KEY_FILE SSHKEYDIR "/ssh_host_key"
116 +#define _PATH_HOST_DSA_KEY_FILE SSHKEYDIR "/ssh_host_dsa_key"
117 +#define _PATH_HOST_ECDSA_KEY_FILE SSHKEYDIR "/ssh_host_ecdsa_key"
118 +#define _PATH_HOST_ED25519_KEY_FILE SSHKEYDIR "/ssh_host_ed25519_key"
119 +#define _PATH_HOST_RSA_KEY_FILE SSHKEYDIR "/ssh_host_rsa_key"
120 +#define _PATH_DH_MODULI SSHKEYDIR "/moduli"
121 /* Backwards compatibility */
122 #define _PATH_DH_PRIMES SSHDIR "/primes"
123
124 --
125 2.5.4 (Apple Git-61)
126