How to use certbot-postfix - 8 common examples

To help you get started, we’ve selected a few certbot-postfix examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EFForg / starttls-everywhere / certbot-postfix / certbot_postfix / util.py View on Github external
def _get_output(self, extra_args=None):
        """Runs the Postfix utility and returns only stdout output.

        This function relies on self._call for running the utility.

        :param list extra_args: additional arguments for the command

        :returns: data written to stdout
        :rtype: str

        :raises subprocess.CalledProcessError: if the command fails

        """
        return self._call(extra_args)[0]

class PostfixUtil(PostfixUtilBase):
    """Wrapper around Postfix CLI tool.
    """
    
    def __init__(self, config_dir=None):
        PostfixUtilBase.__init__(self, COMMAND, config_dir)

    def test(self):
        """Make sure the configuration is valid.

        :raises .MisconfigurationError: if the config is invalid
        """
        try:
            self._call(["check"])
        except subprocess.CalledProcessError as e:
            print e
            raise errors.MisconfigurationError(
github certbot / certbot / certbot-postfix / certbot_postfix / util.py View on Github external
def _get_output(self, extra_args=None):
        """Runs the Postfix utility and returns only stdout output.

        This function relies on self._call for running the utility.

        :param list extra_args: additional arguments for the command

        :returns: data written to stdout
        :rtype: str

        :raises subprocess.CalledProcessError: if the command fails

        """
        return self._call(extra_args)[0]

class PostfixUtil(PostfixUtilBase):
    """Wrapper around Postfix CLI tool.
    """

    def __init__(self, config_dir=None):
        super(PostfixUtil, self).__init__(COMMAND, config_dir)

    def test(self):
        """Make sure the configuration is valid.

        :raises .MisconfigurationError: if the config is invalid
        """
        try:
            self._call(["check"])
        except subprocess.CalledProcessError as e:
            logger.debug("Could not check postfix configuration:\n%s", e)
            raise errors.MisconfigurationError(
github EFForg / starttls-everywhere / certbot-postfix / certbot_postfix / util.py View on Github external
def __init__(self, config_dir=None):
        PostfixUtilBase.__init__(self, COMMAND, config_dir)
github certbot / certbot / certbot-postfix / certbot_postfix / installer.py View on Github external
def rollback_checkpoints(self, rollback=1):
        """Rollback saved checkpoints.

        :param int rollback: Number of checkpoints to revert

        :raises .errors.PluginError: If there is a problem with the input or
            the function is unable to correctly revert the configuration
        """
        super(Installer, self).rollback_checkpoints(rollback)
        self.postconf = postconf.ConfigMain(self.conf('config-utility'),
                                            self.conf('ignore-master-overrides'),
                                            self.conf('config-dir'))
github EFForg / starttls-everywhere / certbot-postfix / certbot_postfix / installer.py View on Github external
def __init__(self, *args, **kwargs):
        super(Installer, self).__init__(*args, **kwargs)
        self.config_dir = None
        self.postconf = None
        # self.proposed_changes = {}
        self.save_notes = []
        self.policy = None
        self.policy_lines = []
        self.policy_file = None
        self.postfix_policy_file = None
github certbot / certbot / certbot-postfix / certbot_postfix / postconf.py View on Github external
def __init__(self, executable, ignore_master_overrides=False, config_dir=None):
        super(ConfigMain, self).__init__(executable, config_dir)
        # Whether to ignore overrides from master.
        self._ignore_master_overrides = ignore_master_overrides
        # List of all current Postfix parameters, from `postconf` command.
        self._db = {} # type: Dict[str, str]
        # List of current master.cf overrides from Postfix config. Dictionary
        # of parameter name => list of tuples (service name, paramter value)
        # Note: We should never modify master without explicit permission.
        self._master_db = {} # type: Dict[str, List[Tuple[str, str]]]
        # List of all changes requested to the Postfix parameters as they are now
        # in _db. These changes are flushed to `postconf` on `flush`.
        self._updated = {} # type: Dict[str, str]
        self._read_from_conf()
github EFForg / starttls-everywhere / certbot-postfix / certbot_postfix / postconf.py View on Github external
postconf before any values in extra_args.

        :param list extra_args: additional arguments for the command

        :returns: data written to stdout and stderr
        :rtype: `tuple` of `str`

        :raises subprocess.CalledProcessError: if the command fails

        """
        all_extra_args = []
        for args_list in (self._modifiers, extra_args,):
            if args_list is not None:
                all_extra_args.extend(args_list)

        return super(ConfigMain, self)._call(all_extra_args)
github certbot / certbot / certbot-postfix / certbot_postfix / util.py View on Github external
def __init__(self, config_dir=None):
        super(PostfixUtil, self).__init__(COMMAND, config_dir)