Commit Graph

977 Commits (29d65dd0d5454d38591427144c765fa2acc9a5e5)

Author SHA1 Message Date
Dustin 3473694eb0 roles/named: Improve support for other zone types
Only *master* zones need zone files pre-populated, as the other types of
zones are populated by data named receives from queries and transfers.
Other types of zones require other options, however, to be usable. This
commit introduces minimal support for specifying *slave*, *forward*, and
*stub* zones.
2018-02-21 22:33:52 -06:00
Dustin 83817ca340 roles/bind: Simplify zone allow-update settings
Items in the `allow_update` property can use the address match list
syntax to specify arbitrary restrictions, including TSIG key names.
There is really no need for a special case for key names.
2018-02-21 22:28:35 -06:00
Dustin eca967c8b3 roles/named: Support managing TSIG keys
To support signing of updates, TSIG keys can be defined using the
`named_keys` variable. This variable takes a list of objects with the
following properties:

* `name`: The name of the key
* `algorithm`: The signature algorithm (default: `hmac-md5`)
* `secret`: The base64-encoded key material
2018-02-20 16:12:23 -06:00
Dustin 0629a063bc roles/named: Support managing zones
The *named* role now supports generating configuration for authoritative
DNS zones and DNSSEC keys. Zones are defined by populating the
`named_zones` variable with a list of objects describing the zone. Zone
properties can include:

* `name`: The DNS domain name
* `type`: The zone type, defaults to `master`
* `allow_update`: A list of hosts/networks or DNSSEC key names (which
  must be specified as an object with a `key` property)
* `update_policy`: A list of BIND update policy statements
* `ttl`: The default (minimum) TTL for the zone
* `origin`: The authoritative name server for the zone
* `refresh`, `retry`, `expire`: Record cache timeout values
* `default_records`: A list of default records, defined as objects with
  the following properties:
  * `name`: The RR name
  * `type`: The RR type (default: `A`)
  * `value`: The RR value

Zone files will be created in `/var/named/dynamic`. Existing zone files
will **not** be overwritten; management of zone records is done using
`nsupdate` or similar.
2018-02-20 16:12:05 -06:00
Dustin 7144701787 roles/named: Add missing variable defaults 2018-02-20 13:25:10 -06:00
Dustin bf820c482e hosts: Add new domain controllers 2018-02-19 22:46:27 -06:00
Dustin a3cc57919a samba-dc: Switch away from BIND9_DLZ
The BIND9_DLZ plugin turned out to be pretty flaky. It craps out
whenever `named` is reloaded, which seems to happen occasionally for
reasons I cannot identify. Combined with the weird SELinux issues, and
the fact that upstream recommends against it anyway, I decided to just
use the built-in DNS server in Samba.
2018-02-19 22:46:27 -06:00
Dustin efbb563670 roles/samba-dc: Conditionally configure BIND9_DLZ
This commit adjusts the tasks in the *samba-dc* role to use a
conditional include to restrict tasks relating to the BIND9_DLZ plugin
only to hosts that are configured to use it.
2018-02-19 22:46:27 -06:00
Dustin 03ef6a402a roles/samba: Add some management tools
The *bind-utils* package contains `dig` and `nsupdate`, which are used
to query and manage DNS records.

The *cyrus-sasl-gssapi* package contains the GSSAPI plugin for
SASL-aware applications, including `ldapsearch`.

The *ldb-tools* package contains `ldbsearch` and other tools for
directly using Samba database files.
2018-02-18 13:14:35 -06:00
Dustin f458a46e3f roles/samba-dc: Additional BIND SELinux contexts
The `/var/lib/samba/bind-dns` directory contains files that are
hard-linked to files in the `/var/lib/samba/private` directory. All
paths for a file must have the same context, or `restorecon` will
effectively "toggle" the labels each time it is run.
2018-02-18 13:10:31 -06:00
Dustin 94154a9f2b roles/samba-dc: Correct restorecon path
Evidently, some files in `/var/lib/samba` match multiple file context
rules. Thus, when running `restorecon` against the entire
`/var/lib/samba` directory, files in the `bind-dns` subdirectory may end
up with the wrong label. To work around this issue, `restorecon` is now
run only on that subdirectory to ensure the correct labels are applied.

This is likely to cause problems when a full filesystem relabel is
scheduled.
2018-02-18 10:09:57 -06:00
Dustin 7191903801 roles/named: Restart daemon after modifying config
The `named` daemon does not seem to pick up all changes to the
configuration file during a graceful reload. To avoid strange states,
the daemon is now fully restarted after the configuration file is
regenerated.
2018-02-18 10:09:57 -06:00
Dustin f5b922265b roles/named: Add allow-update block to named.conf
The `allow-update` block in `named.conf` enumerates the hosts/networks
that are allowed to issue dynamic DNS updates. This is required in
Active Directory and other environments where clients and/or DHCP
servers create DNS records automatically.

By default, the block is omitted from the generated configuration file.
The `named_allow_update` variable can be set to a list of patterns (e.g.
CIDR blocks, ACL names, etc.) to populate it.
2018-02-18 10:04:27 -06:00
Dustin 10ae79e5a2 firewalld: Playbook to bootstrap firewalld
For machines that were not pre-installed with firewalld, the
`firewalld.yml` playbook will install it and set it to start
automatically at boot.
2018-01-29 15:11:07 -06:00
Dustin 20fb830eda Protect vault secret with GPG
Encrypting the vault password with GPG protects the key when stored on
disk and allows it to be accessed non-interactively, as long as the
GnuPG agent is set up correctly.
2018-01-29 15:11:07 -06:00
Dustin 940ea5efb2 domain-controller: Load secrets from vault
If a file exists at `vault/samba-dc/{{ krb5_realm }}`, it will be loaded
before applying the tasks to deploy a Samba domain controller. This can
be used, for example, to set the credentials for adding a new domain
controller to an existing domain.
2018-01-29 15:11:07 -06:00
Dustin cb7c36d65a roles/samba-dc: Support joining existing domain
The *samba-dc* role now supports joining an existing Active Directory
domain as an additional domain controller. The `samba_is_first_dc` variable
controls whether the machine will be provisioned with a new domain (when
true) or added to an existing domain (when false).

Joining an existing domain naturally requires credentials of a user with
permission to add a new DC, the `samba_dc_join_username` and
`samba_dc_join_password` variables can be used to specify them.
Alternatively, if these variables are not defined, then the process will
attempt to use Kerberos credentials. This would require playbooks to
make a ticket-granting-ticket available somehow, such as by executing
`kinit` prior to applying the *samba-dc* role.
2018-01-29 15:11:07 -06:00
Dustin 1ccb8928bf domain-controller: Playbook to deploy Samba DCs
The `domain-controller.yml` playbook combins the `samba-dc.yml` and
`named-server.yml` playbooks, making the process of deploying a new AD
DC using Samba and BIND slightly simpler.
2018-01-29 15:10:28 -06:00
Dustin 6ac9ea82f0 named-server: Playbook to deploy BIND
The `named-server.yml` playbook applies the *named* role to deploy BIND
on members of the *named-server* host group.
2018-01-29 15:10:04 -06:00
Dustin b493d81cfa roles/named: Deploy BIND DNS server
The *named* role configures the BIND DNS server on managed nodes. It
writes `/etc/named.conf`, using a template that supports most of the
commonly-used options. The configuration can be augmented by other
templates, etc. by specifying file paths in the `named_options_include`
or `named_global_include` variables, both of which are lists.
2018-01-29 15:07:31 -06:00
Dustin ac354643c5 samba-dc: Playbook to deploy Samba AD DCs
The `samba-dc.yml` playbook simply applies the *samba-dc* role to
managed nodes in the *samba-dc* host group.
2018-01-29 15:07:24 -06:00
Dustin 42ce2434ad roles/samba-dc: Deploy a Samba AD DC
The *samba-dc* role installs Samba on the managed node and configures it
as an Active Directory Domain controller. A custom module,
`samba_domain` handles the provisioning using `samba-tool domain
provision` in an idempotent way.
2018-01-29 15:07:15 -06:00
Dustin ec524416c6 roles/kerberos: Configure mit-krb5
The *kerberos* role configures the MIT Kerberos library.  Specifically,
it creates `/etc/krb5.conf` and populates it with some basic default
options. It also creates the `/etc/krb5.conf.d` directory, into which
other roles can write additional configuration files.
2018-01-29 15:05:51 -06:00
Dustin 5819b222af base: Base playbook
The `base.yml` playbook applies the *base* role.
2018-01-29 15:03:45 -06:00
Dustin b870daff58 roles/base: Basic config management support
The *base* role performs the basic tasks needed to manage a node using
Ansible. Specifically, it installs the necessary packages for
manipulating SELinux policy.
2018-01-29 15:02:10 -06:00
Dustin e327db1f4f hostname: Playbook to set system hostname
The `hostname.yml` playbook does what it says on the tin: it sets the
hostname of the managed node. The `preferred_hostname` variable can be
used to specify the value to use for the hostname. If it is not set, the
name specified in the inventory is used.
2018-01-02 23:37:00 -06:00
Dustin 7f86881b7c Initial commit 2018-01-02 23:36:42 -06:00