In general it would be useful to set the path of the key file to be the dirname of the bcfg2.conf file (e.g. when using -C /home/user/tmp/bcfg2/bcfg2.conf) instead of the hardcoded path /etc/bcfg2.key which is not useful under FreeBSD, ... .
Suggestion:
Index: bcfg2-admin
===================================================================
--- bcfg2-admin (revision 3217)
+++ bcfg2-admin (working copy)
@@ -34,7 +34,7 @@
[communication]
protocol = xmlrpc/ssl
password = %s
-key = /etc/bcfg2.key
+key = %s/bcfg2.key
[components]
bcfg2 = %s
@@ -92,13 +92,16 @@
if uri == '':
uri = server
- open(cfile,"w").write(config % ( repo, password, uri ))
+ #guess path of ssl key file
+ keypath = os.path.dirname(os.path.abspath(cfile))
+ open(cfile,"w").write(config % ( repo, password, keypath, uri ))
+
#generate the ssl key
print "Now we will generate the ssl key used for secure communitcation"
- os.popen('openssl req -x509 -nodes -days 1000 -newkey rsa:1024 -out /etc/bcfg2.key -keyout /etc/bcfg2.key')
+ os.popen('openssl req -x509 -nodes -days 1000 -newkey rsa:1024 -out %s/bcfg2.key -keyout %s/bcfg2.key' % (keypath, keypath))
try:
- os.chmod('/etc/bcfg2.key','0600')
+ os.chmod('%s/bcfg2.key'% keypath,'0600')
except:
pass