# `certbot.plugins.dns_common`

Common code for DNS Authenticator Plugins.

class `certbot.plugins.dns_common.``DNSAuthenticator`(config, name)

  Bases: `certbot.plugins.common.Plugin`

  Base class for DNS Authenticators

  classmethod `add_parser_arguments`(add, default_propagation_seconds=10)

    Add plugin arguments to the CLI argument parser.

    NOTE: If some of your flags interact with others, you can use cli.report_config_interaction to register this to ensure values are correctly saved/overridable during renewal.

    Parameters: | add (callable) – Function that proxies calls to `argparse.ArgumentParser.add_argument` prepending options with unique plugin name prefix.

  `_setup_credentials`()

    Establish credentials, prompting if necessary.

  `_perform`(domain, validation_name, validation)

    Performs a dns-01 challenge by creating a DNS TXT record.

    Parameters:

    - domain (str) – The domain being validated.
    - validation_domain_name (str) – The validation record domain name.
    - validation (str) – The validation record content.

    Raises: | errors.PluginError – If the challenge cannot be performed

  `_cleanup`(domain, validation_name, validation)

    Deletes the DNS TXT record which would have been created by `_perform_achall`.

    Fails gracefully if no such record exists.

    Parameters:

    - domain (str) – The domain being validated.
    - validation_domain_name (str) – The validation record domain name.
    - validation (str) – The validation record content.

  `_configure`(key, label)

    Ensure that a configuration value is available.

    If necessary, prompts the user and stores the result.

    Parameters:

    - key (str) – The configuration key.
    - label (str) – The user-friendly label for this piece of information.

  `_configure_file`(key, label, validator=None)

    Ensure that a configuration value is available for a path.

    If necessary, prompts the user and stores the result.

    Parameters:

    - key (str) – The configuration key.
    - label (str) – The user-friendly label for this piece of information.

  `_configure_credentials`(key, label, required_variables=None, validator=None)

    As `_configure_file`, but for a credential configuration file.

    If necessary, prompts the user and stores the result.

    Always stores absolute paths to avoid issues during renewal.

    Parameters:

    - key (str) – The configuration key.
    - label (str) – The user-friendly label for this piece of information.
    - required_variables (dict) – Map of variable which must be present to error to display.
    - validator (callable) – A method which will be called to validate the `CredentialsConfiguration` resulting from the supplied input after it has been validated to contain the `required_variables`. Should throw a `PluginError` to indicate any issue.

  static `_prompt_for_data`(label)

    Prompt the user for a piece of information.

    Parameters: | label (str) – The user-friendly label for this piece of information.
    Returns: | The user’s response (guaranteed non-empty).
    Return type: | str

  static `_prompt_for_file`(label, validator=None)

    Prompt the user for a path.

    Parameters:

    - label (str) – The user-friendly label for the file.
    - validator (callable) – A method which will be called to validate the supplied input after it has been validated to be a non-empty path to an existing file. Should throw a `PluginError` to indicate any issue.

    Returns: | The user’s response (guaranteed to exist).
    Return type: | str

class `certbot.plugins.dns_common.``CredentialsConfiguration`(filename, mapper=<function CredentialsConfiguration.<lambda>>)

  Bases: `object`

  Represents a user-supplied filed which stores API credentials.

  `require`(required_variables)

    Ensures that the supplied set of variables are all present in the file.

    Parameters: | required_variables (dict) – Map of variable which must be present to error to display.
    Raises: | errors.PluginError – If one or more are missing.

  `conf`(var)

    Find a configuration value for variable `var`, as transformed by `mapper`.

    Parameters: | var (str) – The variable to get.
    Returns: | The value of the variable.
    Return type: | str

`certbot.plugins.dns_common.``validate_file`(filename)

  Ensure that the specified file exists.

`certbot.plugins.dns_common.``validate_file_permissions`(filename)

  Ensure that the specified file exists and warn about unsafe permissions.

`certbot.plugins.dns_common.``base_domain_name_guesses`(domain)

  Return a list of progressively less-specific domain names.

  One of these will probably be the domain name known to the DNS provider.

  Example: |

      >>> base_domain_name_guesses('foo.bar.baz.example.com')
      ['foo.bar.baz.example.com', 'bar.baz.example.com', 'baz.example.com', 'example.com', 'com']

  Parameters: | domain (str) – The domain for which to return guesses.
  Returns: | The a list of less specific domain names.
  Return type: | list