summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2002-07-03 14:21:06 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2002-07-03 14:21:06 +0000
commitbdef7cefef70cb4b64a79c585382b7097c173724 (patch)
tree668094abfd9a806d8f31b47266a8f291c75096e1
parent0817a614e6881fafcdb6d01b89d2f8295b231330 (diff)
re-enable ssh-keysign's sbit, but make ssh-keysign read /etc/ssh/ssh_config
and exit if HostbasedAuthentication is disabled globally. based on discussions with deraadt, itojun and sommerfeld; ok itojun@
-rw-r--r--usr.bin/ssh/ssh-keysign.817
-rw-r--r--usr.bin/ssh/ssh-keysign.c16
-rw-r--r--usr.bin/ssh/ssh-keysign/Makefile6
-rw-r--r--usr.bin/ssh/ssh.c5
-rw-r--r--usr.bin/ssh/ssh_config3
5 files changed, 39 insertions, 8 deletions
diff --git a/usr.bin/ssh/ssh-keysign.8 b/usr.bin/ssh/ssh-keysign.8
index ab2cf21bab3..cea4a8244a6 100644
--- a/usr.bin/ssh/ssh-keysign.8
+++ b/usr.bin/ssh/ssh-keysign.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ssh-keysign.8,v 1.2 2002/06/10 16:56:30 stevesk Exp $
+.\" $OpenBSD: ssh-keysign.8,v 1.3 2002/07/03 14:21:05 markus Exp $
.\"
.\" Copyright (c) 2002 Markus Friedl. All rights reserved.
.\"
@@ -36,6 +36,16 @@ is used by
.Xr ssh 1
to access the local host keys and generate the digital signature
required during hostbased authentication with SSH protocol version 2.
+.Pp
+.Nm
+is disabled by default and can only be enabled in the
+the global client configuration file
+.Pa /etc/ssh/ssh_config
+by setting
+.Cm HostbasedAuthentication
+to
+.Dq yes .
+.Pp
.Nm
is not intended to be invoked by the user, but from
.Xr ssh 1 .
@@ -46,6 +56,10 @@ and
for more information about hostbased authentication.
.Sh FILES
.Bl -tag -width Ds
+.It Pa /etc/ssh/ssh_config
+Controls whether
+.Nm
+is enabled.
.It Pa /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_key
These files contain the private parts of the host keys used to
generate the digital signature. They
@@ -58,6 +72,7 @@ must be set-uid root if hostbased authentication is used.
.Sh SEE ALSO
.Xr ssh 1 ,
.Xr ssh-keygen 1 ,
+.Xr ssh_config 5 ,
.Xr sshd 8
.Sh AUTHORS
Markus Friedl <markus@openbsd.org>
diff --git a/usr.bin/ssh/ssh-keysign.c b/usr.bin/ssh/ssh-keysign.c
index 151981227af..f76cfcc6566 100644
--- a/usr.bin/ssh/ssh-keysign.c
+++ b/usr.bin/ssh/ssh-keysign.c
@@ -22,7 +22,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-keysign.c,v 1.6 2002/07/03 09:55:38 markus Exp $");
+RCSID("$OpenBSD: ssh-keysign.c,v 1.7 2002/07/03 14:21:05 markus Exp $");
#include <openssl/evp.h>
#include <openssl/rand.h>
@@ -30,6 +30,7 @@ RCSID("$OpenBSD: ssh-keysign.c,v 1.6 2002/07/03 09:55:38 markus Exp $");
#include "log.h"
#include "key.h"
+#include "ssh.h"
#include "ssh2.h"
#include "misc.h"
#include "xmalloc.h"
@@ -39,6 +40,9 @@ RCSID("$OpenBSD: ssh-keysign.c,v 1.6 2002/07/03 09:55:38 markus Exp $");
#include "msg.h"
#include "canohost.h"
#include "pathnames.h"
+#include "readconf.h"
+
+uid_t original_real_uid; /* XXX readconf.c needs this */
static int
valid_request(struct passwd *pw, char *host, Key **ret, u_char *data,
@@ -130,6 +134,7 @@ int
main(int argc, char **argv)
{
Buffer b;
+ Options options;
Key *keys[2], *key;
struct passwd *pw;
int key_fd[2], i, found, version = 2, fd;
@@ -148,6 +153,15 @@ main(int argc, char **argv)
log_init("ssh-keysign", SYSLOG_LEVEL_DEBUG3, SYSLOG_FACILITY_AUTH, 0);
#endif
+ /* verify that ssh-keysign is enabled by the admin */
+ original_real_uid = getuid(); /* XXX readconf.c needs this */
+ initialize_options(&options);
+ (void)read_config_file(_PATH_HOST_CONFIG_FILE, "", &options);
+ fill_default_options(&options);
+ if (options.hostbased_authentication != 1)
+ fatal("Hostbased authentication not enabled in %s",
+ _PATH_HOST_CONFIG_FILE);
+
if (key_fd[0] == -1 && key_fd[1] == -1)
fatal("could not open any host key");
diff --git a/usr.bin/ssh/ssh-keysign/Makefile b/usr.bin/ssh/ssh-keysign/Makefile
index 56d7832de51..19bd9b50192 100644
--- a/usr.bin/ssh/ssh-keysign/Makefile
+++ b/usr.bin/ssh/ssh-keysign/Makefile
@@ -1,16 +1,16 @@
-# $OpenBSD: Makefile,v 1.4 2002/07/01 08:05:48 markus Exp $
+# $OpenBSD: Makefile,v 1.5 2002/07/03 14:21:05 markus Exp $
.PATH: ${.CURDIR}/..
PROG= ssh-keysign
BINOWN= root
-#BINMODE?=4555
+BINMODE?=4555
BINDIR= /usr/libexec
MAN= ssh-keysign.8
-SRCS= ssh-keysign.c
+SRCS= ssh-keysign.c readconf.c
.include <bsd.prog.mk>
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c
index 3e1b37dce59..2a50fa47683 100644
--- a/usr.bin/ssh/ssh.c
+++ b/usr.bin/ssh/ssh.c
@@ -40,7 +40,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh.c,v 1.180 2002/06/30 21:59:45 deraadt Exp $");
+RCSID("$OpenBSD: ssh.c,v 1.181 2002/07/03 14:21:05 markus Exp $");
#include <openssl/evp.h>
#include <openssl/err.h>
@@ -625,7 +625,8 @@ again:
_PATH_HOST_RSA_KEY_FILE, "", NULL);
PRIV_END;
- if (sensitive_data.keys[0] == NULL &&
+ if (options.hostbased_authentication == 1 &&
+ sensitive_data.keys[0] == NULL &&
sensitive_data.keys[1] == NULL &&
sensitive_data.keys[2] == NULL) {
sensitive_data.keys[1] = key_load_public(
diff --git a/usr.bin/ssh/ssh_config b/usr.bin/ssh/ssh_config
index ef31d4336bf..94cffbf395a 100644
--- a/usr.bin/ssh/ssh_config
+++ b/usr.bin/ssh/ssh_config
@@ -1,4 +1,4 @@
-# $OpenBSD: ssh_config,v 1.15 2002/06/20 20:03:34 stevesk Exp $
+# $OpenBSD: ssh_config,v 1.16 2002/07/03 14:21:05 markus Exp $
# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
@@ -22,6 +22,7 @@
# RhostsRSAAuthentication no
# RSAAuthentication yes
# PasswordAuthentication yes
+# HostbasedAuthentication no
# BatchMode no
# CheckHostIP yes
# StrictHostKeyChecking ask