summaryrefslogtreecommitdiff
path: root/source4/kdc/policy.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-12-09 14:17:54 +1100
committerAndrew Bartlett <abartlet@samba.org>2010-12-09 18:02:59 +1100
commitf681859eb819b441da41e2985586bfc59dff2ec5 (patch)
tree2216ee837693a4338024db2e6d1750e00c7427ae /source4/kdc/policy.c
parent22d67758efd20e62d6050fd10c8b922db75747c9 (diff)
downloadsamba-f681859eb819b441da41e2985586bfc59dff2ec5.tar.gz
samba-f681859eb819b441da41e2985586bfc59dff2ec5.tar.bz2
samba-f681859eb819b441da41e2985586bfc59dff2ec5.zip
s4-lsa Implement kerberos ticket life policy
We now no longer print tickets with a potentially infinite life, and we report the same life over LSA as we use in the KDC. We should get this from group policy, but for now it's parametric smb.conf options. Andrew Bartlett
Diffstat (limited to 'source4/kdc/policy.c')
-rw-r--r--source4/kdc/policy.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/source4/kdc/policy.c b/source4/kdc/policy.c
new file mode 100644
index 0000000000..2760e06940
--- /dev/null
+++ b/source4/kdc/policy.c
@@ -0,0 +1,50 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ KDC Policy
+
+ Copyright (C) Andrew Bartlett <abartlet@samba.org> 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "lib/util/util.h"
+#include "kdc/kdc-policy.h"
+#include "system/kerberos.h"
+#include "auth/kerberos/kerberos.h"
+#include "librpc/gen_ndr/lsa.h"
+#include "param/param.h"
+
+void kdc_get_policy(struct loadparm_context *lp_ctx,
+ struct smb_krb5_context *smb_krb5_context,
+ struct lsa_DomainInfoKerberos *k)
+{
+ /* These should be set and stored via Group Policy, but until then, some defaults are in order */
+
+ /* Our KDC always re-validates the client */
+ k->authentication_options = LSA_POLICY_KERBEROS_VALIDATE_CLIENT;
+
+ unix_to_nt_time(&k->service_tkt_lifetime,
+ lpcfg_parm_int(lp_ctx, NULL, "kdc", "service ticket lifefime", 10) * 60 * 60);
+ unix_to_nt_time(&k->user_tkt_lifetime,
+ lpcfg_parm_int(lp_ctx, NULL, "kdc", "user ticket lifefime", 10) * 60 * 60);
+ unix_to_nt_time(&k->user_tkt_renewaltime,
+ lpcfg_parm_int(lp_ctx, NULL, "kdc", "renewal lifefime", 24*7) * 60 * 60);
+ if (smb_krb5_context) {
+ unix_to_nt_time(&k->clock_skew,
+ krb5_get_max_time_skew(smb_krb5_context->krb5_context));
+ }
+ k->reserved = 0;
+}