def getPassKeyFromConfig(configFile = "/opt/mdmi/etc/mdmi.conf"): try: config = ConfigParser() config.read(configFile) if config._sections.has_key('vpn'): config = config._sections['vpn'] if not config.has_key('passout'): logger.error('error, config file %s do not has key passout' % configFile) passKey = None else: passKey = config['passout'] else: logger.error('error, %s do not have section vpn' % configFile) passKey = None return config['passout'] except Exception, e: logger.error('error, can not get passout from %s' % configFile) return None
def getPassKeyFromConfig(configFile="/opt/mdmi/etc/mdmi.conf"): try: config = ConfigParser() config.read(configFile) if config._sections.has_key('vpn'): config = config._sections['vpn'] if not config.has_key('passout'): logger.error('error, config file %s do not has key passout' % configFile) passKey = None else: passKey = config['passout'] else: logger.error('error, %s do not have section vpn' % configFile) passKey = None return config['passout'] except Exception, e: logger.error('error, can not get passout from %s' % configFile) return None
import urllib import os from uuid import uuid4 from ConfigParser import ConfigParser from xml.etree import ElementTree from M2Crypto.EVP import Cipher from openssl import * from utils import logger config = ConfigParser() config.read("/opt/mdmi/etc/mdmi.conf") if config._sections.has_key('vpn'): config = config._sections['vpn'] if not config.has_key('template') \ or not config.has_key('remote_address') \ or not config.has_key('root_ca') \ or not config.has_key('vpn_ca') \ or not config.has_key('issuer_ca') \ or not config.has_key('issuer_key') \ or not config.has_key('issuer_passcode') \ or not config.has_key('passout') \ or not config.has_key('ssl_ca'): config = None else: config = None SIGN_CA = "/opt/emserver/portal/www/profile/domain.crt" INTER_CA = "/opt/emserver/portal/www/profile/intermediate.crt" SIGN_KEY = "/opt/emserver/portal/www/profile/domain.key"