summaryrefslogtreecommitdiffstats
path: root/src/sbin
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-03-12 16:22:51 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-03-12 16:22:51 +0000
commit6e5e9c8e969207e68665f12665a54768090897e4 (patch)
treede198777d5041073db4634a24ca37efad2a1017f /src/sbin
parentac3eb44f16bc14e41ed62169ca36e9992509d7d6 (diff)
downloadbcfg2-6e5e9c8e969207e68665f12665a54768090897e4.tar.gz
bcfg2-6e5e9c8e969207e68665f12665a54768090897e4.tar.bz2
bcfg2-6e5e9c8e969207e68665f12665a54768090897e4.zip
Merged in certs branch in preparation for 0.9.3pre2
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2928 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin')
-rwxr-xr-xsrc/sbin/bcfg22
-rwxr-xr-xsrc/sbin/bcfg2-admin15
2 files changed, 16 insertions, 1 deletions
diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2
index 1364229be..f13f93af8 100755
--- a/src/sbin/bcfg2
+++ b/src/sbin/bcfg2
@@ -35,6 +35,8 @@ class Client:
False, False, False, True),
'drivers':(('-D', '<driver1>,<driver2>', "Specify tool driver set"),
False, False, False, False),
+ 'fingerprint':(('-F', '<server fingerprint>', "Server Fingerprint"),
+ False, ('communication', 'fingerprint'), False, False),
'dryrun':(('-n', False, "do not actually change the system"),
False, False, False, True),
'build': (('-B', False, "run in build mode"),
diff --git a/src/sbin/bcfg2-admin b/src/sbin/bcfg2-admin
index 80b8a06a2..b049aa227 100755
--- a/src/sbin/bcfg2-admin
+++ b/src/sbin/bcfg2-admin
@@ -3,7 +3,7 @@
import difflib, logging, lxml.etree, os, popen2, re, socket, sys, ConfigParser
import xml.sax.saxutils
-import Bcfg2.Server.Core, Bcfg2.Logging
+import Bcfg2.Server.Core, Bcfg2.Logging, Bcfg2.tlslite.api
log = logging.getLogger('bcfg-admin')
@@ -13,6 +13,7 @@ colors = ['steelblue1', 'chartreuse', 'gold', 'magenta', 'indianred1', 'limegree
usage = '''
bcfg2-admin [options]
+fingerprint - print the server certificate fingerprint
init - initialize the bcfg2 repository( this is interactive; only run once )
mineentry <client> <entry type> <entry name> - mine statistics for entry information
minestruct <client> - mine statistics for extra entries
@@ -266,6 +267,16 @@ def do_compare(args):
rcs.append(False)
return not False in rcs
+def do_fingerprint():
+ '''calculate key fingerprint'''
+ cfile = '/etc/bcfg2.conf'
+ cf = ConfigParser.ConfigParser()
+ cf.read([cfile])
+ keypath = cf.get('communication', 'key')
+ x509 = Bcfg2.tlslite.api.X509()
+ x509.parse(open(keypath).read())
+ print x509.getFingerprint()
+
def do_pull(client, etype, ename):
'''Make currently recorded client state correct for entry'''
cfile = '/etc/bcfg2.conf'
@@ -485,6 +496,8 @@ if __name__ == '__main__':
do_viz(sys.argv[2:])
elif sys.argv[1] == 'compare':
do_compare(sys.argv[2:])
+ elif sys.argv[1] == 'fingerprint':
+ do_fingerprint()
else:
print usage