Make the port that certmaster listens on and funcd connects to configurable.
authorAdrian Likins <alikins@redhat.com>
Wed, 12 Nov 2008 16:53:59 +0000 (11:53 -0500)
committerAdrian Likins <alikins@redhat.com>
Wed, 12 Nov 2008 16:53:59 +0000 (11:53 -0500)
add listen_port to /etc/certmaster/certmaster.conf to configure which
port certmaster runs on.

add certmaster_port to /etc/certmaster/minion.conf so funcd knows which
port to talk to certmaster on.

certmaster/certmaster.py
certmaster/commonconfig.py
certmaster/utils.py
etc/certmaster.conf
etc/minion.conf

index aba3f7c..e3abf39 100755 (executable)
@@ -312,7 +312,12 @@ def serve(xmlrpcinstance):
     """
 
 
-    server = CertmasterXMLRPCServer((xmlrpcinstance.cfg.listen_addr, CERTMASTER_LISTEN_PORT))
+    config = read_config(CERTMASTER_CONFIG, CMConfig)
+    listen_addr = config.listen_addr
+    listen_port = config.listen_port
+    if listen_port == '':
+        listen_port = CERTMASTER_LISTEN_PORT 
+    server = CertmasterXMLRPCServer((listen_addr,listen_port))
     server.logRequests = 0 # don't print stuff to console
     server.register_instance(xmlrpcinstance)
     xmlrpcinstance.logger.info("certmaster started")
index d378c92..4be491e 100644 (file)
@@ -19,6 +19,7 @@ from config import BaseConfig, BoolOption, IntOption, Option
 class CMConfig(BaseConfig):
     log_level = Option('INFO')
     listen_addr = Option('')
+    listen_port = IntOption(51235)
     cadir = Option('/etc/pki/certmaster/ca')
     cert_dir = Option('/etc/pki/certmaster')
     certroot =  Option('/var/lib/certmaster/certmaster/certs')
@@ -29,5 +30,6 @@ class CMConfig(BaseConfig):
 class MinionConfig(BaseConfig):
     log_level = Option('INFO')
     certmaster = Option('certmaster')
+    certmaster_port = IntOption(51235)
     cert_dir = Option('/etc/pki/certmaster')
 
index 5544b05..958d26d 100755 (executable)
@@ -127,7 +127,7 @@ def get_hostname(talk_to_certmaster=True):
         config = read_config(config_file, MinionConfig)
 
         server = config.certmaster
-        port = 51235
+        port = config.certmaster_port
 
         try:
             s = socket.socket()
@@ -155,7 +155,7 @@ def create_minion_keys():
     config_file = '/etc/certmaster/minion.conf'
     config = read_config(config_file, MinionConfig)
     cert_dir = config.cert_dir
-    master_uri = 'http://%s:51235/' % config.certmaster
+    master_uri = 'http://%s:%s/' % (config.certmaster, config.certmaster_port)
     # print "DEBUG: acquiring hostname"
     hn = get_hostname()
     # print "DEBUG: hostname = %s\n" % hn
index f522a4d..7664376 100644 (file)
@@ -3,6 +3,7 @@
 [main]
 autosign = no
 listen_addr = 
+listen_port = 51235
 cadir = /etc/pki/certmaster/ca
 cert_dir = /etc/pki/certmaster
 certroot = /var/lib/certmaster/certmaster/certs
index ea3d304..47c6540 100644 (file)
@@ -2,6 +2,7 @@
 
 [main]
 certmaster = certmaster
+certmaster_port = 51235
 log_level = DEBUG
 cert_dir = /etc/pki/certmaster