certbot_apache.obj

Module contains classes used by the Apache Configurator.

class certbot_apache.obj.Addr(tup, ipv6=False)[source]

Bases: certbot.plugins.common.Addr

Represents an Apache address.

_addr_less_specific(addr)[source]

Returns if addr.get_addr() is more specific than self.get_addr().

_rank_specific_addr()[source]

Returns numerical rank for get_addr()

Returns:2 - FQ, 1 - wildcard, 0 - _default_
Return type:int
conflicts(addr)[source]

Returns if address could conflict with correct function of self.

Could addr take away service provided by self within Apache?

Todo

Handle domain name addrs…

Examples:

127.0.0.1:\*.conflicts(127.0.0.1:443) True
127.0.0.1:443.conflicts(127.0.0.1:\*) False
\*:443.conflicts(\*:80) False
_default_:443.conflicts(\*:443) True
is_wildcard()[source]

Returns if address has a wildcard port.

get_sni_addr(port)[source]

Returns the least specific address that resolves on the port.

Examples:

  • 1.2.3.4:443 -> 1.2.3.4:<port>
  • 1.2.3.4:* -> 1.2.3.4:*
Parameters:port (str) – Desired port
class certbot_apache.obj.VirtualHost(filep, path, addrs, ssl, enabled, name=None, aliases=None, modmacro=False, ancestor=None)[source]

Bases: object

Represents an Apache Virtualhost.

Variables:
  • filep (str) – file path of VH
  • path (str) – Augeas path to virtual host
  • addrs (set) – Virtual Host addresses (set of common.Addr)
  • name (str) – ServerName of VHost
  • aliases (list) – Server aliases of vhost (list of str)
  • ssl (bool) – SSLEngine on in vhost
  • enabled (bool) – Virtual host is enabled
  • modmacro (bool) – VirtualHost is using mod_macro
  • ancestor (VirtualHost) – A non-SSL VirtualHost this is based on

https://httpd.apache.org/docs/2.4/vhosts/details.html

Todo

Any vhost that includes the magic _default_ wildcard is given the same ServerName as the main server.

get_names()[source]

Return a set of all names.

display_repr()[source]

Return a representation of VHost to be used in dialog

conflicts(addrs)[source]

See if vhost conflicts with any of the addrs.

This determines whether or not these addresses would/could overwrite the vhost addresses.

Parameters:addrs (Iterable :class:~obj.Addr) – Iterable Addresses
Returns:If addresses conflicts with vhost
Return type:bool
same_server(vhost, generic=False)[source]

Determines if the vhost is the same ‘server’.

Used in redirection - indicates whether or not the two virtual hosts serve on the exact same IP combinations, but different ports. The generic flag indicates that that we’re trying to match to a default or generic vhost

Todo

Handle _default_