/usr/lib/python2.7/dist-packages/securepass/utils.py is in python-securepass 0.4.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | ##
## SecurePass CLI tools utilities
##
## This code is released under GPLv2
##
## (c) 2013 Giuseppe Paterno' (gpaterno@gpaterno.com)
## GARL Sagl (www.garl.ch)
##
import logging
import ConfigParser
import os
import sys
def loadConfig():
"""loadConfig returns cassandra servers"""
conffiles = ['/etc/securepass.conf',
'/usr/local/etc/securepass.conf',
os.getcwd() + '/securepass.conf']
#conffiles.append(os.path.join(os.path.expanduser("~"), ".securepass"))
## Virtual Environment handling
# VIRTUAL_ENV is not reliable, switching to sys.real_prefix
if hasattr(sys, 'real_prefix'):
conffiles.append(sys.prefix + "/securepass.conf")
conffiles.append(sys.prefix + "/etc/securepass.conf")
conf_found = 0
## Get Config File
for conf in conffiles:
if not os.path.isfile(conf):
logging.debug("Unable to open config file %s!" % conf)
else:
logging.debug("Config file found at %s!" % conf)
conf_found = 1
if conf_found == 0:
logging.error("Unable to find configuration files")
sys.exit(1)
config = ConfigParser.ConfigParser()
config.read(conffiles)
## Default config
myconfig = {}
myconfig['endpoint'] = "https://beta.secure-pass.net/"
try:
## Get required configuration
myconfig['app_id'] = config.get("default", "app_id")
myconfig['app_secret'] = config.get("default", "app_secret")
except:
logging.debug("Unable to load config file")
return {}
## Get endpoint, if specified
try:
myconfig['endpoint'] = config.get("default", "endpoint")
except:
pass
# Get realm, if specified
try:
myconfig['realm'] = config.get("nss", "realm")
except:
pass
# SSH behaviour
try:
myconfig['root'] = config.get("ssh", "root")
except:
pass
# Return array with config
return myconfig
|