Ticket #447 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

bcfg2-admin: guess path to ssl key file

Reported by: gogo@cs.uni-sb.de Assigned to: desai
Priority: critical Milestone: Bcfg2 0.9.4 Release
Component: bcfg2-server Version:
Keywords: bcfg2-admin Cc:

Description

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

Attachments

Change History

06/02/07 16:05:48 changed by desai

  • status changed from new to closed.
  • resolution set to fixed.
  • milestone set to Bcfg2 0.9.4 Release.

I've committed this in [3224]


Add/Change #447 (bcfg2-admin: guess path to ssl key file)




Change Properties
Action