Beispiel #1
0
    def config(self, config_id, filename):
        """Configures configuration file for the given strategy.

        NetworkManager requires VPN credentials in its configuration files. So, those are
        pulled in using Props.get_login_credentials() classmethod.

        Args:
            config_id: the name of the profile (i.e. "US East") used as the name of the VPN endpoint
            filename: the filename of where to store the finished configuration file
            enable: NOT USED
        """

        # Gets VPN username and password
        username, password = get_login_credentials(pia.properties.props.login_config)

        # Directory of replacement values for NetworkManager's configuration files
        re_dict = {"##username##": username,
                   "##password##": password,
                   "##id##": config_id,
                   "##uuid##": str(uuid4()),
                   "##remote##": openvpn.get_remote_address(filename)}

        # Complete path of configuration file
        conf = self.conf_dir + "/" + config_id

        # Modifies configuration file
        self.update_config(re_dict, conf)
Beispiel #2
0
    def config(self, config_id, filename):
        """Configures configuration file for the given strategy.

        Args:
            config_id: the name of the profile (i.e. "US East") used as the name of the VPN endpoint
            filename: the filename of where to store the finished configuration file
            enable: NOT USED
        """

        # Directory of replacement values for connman's configuration files
        re_dict = {"##id##": config_id,
                   "##filename##": filename,
                   "##remote##": openvpn.get_remote_address(filename)}

        # Complete path of configuration file
        conf = self.conf_dir + "/" + re.sub(' ', '_', config_id) + ".config"

        # Modifies configuration file
        self.update_config(re_dict, conf)