components/krb5/patches/029-kadmin_disable_anonymity.patch
author Shawn Emery <shawn.emery@oracle.com>
Fri, 27 May 2016 14:04:06 -0600
changeset 6085 eb3c11e27709
parent 5986 bab15c34f645
child 6599 1d033832c5e7
permissions -rw-r--r--
PSARC/2016/244 Sync MIT Kerberos to 1.14.2 22954706 Should synchronize with MIT Kerberos 1.14 23116276 Userland krb pkgs must have mediation removed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5490
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     1
#
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     2
# Temporarily disable anonymity in kadmin (kadmin -n).
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     3
#
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     4
# This feature currently doesn't work with Solaris rpcsec_gss.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     5
# Fails in gss_acquire_cred, because desired_name
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     6
# WELLKNOWN/[email protected] != WELLKNOWN/ANONYMOUS@WELLKNOWN:ANONYMOUS
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     7
#
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     8
# The patch removes -n option from kadmin and its man pages and
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     9
# skips kadmin tests in t_pkinit.py.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    10
#
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    11
# Support can be added later, if there is demand for it.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    12
# This fix would need to either call gss_acquire_cred with empty desired name
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    13
# or disregard realm when matching desired name.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    14
# Either way, rpcsec.so code would need to be adjusted too to accommodate this
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    15
# change.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    16
#
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    17
# This patch is Solaris specific and not intented for upstream contribution.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    18
# Patch source: in-house
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    19
#
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    20
diff -pur old/src/kadmin/cli/kadmin.c new/src/kadmin/cli/kadmin.c
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    21
--- old/src/kadmin/cli/kadmin.c	2015-02-11 19:16:43.000000000 -0800
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    22
+++ new/src/kadmin/cli/kadmin.c	2015-03-05 07:53:41.131383214 -0800
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    23
@@ -282,7 +282,7 @@ kadmin_startup(int argc, char *argv[])
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    24
     }
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    25
 
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    26
     while ((optchar = getopt(argc, argv,
6085
eb3c11e27709 PSARC/2016/244 Sync MIT Kerberos to 1.14.2
Shawn Emery <shawn.emery@oracle.com>
parents: 5986
diff changeset
    27
-                             "+x:r:p:knq:w:d:s:mc:t:e:ON")) != EOF) {
eb3c11e27709 PSARC/2016/244 Sync MIT Kerberos to 1.14.2
Shawn Emery <shawn.emery@oracle.com>
parents: 5986
diff changeset
    28
+                             "+x:r:p:kq:w:d:s:mc:t:e:ON")) != EOF) {
5490
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    29
         switch (optchar) {
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    30
         case 'x':
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    31
             db_args_size++;
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    32
diff -pur old/src/man/kadmin.man new/src/man/kadmin.man
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    33
--- old/src/man/kadmin.man	2015-02-11 19:16:43.000000000 -0800
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    34
+++ new/src/man/kadmin.man	2015-03-05 07:59:17.166151676 -0800
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    35
@@ -37,7 +37,7 @@ level margin: \\n[rst2man-indent\\n[rst2
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    36
 [\fB\-r\fP \fIrealm\fP]
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    37
 [\fB\-p\fP \fIprincipal\fP]
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    38
 [\fB\-q\fP \fIquery\fP]
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    39
-[[\fB\-c\fP \fIcache_name\fP]|[\fB\-k\fP [\fB\-t\fP \fIkeytab\fP]]|\fB\-n\fP]
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    40
+[[\fB\-c\fP \fIcache_name\fP]|[\fB\-k\fP [\fB\-t\fP \fIkeytab\fP]]]
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    41
 [\fB\-w\fP \fIpassword\fP]
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    42
 [\fB\-s\fP \fIadmin_server\fP[:\fIport\fP]]
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    43
 .sp
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    44
@@ -97,21 +97,6 @@ a password.  In this case, the default p
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    45
 Use \fIkeytab\fP to decrypt the KDC response.  This can only be used
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    46
 with the \fB\-k\fP option.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    47
 .TP
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    48
-.B \fB\-n\fP
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    49
-Requests anonymous processing.  Two types of anonymous principals
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    50
-are supported.  For fully anonymous Kerberos, configure PKINIT on
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    51
-the KDC and configure \fBpkinit_anchors\fP in the client\(aqs
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    52
-\fIkrb5.conf(5)\fP\&.  Then use the \fB\-n\fP option with a principal
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    53
-of the form \fB@REALM\fP (an empty principal name followed by the
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    54
-at\-sign and a realm name).  If permitted by the KDC, an anonymous
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    55
-ticket will be returned.  A second form of anonymous tickets is
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    56
-supported; these realm\-exposed tickets hide the identity of the
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    57
-client but not the client\(aqs realm.  For this mode, use \fBkinit
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    58
-\-n\fP with a normal principal name.  If supported by the KDC, the
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    59
-principal (but not realm) will be replaced by the anonymous
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    60
-principal.  As of release 1.8, the MIT Kerberos KDC only supports
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    61
-fully anonymous operation.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    62
-.TP
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    63
 .B \fB\-c\fP \fIcredentials_cache\fP
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    64
 Use \fIcredentials_cache\fP as the credentials cache.  The
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    65
 cache should contain a service ticket for the \fBkadmin/ADMINHOST\fP
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    66
diff -pur old/src/tests/t_pkinit.py new/src/tests/t_pkinit.py
6085
eb3c11e27709 PSARC/2016/244 Sync MIT Kerberos to 1.14.2
Shawn Emery <shawn.emery@oracle.com>
parents: 5986
diff changeset
    67
--- new/src/tests/t_pkinit.py   2016-02-29 11:50:13.000000000 -0800
eb3c11e27709 PSARC/2016/244 Sync MIT Kerberos to 1.14.2
Shawn Emery <shawn.emery@oracle.com>
parents: 5986
diff changeset
    68
+++ patched.1/src/tests/t_pkinit.py     2016-03-19 08:15:59.287791038 -0700
eb3c11e27709 PSARC/2016/244 Sync MIT Kerberos to 1.14.2
Shawn Emery <shawn.emery@oracle.com>
parents: 5986
diff changeset
    69
@@ -73,15 +73,16 @@ if '97:' in out:
eb3c11e27709 PSARC/2016/244 Sync MIT Kerberos to 1.14.2
Shawn Emery <shawn.emery@oracle.com>
parents: 5986
diff changeset
    70
     fail('auth indicators seen in anonymous PKINIT ticket')
5490
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    71
 
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    72
 # Test anonymous kadmin.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    73
-f = open(os.path.join(realm.testdir, 'acl'), 'a')
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    74
-f.write('WELLKNOWN/ANONYMOUS@WELLKNOWN:ANONYMOUS a *')
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    75
-f.close()
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    76
-realm.start_kadmind()
6085
eb3c11e27709 PSARC/2016/244 Sync MIT Kerberos to 1.14.2
Shawn Emery <shawn.emery@oracle.com>
parents: 5986
diff changeset
    77
-realm.run([kadmin, '-n', 'addprinc', '-pw', 'test', 'testadd'])
eb3c11e27709 PSARC/2016/244 Sync MIT Kerberos to 1.14.2
Shawn Emery <shawn.emery@oracle.com>
parents: 5986
diff changeset
    78
-out = realm.run([kadmin, '-n', 'getprinc', 'testadd'], expected_code=1)
5490
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    79
-if "Operation requires ``get'' privilege" not in out:
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    80
-    fail('Anonymous kadmin has too much privilege')
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    81
-realm.stop_kadmind()
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    82
+#f = open(os.path.join(realm.testdir, 'acl'), 'a')
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    83
+#f.write('WELLKNOWN/ANONYMOUS@WELLKNOWN:ANONYMOUS a *')
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    84
+#f.close()
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    85
+#realm.start_kadmind()
6085
eb3c11e27709 PSARC/2016/244 Sync MIT Kerberos to 1.14.2
Shawn Emery <shawn.emery@oracle.com>
parents: 5986
diff changeset
    86
+#realm.run([kadmin, '-n', 'addprinc', '-pw', 'test', 'testadd'])
eb3c11e27709 PSARC/2016/244 Sync MIT Kerberos to 1.14.2
Shawn Emery <shawn.emery@oracle.com>
parents: 5986
diff changeset
    87
+#out = realm.run([kadmin, '-n', 'getprinc', 'testadd'], expected_code=1)
5490
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    88
+#if "Operation requires ``get'' privilege" not in out:
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    89
+#    fail('Anonymous kadmin has too much privilege')
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    90
+#realm.stop_kadmind()
6085
eb3c11e27709 PSARC/2016/244 Sync MIT Kerberos to 1.14.2
Shawn Emery <shawn.emery@oracle.com>
parents: 5986
diff changeset
    91
+sys.stderr.write("Anonymous pkinit support in kadmin disabled, skipping...\n");
5490
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    92
 
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    93
 # Test with anonymous restricted; FAST should work but kvno should fail.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    94
 r_env = realm.special_env('restrict', True, kdc_conf=restrictive_kdc_conf)