2009-11-06 13:58:44 +01:00
|
|
|
{pkgs, config, ...}:
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
let
|
|
|
|
inherit (pkgs.lib) mkOption mkIf;
|
|
|
|
|
|
|
|
cfg = config.krb5;
|
|
|
|
|
|
|
|
options = {
|
|
|
|
krb5 = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable Kerberos V.";
|
|
|
|
};
|
|
|
|
|
|
|
|
defaultRealm = mkOption {
|
|
|
|
default = "ATENA.MIT.EDU";
|
|
|
|
description = "Default realm.";
|
|
|
|
};
|
|
|
|
|
2010-08-06 10:50:48 +02:00
|
|
|
domainRealm = mkOption {
|
|
|
|
default = "atena.mit.edu";
|
|
|
|
description = "Default domain realm.";
|
|
|
|
};
|
|
|
|
|
2009-11-06 13:58:44 +01:00
|
|
|
kdc = mkOption {
|
|
|
|
default = "kerberos.mit.edu";
|
|
|
|
description = "Kerberos Domain Controller";
|
|
|
|
};
|
|
|
|
|
|
|
|
kerberosAdminServer = mkOption {
|
|
|
|
default = "kerberos.mit.edu";
|
|
|
|
description = "Kerberos Admin Server";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
mkIf config.krb5.enable {
|
|
|
|
require = [
|
|
|
|
options
|
|
|
|
];
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
systemPackages = [ pkgs.krb5 ];
|
|
|
|
etc = [
|
|
|
|
{ source = pkgs.writeText "krb5.conf"
|
|
|
|
''
|
|
|
|
[libdefaults]
|
2010-04-15 17:47:26 +02:00
|
|
|
default_realm = ${cfg.defaultRealm}
|
2010-08-06 10:50:48 +02:00
|
|
|
encrypt = true
|
2009-11-06 13:58:44 +01:00
|
|
|
|
|
|
|
# The following krb5.conf variables are only for MIT Kerberos.
|
2010-04-15 17:47:26 +02:00
|
|
|
krb4_config = /etc/krb.conf
|
|
|
|
krb4_realms = /etc/krb.realms
|
|
|
|
kdc_timesync = 1
|
|
|
|
ccache_type = 4
|
|
|
|
forwardable = true
|
|
|
|
proxiable = true
|
2009-11-06 13:58:44 +01:00
|
|
|
|
|
|
|
# The following encryption type specification will be used by MIT Kerberos
|
|
|
|
# if uncommented. In general, the defaults in the MIT Kerberos code are
|
|
|
|
# correct and overriding these specifications only serves to disable new
|
|
|
|
# encryption types as they are added, creating interoperability problems.
|
|
|
|
|
2010-04-15 17:47:26 +02:00
|
|
|
# default_tgs_enctypes = aes256-cts arcfour-hmac-md5 des3-hmac-sha1 des-cbc-crc des-cbc-md5
|
|
|
|
# default_tkt_enctypes = aes256-cts arcfour-hmac-md5 des3-hmac-sha1 des-cbc-crc des-cbc-md5
|
|
|
|
# permitted_enctypes = aes256-cts arcfour-hmac-md5 des3-hmac-sha1 des-cbc-crc des-cbc-md5
|
2009-11-06 13:58:44 +01:00
|
|
|
|
|
|
|
# The following libdefaults parameters are only for Heimdal Kerberos.
|
2010-04-15 17:47:26 +02:00
|
|
|
v4_instance_resolve = false
|
|
|
|
v4_name_convert = {
|
|
|
|
host = {
|
|
|
|
rcmd = host
|
|
|
|
ftp = ftp
|
|
|
|
}
|
|
|
|
plain = {
|
|
|
|
something = something-else
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fcc-mit-ticketflags = true
|
2009-11-06 13:58:44 +01:00
|
|
|
|
|
|
|
[realms]
|
2010-04-15 17:47:26 +02:00
|
|
|
${cfg.defaultRealm} = {
|
|
|
|
kdc = ${cfg.kdc}
|
|
|
|
admin_server = ${cfg.kerberosAdminServer}
|
2010-08-06 10:50:48 +02:00
|
|
|
# kpasswd_server = ${cfg.kerberosAdminServer}
|
2010-04-15 17:47:26 +02:00
|
|
|
}
|
|
|
|
ATHENA.MIT.EDU = {
|
|
|
|
kdc = kerberos.mit.edu:88
|
|
|
|
kdc = kerberos-1.mit.edu:88
|
|
|
|
kdc = kerberos-2.mit.edu:88
|
|
|
|
admin_server = kerberos.mit.edu
|
|
|
|
default_domain = mit.edu
|
|
|
|
}
|
|
|
|
MEDIA-LAB.MIT.EDU = {
|
|
|
|
kdc = kerberos.media.mit.edu
|
|
|
|
admin_server = kerberos.media.mit.edu
|
|
|
|
}
|
|
|
|
ZONE.MIT.EDU = {
|
|
|
|
kdc = casio.mit.edu
|
|
|
|
kdc = seiko.mit.edu
|
|
|
|
admin_server = casio.mit.edu
|
|
|
|
}
|
|
|
|
MOOF.MIT.EDU = {
|
|
|
|
kdc = three-headed-dogcow.mit.edu:88
|
|
|
|
kdc = three-headed-dogcow-1.mit.edu:88
|
|
|
|
admin_server = three-headed-dogcow.mit.edu
|
|
|
|
}
|
|
|
|
CSAIL.MIT.EDU = {
|
|
|
|
kdc = kerberos-1.csail.mit.edu
|
|
|
|
kdc = kerberos-2.csail.mit.edu
|
|
|
|
admin_server = kerberos.csail.mit.edu
|
|
|
|
default_domain = csail.mit.edu
|
|
|
|
krb524_server = krb524.csail.mit.edu
|
|
|
|
}
|
|
|
|
IHTFP.ORG = {
|
|
|
|
kdc = kerberos.ihtfp.org
|
|
|
|
admin_server = kerberos.ihtfp.org
|
|
|
|
}
|
|
|
|
GNU.ORG = {
|
|
|
|
kdc = kerberos.gnu.org
|
|
|
|
kdc = kerberos-2.gnu.org
|
|
|
|
kdc = kerberos-3.gnu.org
|
|
|
|
admin_server = kerberos.gnu.org
|
|
|
|
}
|
|
|
|
1TS.ORG = {
|
|
|
|
kdc = kerberos.1ts.org
|
|
|
|
admin_server = kerberos.1ts.org
|
|
|
|
}
|
|
|
|
GRATUITOUS.ORG = {
|
|
|
|
kdc = kerberos.gratuitous.org
|
|
|
|
admin_server = kerberos.gratuitous.org
|
|
|
|
}
|
|
|
|
DOOMCOM.ORG = {
|
|
|
|
kdc = kerberos.doomcom.org
|
|
|
|
admin_server = kerberos.doomcom.org
|
|
|
|
}
|
|
|
|
ANDREW.CMU.EDU = {
|
|
|
|
kdc = vice28.fs.andrew.cmu.edu
|
|
|
|
kdc = vice2.fs.andrew.cmu.edu
|
|
|
|
kdc = vice11.fs.andrew.cmu.edu
|
|
|
|
kdc = vice12.fs.andrew.cmu.edu
|
|
|
|
admin_server = vice28.fs.andrew.cmu.edu
|
|
|
|
default_domain = andrew.cmu.edu
|
|
|
|
}
|
|
|
|
CS.CMU.EDU = {
|
|
|
|
kdc = kerberos.cs.cmu.edu
|
|
|
|
kdc = kerberos-2.srv.cs.cmu.edu
|
|
|
|
admin_server = kerberos.cs.cmu.edu
|
|
|
|
}
|
|
|
|
DEMENTIA.ORG = {
|
|
|
|
kdc = kerberos.dementia.org
|
|
|
|
kdc = kerberos2.dementia.org
|
|
|
|
admin_server = kerberos.dementia.org
|
|
|
|
}
|
|
|
|
stanford.edu = {
|
|
|
|
kdc = krb5auth1.stanford.edu
|
|
|
|
kdc = krb5auth2.stanford.edu
|
|
|
|
kdc = krb5auth3.stanford.edu
|
|
|
|
admin_server = krb5-admin.stanford.edu
|
|
|
|
default_domain = stanford.edu
|
|
|
|
}
|
2009-11-06 13:58:44 +01:00
|
|
|
|
|
|
|
[domain_realm]
|
2010-08-06 10:50:48 +02:00
|
|
|
.${cfg.domainRealm} = ${cfg.defaultRealm}
|
|
|
|
${cfg.domainRealm} = ${cfg.defaultRealm}
|
2010-04-15 17:47:26 +02:00
|
|
|
.mit.edu = ATHENA.MIT.EDU
|
|
|
|
mit.edu = ATHENA.MIT.EDU
|
|
|
|
.media.mit.edu = MEDIA-LAB.MIT.EDU
|
|
|
|
media.mit.edu = MEDIA-LAB.MIT.EDU
|
|
|
|
.csail.mit.edu = CSAIL.MIT.EDU
|
|
|
|
csail.mit.edu = CSAIL.MIT.EDU
|
|
|
|
.whoi.edu = ATHENA.MIT.EDU
|
|
|
|
whoi.edu = ATHENA.MIT.EDU
|
|
|
|
.stanford.edu = stanford.edu
|
2009-11-06 13:58:44 +01:00
|
|
|
|
2010-08-06 10:50:48 +02:00
|
|
|
[logging]
|
|
|
|
kdc = SYSLOG:INFO:DAEMON
|
|
|
|
admin_server = SYSLOG:INFO:DAEMON
|
|
|
|
default = SYSLOG:INFO:DAEMON
|
2010-04-15 17:47:26 +02:00
|
|
|
krb4_convert = true
|
|
|
|
krb4_get_tickets = false
|
2010-08-06 10:50:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
[appdefaults]
|
|
|
|
pam = {
|
|
|
|
debug = false
|
|
|
|
ticket_lifetime = 36000
|
|
|
|
renew_lifetime = 36000
|
|
|
|
max_timeout = 30
|
|
|
|
timeout_shift = 2
|
|
|
|
initial_timeout = 1
|
|
|
|
}
|
2009-11-06 13:58:44 +01:00
|
|
|
'';
|
|
|
|
target = "krb5.conf";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|