Commit Graph

282 Commits (5351e753d7511d236e5663fda545308cdaeebddd)

Author SHA1 Message Date
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 7766cc1d05 ci: zabbix: Specify credentials
Since the host *gw0* is not a member of the *pyrocufflink.blue* domain,
GSSAPI authentication does not work. As such, the SSH private key has to
be made available to the `ansible-playbook` process for authentication
to that host.
2018-06-22 19:43:08 -05:00
Dustin cae9f2e3c2 ci: zabbix: Separate server, agent stages
Separating the Zabbix server and agent playbooks into separate stages
allows better visibility into the time taken for each.
2018-06-22 19:43:06 -05:00
Dustin 0500adadfa ci: zabbix: Use multiple sudo-pass files
The `zabbix.yml` playbook applies to hosts that are not members of the
*pyrocufflink.blue* domain, and thus have different passwords for
`sudo`. Using the `-e` argument to `ansible-playbook` and specifying a
single Vault-encrypted file that defines the `ansible_become_password`
variable effectively forces Ansible to try to use that password on every
host. This is because variables defined on the command line, or read
from a file specified on the command line, have the highest precedence.

To use different passwords on different hosts, the normal variable
scoping rules have to be used. To that end, one `sudo-pass` file is
created in the `group_vars/pyrocufflink` directory, so it will apply to
all machines that are members of the *pyrocufflink.blue* domain.
Additionally, another `sudo-pass` file is created in the `host_vars/gw0`
directory; it will only apply to the gateway device.
2018-06-22 19:33:23 -05:00
Dustin b809d4294f pyrocufflink: Convert variables file to directory
Converting the *pyrocufflink* group variables definition from a file to
a directory will allow Jenkins jobs to place a Vault-envrypted file
within it that defines the `ansible_become_password` variable. In this
way, a different password can be used for machines that are members of
the *pyrocufflink.blue* domain than for other hosts. The existing
mechanism of specifying the path to the Vault-encrypted file that
defines the variable allows only a single password to be defined, so it
does not work when multiple machines in the same play have different
passwords.
2018-06-22 19:20:22 -05:00
Dustin ddafc09839 dch-gw: Open Zabbix ports in the firewall
Obviously, the Zabbix agent (active and passive) ports need to be open
in order for the gateway device itself to be monitored by Zabbix.
2018-06-19 20:41:45 -05:00
Dustin 5188250cfc hosts: Add dch-gw to zabbix group
The gateway device is now monitored by Zabbix. Adding it to the *zabbix*
group ensures that the Zabbix agent is installed and configured
correctly.

Because the *zabbix-agent* role has a task to configure FirewallD, the
`host_uses_firewalld` variable needs to be set to `false` for *gw0*,
since it does not use FirewallD.
2018-06-19 20:40:58 -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 f14683aaac git0: Set gitea_root_url
The `gitea_root_url` variable is used to configure the root URL for
Gitea, which is in turn used to generate HTTP/HTTPS "clone" links for
Git repositories. If this value is not set, the default is used, which
does not work since the application is behind a reverse proxy.
2018-06-18 19:22:21 -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 5ad0104500 hosts: Add git0.p.b to certbot
The *git.pyrocufflink.blue* site now uses a certificate issued by Let's
Encrypt.
2018-06-13 22:23:27 -05:00
Dustin 974cc3dceb Set Let's Encrypt account email globally 2018-06-13 22:23:27 -05:00
Dustin d5769c254d certbot: Playbook to deploy certbot 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 efc6b62903 dch-gw: Forward HTTP, HTTPS to rprx0.p.b 2018-06-12 22:44:54 -05:00
Dustin 83253cb6d6 dch-gw: Add DHCP reservation for rprx0.p.b
*rprx0.pyrocufflink.blue* needs a DHCP reservation and static address
for port forwarding of HTTP and HTTPS.
2018-06-12 22:44:54 -05:00
Dustin 5318f0c5a1 hosts: Add rprx0.p.b
*rprx0.pyrocufflink.blue* provides a reverse proxy for HTTP and HTTPS
for all public-facing web services
2018-06-12 22:44:54 -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 2f41ac3520 hosts: Add all domain members to zabbix group
By making the *pyrocufflink* group a child of the *zabbix* group, all
hosts that are members of the former will have Zabbix installed.
2018-06-12 21:13:39 -05:00
Dustin c2f819554c hosts: Alphabetize groups 2018-06-12 21:13: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 6396b9fc49 gitea: Restrict SSH configuration
Since Gitea servers may be exposed directly to the Internet, it is
important to prevent SSH tunneling, lest the server become an ingress
point into the network.

Additionally, the *gitea* user should not be allowed to use password
authentication, as this would only work if the user actually has a
password (which it does not) and would result in shell access instead of
Gitea.
2018-06-06 21:45:36 -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 4a91b55a49 pyrocufflink: Trust DCH Root CA
The *DCH Root CA* certificate needs to be trusted on all hosts, as most
internal communication is secured with certificates it has issued.
2018-06-04 20:03:55 -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 4f6260d77d hosts: git0: Define Gitea SSH domain 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 a3e1c20c83 gitea: PB to deploy 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 ce75b1567c zabbix-server: Force prefork Apache MPM
The PHP module for Apache, which is required for the Zabbix front end,
is incompatible with the *event* MPM, so the *prefork* MPM must be used.
2018-06-04 20:03:52 -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 1c130bf840 samba-dc: Configure TLS 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 4c90493443 dch-vpn: PB to deploy Pyrocufflink VPN server 2018-05-20 13:23: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 30ec841cad ansible.cfg: Fix remote_tmp
Newer versions of ansible no longer require a single top-level temporary
directory per user, as each run creates its own. Combined with the weird
random failures on *dc0.pyrocufflink.blue* that prevent Jenkins from
using Ansible occasionally, it's better to just let Ansible create its
own temporary directory directly in `/var/tmp` and clean up after itself
when it finishes.
2018-05-19 10:20:22 -05:00
Dustin 1d2e581a85 ci: Send emails on failed builds 2018-05-19 10:00:34 -05:00