Codebase list krb5-sync / HEAD
HEAD

Tree @HEAD (Download .tar.gz)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 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
104
105
106
107
108
109
110
111
112
113
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
                              krb5-sync 3.1
            (Kerberos Active Directory synchronization plugin)

               Maintained by Russ Allbery <eagle@eyrie.org>

  Copyright 2015 Russ Allbery <eagle@eyrie.org>.  Copyright 2006, 2007,
  2010, 2011, 2012, 2013 The Board of Trustees of the Leland Stanford
  Junior University.  Originally developed by Derrick Brashear and Ken
  Hornstein of Sine Nomine Associates, on behalf of Stanford University.
  This software is distributed under a BSD-style license.  Please see the
  section LICENSE below for more information.

BLURB

  krb5-sync is a toolkit for synchronizing passwords and account status
  from an MIT or Heimdal Kerberos master KDC to Active Directory.
  Password changes are done via the Kerberos password change protocol, and
  account status is updated via LDAP.  It provides a plugin for the kadmin
  libraries and supporting command-line utilities, as well as a patch for
  Heimdal to add plugin support.

DESCRIPTION

  Large organizations may not have the luxury of running a single Kerberos
  KDC, or may need to maintain an MIT or Heimdal Kerberos environment in
  parallel with Active Directory during a transition.  This toolkit allows
  one to run an MIT or Heimdal Kerberos KDC as the master password store,
  create separate user accounts in an independent Active Directory, and
  synchronize password updates and some account flag updates automatically
  between the environments.  It assumes that the MIT or Heimdal Kerberos
  KDC is the only place changes will be made and those changes will be
  replicated to the other environments.  Bidirectional replication is
  outside the scope of this toolkit.

  This code is running in production at Stanford, but will likely require
  modifications to fit any other environment.  Feedback and improvements
  will be gratefully accepted.

  This toolkit consists of three basic pieces:

   * A plugin that pushes password changes and selected account flag
     changes to Active Directory.  This is done using a separate keytab
     for authentication.  Active Directory password updates are done via
     the Kerberos set-password protocol and status updates are done via
     LDAP.

   * A set of command-line utilities that can perform the same password
     and status updates as the plugin but from the command-line.  These
     can be used to process failed synchronizations later, to test the
     system, or to make manual changes as required.

   * Patches to Heimdal to add a plugin system for password changes and
     account status updates.  MIT Kerberos 1.9 and later do not require
     patching, and earlier versions of MIT Kerberos are not supported.
     These patches add hooks that are run before and after password
     changes, principal creations, and changes to principals.  The code
     added by these patches to libkadm5srv is independent of what that
     plugin might do.

  The plugin and system are designed so that operations done in the hook
  prior to the password change can abort the password change if they fail.
  The plugin provided here changes passwords in Active Directory prior to
  the password change in the local KDC database.  This means that if
  Active Directory is unreachable or rejects the password change for some
  reason, the whole operation will be rejected and the user's password
  will not be changed in MIT Kerberos or Heimdal as well.  This matches
  the desired behavior for Stanford University; you may wish to modify it
  for your site.

  Currently, only one Active Directory realm is supported for updates.

REQUIREMENTS

  The utilities provided in this package will work without any
  modifications to your KDC or kadmind, but to use this entire system, you
  will either need MIT Kerberos 1.9 or later or apply the patch in the
  patches directory to Heimdal and rebuild.  Due to how kadmind is
  constructed, the changes are actually in the libkadm5srv library, not
  the kadmind binary, so you'll need to install the modified libraries.
  It is my hope that eventually the hooks necessary to do this will be
  incorporated into the Heimdal distribution as well, and these tools will
  be modified to support the Heimdal interfaces, and then patching will
  not be necessary.

  To build the account status update code, you will need OpenLDAP
  installed.  To authenticate to Active Directory, you will also need
  Cyrus SASL installed including the Kerberos GSSAPI modules.  The plugin
  or command-line utilities will need access to a keytab with
  administrative privileges in Active Directory.  To configure status
  updates, you will also need to know the server to which to do LDAP
  queries (generally, this is one of the Domain Controllers).

  The krb5-sync-backend utility program to manipulate the change queue
  requires the IPC::Run and Net::Remctl::Backend Perl modules.  The first
  is available from CPAN.  The latter is part of the remctl distribution,
  available from:

      http://www.eyrie.org/~eagle/software/remctl/

  To run the full test suite, Perl 5.6.2 or later is required, as well as
  the prerequisites for krb5-sync-backend.  The following additional Perl
  modules will be used if present:

      Perl6::Slurp
      Test::MinimumVersion
      Test::Perl::Critic
      Test::Pod
      Test::Spelling
      Test::Strict

  All are available on CPAN.  Those tests will be skipped if the modules
  are not available.

  To enable tests that may be sensitive to the local environment or that
  produce a lot of false positives without uncovering many problems, set
  RRA_MAINTAINER_TESTS to a true value.

  To bootstrap from a Git checkout, or if you change the Automake files
  and need to regenerate Makefile.in, you will need Automake 1.11 or
  later.  For bootstrap or if you change configure.ac or any of the m4
  files it includes and need to regenerate configure or config.h.in, you
  will need Autoconf 2.64 or later.  For bootstrap, you will also need
  Libtool.  Perl is also required to generate the manual pages from a
  fresh Git checkout.

INSTALLATION

  First, for Heimdal, patch Heimdal with one of the patches provided in
  the patches directory and install the new libkadm5srv library.  See
  patches/README for more information about the patches.  If you're using
  a different version of MIT Kerberos or Heimdal, you may need to adjust
  the patch accordingly.

  Then, you can build and install the plugin and command-line utilities
  with the standard commands:

      ./configure
      make
      make install

  Pass --enable-silent-rules to configure for a quieter build (similar to
  the Linux kernel).  Use make warnings instead of make to build with full
  GCC compiler warnings (requires a relatively current version of GCC).

  By default, the plugin is installed as:

      /usr/local/lib/krb5/plugins/kadm5_hook/krb5_sync.so

  and the utilities are installed in /usr/local/sbin.  The last step will
  probably have to be done as root.  To install in a different location,
  specify the location with the --prefix option to configure.
  Alternately, --libdir, --sbindir, and --mandir can be given to change
  the installation locations of the binaries and manual pages separately.
  The plugin is installed in krb5/plugins/kadm5_hook relative to libdir.

  If /usr/bin/perl is not the path to Perl on your system, you will need
  to change the first line of krb5-sync-backend.  You will also need to
  change the path to the krb5-sync utility in that script unless you
  install krb5-sync in /usr/sbin.

  Use --with-ldap to specify the prefix installation location of OpenLDAP
  if it's not on the compiler's normal search paths.  Or, alternately, use
  --with-ldap-include and --with-ldap-lib to point to the include files
  and libraries directly if OpenLDAP isn't installed under a single prefix
  directory.

  Normally, configure will use krb5-config to determine the flags to use
  to compile with your Kerberos libraries.  If krb5-config isn't found, it
  will look for the standard Kerberos libraries in locations already
  searched by your compiler.  If the the krb5-config script first in your
  path is not the one corresponding to the Kerberos libraries you want to
  use or if your Kerberos libraries and includes aren't in a location
  searched by default by your compiler, you need to specify the flags
  --with-krb5=PATH and --with-kadm-server=PATH:

      ./configure --with-krb5=/usr/pubsw --with-kadm-server=/usr/pubsw

  You can also individually set the paths to the include directory and the
  library directory with --with-krb5-include and --with-krb5-lib, and with
  --with-kadm-server-include and --with-kadm-server-lib.  You may need to
  do this if Autoconf can't figure out whether to use lib, lib32, or lib64
  on your platform.  Note that these settings aren't used if a krb5-config
  script is found.

  To specify a particular krb5-config script to use, either set the
  KRB5_CONFIG environment variable or pass it to configure like:

      ./configure KRB5_CONFIG=/path/to/krb5-config

  To not use krb5-config and force library probing even if there is a
  krb5-config script on your path, set KRB5_CONFIG to a nonexistent path:

      ./configure KRB5_CONFIG=/nonexistent

  You can pass the --enable-reduced-depends flag to configure to try to
  minimize the shared library dependencies encoded in the binaries.  This
  omits from the link line all the libraries included solely because the
  Kerberos libraries depend on them and instead links the programs only
  against libraries whose APIs are called directly.  This will only work
  with shared Kerberos libraries and will only work on platforms where
  shared libraries properly encode their own dependencies (such as Linux).
  It is intended primarily for building packages for Linux distributions
  to avoid encoding unnecessary shared library dependencies that make
  shared library migrations more difficult.  If none of the above made any
  sense to you, don't bother with this flag.

TESTING

  A basic test suite is available, but for right now only tests some of
  the machinery and API and does some rudimentary testing of the change
  queuing system.  You can run it with:

      make check

  If a test fails, you can run a single test with verbose output via:

      tests/runtests -o <name-of-test>

  Do this instead of running the test program directly since it will
  ensure that necessary environment variables are set up.

CONFIGURATION

  Additional configuration is required to tell the plugin and command-line
  tools what to do.  The basic operations are configured by adding a
  krb5-sync sub-section to the [appdefaults] section of /etc/krb5.conf (or
  wherever your Kerberos libraries look for krb5.conf).  Here's an
  example:

      krb5-sync = {
          ad_keytab        = /etc/krb5kdc/ad-keytab
          ad_principal     = service/sync@WINDOWS.EXAMPLE.COM
          ad_realm         = WINDOWS.EXAMPLE.COM
          ad_admin_server  = dc1.windows.example.com
          ad_ldap_base     = ou=People,dc=windows,dc=example,dc=com
          ad_instances     = root ipass
          ad_base_instance = windows
          ad_queue_only    = false

          queue_dir        = /var/spool/krb5-sync
          syslog           = true
      }

  It is possible to add realm-specific configuration here following the
  normal krb5.conf syntax, but be aware that the plugin only looks for
  configuration for the default realm, not for the realm of the affected
  principal.  In other words, it's not possible to have multiple
  configurations based on the realm of the principal affected.

  The configuration options are:

  ad_admin_server

      The host to contact via LDAP to push account status changes.  If not
      set, status changes will not be synchronized, only password changes.

  ad_base_instance

      If ad_base_instance is set, then any password change for a
      single-component principal (such as user@EXAMPLE.COM) will be
      handled somewhat specially.

      First, the instance set in ad_base_instance will be added and a
      check against the local Kerberos database will be done to see if
      that instance (in this case, user/windows@EXAMPLE.COM) exists.  If
      it doesn't, the password change is processed as normal.  If it does,
      the password change will be ignored.  Instead, if the password for
      user/windows@EXAMPLE.COM is changed, that will be propagated as the
      password for the main account in Active Directory (in this case,
      user@WINDOWS.EXAMPLE.COM).

      This allows the Active Directory principal to be linked to a
      separate instance, rather than the main account, in the MIT or
      Heimdal Kerberos realm for particular users.

  ad_instances

      Specifies which instances should have passwords and account status
      propagated to the Active Directory environment.  By default, only
      principals no instances (single-part principals) are propagated.
      You can list a specific set of instances (space-separated), which
      will then also be propagated to Active Directory.

      The ad_instances option is only used by the plugin and is not used
      by the command-line utility.  Any principals passed to the
      command-line utility will be acted on, even if they have non-empty
      instances.

  ad_keytab

      Specifies the location of a keytab for authenticating to the Active
      Directory other realm.  Must be set.

  ad_ldap_base

      Specifies the root DN of the tree inside Active Directory where
      account information is stored.  If not set, status changes will not
      be synchronized, only password changes.

  ad_principal

      Specifies the principal to authenticate as (using the key in the
      keytab).  Must be set.

  ad_queue_only

      Controls whether we attempt to push changes directly to Active
      Directory or always queue them.  It can be set to true to write all
      changes to the queue where they can be processed later (by
      krb5-sync-backend, for example).  This may be helpful if the delay
      from pushing changes to Active Directory causes problems for clients
      (such as kpasswd clients, which are aggressive about retries and
      don't like long delays).

  ad_realm

      Specifies the foreign realm.  If ad_realm is not set, the plugin
      will not attempt to push changes to Active Directory, so you can
      deactivate this plugin while still loading it by removing that part
      of the configuration.

  queue_dir

      Specifies where to queue changes that couldn't be made.  If password
      changes fail in AD, the whole password change is failed, but status
      changes are done before synchronization with AD is attempted.  The
      queuing mechanism is used to be sure that failed changes aren't lost
      and can be investigated further.  For more information, see the man
      page for krb5-sync and krb5-sync-backend.  Must be set.

      A setting of /var/spool/krb5-sync is recommended, since that's the
      default path in krb5-sync-backend.  If you use a different path,
      you'll want to either change the path in that script or always use
      the -d option.

  syslog

      Whether or not to log errors, warnings, and informational messages
      from the plugin to syslog.  By default, this is enabled.  Set this
      configuration option to false to suppress this logging, in which
      case the only logging will be for errors returned to the kadmind or
      kpasswdd servers.

  With MIT Kerberos 1.9 or later, support for kadmind plugins is built in.
  To load this plugin, add the following to the kdc.conf or krb5.conf file
  used by kadmind:

    [plugins]
        kadm5_hook = {
            module = sync:/usr/local/lib/krb5/plugins/kadm5_hook/sync.so
        }

  You may wish to install sync.so under a krb5/plugins/kadm5_hook in the
  library directory used for your Kerberos installation instead, if that
  is not /usr/local/lib, in which case you can use "kadm5_hook/sync.so" as
  the relative path to the plugin.

  The kadmind patch for Heimdal adds a configuration option for the
  krb5.conf file in the [kadmin] section.  If this option is not set, the
  plugin will not be loaded and none of the hooks will be run.  Therefore,
  to use the plugin, add configuration like:

      [kadmin]
          hook_libraries = /usr/local/lib/krb5/plugins/kadm5_hook/sync.so

  to the configuration file used by kadmind and kpasswdd.  Update the path
  for wherever the krb5-sync plugin is located.

ACTIVE DIRECTORY SETUP

  You need to create an Active Directory user account to be used by the
  krb5-sync software.  (In Windows 2003 Active Directory, user accounts
  can be objects of type "user" or "inetOrgPerson".)  To be able to set
  passwords, this account needs to be granted the Extended Right "Reset
  Password" on user account objects in the Active Directory.  To be able
  to do account enabling and disabling, this account must be able to
  locate the user object, usually done by granting "Read" access, and
  write the userAccountControl attribute on user account objects.

  If you have a cross-realm trust in place with your MIT Kerberos or
  Heimdal realm, the AD account can be mapped to an account in the MIT or
  Heimdal realm by setting the altSecurityIdentities property on the AD
  user account object.  This can be set using the "Name Mappings" feature
  in Active Directory Users and Computers to add a Kerberos name.

  From AD Users & Computers:

  * Select "View" and make sure that "Advanced Features" is checked.

  * Right-Click on the action account and select "Name Mappings".

  * Under "Kerberos Names", add the principal name of the MIT account that
    maps to this account.

  If you do not have a cross-realm trust or want to use the AD account
  directly instead of through a mapping, then you can export the account
  using the ktpass command from the Windows support tools:

      ktpass.exe -out <filename> -princ <principal name> -pass <AD password>
          -mapuser <AD user account name>

  (all on one line).

  Thanks to Ross Wilper for this setup information.

HOMEPAGE AND SOURCE REPOSITORY

  The krb5-sync web page at:

      http://www.eyrie.org/~eagle/software/krb5-sync/

  will always have the current version of this package, the current
  documentation, and pointers to any additional resources.

  krb5-sync is maintained using Git.  You can access the current source by
  cloning the repository at:

      git://git.eyrie.org/devel/krb5-sync.git

  or view the repository via the web at:

      http://git.eyrie.org/?p=devel/krb5-sync.git

  Please send any bug reports, patches, or questions to eagle@eyrie.org.

LICENSE

  The krb5-sync package as a whole is covered by the following copyright
  statement and license:

    Copyright 2015 Russ Allbery <eagle@eyrie.org>
    Copyright 2006, 2007, 2008, 2010, 2011, 2012, 2013
        The Board of Trustees of the Leland Stanford Junior University

    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the
    "Software"), to deal in the Software without restriction, including
    without limitation the rights to use, copy, modify, merge, publish,
    distribute, sublicense, and/or sell copies of the Software, and to
    permit persons to whom the Software is furnished to do so, subject to
    the following conditions:

    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

  All individual files without an explicit exception below are released
  under this license.  Some files may have additional copyright holders as
  noted in those files.  There is detailed information about the licensing
  of each file in the LICENSE file in this distribution.

  Some files in this distribution are individually released under
  different licenses, all of which are compatible with the above general
  package license but which may require preservation of additional
  notices.  All required notices are preserved in the LICENSE file.  Each
  file intended for copying into other software packages contains a
  copyright and license notice at the top or bottom of the file.  Please
  take note of any attribution and notice requirements specified in that
  license.