Skip to content

Commit e51d5bb

Browse files
Adapt and document sweeper.py for gssproxy
Resolves: #207 Signed-off-by: Robbie Harwood <rharwood@redhat.com>
1 parent 812fa38 commit e51d5bb

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

README

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ suffix.
245245

246246
**Note:** Consuming application must delete the ccache otherwise it will
247247
litter the filesystem if sessions are used. An example sweeper can be found
248-
in the contrib directory.
248+
in the contrib directory. If using with gssproxy, see note at the top of that
249+
file.
249250

250251
#### Example
251252
GssapiDelegCcacheUnique On

contrib/sweeper.py

100644100755
Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@
99
# removing any ccaches that have expired from the filesystem, and serves as an
1010
# example of how this cleaning can be performed.
1111

12+
# gssproxy note: in order to sweep credentials, the sweeper needs to connect
13+
# to gssproxy as if it were mod_auth_gssapi. In the configuration provided
14+
# with mod_auth_gssapi (80-httpd.conf), this just consists of matching the
15+
# gssproxy uid - so run it as the appropriate user (i.e., apache). Custom
16+
# configurations require careful consideration of how to match the sweeper
17+
# connection to the correct service in gssproxy; this script is just an
18+
# example. This script will not attempt to contact gssproxy unless -g is
19+
# passed.
20+
21+
import argparse
1222
import os
1323
import stat
14-
import sys
1524
import time
1625

1726
# try importing this first to provide a more useful error message
@@ -48,16 +57,21 @@ def should_delete(fname, t):
4857

4958

5059
if __name__ == "__main__":
51-
dirs = sys.argv[1:]
52-
if len(dirs) < 1:
53-
print("Usage: %s dir1 [dir2...]" % sys.argv[0])
54-
exit(1)
60+
parser = argparse.ArgumentParser(description="Sweep expired ccaches")
61+
parser.add_argument("-g", dest="gssproxy", action="store_true",
62+
help="is gssproxy in use (default: no)")
63+
parser.add_argument("dirs", nargs='+')
64+
args = parser.parse_args()
65+
66+
if args.gssproxy:
67+
os.environ["GSS_USE_PROXY"] = "yes"
68+
os.environ["GSSPROXY_BEHAVIOR"] = "REMOTE_FIRST"
5569

5670
print("System looks okay; running sweeper...")
5771

5872
t = time.time()
5973

60-
for basedir in dirs:
74+
for basedir in args.dirs:
6175
os.chdir(basedir)
6276
print("Sweeping %s" % basedir)
6377

0 commit comments

Comments
 (0)