# `letsencrypt_apache.obj`

Module contains classes used by the Apache Configurator.

class `letsencrypt_apache.obj.``Addr`(tup)

  Bases: `letsencrypt.plugins.common.Addr`

  Represents an Apache address.

  `_addr_less_specific`(addr)

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

  `_rank_specific_addr`()

    Returns numerical rank for get_addr()

    Returns: | 2 - FQ, 1 - wildcard, 0 - _default_
    Return type: | int

  `conflicts`(addr)

    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`()

    Returns if address has a wildcard port.

  `get_sni_addr`(port)

    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 `letsencrypt_apache.obj.``VirtualHost`(filep, path, addrs, ssl, enabled, name=None, aliases=None, modmacro=False)

  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

  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`()

    Return a set of all names.

  `conflicts`(addrs)

    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)

    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_