From: Adrian Likins Date: Wed, 12 Nov 2008 16:53:59 +0000 (-0500) Subject: Make the port that certmaster listens on and funcd connects to configurable. X-Git-Tag: v0.24~3 X-Git-Url: https://pwan.org/git/?a=commitdiff_plain;h=48b1e96d3c66a1a733ca573505e7203651142308;p=certmaster.git Make the port that certmaster listens on and funcd connects to configurable. 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. --- diff --git a/certmaster/certmaster.py b/certmaster/certmaster.py index aba3f7c..e3abf39 100755 --- a/certmaster/certmaster.py +++ b/certmaster/certmaster.py @@ -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") diff --git a/certmaster/commonconfig.py b/certmaster/commonconfig.py index d378c92..4be491e 100644 --- a/certmaster/commonconfig.py +++ b/certmaster/commonconfig.py @@ -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') diff --git a/certmaster/utils.py b/certmaster/utils.py index 5544b05..958d26d 100755 --- a/certmaster/utils.py +++ b/certmaster/utils.py @@ -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 diff --git a/etc/certmaster.conf b/etc/certmaster.conf index f522a4d..7664376 100644 --- a/etc/certmaster.conf +++ b/etc/certmaster.conf @@ -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 diff --git a/etc/minion.conf b/etc/minion.conf index ea3d304..47c6540 100644 --- a/etc/minion.conf +++ b/etc/minion.conf @@ -2,6 +2,7 @@ [main] certmaster = certmaster +certmaster_port = 51235 log_level = DEBUG cert_dir = /etc/pki/certmaster