]> andersk Git - openssh.git/blobdiff - servconf.c
- stevesk@cvs.openbsd.org 2002/06/20 20:03:34
[openssh.git] / servconf.c
index 445d2da79dc2c23181c4108d99eeef7d70c6d28c..7a776ac8e8a797a7a5134a72e62eaac42dfa6833 100644 (file)
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: servconf.c,v 1.97 2002/01/04 18:14:16 stevesk Exp $");
+RCSID("$OpenBSD: servconf.c,v 1.110 2002/05/15 21:56:38 markus Exp $");
 
-#if defined(KRB4) || defined(KRB5)
+#if defined(KRB4)
+#include <krb.h>
+#endif
+#if defined(KRB5)
+#ifdef HEIMDAL
 #include <krb.h>
+#else
+/* Bodge - but then, so is using the kerberos IV KEYFILE to get a Kerberos V
+ * keytab */
+#define KEYFILE "/etc/krb5.keytab"
+#endif
 #endif
 #ifdef AFS
 #include <kafs.h>
@@ -36,6 +45,8 @@ static void add_one_listen_addr(ServerOptions *, char *, u_short);
 
 /* AF_UNSPEC or AF_INET or AF_INET6 */
 extern int IPv4or6;
+/* Use of privilege separation or not */
+extern int use_privsep;
 
 /* Initializes the server options to their default values. */
 
@@ -63,11 +74,12 @@ initialize_server_options(ServerOptions *options)
        options->print_lastlog = -1;
        options->x11_forwarding = -1;
        options->x11_display_offset = -1;
+       options->x11_use_localhost = -1;
        options->xauth_location = NULL;
        options->strict_modes = -1;
        options->keepalives = -1;
-       options->log_facility = (SyslogFacility) - 1;
-       options->log_level = (LogLevel) - 1;
+       options->log_facility = SYSLOG_FACILITY_NOT_SET;
+       options->log_level = SYSLOG_LEVEL_NOT_SET;
        options->rhosts_authentication = -1;
        options->rhosts_rsa_authentication = -1;
        options->hostbased_authentication = -1;
@@ -104,11 +116,14 @@ initialize_server_options(ServerOptions *options)
        options->max_startups_rate = -1;
        options->max_startups = -1;
        options->banner = NULL;
-       options->reverse_mapping_check = -1;
+       options->verify_reverse_mapping = -1;
        options->client_alive_interval = -1;
        options->client_alive_count_max = -1;
        options->authorized_keys_file = NULL;
        options->authorized_keys_file2 = NULL;
+
+       /* Needs to be accessable in many places */
+       use_privsep = -1;
 }
 
 void
@@ -159,15 +174,17 @@ fill_default_server_options(ServerOptions *options)
                options->x11_forwarding = 0;
        if (options->x11_display_offset == -1)
                options->x11_display_offset = 10;
+       if (options->x11_use_localhost == -1)
+               options->x11_use_localhost = 1;
        if (options->xauth_location == NULL)
                options->xauth_location = _PATH_XAUTH;
        if (options->strict_modes == -1)
                options->strict_modes = 1;
        if (options->keepalives == -1)
                options->keepalives = 1;
-       if (options->log_facility == (SyslogFacility) (-1))
+       if (options->log_facility == SYSLOG_FACILITY_NOT_SET)
                options->log_facility = SYSLOG_FACILITY_AUTH;
-       if (options->log_level == (LogLevel) (-1))
+       if (options->log_level == SYSLOG_LEVEL_NOT_SET)
                options->log_level = SYSLOG_LEVEL_INFO;
        if (options->rhosts_authentication == -1)
                options->rhosts_authentication = 0;
@@ -183,7 +200,7 @@ fill_default_server_options(ServerOptions *options)
                options->pubkey_authentication = 1;
 #if defined(KRB4) || defined(KRB5)
        if (options->kerberos_authentication == -1)
-               options->kerberos_authentication = (access(KEYFILE, R_OK) == 0);
+               options->kerberos_authentication = 0;
        if (options->kerberos_or_local_passwd == -1)
                options->kerberos_or_local_passwd = 1;
        if (options->kerberos_ticket_cleanup == -1)
@@ -195,7 +212,7 @@ fill_default_server_options(ServerOptions *options)
 #endif
 #ifdef AFS
        if (options->afs_token_passing == -1)
-               options->afs_token_passing = k_hasafs();
+               options->afs_token_passing = 0;
 #endif
        if (options->password_authentication == -1)
                options->password_authentication = 1;
@@ -217,8 +234,8 @@ fill_default_server_options(ServerOptions *options)
                options->max_startups_rate = 100;               /* 100% */
        if (options->max_startups_begin == -1)
                options->max_startups_begin = options->max_startups;
-       if (options->reverse_mapping_check == -1)
-               options->reverse_mapping_check = 0;
+       if (options->verify_reverse_mapping == -1)
+               options->verify_reverse_mapping = 0;
        if (options->client_alive_interval == -1)
                options->client_alive_interval = 0;
        if (options->client_alive_count_max == -1)
@@ -232,6 +249,10 @@ fill_default_server_options(ServerOptions *options)
        }
        if (options->authorized_keys_file == NULL)
                options->authorized_keys_file = _PATH_SSH_USER_PERMITTED_KEYS;
+
+       /* Turn privilege separation on by default */
+       if (use_privsep == -1)
+               use_privsep = 1;
 }
 
 /* Keyword tokens. */
@@ -255,15 +276,16 @@ typedef enum {
        sChallengeResponseAuthentication,
        sPasswordAuthentication, sKbdInteractiveAuthentication, sListenAddress,
        sPrintMotd, sPrintLastLog, sIgnoreRhosts,
-       sX11Forwarding, sX11DisplayOffset,
+       sX11Forwarding, sX11DisplayOffset, sX11UseLocalhost,
        sStrictModes, sEmptyPasswd, sKeepAlives,
        sUseLogin, sAllowTcpForwarding,
        sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups,
        sIgnoreUserKnownHosts, sCiphers, sMacs, sProtocol, sPidFile,
        sGatewayPorts, sPubkeyAuthentication, sXAuthLocation, sSubsystem, sMaxStartups,
-       sBanner, sReverseMappingCheck, sHostbasedAuthentication,
+       sBanner, sVerifyReverseMapping, sHostbasedAuthentication,
        sHostbasedUsesNameFromPacketOnly, sClientAliveInterval,
        sClientAliveCountMax, sAuthorizedKeysFile, sAuthorizedKeysFile2,
+       sUsePrivilegeSeparation,
        sDeprecated
 } ServerOpCodes;
 
@@ -315,6 +337,7 @@ static struct {
        { "ignoreuserknownhosts", sIgnoreUserKnownHosts },
        { "x11forwarding", sX11Forwarding },
        { "x11displayoffset", sX11DisplayOffset },
+       { "x11uselocalhost", sX11UseLocalhost },
        { "xauthlocation", sXAuthLocation },
        { "strictmodes", sStrictModes },
        { "permitemptypasswords", sEmptyPasswd },
@@ -332,11 +355,13 @@ static struct {
        { "subsystem", sSubsystem },
        { "maxstartups", sMaxStartups },
        { "banner", sBanner },
-       { "reversemappingcheck", sReverseMappingCheck },
+       { "verifyreversemapping", sVerifyReverseMapping },
+       { "reversemappingcheck", sVerifyReverseMapping },
        { "clientaliveinterval", sClientAliveInterval },
        { "clientalivecountmax", sClientAliveCountMax },
        { "authorizedkeysfile", sAuthorizedKeysFile },
        { "authorizedkeysfile2", sAuthorizedKeysFile2 },
+       { "useprivilegeseparation", sUsePrivilegeSeparation},
        { NULL, sBadOption }
 };
 
@@ -429,7 +454,7 @@ process_server_config_line(ServerOptions *options, char *line,
                        return 0;
                if (options->listen_addrs != NULL)
                        fatal("%s line %d: ports must be specified before "
-                           "ListenAdress.", filename, linenum);
+                           "ListenAddress.", filename, linenum);
                if (options->num_ports >= MAX_PORTS)
                        fatal("%s line %d: too many ports.",
                            filename, linenum);
@@ -655,6 +680,10 @@ parse_flag:
                intptr = &options->x11_display_offset;
                goto parse_int;
 
+       case sX11UseLocalhost:
+               intptr = &options->x11_use_localhost;
+               goto parse_flag;
+
        case sXAuthLocation:
                charptr = &options->xauth_location;
                goto parse_filename;
@@ -679,15 +708,15 @@ parse_flag:
                intptr = &options->gateway_ports;
                goto parse_flag;
 
-       case sReverseMappingCheck:
-               intptr = &options->reverse_mapping_check;
+       case sVerifyReverseMapping:
+               intptr = &options->verify_reverse_mapping;
                goto parse_flag;
 
        case sLogFacility:
                intptr = (int *) &options->log_facility;
                arg = strdelim(&cp);
                value = log_facility_number(arg);
-               if (value == (SyslogFacility) - 1)
+               if (value == SYSLOG_FACILITY_NOT_SET)
                        fatal("%.200s line %d: unsupported log facility '%s'",
                            filename, linenum, arg ? arg : "<NONE>");
                if (*intptr == -1)
@@ -698,7 +727,7 @@ parse_flag:
                intptr = (int *) &options->log_level;
                arg = strdelim(&cp);
                value = log_level_number(arg);
-               if (value == (LogLevel) - 1)
+               if (value == SYSLOG_LEVEL_NOT_SET)
                        fatal("%.200s line %d: unsupported log level '%s'",
                            filename, linenum, arg ? arg : "<NONE>");
                if (*intptr == -1)
@@ -709,6 +738,10 @@ parse_flag:
                intptr = &options->allow_tcp_forwarding;
                goto parse_flag;
 
+       case sUsePrivilegeSeparation:
+               intptr = &use_privsep;
+               goto parse_flag;
+
        case sAllowUsers:
                while ((arg = strdelim(&cp)) && *arg != '\0') {
                        if (options->num_allow_users >= MAX_ALLOW_USERS)
This page took 0.04902 seconds and 4 git commands to generate.