certbot_nginx.obj

Module contains classes used by the Nginx Configurator.

class certbot_nginx.obj.Addr(host, port, ssl, default, ipv6, ipv6only)[source]

Bases: certbot.plugins.common.Addr

Represents an Nginx address, i.e. what comes after the ‘listen’ directive.

According to the documentation, this may be address[:port], port, or unix:path. The latter is ignored here.

The default value if no directive is specified is *:80 (superuser) or *:8000 (otherwise). If no port is specified, the default is 80. If no address is specified, listen on all addresses.

Todo

Old-style nginx configs define SSL vhosts in a separate block instead of using ‘ssl’ in the listen directive.

Parameters:
  • addr (str) – addr part of vhost address, may be hostname, IPv4, IPv6, “”, or “*”
  • port (str) – port number or “*” or “”
  • ssl (bool) – Whether the directive includes ‘ssl’
  • default (bool) – Whether the directive includes ‘default_server’
classmethod fromstring(str_addr)[source]

Initialize Addr from string.

to_string(include_default=True)[source]

Return string representation of Addr

super_eq(other)[source]

Check ip/port equality, with IPv6 support.

class certbot_nginx.obj.VirtualHost(filep, addrs, ssl, enabled, names, raw, path)[source]

Bases: object

Represents an Nginx Virtualhost.

Variables:
  • filep (str) – file path of VH
  • addrs (set) – Virtual Host addresses (set of Addr)
  • names (set) – Server names/aliases of vhost (list of str)
  • raw (list) – The raw form of the parsed server block
  • ssl (bool) – SSLEngine on in vhost
  • enabled (bool) – Virtual host is enabled
  • path (list) – The indices into the parsed file used to access the server block defining the vhost
contains_list(test)[source]

Determine if raw server block contains test list at top level

ipv6_enabled()[source]

Return true if one or more of the listen directives in vhost supports IPv6

ipv4_enabled()[source]

Return true if one or more of the listen directives in vhost are IPv4 only

display_repr()[source]

Return a representation of VHost to be used in dialog