summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Admin/Fingerprint.py
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-12-29 04:57:53 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-12-29 04:57:53 +0000
commit3610288cbcbf4d1adedefa03166cd77ee15aad96 (patch)
tree1588fb78ae1c6e51e4e4ea2dab46a006a3ece0d3 /src/lib/Server/Admin/Fingerprint.py
parent6bf7875bc299a1f81061782c8646c90972e06e5a (diff)
downloadbcfg2-3610288cbcbf4d1adedefa03166cd77ee15aad96.tar.gz
bcfg2-3610288cbcbf4d1adedefa03166cd77ee15aad96.tar.bz2
bcfg2-3610288cbcbf4d1adedefa03166cd77ee15aad96.zip
Refactor of bcfg2-admin (all modes moved to discrete modules in Bcfg2.Server.Admin
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4125 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Admin/Fingerprint.py')
-rw-r--r--src/lib/Server/Admin/Fingerprint.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/Server/Admin/Fingerprint.py b/src/lib/Server/Admin/Fingerprint.py
new file mode 100644
index 000000000..bf50f0aaa
--- /dev/null
+++ b/src/lib/Server/Admin/Fingerprint.py
@@ -0,0 +1,19 @@
+'''Fingerprint mode for bcfg2-admin'''
+
+import Bcfg2.tlslite.api
+import Bcfg2.Server.Admin
+
+class Fingerprint(Bcfg2.Server.Admin.Mode):
+ '''Produce server key fingerprint'''
+ __shorthelp__ = 'bcfg2-admin fingerprint'
+ __longhelp__ = __shorthelp__ + '\n\tPrint the server certificate fingerprint'
+ def __call__(self, args):
+ Bcfg2.Server.Admin.Mode.__call__(self, args)
+ print self.getFingerprint()
+
+ def getFingerprint(self):
+ '''calculate key fingerprint'''
+ keypath = self.cfp.get('communication', 'key')
+ x509 = Bcfg2.tlslite.api.X509()
+ x509.parse(open(keypath).read())
+ return x509.getFingerprint()