]> git.michaelhowe.org Git - packages/m/mh-sysadmin-tools.git/commitdiff
Added with-creds
authorMichael Howe <michael@michaelhowe.org>
Sun, 29 Jan 2012 15:03:13 +0000 (15:03 +0000)
committerMichael Howe <michael@michaelhowe.org>
Sun, 29 Jan 2012 15:03:13 +0000 (15:03 +0000)
Makefile
bin/with-creds [new file with mode: 0755]
debian/changelog

index 2e517a26c85bc12b3478d00a4ea2bde892096446..7ed4f68c4457bf1e2e4f520786e07f7d3e57e2f9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,5 +7,6 @@ build:
 install:
        $(INSTALL) -d $(DESTDIR)/usr/bin
        $(INSTALL) -m 0755 $(srcdir)/bin/rksu $(DESTDIR)/usr/bin/rksu
+       $(INSTALL) -m 0755 $(srcdir)/bin/with-creds $(DESTDIR)/usr/bin/with-creds
 
 .PHONY: install
diff --git a/bin/with-creds b/bin/with-creds
new file mode 100755 (executable)
index 0000000..d76e569
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# $HeadURL$
+# $LastChangedRevision$
+# $LastChangedDate$
+# $LastChangedBy$
+#
+
+while getopts ":i:" opt; do
+    case $opt in
+        i)
+            userpart=$OPTARG
+            ;;
+        \?)
+            echo "Error: unsupported option -$OPTARG" >&2
+            exit 1
+            ;;
+    esac
+done
+
+shift $(($OPTIND - 1))
+
+if [ -z "$userpart" ]; then
+    echo "Error: no service part defined (use -i <service>)" >&2
+    exit 2
+fi
+
+if [ $# -eq 0 ]; then
+    echo "Error: no command specified" >&2
+    exit 3
+fi
+
+ccache=/tmp/krb5cc_${UID}_${userpart}
+
+if klist -s -c $ccache; then
+    export KRB5CCNAME=$ccache
+else
+    export KRB5CCNAME=$ccache
+    kinit -p $USER/$userpart
+fi
+
+exec "$@"
index 74644a9cbff5f1f7e01d03eea06bf4c570336204..599f7b4d1292d1c2b559b329266780259b018ea8 100644 (file)
@@ -3,8 +3,9 @@ mh-sysadmin-tools (1.1) unstable; urgency=low
   * Don't forward X11 when using SSH 
   * Pass all arguments to the remote side
   * Add some documentation
+  * Add with-creds, our own custom version 
 
- -- Michael Howe <michael@michaelhowe.org>  Sat, 28 Jan 2012 21:20:22 +0000
+ -- Michael Howe <michael@michaelhowe.org>  Sun, 29 Jan 2012 14:58:29 +0000
 
 mh-sysadmin-tools (1.0) unstable; urgency=low