github-1: support for hashing functions other than sha1
[certmaster.git] / certmaster / config.py
index 2cec66f..bf9b87b 100644 (file)
 
 import os
 import sys
-import warnings
 import copy
 import urlparse
 from ConfigParser import NoSectionError, NoOptionError, ConfigParser
 from ConfigParser import ParsingError
 import exceptions
+import warnings
 
 CONFIG_FILE = "/etc/certmaster/certmaster.conf"
 
@@ -448,7 +448,7 @@ class BaseConfig(object):
         self.cfg.write(fileobj)
 
     def getConfigOption(self, option, default=None):
-        warnings.warn('getConfigOption() will go away in a future version of Yum.\n'
+        warnings.warn('getConfigOption() will go away in a future version of certmaster.\n'
                 'Please access option values as attributes or using getattr().',
                 DeprecationWarning)
         if hasattr(self, option):
@@ -456,7 +456,7 @@ class BaseConfig(object):
         return default
 
     def setConfigOption(self, option, value):
-        warnings.warn('setConfigOption() will go away in a future version of Yum.\n'
+        warnings.warn('setConfigOption() will go away in a future version of certmaster.\n'
                 'Please set option values as attributes or using setattr().',
                 DeprecationWarning)
         if hasattr(self, option):
@@ -481,6 +481,7 @@ def read_config(config_file, BaseConfigDerived):
 
     ## Add the default items when just using a single ca
     opts.ca[''] = BaseConfigDerived()
+    opts.ca[''].hash_function = "sha256"
     opts.ca[''].populate(confparser,'main')
 
     ## Add additonal ca sections
@@ -489,6 +490,7 @@ def read_config(config_file, BaseConfigDerived):
         if a_section.startswith('ca:'):
             ca_name = a_section[3:]
             opts.ca[ca_name] = BaseConfigDerived()
+            opts.ca[ca_name].hash_function = "sha256"
             opts.ca[ca_name].populate(confparser,a_section)
             opts.ca[ca_name].cakey = None
             opts.ca[ca_name].cacert = None