/usr/lib/python-securepass/sp-app-add is in python-securepass 0.4.3-1.
This file is owned by root:root, with mode 0o755.
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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | #!/usr/bin/python
##
## SecurePass CLI tools utilities
## Add application
##
## (c) 2013 Giuseppe Paterno' (gpaterno@gpaterno.com)
## GARL Sagl (www.garl.ch)
##
from securepass import utils
from securepass import securepass
import logging
from argparse import ArgumentParser
parser = ArgumentParser(
description="Add application in SecurePass",
prog="sp-app-add",
)
parser.add_argument('-D', '--debug',
action='store_true',
default=False,
dest="debug_flag",
help="Enable debug output",)
parser.add_argument('-4', '--ipv4',
default="0.0.0.0/0",
action='store', dest="ipv4",
help="Restrict to IPv4 network (default: 0.0.0.0/0)",)
parser.add_argument('-6', '--ipv6',
default="::/0",
action='store', dest="ipv6",
help="Restrict to IPv6 network (default: ::/0)",)
parser.add_argument('-g', '--group',
default="",
action='store', dest="group",
help="Group name (restriction)",)
parser.add_argument('-r', '--realm',
action='store', dest="realm",
help="Set alternate realm",)
parser.add_argument('-w', '--write',
action='store_true', dest="write",
default=False,
help="Write capabilites (default readonly)",)
parser.add_argument('-p', '--privacy',
action='store_true', dest="privacy",
default=False,
help="Privacy flag (default no)",)
parser.add_argument('label', action='store')
values = parser.parse_args()
## Set debug
FORMAT = '%(asctime)-15s %(levelname)s: %(message)s'
if values.debug_flag:
logging.basicConfig(format=FORMAT, level=logging.DEBUG)
else:
logging.basicConfig(format=FORMAT, level=logging.INFO)
## Load config
config = utils.loadConfig()
## Config the handler
sp_handler = securepass.SecurePass(app_id=config['app_id'],
app_secret=config['app_secret'],
endpoint=config['endpoint'])
## Add the user
logging.debug("Adding application %s" % values.label)
try:
result = sp_handler.app_add(label=values.label,
allow_network_ipv4=values.ipv4,
allow_network_ipv6=values.ipv6,
write=values.write,
realm=values.realm,
group=values.group.strip().lower(),
privacy=values.privacy)
print "Application ID: %s" % result['app_id']
print "Application Secret: %s" % result['app_secret']
print ""
print "Please save the above results, secret will be no longer displayed for security reasons."
except Exception as e:
print e
|