def __init__(self): # building path config.appliance_url = "https://conjur-dev-master.d1.opendns.com/api" config.account = "dev" config.cert_file = "/Users/" + getpass.getuser() + "/.conjur/conjur-dev.pem" self.conjurapi = conjur.new_from_netrc("/Users/" + getpass.getuser() + "/.netrc", config=config) print getpass.getuser()
def __init__(self): # building path config.appliance_url = "hti" config.account = "dev" config.cert_file = "/Users/" + getpass.getuser( ) + "/.conjur/conjur-dev.pem" self.conjurapi = conjur.new_from_netrc("/Users/" + getpass.getuser() + "/.netrc", config=config) print getpass.getuser()
def _conjur_api(): conjur_conf = yaml.load(file('/etc/conjur.conf', 'r')) conjur.configure(account=conjur_conf['account'], appliance_url=conjur_conf['appliance_url'], verify_ssl=False) return conjur.new_from_netrc('/root/.netrc')
#current time ts = time.time() st = datetime.datetime.fromtimestamp(ts).strftime('%Y%m%d_%H%M%S') print st ## Reads the server.key text_file = open("/Users/keval/PycharmProjects/untitled1/server.key", "r") lines = text_file.read() print lines config.appliance_url = "https://conjur-/api" config.account = "dev" config.cert_file = "/Users/" + getpass.getuser() + "/.conjur/conjur-dev.pem" conjurapi = conjur.new_from_netrc("/Users/" + getpass.getuser() + "/.netrc", config=config) print getpass.getuser() # create a variable to store a secret token = conjurapi.create_variable( id='dev/lemur/certs/' + st + '/key', value=lines ) print token.value() value = conjurapi.variable('dev/lemur/certs/' + st + '/key').value(version=None) print value