Skip to content

Commit 5e85873

Browse files
committed
Allow configuring the path and principal for keytabs
1 parent 4180fe8 commit 5e85873

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

development.ini

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ beaker.session.secret = somesecret
3131
# scripts module config
3232
title = Scripts Pony
3333
tagline = Manage Hostnames for scripts.mit.edu
34+
keytab = ~/Private/scripts-pony.keytab
35+
principal = daemon/scripts-pony.mit.edu
3436

3537
# If you'd like to fine-tune the individual locations of the cache data dirs
3638
# for the Cache data, or the Session saves, un-comment the desired settings

scripts/keytab.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@
33
import threading
44
from datetime import datetime, timedelta
55

6+
from tg import config
7+
68
KEYTAB_FILE = None
79
principal = None
810

911

10-
def set(name):
11-
"""Tells the keytab module to look for the daemon/NAME.mit.edu
12-
keytab in ~/Private/NAME.keytab"""
12+
def set(keytab_file, k5principal):
13+
"""Tells the keytab module to look for the k5principal
14+
keytab in keytab_file"""
1315
global KEYTAB_FILE, principal
14-
KEYTAB_FILE = os.path.expanduser("~/Private/%s.keytab" % name)
15-
principal = "daemon/%s.mit.edu" % name
16+
KEYTAB_FILE = os.path.expanduser(keytab_file)
17+
principal = k5principal
1618

1719

1820
def exists():
21+
if not KEYTAB_FILE:
22+
set(config.get('keytab'), config.get('principal'))
1923
return os.path.exists(KEYTAB_FILE)
2024

2125

scriptspony/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# -*- coding: utf-8 -*-
22
"""The ScriptsPony package"""
33

4-
from scripts import log, keytab
4+
from scripts import log
55

66
log.set_tag("Pony", "pony")
7-
keytab.set("scripts-pony")

0 commit comments

Comments
 (0)