Commit Graph

295 Commits (3f99708c48c76b1a671d8b77ab94bbdafbd622d6)

Author SHA1 Message Date
Dustin ed5f7108dc websites: Add role for pyrocufflink.net site
The *websites/pyrocufflink.net* role configures the public web server to
host *pyrocufflink.net*. This site has two functions:

* It redirects `/` to http://dustin.hatch.name/
* It proxies user home directories (i.e. /~dustin/) to the file server
2019-01-04 20:52:23 -06:00
Dustin 52a9fb1c0e roles/apache: Set ServerName in default SSL vhost
The `ServerName` directive needs to be set inside the default SSL vhost,
as this property does not get inherited from the global configuration,
and it is needs to be set in order for SNI to work correctly.
2019-01-04 20:52:23 -06:00
Dustin ea1f52814d roles/apache: Configure mod_userdir
By default, per-user directories (i.e. `/~username/`) are disabled in
Fedora's configuration of Apache. This commit introduces a new variable,
`apache_userdir`, which can be used to enable this feature. It should be
set to a string other than *disabled*, which is the path under users'
home directories that will be served, if it is accessible. Normally, the
value would be `public_html`.
2019-01-04 20:52:23 -06:00
Dustin 972dbd1fdf websites/dcow: Add certbot role dependency
To support multiple websites with separate Let's Encrypt certificates,
the *certbot* role needs to be applied as a dependency of each
individual website role. This will allow each application to specify a
different value for `certbot_domains`.
2019-01-04 20:52:23 -06:00
Dustin d1a72de6b0 roles/certbot: Run periodically as certbot user
The default systemd unit configuration for *certbot-renew.service* runs
the `certbot renew …` command as root. This can cause permissions
issues, since this Ansible role expects the *certbot* user to be able to
access all configuration, data, and log files. As such, this commit adds
a systemd unit extension for *certbot-renew.service* to run the command
as *certbot*.
2019-01-04 20:52:23 -06:00
Dustin b61070fea8 dch-openvpn: Support road-warrior clients
Moving the route definitions to global scope, and defining an address
pool, will allow other clients besides *dhatch-d4b* to connect to and
use the OpenVPN tunnel service. This may be useful in situations where
IPsec is blocked
2018-10-07 21:42:18 -05:00
Dustin a1ca06a3c5 Move VPN server to dedicated VM
The VPN capability of the UniFi Security Gateway is extremely limited.
It does not support road-warrior IPsec/IKEv2 configuration, and its
OpenVPN configuration is inflexible. As with DHCP, the best solution is
to simply move service to another machine.

To that end, I created a new VM, *vpn0.pyrocufflink.blue*, to host both
strongSwan and OpenVPN. For this to work, the necessary TCP/UDP ports
need to be forwarded, of course, and all of the remote subnets need
static routes on the gateway, specifying this machine as the next hop.
Additionally, ICMP redirects need to be disabled, to prevent confusing
the routing tables of devices on the same subnet as the VPN gateway.
2018-10-07 21:42:18 -05:00
Dustin 07356697c8 roles/dch-openvpn-server: Use firemon_networks
The routes to FireMon networks are now defined using the
`firemon_networks` Ansible variable. The global `iroute` and
client-specific `route` options are generated from the CIDR blocks
specified in this list.
2018-08-26 17:32:23 -05:00
Dustin 88dd80e6fd aria2: Deploy aria2 download manager
The *aria2* role installs the *aria2* download manager and sets it up to
run as a system service with RPC enabled. It also sets up the web UI,
though that must be installed manually from an archive, for now.
2018-08-19 14:17:48 -05:00
Dustin f250e00a17 roles/named: Provide default for named_keys
For hosts that do not have any TSIG keys, the `named_keys` variable
still must be defined (to an empty iterable) in order for the template
to expand properly.
2018-08-12 18:06:14 -05:00
Dustin 07a23267c6 hosts: Add dns1.pyrocufflink.blue
To avoid having a single point of failure, a second recursive DNS server
is necessary. This will be useful in cases where the VM hosts must both
be taken offline, but Internet access is still required.

The new server, *dns1.pyrocufflink.blue*, has all the same zones defined
as the original. It forwards the *pyrocufflink.blue* zone and
corresponding reverse zones to the domain controllers, and acts as a
slave for the *pyrocufflink.red* zone.
2018-08-12 17:24:37 -05:00
Dustin 26f3637bfa hosts: Add proxy0.pyrocufflink.blue
As its name suggests, *proxy0.pyrocufflink.blue* acts as an HTTP proxy
server running Squid.
2018-08-12 16:00:53 -05:00
Dustin b86ecb99fd squid: Add role and PB to deploy Squid 2018-08-12 16:00:32 -05:00
Dustin 72b148bd0e hosts: Add smtp1.p.b
*smtp1.pyrocufflink.blue* is a VM that will replace
*smtp0.pyrocufflink.blue*, a Raspberry Pi.

I decided that there is little use in having the availability guarantee of
a discreet machine for the SMTP relay. The only system that would NEED
to send mail if the VM host fails is Zabbix, which operates as its own
relay anyway. As such, the main relay can be a VM, and the Raspberry Pi
can be repurposed as a recursive DNS server.
2018-08-12 15:22:31 -05:00
Dustin 18ed14f376 Add SSH host keys for burp0.p.b 2018-08-12 10:27:20 -05:00
Dustin 4e8bd8995b hosts: Add koji0.pyrocufflink.blue
*koji0.pyrocufflink.blue* hosts the Koji ecosystem, including a builder.
2018-08-12 10:27:20 -05:00
Dustin a0dd911a63 roles/koji-builder: Deploy the Koji builder
The *koji-builder* role installs and configures the Koji builder
(*kojid*). It supports configuring an HTTP proxy, if required.
2018-08-12 10:14:25 -05:00
Dustin da4ec1612c roles/koji-web: Deploy the Koji Web UI
The *koji-web* role installs and configures the Koji Web GUI front-end
for Koji. It requires Apache and mod_wsgi. A client certificate is
required for authentication to the hub, and must be placed in the
host-specific subdirectory of `certs/koji`.
2018-08-12 10:08:01 -05:00
Dustin 6341d972f6 roles/koji-client: Configure the koji client
The *koji-client* role is a generic role that can be used to configure
the Koji client library/`koji` CLI tool. By default, it manages the
default configuration at `/etc/koji`, but by using the
`koji_client_dir`, `koji_client_user`, and `koji_client_id` variables,
it can be used to configure per-user client configuration as well.
2018-08-12 10:05:56 -05:00
Dustin aed2776e27 roles/kojira: Deploy the Koji repository agent
The *kojira* role sets up the Koji repository agent to manage
repository metadata for build tags. It runs as a daemon, usually on the
same machine as the Koji hub. A client certificate is required for
authentication, and must be supplied by placing it in the
`certs/koji/{{ inventory_hostname }}` directory.
2018-08-12 10:04:23 -05:00
Dustin 1a8d7ce29a roles/koji-gc: Deploy the Koji garbage collector
The *koji-gc* role sets up the Koji garbage collector utility to run
periodically. It uses cron for scheduling. A client certificate is
required for authentication, and must be supplied by placing it in the
`certs/koji/{{ inventory_hostname }}` directory.
2018-08-12 09:58:56 -05:00
Dustin 760d3f4aec roles/koji-hub: Deploy the Koji Hub
The *koji-hub* role installs and configures the Koji Hub. It requires
Apache and mod_wsgi. Management of client certificates must be done
externally.
2018-08-12 09:33:08 -05:00
Dustin a810e9c691 roles/cronie: Install cronie
The minimal Fedora installation does not include a cron implementation.
The *cronie* role can be applied to hosts installed in this way to
ensure that cron is available for task scheduling.
2018-08-08 21:38:56 -05:00
Dustin 47999302cf roles/dch-vpn-server: Update remote access DNS
This commit updates the DNS server addresses pushed to remote access VPN
clients to use the new DNS server on the *pyrocufflink.blue* network.
2018-08-08 21:37:30 -05:00
Dustin b7fafa6734 roles/burp-client: Deploy BURP client
The *burp-client* role installs and configures a BURP client. It should
support RHEL/CentOS/Fedora and Gentoo.

To manage the client password and other server-mandated configuration,
the role uses Ansible's delegation feature to generate a configuration
file in the "clientconfdir" on the BURP server.

An hourly cron task is scheduled that runs `burp -a t` every hour. This
allows the server to configure backup timebands and intervals.
2018-08-08 20:11:46 -05:00
Dustin ddd7031624 roles/burp-server: Deploy BURP server
The *burp-server* role installs and configures a BURP server. It is
adapted from a previous iteration, and should support CentOS/RHEL/Fedora
and Gentoo, as well as both BURP 1.x and 2.x (depending on which version
gets installed by the system package manager).

To manage the certificate authority, the *burp-server* role uses the
`burp_ca` command. This has the advantage of not requiring any external
certificate management, but effectively binds the CA to a specific
machine.
2018-08-08 20:08:16 -05:00
Dustin 0a975ae4af roles/postfix: Vary shlib directory by arch
The value of the `shlib_directory` is dependent the system architecture.
Specifically, x86_64 machines use `/usr/lib64/postfix`, while everything
else uses `/usr/lib/postfix`. This role was originally deployed on a
Raspberry Pi, so the original path was correct. Attempting to deploy it
on an x86_64 machine revealed the error.

This commit adds a new task that loads a variables file based on the
architecture. Each option defines an `arch_libdir` variable, which can
be expanded in the `postfix_shlib_directory` variable as needed.
2018-08-07 19:51:09 -05:00
Dustin 4d45d727cb roles/dch-proxy: Remove backend myala
*myala.pyrocufflink.jazz* no longer hosts any public-facing websites,
and is in fact shut down. To prevent HAproxy from failing to start
because it cannot resolve the name, this backend needs to be removed.
2018-08-03 00:27:32 -05:00
Dustin a58b0f6523 Add SSH host key for web0 2018-08-01 22:29:40 -05:00
Dustin b4bcb12750 Add SSH host keys for vmhost0, vmhost1 2018-08-01 22:11:40 -05:00
Dustin 69a7e869b4 hosts: Add file0.p.b 2018-08-01 22:11:40 -05:00
Dustin 84a5d66b7a roles/fileserver: Deploy Samba file server
The *fileserver* role configures Samba as a file sharing server. It uses
the *samba* role to handle cross-distribution installation of Samba
itself, and is focused primarily on configuring shared folders.
2018-08-01 22:04:07 -05:00
Dustin f078522d97 roles/vmhost: Open libvirt migration firewall port 2018-07-29 10:39:36 -05:00
Dustin da79e8482c vmhost1: Update net-ifaces script 2018-07-29 10:39:12 -05:00
Dustin a95937d111 roles/dch-storage-net: Add After device dependency
This commit adds an *after* ordering dependency on the network device
unit to the *wait-global-address@.service* template unit. Without this
dependency, the service will wait forever for a global address if the
device does not exist. With the dependency, though, if the device does
not appear within the default timeout, the wait service will never
start, causing all dependent services to fail, but allowing the boot
process to continue.
2018-07-29 10:14:00 -05:00
Dustin 131c872d32 Merge remote-tracking branch 'refs/remotes/origin/master' 2018-07-29 10:02:28 -05:00
Dustin 9bf2a911c6 roles/dch-proxy: Switch default backend to web0.p.b
The public-facing websites are now hosted by *web0.pyrocufflink.blue*
and *myala.pyrocufflink.jazz* has been decommissioned.
2018-07-29 09:41:10 -05:00
Dustin 33ee3bf08d websites: Add role for darkchestofwonders.us
The *websites/darkchestofwonders.us* role prepares a machine to host
http://darkchestofwonders.us/. The website itself is published via rsync
by Jenkins.
2018-07-29 09:34:41 -05:00
Dustin 1f16b4c3e4 websites: Add role for nratonpass.com
The *websites/nratonpass.com* role prepares a machine to host
http://nratonpass.com/. The website itself is published via rsync by
Jenkins.
2018-07-29 09:34:21 -05:00
Dustin ae5d8bee56 websites: Add role for ebonfire.com
The *websites/ebonfire.com* role prepares a machine to host
http://ebonfire.com/. The website itself is published via rsync by
Jenkins.
2018-07-29 09:33:31 -05:00
Dustin 3d46e6b411 websites: Add role for dustin.hatch.name
The *websites/dustin.hatch.name* role configures a server to host
http://dustin.hatch.name/. The role only applies basic configuration;
the actual website application is published by Jenkins.
2018-07-29 09:32:19 -05:00
Dustin 4a5d319a17 roles/certbot: Reload Apache before cert requests
The Apache service needs to be reloaded after the *certbot* role
configures it to serve the `/.well-known/acme-challenge` path, so that
the changes can take effect before the `certbot` command is run to
request the certificate(s).
2018-07-29 09:28:12 -05:00
Dustin 9f5f692b6a roles/apache: Do not start Apache
If another role that depends on the *apache* role accidentally creates
an invalid configuration, it will be impossible to correct it by
subsequent invocations of its playbook. This is because the *apache*
role always tries to start the service, which will fail if the
configuration is invalid, thus aborting the playbook. With this early
abort, there is no way for later tasks to correct the error.

Playbooks that include the *apache* role should have a task that is
executed after all the roles have been applied to ensure the service is
running.
2018-07-29 09:25:54 -05:00
Dustin e8f9f48bfd roles/winbind: Actually perform domain join 2018-07-26 16:54:03 -05:00
Dustin 11dc40bc76 hosts: Add vmhost{0,1}.p.b 2018-07-23 17:35:10 -05:00
Dustin f8ae016042 roles/dch-storage-net: Set up/mount shared storage
The *dch-storage-net* role configures a machine to connect the storage
network and mount shared folders from the storage appliance.

The `wait-global-address.sh` script and corresponding
*wait-global-address@.service* systemd unit template are necessary to
ensure that the storage network is actually available before attempting
to mount the shared volumes. This is particularly important at boot,
since `dhcpcd` does not implement any kind of signaling that can be used
by *network-online.target*, so the network is considered "online" as
soon as the `dhcpcd` process has started. This typically results in
"network unreachable" errors.
2018-07-23 17:35:10 -05:00
Dustin abd05f8443 roles/vmhost: Configure libvirtd+QEMU
The *vmhost* role installs and configures the libvirt daemon to host
QEMU/KVM virtual machines.
2018-07-23 17:35:10 -05:00
Dustin 704850caa9 roles/net-ifaces: Configure virtual net interfaces
The *net-ifaces* role manages a script that creates virtual network
interfaces, such as bridge, bond, and VLAN, that `dhcpcd`/`dhclient`
alone cannot. This provides a lightweight alternative to
*systemd-networkd* and *NetworkMangager*.
2018-07-23 17:35:10 -05:00
Dustin 44a82688e4 roles/dhcpcd: Always send FQDN
Though the default for the `fqdn` value is listed as `both` in
*dhcpcd.conf(5)*, the current behavior of `dhcpcd` suggests that it may
actually be `none`. Without explicitly setting `fqdn both`, the value of
the kernel node name is sent as-is in the *hostname* option (12). If the
node name is set to the FQDN, then dynamic DNS gets broken, since the
DHCP server always appends its domain name to the provided hostname.
Setting `fqdn both` causes `dhcpcd` to send the FQDN in the *FQDN*
option (81), which the DHCP server interprets correctly.
2018-07-23 17:35:10 -05:00
Dustin 1302cd8825 roles/dhcpcd: Use a list for allow/deny interfaces
Using a list to specify the values for the `allowinterfaces` and
`denyinterfaces` parameters in `dhcpcd.conf` makes the configuration
policy cleaner and more type-safe.
2018-07-23 17:35:10 -05:00
Dustin a3b0349b4c roles/freeradius: Enable/start service
The *radiusd* service needs to be set to start on boot, lest the WiFi
goes down when the server is rebooted!
2018-07-23 12:25:14 -05:00
Dustin da2d73b676 roles/dhcpcd: Disable device management module
Today I realized that `dhcpcd` has been logging several hundred thousand
of these messages every second:

    libudev: received NULL device

This was causing both `dhcpcd` and `systemd-journald` to consume 100%
CPU.

I am not entirely sure what a "device management" module is in the
context of `dhcpcd`, but it does not seem to be required. Setting the
`nodev` option in `dhcpcd.conf` suppresses the messages, and seems to
have no effect on the operation of the daemon.
2018-07-20 17:46:47 -05:00
Dustin c88ee8bd99 dch-gw: Restrict traffic from Management network
Traffic from the management network is not allowed except for specific
services. NTP is required of course, for time synchronization with the
pyrocufflink.blue domain controllers. RADIUS is necessary for WiFi
authentication, which is also handled by the DCs.
2018-07-15 12:16:43 -05:00
Dustin 6e77d3cf07 roles/dch-openvpn-server: Add FireMon Mgmt subnet 2018-07-14 19:16:40 -05:00
Dustin 16a883f2f1 roles/ssh-hostkeys: Add keys for jenkins0.p.b 2018-07-03 13:30:34 -05:00
Dustin 03e5764de1 roles/dch-openvpn-server: Correct routes
The `ifconfig` global directive specifies the IP address added to the
tunnel interface device, not the network. The `push route` directives
need to include this address to correctly send route information to
clients.
2018-07-01 16:47:43 -05:00
Dustin c3f1f5750d roles/dch-proxy: Add OpenVPN backend
The `openvpn` haproxy backend allows forwarding TLS traffic for
*vpn.securepassage.com* to the OpenVPN-over-TLS service on the gateway.
2018-07-01 15:17:14 -05:00
Dustin e3c003e4aa hosts: gw0: Add OpenVPN certs/key 2018-07-01 15:16:51 -05:00
Dustin 780c8783db roles/dch-openvpn-server: Deploy OpenVPN server
The *dch-openvpn-server* role installs and configures OpenVPN and
stunnel to provide both native OpenVPN service as well as
OpenVPN-over-TLS. The latter uses stunnel, listening on TCP port 9876,
to allow better firewall traversal and TCP port sharing via reverse
proxy.
2018-07-01 15:14:23 -05:00
Dustin a02ddbb53f roles/apache: Support setting ServerTokens
The `apache_server_tokens` variable can now be set, which controls the
value of the `ServerTokens` directive. If the variable is set, the
`ServerTokens` directive will be added to the `00-servername.conf` file.
2018-06-23 14:42:45 -05:00
Dustin 10d6b52460 roles/samba: Support selecting interfaces
The `samba_interfaces` variable can now be defined to populate the
`interfaces` global configuration parameter in `smb.conf`. This
parameter controls the interfaces or addresses to which the Samba server
binds, and also the IP addresses that are registered in DNS.
2018-06-23 14:42:45 -05:00
Dustin 9d54411d52 roles/dch-proxy: Add backend for Jenkins
This commit configures HAProxy to proxy *jenkins.pyrocufflink.net* and
*jenkins.pyrocufflink.blue* to the Jenkins master.
2018-06-23 14:42:45 -05:00
Dustin c95a4b7379 roles/certbot: Support using existing account data
The *certbot* role now supports copying the data for an existing Let's
Encrypt account to the managed node using an archive. If an archive
named for the inventory hostname (typically the FQDN) of the managed
node is found in the `accounts` directory under the `files` directory of
the *certbot* role, it will be copied to the managed node and extracted
at `/var/lib/letsencrypt/accounts`. This takes the place of running
`certbot register` to sign up for a new account.
2018-06-23 13:44:34 -05:00
Dustin 52436acb48 roles/certbot: Add some task tags
The *install* tag is applied to any task that installs a package.

The *user* tag is applied to any task that creates an OS user or group.

The *group* tag is applied to any task that creates an OS user group.
2018-06-23 13:43:14 -05:00
Dustin f78fe14eae roles/zabbix: Respect host_uses_firewalld
For machines that do not use firewalld, the *zabbix-agent* role will now
skip attempting to open the Zabbix agent port using the `firewalld`
module. The `host_uses_firewalld` variable controls this behavior.
2018-06-19 20:37:09 -05:00
Dustin b5ea6b702a roles/ssh-hostkeys: Add keys for rprx0.p.b 2018-06-18 20:08:30 -05:00
Dustin 7b687db1c1 roles/ssh-hostkeys: Add keys for git0.p.b 2018-06-18 20:08:12 -05:00
Dustin fd172ddf7c roles/dch-proxy: Redirect git.p.n to Gitea
The name *git.pyrocufflink.net* now proxies to Gitea instead of CGit.
2018-06-13 22:23:27 -05:00
Dustin 222acdba32 git0: Switch to Let's Encrypt certificate 2018-06-13 22:23:27 -05:00
Dustin c6a50313dc roles/certbot: Set up Let's Encrypt certificates
The *certbot* role installs and configures the `certbot` ACME client. It
adjusts the default configuration to allow the tool to run as an
unprivileged user, and then configures Apache to work with the *webroot*
plugin. It registers for an account and requests a certificate for the
domains specified by the `certbot_domains` Ansible variable. Finally, it
enables the *certbot-renew.timer* systemd unit to schedule automatic
renewal of all Let's Encrypt certificates.
2018-06-13 22:23:21 -05:00
Dustin c5fe4a66aa roles/dch-proxy: Deploy reverse HTTP/HTTPS proxy
The *dch-proxy* role sets up HAProxy to provide a revers proxy for all
public-facing web services on the Pyrocufflink network. It uses the TLS
Server Name Indication (SNI) extension to determine the proper backend
server based on the name requested by the client.

For now, only Gitea is configured; the name *git.pyrocufflink.blue* is
proxied to *git0.pyrocufflink.blue*. All other names are proxied to
Myala.
2018-06-12 22:31:15 -05:00
Dustin 235468a71c roles/haproxy: Basic setup for HAproxy
The *haproxy* installs HAproxy and sets up basic configuration for it.
It configures the systemd unit to launch the service with the `-f
/etc/haproxy` arguments, which will cause it to load all files from the
`/etc/haproxy` directory, instead of just `/etc/haproxy/haproxy.cfg`.
This will allow other roles to add frontend and backend configuration by
adding additional files to this directory.
2018-06-12 22:31:15 -05:00
Dustin 701ce24eb3 roles/ssh-hostkeys: Add keys for git0.p.b 2018-06-09 14:36:17 -05:00
Dustin a6182c74cb roles/zabbix-server: Redirect HTTP -> HTTPS 2018-06-09 14:35:22 -05:00
Dustin 2be0e3d0a5 roles/sshd: Configure OpenSSH daemon
The *sshd* role can be used to configure the OpenSSH daemon. It supports
configuring a few options globally, as well as a limited set of options
in `Match` blocks (e.g. per-user/group configuration).
2018-06-06 21:44:28 -05:00
Dustin 861c6f4fe1 roles/trustca: Generic role for adding CA certs
The `trustca` role can be used to add CA certificates to the system
trust store. It requires a variable, `ca`, to be defined, referring to
the name of a file containing a CA certificate to install.
2018-06-04 20:03:55 -05:00
Dustin 6a83a6dfa3 roles/gitea: Allow configuring clone URLs
The `gitea_ssh_domain` and `gitea_http_domain` variables can be used to
configure the host portion of the URLs for cloning Git repositories over
SSH and HTTPS, respectively. By default, both values are the FQDN of the
machine hosting Gitea.
2018-06-04 20:03:55 -05:00
Dustin a7ebe3b2ae roles/gitea: Add HTTP -> HTTPS redirect 2018-06-04 20:03:55 -05:00
Dustin d97dbaa189 hosts: Add git0.pyrocufflink.blue
*git0.pyrocufflink.blue* hosts Gitea.
2018-06-04 20:03:55 -05:00
Dustin adaf3c6789 roles/gitea: Deploy Gitea server
The *gitea* role installs Gitea using the system package manager and
configures Apache as a reverse proxy for it.

The configuration file requires a number of "secret" values that need to
be unique. These must be specified as Ansible variables:

* `gitea_internal_token`
* `gitea_secret_key`
* `gitea_lfs_jwt_secret`

The `gitea generate` command can be used to create these values.

Normally, Gitea expects to run its own setup tool to generate the
configuration file and create the administrative user. Since the
configuration file is generated from the template instead, no
administrative user is created automatically. Luckily, the `gitea`
command includes a tool to create users, so the administrator can be
created manually, e.g.:

    sudo -u gitea gitea admin create-user -c /etc/gitea/app.ini \
        --admin
        --name giteadmin \
        --password giteadmin \
        --email giteadmin@example.org
2018-06-04 20:03:55 -05:00
Dustin c85fbedf31 roles/apache: Use event MPM by default
The *event* multi-process module is the default on Fedora, so it should
be used by default wherever possible.
2018-05-28 15:24:34 -05:00
Dustin 02380b23e3 roles/apache: Correct path to MPM config file 2018-05-28 15:24:34 -05:00
Dustin 93598145b6 roles/samba-dc: Support configuring TLS
In order to enable LDAPS/STARTTLS support in Samba, the `tls enabled`
option must be set to `yes` and the `tls keyfile` and `tls certfile`
options must be set to the path of the private key and certificate
files, respectively, that Samba will use. The `samba_tls_enabled`,
`samba_tls_keyfile`, and `samb_tls_certfile` Ansible variables can be
used to control these values.
2018-05-28 15:24:34 -05:00
Dustin 024f9f719d roles/samba: Remove socket options
The `socket options` directive does not need to be specified in
`smb.conf`. I think I copied it from an example many years ago, and
never bothered to remove it. It is definitely not required, most likely
not helping performance at all, and most likely hindering it.
2018-05-28 09:51:20 -05:00
Dustin f8641cb912 dch-gw: Host Pyrocufflink VPN locally
This commit adjusts the firewall and networking configuration on dc0 to
host the Pyrocufflink remote access IPsec VPN locally instead of
forwarding it to the internal VPN server.
2018-05-20 13:23:20 -05:00
Dustin 42b8d2e54f roles/dch-vpn-server: Deploy pyrocufflink VPN
The *dch-vpn-server* role configures strongSwan to act as an IPsec
responder for `vpn.pyrocufflink.net` and provide an IKEv2/IPsec VPN for
remote access clients, as well as the reverse VPN to FireMon.
2018-05-20 12:58:07 -05:00
Dustin ae4d1c08f9 roles/strongswan: Base role for strongSwan setup
The *strongwan* role is intended to be used as a dependency of other
roles that use strongSwan for IPsec configuration. It deploys some basic
configuration and configures the *strongswan* service, but does not
configure any connections, secrets, etc.
2018-05-20 12:56:27 -05:00
Dustin 4deb17be94 roles/freeradius: Optimize defaults cleanup
Using `state=absent` with the `file` module in a `with_items` loop to
delete the "default" module and site configuration files and the example
certificates is incredibly slow. Especially on the Raspberry Pi, it can
take several minutes to apply this role, even when there are no changes
to make. Using the `command` module and running `rm` to remove these
files, while not as idempotent, is significantly faster. The main
drawback is that each item in the list is not checked, so new items to
remove have to be added to the end of the list instead of in
alphabetical order.
2018-05-06 18:39:39 -05:00
Dustin efc78f0db6 roles/dhcpd: Allow disabling DDNS per-subnet
In some cases, DDNS may be enabled globally, but some subnets may not
utilize it. To support this scenario, subnets can set `ddns_updates` to
false.
2018-05-06 13:38:15 -05:00
Dustin aba3fe8e04 hosts: Add DCs to radius group
All domain controllers for the *pyrocufflink.blue* domain are RADIUS
servers as well.
2018-05-06 13:10:31 -05:00
Dustin ebda61b67a roles/freeradius: Role to deploy RADIUS with EAP-TLS
The *freeradius* role is used to install and configure FreeRADIUS. The
configuration system for it is extremely complicated, with dozens of
files in several directories. The default configuration has a plethora
of options enabled that are not needed in most cases, so they are
disabled here. Since the initial (and perhaps only) use case I have for
RADIUS is WiFi authentication via certificates, only the EAP-TLS
mechanism is enabled currently.
2018-05-06 13:06:42 -05:00
Dustin 424275fc57 ntp: Initial PB and role to set up ntpd 2018-04-22 11:19:22 -05:00
Dustin 653f5eb1d2 ssh-hostkeys: Add keys for smtp0.p.b 2018-04-15 11:42:24 -05:00
Dustin c5abee997e roles/postfix: Deploy Postfix MTA
The *postfix* role installs and configures the Postfix MTA. It currently
supports a number of modes, including direct transfer and relay. Relay
mode supports STARTTLS security and PLAIN authentication.
2018-04-15 11:37:25 -05:00
Dustin 9e729014d6 roles/zabbix-agent: Use variable for Include
Since the location of the configuration drop-in directory can vary by
distribution, it is important to expand the `zbx_agent_config_dir`
variable in the `Include` parameter.
2018-04-14 16:22:48 -05:00
Dustin 290a0fcfef roles/zabbix-agent: Correct zbx_agent_config_dir
The configuration drop-in directory for the Zabbix agent daemon on
Fedora/RHEL is `/etc/zabbix_agentd.conf.d`, not
`/etc/zabbix_agent.conf.d`.
2018-04-14 16:21:52 -05:00
Dustin 3d1b7f84bf roles/ssh-hostkeys: Add keys for zbx0.p.b 2018-04-14 15:57:50 -05:00
Dustin 668b158cf9 roles/zabbix-agent: Deploy Zabbix agent
The *zabbix-agent* role installs the Zabbix monitoring agent on the
managed node, and sets it up to communicate with the Zabbix server
specified by the `zabbix_server` variable. This role "should" be
compatible with most distributions; it has been tested with Fedora and
Gentoo.
2018-04-14 15:27:02 -05:00
Dustin 3a7c9b52bf roles/zabbix-server: Deploy Zabbix server, web UI
The *zabbix-server* role deploys the Zabbix server database, daemon, and
web interface. It requires the *apache* role to configure Apache HTTPD
to serve the web UI.
2018-04-14 15:26:54 -05:00
Dustin afe4fb7eff roles/postgresql-server: Deploy PostgreSQL
The *postgresql-server* role installs and configures PostgreSQL on
Fedora/RHEL-based distributions.
2018-04-14 15:23:44 -05:00
Dustin f89b279d3a roles/apache: Role to deploy Apache HTTPD
The *apache* role installs and configures the Apache HTTPD server and
its *mod_ssl* module. It currently only works on Fedora/RHEL-based
distributions.
2018-04-14 15:21:15 -05:00
Dustin ea5f289905 roles/winbind: Use ad idmap backend
The `ad` identity mapper backend is apparently the only one that can
use shell, home directory, etc. attributes from the directory now (as of
Samba 4.6).
2018-04-08 14:40:04 -05:00
Dustin 5489ddac1f roles/ssh-hostkeys: Add keys for cm0.p.b 2018-04-08 14:28:25 -05:00
Dustin 45bb2f5cd3 roles/ansible: Install python-netaddr
The *python-netaddr* package is needed on Ansible control machines for
the `ipaddr`, etc. Jinja2 template filters.
2018-04-08 12:33:54 -05:00
Dustin 06a21b2090 ssh-hostkeys: Manage global SSH host key database
The *ssh-hostkeys* role is used to manage the global SSH host key
database. This file is consulted by the `ssh` command when verifying
remote host keys on first connect. If the host key is found here, it is
copied to the user's host key database file without prompting for
verification.
2018-04-08 12:32:02 -05:00
Dustin ac4e9fc390 ansible: Install Ansible
The `ansible.yml` playbook and corresponding *ansible* role simply
install Ansible and related utilities, such as OpenSSH and GnuPG.
2018-04-08 12:20:03 -05:00
Dustin fd347fa600 roles/jenkins-slave: Prepare host for Jenkins
The *jenkins-slave* role prepares a host to have the Jenkins slave
agent deployed on it. Deploying the agent itself is done by the Jenkins
master, through the web UI.
2018-04-08 11:59:18 -05:00
Dustin 984628cbbc roles/samba-dc: Fix typo in host principal name
The service principal name added to `/etc/krb5.keytab` had a trailing
`}` character because of a typo in the Ansible task. This resulted in
GSSAPI authentication failing because server processes could not find
the host key in the key table.
2018-04-08 10:50:51 -05:00
Dustin 712d298b38 hostname: Also write /etc/hosts
This commit introduces a new role, *hostname*, that is used by the
`hostname.yml` playbook to set the hostname. It also writes
`/etc/hosts` using a template.
2018-04-08 10:11:43 -05:00
Dustin 2d5a614633 roles/radvd: Support multiple prefixes per network
It is occasionally necessary to advertise multiple prefixes on the same
interface, particularly when those prefixes are not on-link. The *radvd*
role thus now expects each item in `radvd_interfaces` list to have a
`prefixes` property, which itself is a list of prefixes to advertise.
Prefixes can specify properties such as `on_link`, `autonomous`,
`preferred_lifetime`, etc.
2018-04-06 20:16:02 -05:00
Dustin b83e832df9 roles/dch-gw: Explicitly accept forwarded ports
Marking packets matching port-forwarding rules, and then allowing
traffic carrying that mark did not seem to work well. Often, packets
seemed to get dropped for no apparent reason, and outside connections to
NAT'd services was sometimes slow as a result. Explicitly listing every
destination host/port in the `forward` table seems to resolve this
issue.
2018-04-06 20:13:03 -05:00
Dustin e9c9445a96 roles/named: Support global forwarders
The *named* role now supports configuring BIND to use forwarders for
recursive queries instead of or in addition to the root nameservers.
2018-04-06 20:11:08 -05:00
Dustin a0a4b91faf roles/dch-gw: Configure the filter table
The *filter* table is responsible for deciding which packets will be
accepted and which will be rejected. It has three chains, which classify
packets according to whether they are destined for the local machine
(input), passing through this machine (forward) or originating from the
local machine (output).

The *dch-gw* role now configures all three chains in this table. For
now, it defines basic rules, mostly based on TCP/UDP destination port:

* Traffic destined for a service hosted by the local machine (DNS, DHCP,
  SSH), is allowed if it does not come from the Internet
* Traffic passing through the machine is allowed if:
  * It is passing between internal networks
  * It is destined for a host on the FireMon network (VPN)
  * It was NATed to in internal host (marked 323)
  * It is destined for the Internet
* Only DHCP, HTTP, and DNS are allowed to originate from the local
machine

This configuration requires an `internet_iface` variable, which
indicates the name of the network interface connected to the Internet
directly.
2018-03-29 10:06:30 -05:00
Dustin c5e3c861ab roles/dch-gw: Ensure dhcpcd starts after network
`dhcpcd` needs to start after the `network` service has started, as the
latter creates the interfaces to which the former needs to delegate IPv6
prefixes.
2018-03-29 07:52:20 -05:00
Dustin 51acc08d3c roles/rhel-network: Add static route support 2018-03-27 20:44:43 -05:00
Dustin a7ac6c586d dch-gw: Initial commit
The *dch-gw* role, and the corresponding `dch-gw.yml` playbook, apply
all of the necessary configuration to the edge router on my home
network.
2018-03-27 20:44:43 -05:00
Dustin 5d1b646d14 roles/nftables: Basic nftables configuration
The *nftables* role handles installation and basic configuration of the
userspace components for nftables.

Note that this role currently only works on Fedora, and requires
*nftables* 0.8 or later for wildcard includes.
2018-03-27 20:44:43 -05:00
Dustin 3169278429 roles/rhel-network: Enable/start service
The *networking* service, which is actually a legacy init script, is
provided by the *initscripts* package on RHEL and its derivatives. This
service needs to be running in order for the configuration generated by
the *rhel-network* role to be applied to the managed node.
2018-03-27 20:44:43 -05:00
Dustin 1973378e75 radvd: Install and configure radvd
The *radvd* role and `radvd.yml` playbook can be used to configure the
`radvd` IPv6 SLAAC router advertisement daemon on Linux.
2018-03-27 20:44:43 -05:00
Dustin 2a5b257943 network: Playbook to configure networking
The `network.yml` playbook is used to configure the network interfaces
on a managed node. Currently, it only supports the Red Hat configuration
style (i.e. `/etc/sysconfig/network-scripts/ifcfg-*` files).
2018-03-27 20:44:43 -05:00
Dustin 4811a726a1 dhcpd: Install and configure ISC DHCPD 2018-03-27 20:44:43 -05:00
Dustin 9e73b56ac7 dhcpcd: Install and configure dhcpcd
`dhcpcd` is a fully-featured network manager, without all the bloat of
`NetworkManager`.
2018-03-13 23:19:50 -05:00
Dustin 5a91cb731a samba-dc: Configure samba4 winbind
The *samba-dc* role now configures `winbindd` on domain controllers to
support identity mapping on the local machine. This will allow domain
users to log into the domain controller itself, e.g. via SSH.

The Fedora packaging of *samba4* still has some warts. Specifically, it
does not have a proper SELinux policy, so some work-arounds need to be
put into place in order for confined processes to communicate with
winbind.
2018-03-11 18:16:17 -05:00
Dustin 5570a94be3 roles/winbind: Configure Samba AD membership
The *winbind* role builds upon the *samba* role to configure the machine
as an Active Directory domain member.
2018-03-11 18:16:17 -05:00
Dustin 4546cffeba roles/samba: Basic Samba configuration
The *samba* role provides general configuration for Samba. Other roles
will provide configuration for specific features such as Active
Directory membership, file shares, etc.
2018-03-11 18:16:17 -05:00
Dustin f16b7557cd roles/sudo: Configure sudo and policy
The *sudo* role installs `sudo` and configures policy for it. By
default, users who are members of the *sudo* group can run any command
as root.
2018-03-11 18:16:17 -05:00
Dustin 0fa0c2f66e roles/system-auth: Configure PAM system authentication
The *system-auth* role deploys PAM configuration for system-wide user
authentication. It is specifically focused on Active Directory
authentication using Samba/Winbind.
2018-03-11 18:16:17 -05:00
Dustin 7217c1c8a0 roles/nsswitch: Configure glibc name service
The *nsswitch* role can be used to configure the name service switch on
glibc-based distributions, including Gentoo, Fedora, and CentOS. It is
specifically focused on Active Directory authentication via
Samba/Winbind.
2018-03-11 18:16:17 -05:00
Dustin 5ed1b23321 roles/named: Set minimal responses
Including authority and additional responses in all responses is just a
waste of bandwidth.
2018-02-21 22:40:40 -06:00
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 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 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 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 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 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