Maintenance: GitLab GKE platform upgrade and software upgrade on Friday Oct. 22 at 9 p.m. Service may not be available between 9 p.m. and 9:20 p.m.

krb5_conf.pp 4.92 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# A define that creates a krb5.conf file.
#
# The $name parameter is where the file will be put.
#
# $prefer_tcp:
#   Normal kerberos traffic uses UDP, but some applications
#   (lookin' at you Java!) work better with TCP. Set this parameter to
#   "true" to force the client to prefer TCP to UDP.
#   Default: false
#
# $rdns_enabled:
#   If 'true' have the Kerberos client do a reverse DNS lookup on the
#   hostname when connecting to a server. This should be set to 'false' if
#   you want the client to be able to connect to services where the service
#   name's IP address PTR record may not match the hostname (e.g., for
#   services running in Amazon Web Services).
17
#   Default: false
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#
## ADVANCED
#
# $env: Valid values:
#  * prod (default)
#  * dev
#  * test
#  * uat
#  * qa
#  * custom
#
# In the "stanford.edu" section of [realms], by default the production
# settings will appear:
#
#   [realms]
#       stanford.edu = {
#           kdc            = krb5auth1.stanford.edu:88
#           kdc            = krb5auth2.stanford.edu:88
#           kdc            = krb5auth3.stanford.edu:88
#           master_kdc     = master-kdc.stanford.edu:88
#           admin_server   = krb5-admin.stanford.edu
#           kpasswd_server = krb5-admin.stanford.edu
#           default_domain = stanford.edu
#           kadmind_port   = 749
#       }
#
# If the environment is set to a different value, then that section will
# instead look like this:
#
#   [realms]
#       stanford.edu = {
#           kdc            = krb5auth-<env>1.stanford.edu:88
#           kdc            = krb5auth-<env>2.stanford.edu:88
#           kdc            = krb5auth-<env>3.stanford.edu:88
#           kdc            = krb5auth-<env>4.stanford.edu:88
#           master_kdc     = master-kdc-<env>.stanford.edu:88
#           admin_server   = krb5-admin-<env>.stanford.edu
#           kpasswd_server = krb5-admin-<env>.stanford.edu
#           default_domain = stanford.edu
#           kadmind_port   = 749
#       }
#
# For example, if $env is set to 'test', then the above would be
#
#   [realms]
#       stanford.edu = {
#           kdc            = krb5auth-test1.stanford.edu:88
#           kdc            = krb5auth-test2.stanford.edu:88
#           kdc            = krb5auth-test3.stanford.edu:88
#           kdc            = krb5auth-test4.stanford.edu:88
#           master_kdc     = master-kdc-test.stanford.edu:88
#           admin_server   = krb5-admin-test.stanford.edu
#           kpasswd_server = krb5-admin-test.stanford.edu
#           default_domain = stanford.edu
#           kadmind_port   = 749
#       }
#
#
# Finally, if you want to override these using these parameters, set the
# $env variable to 'custom' and set these parameters:
#
#
# $kdcs: Use this set of server names for the "kdc" entries in the
#   realm. If the array is empty, use the the normal production KDC list.
#
# Example:
#  kdcs => ['kerberos-qa2.stanford.edu', 'kerberos-qa1.stanford.edu'],
#
# will result in
#
# [realms]
#   stanford.edu = {
#     kdc            = kerberos-qa2.stanford.edu:88
#     kdc            = kerberos-qa1.stanford.edu:88
#
# $master_kdc: sets the master_kdc setting.
#
# $admin_server: sets the admin_server setting
#
# $kpasswd_server: sets the kpasswd_server setting.
#
# NOTE! If $env is set to 'custom', then ALL of $kdcs, $master_kdc,
# $admin_server, and $kpasswd_server MUST be set. If not, Puppet will
# raise an exception.


104
define base::kerberos::krb5_conf (
105
106
107
108
109
110
111
112
  $env                             = 'prod',
  $realm                           = 'stanford.edu',
  $default_realm                   = 'stanford.edu',
  $stanford_realm_is_production    = true,
  $kdcs                            = [],
  $master_kdc                      = undef,
  $admin_server                    = undef,
  $kpasswd_server                  = undef,
113
  $rdns_enabled                    = false,
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
  $prefer_tcp                      = false,
) {

  case $env {
    'prod': {
      $kdcs_actual = [
        "krb5auth1.stanford.edu",
        "krb5auth2.stanford.edu",
        "krb5auth3.stanford.edu",
      ]
      $master_kdc_actual     = "master-kdc.stanford.edu"
      $admin_server_actual   = "krb5-admin.stanford.edu"
      $kpasswd_server_actual = "krb5-admin.stanford.edu"
    }
    'dev', 'test', 'uat', 'qa': {
      $kdcs_actual = [
        "krb5auth-${env}1.stanford.edu",
        "krb5auth-${env}2.stanford.edu",
        "krb5auth-${env}3.stanford.edu",
        "krb5auth-${env}4.stanford.edu",
      ]
      $master_kdc_actual     = "master-kdc-${env}.stanford.edu"
      $admin_server_actual   = "krb5-admin-${env}.stanford.edu"
      $kpasswd_server_actual = "krb5-admin-${env}.stanford.edu"
    }
    'custom': {
      $kdcs_actual           = $kdcs
      $master_kdc_actual     = $master_kdc
      $admin_server_actual   = $admin_server
      $kpasswd_server_actual = $kpasswd_server
    }
    default : {
      fail("do not know env '${env}'")
    }
  }

  file { $name:
    content => template('base/kerberos/etc/krb5.conf.erb'),
  }
}