Esempio n. 1
0
def exclude():
    """Excludes applications from being configured."""
    ex = props.commandline.exclude
    for e in ex.split():
        app = appstrategy.get_app(e)
        if app and not app.strategy == 'openvpn':
            app.configure = False
Esempio n. 2
0
def list_configurations():
    """Prints a list of installed OpenVPN configurations."""
    lis = properties.get_default_hosts_list(names_only=True)
    configs = dict()

    # Checks if configuration is installed for a given config_id
    for c in sorted(lis):
        config = {'host': re.sub('_', ' ', c), 'openvpn': '', 'apps': ''}

        for app_name in appstrategy.get_supported_apps():
            app = appstrategy.get_app(app_name)
            if app.configure and app.find_config(c):
                logger.debug('Configuring %s for %s' % (c, app.strategy))
                if app_name == 'openvpn':
                    config['openvpn'] = '*'
                else:
                    config['apps'] += '[' + app_name + ']'
        configs[c] = config

    print("List of OpenVPN configurations")
    for c in configs:
        if configs[c]['openvpn']:
            print('  {openvpn} {host} {apps}'.format(**configs[c]))
        else:
            print('    {host} {apps}'.format(**configs[c]))
    sys.exit()
Esempio n. 3
0
def exclude():
    """Excludes applications from being configured."""
    ex = props.commandline.exclude
    for e in ex.split():
        app = appstrategy.get_app(e)
        if app and not app.strategy == 'openvpn':
            app.configure = False
Esempio n. 4
0
def list_configurations():
    """Prints a list of installed OpenVPN configurations."""
    lis = properties.get_default_hosts_list(names_only=True)
    configs = dict()

    # Checks if configuration is installed for a given config_id
    for c in sorted(lis):
        config = {'host': re.sub('_', ' ', c), 'openvpn': '', 'apps': ''}

        for app_name in appstrategy.get_supported_apps():
            app = appstrategy.get_app(app_name)
            if app.configure and app.find_config(c):
                logger.debug('Configuring %s for %s' % (c, app.strategy))
                if app_name == 'openvpn':
                    config['openvpn'] = '*'
                else:
                    config['apps'] += '[' + app_name + ']'
        configs[c] = config

        print("List of OpenVPN configurations")
    for c in configs:
        if configs[c]['openvpn']:
            print('  {openvpn} {host} {apps}'.format(**configs[c]))
        else:
            print('    {host} {apps}'.format(**configs[c]))
    sys.exit()
Esempio n. 5
0
def auto_configure():
    """Auto configures applications"""
    for config in properties.props.hosts:
        for app_name in appstrategy.get_supported_apps():
            app = appstrategy.get_app(app_name)
            if app.configure:
                logger.debug("Configuring configurations for %s" % app_name)
                app.config(config)
Esempio n. 6
0
def auto_configure():
    """Auto configures applications"""
    for config in properties.props.hosts:
        for app_name in appstrategy.get_supported_apps():
            app = appstrategy.get_app(app_name)
            if app.configure:
                logger.debug("Configuring configurations for %s" % app_name)
                app.config(config)
Esempio n. 7
0
def remove_configurations():
    """Removes configurations based on openvpn.configs"""
    logger.debug("Removing configurations!")
    for app_name in appstrategy.get_supported_apps():
        app = appstrategy.get_app(app_name)
        app.remove_configs()
Esempio n. 8
0
def remove_configurations():
    """Removes configurations based on openvpn.configs"""
    logger.debug("Removing configurations!")
    for app_name in appstrategy.get_supported_apps():
        app = appstrategy.get_app(app_name)
        app.remove_configs()