Modify

Ticket #447 (closed enhancement: fixed)

Opened 16 years ago

Last modified 16 years ago

bcfg2-admin: guess path to ssl key file

Reported by: [email protected] Owned by: 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

comment:1 Changed 16 years ago 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 [e57ef67c2f869513ee8e742e762130b945327ef9] (SVN r3224)

WARNING! You need to establish a session before you can create or edit tickets. Otherwise the ticket will get treated as spam.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.