Commit Graph

581 Commits (717a8f90c69b627fae43bd7406cbb5c52de997d5)

Author SHA1 Message Date
Dustin 0d30e54fd5 r/fileserver: Restrict non-administrators to SFTP
Normal users do not need shell access to the file server, and certainly
should not be allowed to e.g. forward ports through it.  Using a `Match`
block, we can apply restrictions to users who do not need administrative
functionality.  In this case, we restrict everyone who is not a member
of the *Server Admins* group in the PYROCUFFLINK AD domain.
2024-02-01 10:29:32 -06:00
Dustin 091d9e1f78 r/sudo: Optionally enable pam_ssh_agent_auth
The [pam_ssh_agent_auth][0] PAM module authenticates users using keys in
their SSH agent.  Using SSH agent forwarding, it can even authenticate
users with keys on a remote system.  By adding it to the PAM stack for
`sudo`, we can configure the latter to authenticate users without
requiring a password.  For servers especially, this is significantly
more secure than configuring `sudo` not to require a password, while
still being almost as convenient.

For this to work, users need to enable SSH agent forwarding on their
clients, and their public keys have to be listed in the
`/etc/security/sudo.authorized_keys` file.  Additionally, although the
documentation suggests otherwise, the `SSH_AUTH_SOCK` environment
variable has to be added to the `env_keep` list in *sudoers(5)*.

[0]: https://github.com/jbeverly/pam_ssh_agent_auth
2024-01-28 12:16:35 -06:00
Dustin 7569c9da0d r/squid: Fix SELinux AVC denial after cache init
Running `squid -z` as *root* leaves behind temporary files in
`/dev/shm`.  When *squid.service* starts squid, in the proper SELinux
domain, it is unable to access these files and crashes.  To avoid this,
we mount a private *tmpfs* so no existing files are accessible in the
service's namespace.
2024-01-27 20:28:06 -06:00
Dustin 541a6385e2 r/squid: Update default config for latest version
At some point, the default `squid.conf` file changed a bit.  Updating
the template to match.
2024-01-27 20:08:16 -06:00
Dustin 1d94dc9528 r/squid: Support custom cache rules
Instead of hard-coding a single cache directory and a set of refresh
patterns, the *squid* role can now have custom cache rules defined with
the `squid_cache_dir` variable (which now takes a list of `cache_dir`
settings) and the `squid_refresh_pattern` variable (which takes a list
of refresh patterns).  If neither of these are defined, the default
configuration is used.

This is a breaking change, since `squid_cache_dir` used to refer to a
directory, and the previous default was to configure one cache path.
There are no extant users of this role, though, so it doesn't really
matter.
2024-01-27 20:05:35 -06:00
Dustin af18a575d1 r/squid: Support custom ACLs and rules
The default set of access control lists and access rules for Squid are
fine for allowing hosts on the local network access to the web in
general.  For other uses, such as web filtering, etc. more complex rules
may be needed.  To that end, the *squid* role now supports some
additional variables.  Notably, `squid_acl` contains a map of ACL names
to list entries and `squid_http_access` contains a list of access rules.
If these are set, their corresponding defaults are not included in the
rendered configuration file.
2024-01-27 19:56:02 -06:00
Dustin 236e6dced6 r/web/hlc: Add formsubmit config for summer signup
And of course, Tabitha lost her SSH key so she had to get another one.
2024-01-23 22:04:29 -06:00
Dustin 5287ff601b r/jellyfin: Enable service auto restart 2024-01-22 20:37:21 -06:00
Dustin 54727e148f r/nut{,-monitor}: Enable nut.target
Recent versions of NUT have a *nut.target* unit that collects all of the
NUT-related services.  Enabling any of the services individually does
effectively nothing, as it only adds the service as a `Wants` dependency
for *nut.target*, and that unit already has dependencies for all of
them. Thus, in order for the service to start at boot, *nut.target* has
to be enabled instead.

In situations where only *nut-monitor* should be enabled, enabling
*nut.target* is inappropriate, since that enables *nut-driver* and
*nut-server* as well. It's not clear why upstream made this change (it
was part of a [HUGE pull request][0]), but restoring the desired
behavior is easy enough by clearing the dependencies from *nut.target*.
Services that we want to start automatically can still be enabled
individually, and will start as long as *nut.target* is enabled.

[0]: https://github.com/networkupstools/nut/pull/330
2024-01-22 09:03:15 -06:00
Dustin 681384872c r/synapse: Increase service startup timeout
The Synapse server can sometimes take a very long time to start.
Increasing the start timeout should keep it from failing to come up when
the machine is under load.
2024-01-21 19:05:00 -06:00
Dustin 55e26a7c81 r/unifi: Increase startup timeout
The UniFi controller service can sometimes take a really long time to
start up.  This most frequently happens after a full outage, when the VM
hosts are very busy bringing everything up.
2024-01-21 16:12:29 -06:00
Dustin bba55b5182 r/unifi: Enable service auto restart
Automatically restart the UniFi service in case it crashes (which it
tends to do quite frequently).
2024-01-21 16:12:29 -06:00
Dustin b4fcbb8095 unifi: Deploy unifi_exporter
`unifi_exporter` provides Prometheus metrics for UniFi controller.
2024-01-21 16:12:29 -06:00
Dustin d5de7131a0 r/vmhost: Remove system call filters from unit
The `vm-autostart` script fails with `bad system call` errors when
trying to start libvirt domains.  Removing the system call filters works
around this.  Ideally, we should figure out exactly which system call is
being rejected and allow it, but that's rather difficult to do and
probably not really worth the effort in this case.
2024-01-21 15:53:44 -06:00
Dustin 823d899e9e r/minio: Start more reliably on boot
The MinIO service often fails to start from a cold boot.  Delaying
starting the service until the network is online, plus increasing the
startup timeout, should help with this.  If not, enabling auto restart
will let systemd try to start the service again if it still fails to
come up on time.
2024-01-21 15:53:33 -06:00
Dustin 525f2b2a04 nut-monitor: Configure upsmon
`upsmon` is the component of [NUT] that monitors (local or remote) UPS
devices and reacts to changes in their state.  Notably, it is
responsible for powering down the system when there is insufficient
power to the system.
2024-01-19 20:50:03 -06:00
Dustin fe258c51ac r/web/dcow: Proxy to Kubernetes
I've moved the Dark Chest of Wonders website to run in a container on
Kubernetes.  This will keep it from breaking every time the OS is
updated on the web server, when the version of Python in Fedora changes.
2023-12-17 20:16:51 -06:00
Dustin 5c297df6b9 r/gitea: use sshd_config.d
Recent(-ish) versions of Fedora have a drop-in configuration directory
for `sshd`.  This allows applications, etc. to define certain settings
for the SSH server, without having to manage the entire server
configuration.  For Gitea specifically, we only need to set a few
settings for the *gitea* user, leaving the remaining settings alone.

This commit does not include any migration to undo the settings that
were originally set,  but that should be as simple as `mv
/etc/ssh/sshd_config.rpmnew /etc/ssh/sshd_config && systemctl reload
sshd`.
2023-11-13 17:45:21 -06:00
Dustin dfd828af08 r/ssh-host-certs: Manage SSH host certificates
The *ssh-host-certs* role, which is now applied as part of the
`base.yml` playbook and therefore applies to all managed nodes, is
responsible for installing the *sshca-cli* package and using it to
request signed SSH host certificates.  The *sshca-cli-systemd*
sub-package includes systemd units that automate the process of
requesting and renewing host certificates.  These units need to be
enabled and provided the URL of the SSHCA service.  Additionally, the
SSH daemon needs to be configured to load the host certificates.
2023-11-07 21:27:02 -06:00
Dustin c3f58aff83 r/dch-yum: Configure dch Yum repository
The *dch* repository, hosted on *file0.pyrocufflink.blue* and managed by
the *repohost* Ansible role, is where I plan to host RPM packages for
internal use (e.g. *sshca-cli*, *dch-selinux*, etc.).  The *dch-yum*
role configures Yum/dnf to use this repository.  Roles that need to
install a package from here will list this role as a dependency.
2023-11-07 21:24:40 -06:00
Dustin c6f0ea9720 r/repohost: Configure Yum package repo host
So it turns out Gitea's RPM package repository feature is less than
stellar.  Since each organization/user can only have a single
repository, separating packages by OS would be extremely cumbersome.
Presumably, the feature was designed for projects that only build a
single PRM for each version, but most of my packages need multiple
builds, as they tend to link to system libraries.  Further, only the
repository owner can publish to user-scoped repositories, so e.g.
Jenkins cannot publish anything to a repository under my *dustin*
account.  This means I would ultimately have to create an Organization
for every OS/version I need to support, and make Jenkins a member of it.
That sounds tedious and annoying, so I decided against using that
feature for internal packages.

Instead, I decided to return to the old ways, publishing packages with
`rsync` and serving them with Apache.  It's fairly straightforward to
set this up: just need a directory with the appropriate permissions for
users to upload packages, and configure Apache to serve from it.

One advantage Gitea's feature had over a plain directory is its
automatic management of repository metadata.  Publishers only have to
upload the RPMs they want to serve, and Gitea handles generating the
index, database, etc. files necessary to make the packages available to
Yum/dnf.  With a plain file host, the publisher would need to use
`createrepo` to generate the repository metadata and upload that as
well.  For repositories with multiple packages, the publisher would need
a copy of every RPM file locally in order for them to be included in the
repository metadata.  This, too, seems like it would be too much trouble
to be tenable, so I created a simple automatic metadata manager for the
file-based repo host.  Using `inotifywatch`, the `repohost-createrepo`
script watches for file modifications in the repository base directory.
Whenever a file is added or changed, the directory containing it is
added to a queue.  Every thirty seconds, the queue is processed; for
each unique directory in the queue, repository metadata are generated.

This implementation combines the flexibility of a plain file host,
supporting an effectively unlimited number of repositories with
fully-configurable permissions, and the ease of publishing of a simple
file upload.
2023-11-07 20:51:10 -06:00
Dustin 420764d795 hosts: Add dc-nrtxms.p.b
New Fedora 38 Active Directory Domain Controller
2023-10-28 16:07:39 -05:00
Dustin f334363aab r/samba-dc: sysvolsync: Remove winbind cache file
The `net cache flush` command does not seem to always work to clear the
identity mapping cache used by winbind.  Explicitly moving the file
does, though.
2023-10-28 09:56:44 -05:00
Dustin 3e70600691 r/samba-dc: sysvolsync: Fix running on fresh DC
On a new DC, the `idmap.ldb` file does not yet exist the first time
`sysvolsync` runs.  This causes a syntax error in the condition that
checks the modification timestamp of the file.
2023-10-28 09:52:24 -05:00
Dustin c814007c6d hosts: Add dc-qi85ia.p.b
New Fedora 38 domain controller.
2023-10-28 09:50:07 -05:00
Dustin 5bffdc68a2 r/samba-dc: sysvolsync: Use system DNS server
Forcing the PDC lookup to use localhost as the DNS server does not work
when first adding a new domain controller, as the `sysvolsync` script
runs before Samba starts.  There isn't much advantage to using the local
DNS server over the system-defined server anyway.
2023-10-27 17:55:44 -05:00
Dustin b45e647382 r/gitea: Update to v1.20.5 2023-10-27 17:41:43 -05:00
Dustin 7b23f6a4ac r/winbind: Disable offline login by default
The `winbind offline login` setting seems to cause issues when one of
the domain controllers is offline.  Rather than try the other DC,
winbind seems to just "give up" and return NT_STATUS_NO_SUCH_USER for
all authentication requests until the offline cache is flushed.  There's
not really any reason to use this setting on servers anyway, since they
are always connected to the LAN, as opposed to laptops that may
occasionally disconnect.  Let's disable this option in the hopes that it
makes logins more resilient to DC downtime.  After all, there's not much
point in having multiple DCs if they all have to be available in order
to log in.
2023-10-27 17:37:49 -05:00
Dustin 686817571e smtp-relay: Switch to Fastmail
AWS is going to begin charging extra for routable IPv4 addresses soon.
There's really no point in having a relay in the cloud anymore anyway,
since a) all outbound messages are sent via the local relay and b) no
messages are sent to anyone except me.
2023-10-24 17:27:21 -05:00
Dustin d2eb61cce1 r/sudo: Tag install tasks
Tasks that install packages need to be tagged as `install` so they can
be skipped by Jenkins daily runs.
2023-10-21 22:16:28 -05:00
Dustin 7c6ed667be r/system-auth: Tag install tasks
Tasks that install packages need to be tagged as `install` so they can
be skipped by Jenkins daily runs.
2023-10-21 22:16:28 -05:00
Dustin 6a6765ac06 r/system-auth: Remove uninstall authconfig task
The *authconfig* package has been gone from Fedora since ages.  There's
no reason to have this no-op step any more, especially since it has the
side-effect of making a network request to refresh the dnf cache.
2023-10-21 13:11:25 -05:00
Dustin 50f4b565f8 hosts: Remove nvr1.p.b as managed system
*nvr1.pyrocufflink.blue* has been migrated to Fedora CoreOS.  As such,
it is no longer managed by Ansible; its configuration is done via
Butane/Ignition.  It is no longer a member of the Active Directory
domain, but it does still run *collectd* and export Prometheus metrics.
2023-09-27 20:24:47 -05:00
Dustin e4c2b36dfd r/scrape-collectd: Also scrape unmanaged targets
The `scrape_collectd_extra_targets` variable can be used to specify a
list of additional targets to scrape, in addition to the hosts in the
*collectd-prometheus* group.  This will allow us to scrape hosts that
are not managed by the configuration policy, but still expose Prometheus
metrics via collectd.
2023-09-27 20:24:47 -05:00
Dustin 0037a3c281 r/minio: Reload server after changing cert
MinIO is supposed to automatically reload itself when the certificate
changes, but this does not appear to happen in all cases.  To ensure the
updated certificate gets used, we need to send SIGHUP to the MinIO
server process.
2023-09-22 07:29:05 -05:00
Dustin 1b63332872 r/jellyfin: Restrict HTTPS redirect to Jellyfin
Since Jellyfin is running on the file server, which also hosts a few
other websites that do not define virtual hosts, the HTTP-to-HTTPS
redirect was applied to *all* requests.  To avoid this, we simply add a
rewrite condition so that the redirect only applies to requests for
Jellyfin.
2023-09-13 10:06:12 -05:00
Dustin a2b3f9b5b9 jellyfin: Deploy Jellyfin media server
Jellyfin is a multimedia library manager. Clients can browse and stream
music, movies, and TV shows from the server and play them locally
(including in the browser).
2023-09-12 13:38:35 -05:00
Dustin 6a5d1437e8 hosts: add unifi1.p.b
*unifi1.pyrocufflink.blue* is a Fedora machine that hosts the Unifi
Network controller software.
2023-07-07 10:05:01 -05:00
Dustin 71a43ccf07 unifi: Deploy Unifi Network controller
Since Ubiquiti only publishes Debian packages for the Unifi Network
controller software, running it on Fedora has historically been neigh
impossible.  Fortunately, a modern solution is available: containers.
The *linuxserver.io* project publishes a container image for the
controller software, making it fairly easy to deploy on any host with an
OCI runtime.  I briefly considered creating my own image, since theirs
must be run as root, but I decided the maintenance burden would not be
worth it.  Using Podman's user namespace functionality, I was able to
work around this requirement anyway.
2023-07-07 10:05:01 -05:00
Dustin 9f221cf734 web/dustinandtabitha: Disable RSVP form
The spammers have found our wedding RSVP form.
2023-06-27 09:02:54 -05:00
Dustin b05edbf7fb r/minio: Configure firewall
The firewall needs to allow inbound connections to the MinIO HTTP API
and web UI ports.
2023-06-08 10:07:32 -05:00
Dustin 679ea47bf7 r/homeassistant: Protect ~/.ssh
When the Home Assistant container restarts, Podman relabels the entire
`/var/lib/homeassistant` directory as `container_file_t`.  Since the
*homeassistant* user's home directory is `/var/lib/homeassistant`, its
`~/.ssh` directory is thus also relabeled, preventing the SSH daemon
from accessing it.  Since Home Assistant itself does not need access to
this path, we can tell systemd to mount an empty tmpfs filesystem there
in the service unit's mount namespace.  This way, when Podman relabels
the directory, it will change the label of the tmpfs mount point instead
of the actual directory.
2023-06-08 10:05:36 -05:00
Dustin 87e8ec2ed4 synapse: Back up data using BURP
Most of the Synapse server's state is in its SQLite database.  It also
has a `media_store` directory that needs to be backed up, though.

In order to back up the SQLite database while the server is running, the
database must be in "WAL mode."  By default, Synapse leaves the database
in the default "rollback journal mode," which disallows multiple
processes from accessing the database, even for read-only operations.
To change the journal mode:

```sh
sudo systemctl stop synapse
sudo -u synapse sqlite3 /var/lib/synapse/homeserver.db 'PRAGMA journal_mode=WAL;'
sudo systemctl start synapse
```
2023-05-23 09:52:50 -05:00
Dustin 74243080bb r/burp-client: Support pre/post-restore scripts
BURP can run scripts before and after restore.  This may be useful, for
example, to clean up files in a backup that may be in an inconsistent
state.
2023-05-23 09:52:50 -05:00
Dustin 66d0a9157f burp-client: Switch from cron to systemd timer
systemd timer units are supported on all relevant OS versions now.
There is no longer any reason to use cron.
2023-05-23 09:51:07 -05:00
Dustin d26de78b3d r/samba-dc: Rotate KDC log weekly
The Samba KDC log file seems to grow rather quickly sometimes, outpacing
the monthly rotation policy.  Let's rotate it weekly and keep 4
historical versions.
2023-05-23 08:31:58 -05:00
Dustin 78296f7198 Merge branch 'journal2ntfy' 2023-05-23 08:31:52 -05:00
Dustin 347cda74fd metrics: Scrape metrics from Kubernetes API server
Kubernetes exports a *lot* of metrics in Prometheus format.  I am not
sure what all is there, yet, but apparently several thousand time series
were added.

To allow anonymous access to the metrics, I added this RoleBinding:

```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: prometheus
rules:
- apiGroups:
  - ""
  resources:
  - nodes/metrics
  verbs:
  - get
- nonResourceURLs:
  - /metrics
  verbs:
  - get
```
2023-05-22 21:21:08 -05:00
Dustin c0bb387b18 metricspi: Scrape metrics from MinIO backup storage
MinIO exposes metrics in Prometheus exposition format.  By default, it
requires an authentication token to access the metrics, but I was unable
to get this to work.  Fortunately, it can be configured to allow
anonymous access to the metrics, which is fine, in my opinion.
2023-05-22 21:19:25 -05:00
Dustin a7319c561d journal2ntfy: Script to send log messagess via ntfy
The `journal2ntfy.py` script follows the systemd journal by spawning
`journalctl` as a child process and reading from its standard output
stream.  Any command-line arguments passed to `journal2ntfy` are passed
to `journalctl`, which allows the caller to specify message filters.
For any matching journal message, `journal2ntfy` sends a message via
the *ntfy* web service.

For the BURP server, we're going to use `journal2ntfy` to generate
alerts about the RAID array.  When I reconnect the disk that was in the
fireproof safe, the kernel will log a message from the *md* subsystem
indicating that the resynchronization process has begun.  Then, when
the disks are again in sync, it will log another message, which will
let me know it is safe to archive the other disk.
2023-05-17 14:51:21 -05:00
Dustin ad9fb6798e samba-dc: Omit tls cafile setting
The `tls cafile` setting in `smb.conf` is not necessary.  It is used for
verifying peer certificates for mutual TLS authentication, not to
specify the intermediate certificate authority chain like I thought.

The setting cannot simply be left out, though.  If it is not specified,
Samba will attempt to load a file from a built-in default path, which
will fail, causing the server to crash.  This is avoided by setting the
value to the empty string.
2023-05-10 08:28:49 -05:00
Dustin f54bc44a48 minio: Install and configure MinIO
[MinIO][0] is an S3-compatible object storage server.  It is designed to
provide storage for cloud-native applications for on-premises
deployments.

MinIO has not been packaged for Fedora (yet?).  As such, the best way to
deploy it is usining its official container image.  Here, we are using
`podman-systemd-generator` (Quadlet) to generate a systemd service
unit to manage the container process.
2023-05-09 21:37:46 -05:00
Dustin ed42f848b9 r/ssh-hostkeys: Add keys for git.p.b
Git clients access Gitea over SSH using the *git.pyrocufflink.blue* and
*git.pyrocufflink.net* names.
2023-04-23 20:03:44 -05:00
Dustin 2920c25a69 websites/p-bitwarden: Redirect .blue to .net
Avoid confusion with WebAuthn by ensuring users only access the
application by its canonical name.
2023-04-23 18:45:28 -05:00
Dustin b1fa4fc8a7 r/web/chmod777.sh: Add HTTP redirect
The HTTP->HTTPS redirect for chmod777.sh was only working by
coincidence.  It needs its own virtual host to ensure it works
irrespective of how other websites are configured.
2023-01-09 13:06:56 -06:00
Dustin 1b7a8885b8 r/web/hlc: Configure formsubmit
Tabitha's Hatch Learning Center site has two user submission forms: one
for signing in/out students for class, and another for parents to
register new students for the program.  These are handled by
*formsubmit* and store data in CSV spreadsheets.
2023-01-09 12:59:58 -06:00
Dustin bc4c7edbad r/base: Clear facts after installing python-selinux
If the Python bindings for SELinux policy management are not installed
when Ansible gathers host facts, no SELinux-related facts will be set.
Thus, any tasks that are conditional based on these facts will not run.
Typically, such tasks are required for SELinux-enabled hosts, but must
not be performed for non-SELinux hosts.  If they are not run when they
should, the deployment may fail or applications may experience issues at
runtime.

To avoid these potential issues, the *base* role now forces Ansible to
gather facts again if it installed the Python SELinux bindings.

Note: one might suggest using `meta: clear_facts` instead of `setup` and
letting Ansible decide if and when to gather facts again. Unfortunately,
this for some reason doesn't work; the `clear_facts` meta task just
causes Ansible to crash with a "shared connection to {host} closed."
2022-12-23 08:44:30 -06:00
Dustin 10344b07c7 hosts: Add ag62kz.p.b
New domain controller (Fedora 37): *ag62kz.pyrocufflink.blue*
2022-12-23 06:56:52 -06:00
Dustin 4bc587e408 r/dch-selinux: Install dch-selinux package
The *dch-selinux* package contains customized SELinux policy modules.
I haven't worked out exactly how to build an publish it through a
continuous integration pipeline yet, so for now it's just hosted in my
user `public_html` folder on the main file server.
2022-12-23 06:52:28 -06:00
Dustin 5661910a21 samba-dc: Add sysvolsync script
Samba AD DC does not implement [DFS-R for replication of the SYSVOL][0]
contents.  This does not make much of a difference to me, since
the SYSVOL is really only used for Group Policy.  Windows machines may
log an error if they cannot access the (basically empty) GPO files, but
that's pretty much the only effect if the SYSVOL is in sync between
domain controllers.

Unfortunately, there is one side-effect of the missing DFS-R
functionality that does matter.  On domain controllers, all user,
computer, and group accounts need to have Unix UID/GID numbers mapped.
This is different than regular member machines, which only need UID/GID
numbers for users that will/are allowed to log into them.  LDAP entries
only have ID numbers mapped for the latter class of users, which does
not include machine accounts.  As a result, Samba falls back to
generating local ID numbers for the rest of the accounts.  Those ID
numbers are stored in a local database file,
`/var/lib/samba/private/idmap.ldb`.  It would seem that it wouldn't
actually matter if accounts have different ID numbers on different
domain controllers, but there are evidently [situations][1] where DCs
refuse to allocate ID numbers at all, which can cause authentication to
fail.  As such, the `idmap.ldb` file needs to be kept in sync.

If we're going to go through the effort of synchronizing `idmap.ldb`, we
might as well keep the SYSVOL in sync as well.  To that end, I've
written a script to synchronize both the SYSVOL contents and the
`idmap.ldb` file.  It performs a simple one-way synchronization using
`rsync` from the DC with the PDC emulator role, as discovered using DNS
SRV records.  To ensure the `idmap.ldb` file is in a consistent state,
it only copies the most recent backup file.  If the copied file differs
from the local one, the script stops Samba and restores the local
database from the backup.  It then flushes Samba's caches and restarts
the service.  Finally, it fixes the NT ACLs on the contents of the
SYSVOL.

Since the contents of the SYSVOL are owned by root, naturally the
synchronization process has to run as root as well.  To attempt to limit
the scope of control this would give the process, we use as much of the
systemd sandbox capabilities as possible.  Further, the SSH key pairs
the DCs use to authenticate to one another are restricted to only
running rsync.  As such, the `sysvolsync` script itself cannot run
`tdbbackup` to back up `idmap.ldb`.  To handle that, I've created a
systemd service and corresponding timer unit to run `tdbbackup`
periodically.

I considered for a long time how to best implement this process, and
although I chose this naïve implementation, I am not exactly happy with
it.  Since I do not fully understand *why* keeping
the `idmap.ldb` file in sync is necessary, there are undoubtedly cases
where blindly copying it from the PDC emulator is not correct.  There
are definitely cases where the contents of the SYSVOL can be updated on
a DC besides the PDC emulator, but again, we should not run into them
because we don't really use the SYSVOL at all.  In the end, I think this
solution is good enough for our needs, without being so complicated

[0]: https://wiki.samba.org/index.php?title=SysVol_replication_(DFS-R)&oldid=18120
[1]: https://lists.samba.org/archive/samba/2021-November/238370.html
2022-12-22 18:55:07 -06:00
Dustin 3949a40f64 r/collectd-version: Fix handlers
Upating the `collect-version` script should restart the
*collectd-version* service, not *collectd* itself.
2022-12-19 10:17:57 -06:00
Dustin 066a68318c hosts: Add dc-4k6s8e.p.b
This is a new domain controller running Fedora 37.
2022-12-18 22:49:44 -06:00
Dustin a670e34e90 r/homeassistant: Proxy for Zigbee2MQTT frontend
Zigbee2MQTT now has a web GUI, which makes it *way* easier to manage the
Zigbee network.  Now that I've got all the Philips Hue bulbs controlled
by Zigbee2MQTT instead of the Hue Hub, having access to the GUI is
awesome.
2022-12-12 17:47:05 -06:00
Dustin 244482ac52 websites: Add hatchlearningcenter.org
This is the website for Tabitha's new hybrid private school! 👩‍🎓
2022-11-30 22:04:29 -06:00
Dustin 772f669ab2 r/gitea: Handle encoded / characters in HTTP paths
Gitea package names (e.g. OCI images, etc.) can contain `/` charactres.
These are encoded as %2F in request paths.  Apache needs to forward
these sequences to the Gitea server without decoding them.
Unfortunately, the `AllowEncodedSlashes` setting, which controls this
behavior, is a per-virtualhost setting that is *not* inherited from the
main server configuration, and therefore must be explicitly set inside
the `VirtualHost` block.  This means Gitea needs its own virtual host
definition, and cannot rely on the default virtual host.
2022-11-27 17:21:03 -06:00
Dustin e09e684fd8 hosts: Update mtrcs0 FQDN
I moved the metrics Pi from the red network to the blue network.  I
started to get uncormfortable with the firewall changes that were
required to host a service on the red network.  I think it makes the
most sense to define the red network as egress only.
2022-11-09 18:56:05 -06:00
Dustin 0e97d5e39f r/gitea: Update to 1.17.0
The only major change that affects the configuration policy is the
introduction of the `webhook.ALLOWED_HOST_LIST` setting.  For some dumb
reason, the default value of this setting *denies* access to machines on
the local network.  This makes no sense; why do they expect you to host
your CI or whatever on a *public* network?  Of course, the only reason
given is "for security reasons."
2022-09-01 17:29:34 -05:00
Dustin 8965ede50a r/samba-dc: Remove winbindd restorecon workaround
This work-around is no longer necessary as the default Fedora policy now
covers the Samba DC daemon.  It never really worked correctly, anyway,
because Samba doesn't start `winbindd` fast enough for the
`/run/samba/winbindd` directory to be created before systemd spawns the
`restorecon` process, so it would usually fail to start the service the
first time after a reboot.
2022-08-22 20:32:07 -05:00
Dustin 2ca92f68f7 r/frigate: Restart service if it fails
Sometimes, Frigate crashes in situations that should be recoverable or
temporary.  For example, it will fail to start if the MQTT server is
unreachable initially, and does not attempt to connect more than once.
To avoid having to manually restart the service once the MQTT server is
ready, we can configure the systemd unit to enable automatic restarts.
2022-08-22 20:08:09 -05:00
Dustin 1834f9a108 r/bitwarden_rs: Remove dangling container at start
If the *vaultwarden* service terminates unexpectedly, e.g. due to a
power loss, `podman` may not successfully remove the container.  We
therefore need to try to delete it before starting it again, or `podman`
will exit with an error because the container already exists.
2022-08-22 20:06:02 -05:00
Dustin 31c73e696f r/z*2mqtt: Restart services after unexpected stop
Both *zwavejs2mqtt* and *zigbee2mqtt* have various bugs that can cause
them to crash in the face of errors that should be recoverable.
Specifically, when there are network errors, the processes do not always
handle these well.  Especially during first startup, they tend to crash
instead of retry.  Thus, we'll move the retry logic into systemd.
2022-08-21 22:25:12 -05:00
Dustin 465aa4d78e r/z*2mqtt: Wait for clock to sync before starting
The *zwavejs2mqtt* and *zigbee2mqtt* services need to wait until the
system clock is fully synchronized before starting.  If the system clock
is wrong, they may fail to validate the MQTT server certificate.

The *time-sync.target* unit is not started until after services that
sync the clock, e.g. using NTP.  Notably, the *chrony-wait.service* unit
delays *time-sync.target* until `chrony waitsync` returns.
2022-08-21 21:58:30 -05:00
Dustin 7044cf3a46 r/hass-dhcp: Start dnsmasq after network is up
The *vlan99* interface needs to be created and activated by
`systemd-networkd` before `dnsmasq` can start and bind to it.  Ordering
the *dnsmasq.service* unit after *network.target* and
*network-online.target* should ensure that this is the case.
2022-08-21 08:03:00 -05:00
Dustin 0cd58564c9 r/vmhost: Add autostart script
*libvirt*'s native autostart functionality does not work well for
machines that migrate between hosts.  Machines lose their auto-start
flag when they are migrated, and the flag is not restored if they are
migrated back.  This makes the feature pretty useless for us.

To work around this limitation, I've added a script that is run during
boot that will start the machines listed in `/etc/vm-autostart`, if they
exist.  That file can also insert a delay between starting two machines,
which may be useful to allow services to fully start on one machine
before starting another that may depend on them.
2022-08-20 21:15:31 -05:00
Dustin a34debbdd5 r/named: Fix typo in firewalld condition 2022-08-20 18:18:38 -05:00
Dustin b7bbafd189 r/protonvpn: Move remote_addrs file to /var
If `/` is mounted read-only, as is usually the case, the Proton VPN
watchdog cannot update the `remote_addrs` configuration file.  It needs
to be stored in a directory that is guaranteed to be writable.
2022-08-20 18:18:21 -05:00
Dustin b6a35f9ce9 r/protonvpn: Install watchdog dependencies
The `protonvpn-watchdog.py` script requires the *httpx* Python package.
This needs to be installed for the script to work.
2022-08-20 18:14:31 -05:00
Dustin 9c364b1f06 r/netboot/basementhud: Configure NBD export
The *netboot/basementhud* Ansible role configures two network block
devices for the basement HUD machine:

* The immutable root filesystem
* An ephemeral swap device
2022-08-15 17:18:48 -05:00
Dustin 4622240c6c r/netboot/jenkins-agent: Configure NBD exports
The *netboot/jenkins-agent* Ansible role configures three NBD exports:

* A single, shared, read-only export containing the Jenkins agent root
  filesystem, as a SquashFS filesystem
* For each defined agent host, a writable data volume for Jenkins
  workspaces
* For each defined agent host, a writable data volume for Docker

Agent hosts must have some kind of unique value to identify their
persistent data volumes.  Raspberry Pi devices, for example, can use the
SoC serial number.
2022-08-15 17:14:06 -05:00
Dustin 20fd03795b hosts: add pxe0.p.b
*pxe0.pyrocufflink.blue* hosts TFTP and NBD for network-booted devices.
2022-08-15 17:13:56 -05:00
Dustin 02e4df023c r/pxe: Set up a PXE server
The *pxe* role configures the TFTP and NBD stages of PXE network
booting.  The TFTP server provides the files used for the boot stage,
which may either be a kernel and initramfs, or another bootloader like
SYSLINUX/PXELINUX or GRUB.  The NBD server provides the root filesystem,
typically mounted by code in early userspace/initramfs.

The *pxe* role also creates a user group called *pxeadmins*.  Users in
this group can publish content via TFTP; they have write-access to the
`/var/lib/tftpboot` directory.
2022-08-15 17:12:35 -05:00
Dustin 5a284faa5c r/tftp: Deploy TFTP server
The *tftp* role installs the *tftp-server* package.  There is
practically no configuration for the TFTP server.  It "just works" out
of the box, as long as its target directory exists.
2022-08-15 17:06:20 -05:00
Dustin 14bfddd0ee r/nbd-server: Deploy nbd-server
The *nbd-server* role configures a machine as a Network Block Device
(NDB) server, using the reference `nbd-server` implementation.  It
configures a systemd socket unit to listen on the port and accept
incoming connections, and a template service unit for systemd to
instantiate and pass each incoming connection.

The reference `nbd-server` is actually not very good.  It does not clean
up closed connections reliably, especially if the client disconnects
unexpectedly.  Fortunately, systemd provides the necessary tools to work
around these bugs.  Specifically, spawning one process per connection
allows processes to be killed externally.  Further, since systemd
creates the listening socket, it can control the keep-alive interval.
By setting this to a rather low value, we can clean up server processes
for disconnected clients more quickly.

Configuration of the server itself is minimal; most of the configuration
is done on a per-export basis using drop-in configuration files.  Other
Ansible roles should create these configuration files to configure
application-specific exports.  Nothing needs to be reloaded or restarted
for changes to take effect; the next incoming connection will spawn a
new process, which will use the latest configuration file automatically.
2022-08-15 16:55:36 -05:00
Dustin 82f2a7518e r/system-auth: Disable authselect
*authselect* is now [mandatory][0] in Fedora 36.  It cannot be
uninstalled, but it can be disabled by removing its configuration file.

[0]: https://fedoraproject.org/wiki/Changes/Make_Authselect_Mandatory
2022-08-12 16:54:00 -05:00
Dustin 0de1f84905 r/frigate: Wait for network before starting service
Frigate needs to be able to connect to the MQTT immediately upon start
up or it will crash.  Ordering the *frigate.service* unit after
*network-online.target* will help ensure Frigate starts when the system
boots.
2022-08-12 16:24:28 -05:00
Dustin de93ccb0da r/systemd-resolved: Manage systemd resolver daemon
The *systemd-resolved* role/playbook ensures the *systemd-resolved*
service is enabled and running, and ensures that the `/etc/resolv.conf`
file is a symlink to the appropriate managed configuration file.
2022-08-12 14:35:14 -05:00
Dustin d2ee99daa6 mtrcs0: Update SSH host key
I committed the wrong SSH host key.  It was probably from before I
rebuilt the machine using a new SSD.
2022-08-12 13:15:01 -05:00
Dustin 1f04813879 r/v-m-nginx: Prevent requesting reload
Remote systems should not be able to trigger a reload of the services
behind the reverse proxy.
2022-08-12 13:14:05 -05:00
Dustin ce3e88932d vmalert: Allow configuring http.pathPrefix
*vmalert* requires explicit configuration when it is behind a reverse
proxy.
2022-08-12 13:10:36 -05:00
Dustin fe87edea21 r/vmalert: Allow configuring external source URLs
The `-external.url` and `-external.alert.source` command line arguments
and their corresponding environment variables can be used to configure
the "Source" links associated with alerts created by `vmalert`.
2022-08-12 12:58:53 -05:00
Dustin 887d462127 r/v-m-nginx: Proxy for other services too
The *metricspi* hosts several Victoria Metrics-adjacent applications.
These each expose their own HTTP interface that can be used for
debugging or introspecting state.  To make these accessible on the
network, the *victoria-metrics-nginx* role now configures `proxy_pass`
directives for them in its nginx configuration.
2022-08-12 11:59:25 -05:00
Dustin 993e29c0fe r/scrape-collectd: collectd scrape targets config
The *scrape-collectd* role generates the
`/etc/prometheus/scrape-collectd.yml` file.  This file can be read by
Prometheus/Victoria Metrics/vmagent to identify the hosts running
*collectd* with the *write_prometheus* plugin, using the
`files_sd_configs` scrape configuration option.

All hosts in the *collectd-prometheus* group are listed as scrape
targets.
2022-08-11 21:40:19 -05:00
Dustin 4ddbc9f256 hosts: Add mtrcs0.p.r
*mtrcs0.pyrocufflink.red* is a Raspberry Pi CM4 on a Waveshare
CM4-IO-BASE-B carrier board with a NVMe SSD.  It runs a custom OS built
using Buildroot, and is not a member of the *pyrocufflink.blue* AD
domain.

*mtrcs0.p.r* hosts Victoria Metrics/`vmagent`, `vmalert`, AlertManager,
and Grafana.  I've created a unique group and playbook for it,
*metricspi*, to manage all these applications together.
2022-08-11 21:40:19 -05:00
Dustin 7c654031f0 r/grafana: Allow configuring LDAP CA cert
The `grafana_ldap_root_ca_cert` can be used to set the path to the root
CA certificate (bundle) Grafana uses to validate the certificate
presented by the configured LDAP server.  By default, Grafana uses the
system root CA trust store, but this variable can be used in situations
where this is not suitable.
2022-08-11 21:40:19 -05:00
Dustin b3403268a8 r/vmalert: Deploy vmalert
`vmalert` is a component of Victoria Metrics. It handles alerting and
recording rules, periodically executing queries and dispatching alerts
or writing aggregated data back to the TSDB.
2022-08-11 21:40:19 -05:00
Dustin 0dab3afc85 r/alertmanager: Deploy AlertManager
*AlertManager* is the component of the Prometheus ecosystem responsible
for sending alert notifications.
2022-08-10 22:18:53 -05:00
Dustin 1e14dd7905 r/blackbox-exporter: Deploy blackbox_exporter
The Prometheus *blackbox_exporter* is a tool that can perform arbitrary,
generic ICMP, TCP, or HTTP "probes" against external services.  This is
useful for applications that do not export their own metrics, and for
evaluating the health of protocol-level operations (e.g. TLS
certificate expiration).

The *blackbox-exporter* Ansible role installs and configures the
Blackbox Exporter on the target system.  It fetches the specified binary
release from Github and copies it to the remote machine.  It also
creates a systemd unit and configures the Blackbox exporter's "modules"
from the `blackbox_modules` Ansible variable.
2022-08-10 22:18:53 -05:00
Dustin 60505657f3 r/vmagent: Deploy vmagent
The *vmagent* role installs and configures the scraping and routing
agent used in the Victoria Metrics ecosystem.
2022-08-10 22:18:43 -05:00
Dustin 956a40f054 r/victoria-metrics-nginx: Add reverse proxy for V-M
The *victoria-metrics-nginx* role configures *nginx* as a reverse proxy
for Victoria Metrics.
2022-08-10 22:16:48 -05:00
Dustin 31fe128d48 r/collectd: Max unixsock plugin optional
Some hosts may not need this plugin, or may not have it installed.
Notably, it is not needed or used on my systems based on Buildroot,
since the only current use case for it is to keep track of the Fedora
version.
2022-08-10 21:55:54 -05:00
Dustin ac127b4649 r/grafana: Ensure service starts at boot 2022-08-10 21:55:54 -05:00
Dustin 13e26ac64c r/grafana: Ensure configuration directory exists
The *grafana* package for Fedora creates `/etc/grafana`, but it is not
created by default on Buildroot-based systems.
2022-08-10 21:55:54 -05:00
Dustin 7e08fb66f7 r/nginx: Fix applying on Buildroot systems
There are a few minor differences between the way Fedora and Buildroot
package *nginx*:

* Fedora uses a user named *nginx* while buildroot uses *www-data*
* Buildroot uses a Debian-like configuration layout (with
  `sites-enabled` and `modules-enabled` directories)

This commit adjusts the *nginx* Ansible role to compensate for these
differences, eschewing Buildroot's configuration layout for the one used
by Fedora/Red Hat.
2022-08-10 21:55:54 -05:00
Dustin 0785fda26b r/v-m: Add role for Victoria Metrics
The *victoria-metrics* role deploys a single-server instance of the
Victoria Metrics time series database server.  It installs the selected
version by downloading the binary release from Github and copying it to
`/usr/local/sbin` on the managed node.  Scrape configuration is optional
and can be specified with the `scrape_configs` variable.
2022-08-10 19:47:12 -05:00
Dustin 8176eaf694 r/collectd-prometheus: Work w/o firewalld, selinux
Tasks that configure the SELinux policy obviously only make sense if the
host uses SELinux.  Similarly, if the host does not use FirewallD,
configuring firewall rules doesn't work.
2022-08-10 19:47:12 -05:00
Dustin ad96dc2757 r/collectd: Manage collectd.d directory
The `/etc/collectd.d` directory is created by the RPM package on
machines running a Red Hat-based Linux distribution, but it may not
always be present on other machines.
2022-08-10 19:47:12 -05:00
Dustin a357b5dc08 r/ssh-hostkeys: Add SSH keys for K8s nodes
I forgot to add the SSH host keys for the nodes in the Kubernetes
cluster when I first added them to the inventory.
2022-08-10 19:47:12 -05:00
Dustin c48cc985b2 r/collectd: Ignore filesystems by path
In addition to ignoring particular types of filesystems, e.g. OverlayFS,
we can also ignore filesystems by their mount point.  This could be
useful, for example, for bind-mounted directories, such as those used on
Kubernetes nodes.
2022-08-05 18:56:48 -05:00
Dustin 8cab0b368e r/collectd: Ignore overlay filesystems
By default, the *df* pluggin for collectd, which monitors filesystem
usage, collects data about all mounted filesystems.  It can be
configured to ignore some filesystems, either by mount point, device, or
filesystem type.  We will uses this capability to avoid collecting data
about OverlayFS mounts, because by definition, they do not represent a
real filesystem, but one or more other mounted filesystems.  Collecting
data about these just creates useless metrics, especially on machines
that run containers.
2022-08-03 21:21:28 -05:00
Dustin 1214b507c5 r/collectd-prometheus: Skip firewalld tasks
Some machines, such as the nodes in the Kubernetes cluster, do not use
*firewalld*.  For these machines, we need to skip the `firewalld` tasks,
as they will fail.  The `host_uses_firewalld` variable can be set to
`False` for these machines to do so.
2022-08-03 20:57:05 -05:00
Dustin be4bbc0092 r/grafana: Fix Origin not allowed error
Grafana 8.3.5 introduced a new CSRF protection mechanism that requires
the value of the Host HTTP request header to be preserved from the
original client request.

https://github.com/grafana/grafana/issues/45117#issuecomment-1033842787
2022-07-24 10:07:45 -05:00
Dustin 797cc2092f hosts: Add nvr1.p.b
*nvr1.pyrocufflink.blue* is the new video recording server.  It is a
1U rack-mounted physical machine based on the [Jetway
JBC150F596-3160-B][0] barebone system.  It replaces
*nvr0.pyrocufflink.blue* in this role.

[0]: https://www.jetwaycomputer.com/JBC150F596.html
2022-07-23 17:52:26 -05:00
Dustin eb79f6ea83 r/frigate: Work around podman/netavark lock
Podman 4 puts lock files in the configuration directory for [some stupid
reason][0].  There are so many issues here!

* It is now impossible to run `podman` as root with a read-only `/etc`.
* Why does it need the lock file at all when using `--network=host`?

Luckily, we can work around it fairly easily by mounting a tmpfs
filesystem over the directory it wants to put the lock file in.  This
pretty much defeats the purpose of having a lock file, but it's likely
not needed anyway.

[0]: 836fa4c493
2022-07-23 17:43:54 -05:00
Dustin ee0e6873ad r/collectd-sensors: Install collectd sensors plugin
The *sensors* plugin for collectd reads temperature information from the
I²C/SMBus using *lm_sensors*.  Naturally, it is only useful on physical
machines, so it is not installed or enabled by default.
2022-07-21 13:14:25 -05:00
Dustin a60327a995 r/collectd: Allow the thermal plugin
Raspberry Pi devices provide SoC temperature information through thermal
zone data in sysfs.
2022-07-21 12:37:07 -05:00
Dustin 29a6a0540f r/collectd: Better control over enabled plugins
Instead of a simple list of disabled plugins, hosts and host groups can
now control whether plugins are enabled or disabled using the
`collectd_plugins` map.  The map keys are plugin names, and the values
are booleans indicating if the plugin is enabled.

Using this mechanism, some plugins can be disabled by default (e.g. the
*md* plugin), and enabling them per host or per host group is simpler.
2022-07-21 12:22:19 -05:00
Dustin c7ca8e5b15 r/collectd: Allow enabling the md plugin
The *md* plugin monitors Linux multi-disk RAID (*mdraid*) devices.
2022-07-21 12:22:19 -05:00
Dustin e7534d36cf r/mosquitto: Support persistence
Mosquitto can save retained messages, persistent clients, etc. to the
filesystem and restore them at startup.  This allows state to be
maintained even after the process restarts.
2022-05-29 11:25:25 -05:00
Dustin 24228953b0 r/samba-dc: Configure logrotate for KDC
The KDC service, as managed by Samba, continuously logs to two files
that need to be rotated.  The upstream configuration for logrotate only
manages one of these files, and does not correctly signal the service
after rotating, as it expects the service to be managed by systemd
instead of Samba.  As such, we need to adjust the configuration to
handle both files and send SIGHUP directly to the process.
2022-04-24 11:37:13 -05:00
Dustin d363026db2 websites: dustin.hatch.name: Deploy new site
Promoting the new site I have been working on at *dustin.hatch.is* to my
main domain, *dustin.hatch.name*.  The new site is just static content,
generated and uploaded by a Jenkins job.

Finally have a certificate for *dustin.hatch.name* now, too!
2022-04-23 15:30:40 -05:00
Dustin 3c8e576841 grafana: Enable anonymous access
Allow unauthenticated users to view dashboards.  Useful for Heads-Up
Displays.
2022-03-07 20:10:13 -06:00
Dustin 5e2cfee8a1 r/protonvpn: watchdog: Improve error handling
This resolves two issues with fetching the Proton VPNserver list:

1. If a connection error occurs when fetching the list, it will be
   ignored, just as with HTTP errors
2. If any errors are encountered when fetching the list, and a valid
   cache was loaded, its contents are returned, regardless of the
   timestamp of the cache file.
2022-03-01 21:28:21 -06:00
Dustin 5485fc6f93 websites/d…and…t: Configure formsubmit
To handle the RSVP form on *dustinandtabitha.com*, we are going to use
*formsubmit*.  It runs on the same machine that hosts the website, so
there's no dealing with CORS.  The */submit/rsvp* path, which is proxied
to the backend, is the RSVP form's target.
2022-02-27 17:56:54 -06:00
Dustin b350698148 r/formsubmit: Deploy formsubmit app
*formsubmit* is a simple, customizable HTML for submission handler.  I
designed it for Tabitha to use to collect information from forms on her
websites.  Notably, we will use it for the RSVP page on our wedding
invitation site.
2022-02-27 17:42:15 -06:00
Dustin 3632698f37 websites/dustinandtabitha.com: Add role
Wedding website 😍
2022-02-27 17:41:40 -06:00
Dustin 5efbee725e home-assistant: Omit history DB from backups
The state history database is entirely too big.  It takes over an hour
to create a backup of it, which usually causes BURP to time out.  The
data it stores isn't particularly interesting anyway.  Instead of trying
to back it up and ultimately not getting any backup at all, we'll just
skip it altogether to ensure we have a consistent backup of everything
else that is actually important.
2022-01-02 12:07:12 -06:00
Dustin d8bb629c5d r/frigate: Ensure service starts at boot
Missing a task to enable the *frigate.service* unit meant that the
service would not start automatically when the machine booted.
2021-12-30 09:35:14 -06:00
Dustin dfa61c8a73 r/nextcloud: Increase Apache timeout
Uploading large files can take a very long time.  If the process takes
longer than the configured timeout in Apache, it will be aborted and the
client will receive an HTTP 504 Gateway Timeout error.  Increasing the
timeout will help alleviate this for files up to a certain size.
Notably, it now lets me upload Signal backups without errors.
2021-12-22 11:28:52 -06:00
Dustin 7d7dda6061 r/nextcloud: Dynamically set version in config
Nextcloud thinks it needs to run the upgrade/migration tool if the
version number in its configuration file does not match the running
version.  It then updates the config file with the correct version. The
next time the configuration policy is applied, however, the version will
revert back to whatever is set in the template.  This will re-trigger
the upgrade notification.

To avoid this problem, we now set the version in the configuration file
dynamically.  Nextcloud writes its version number in a constant in
`version.php`.
2021-12-20 22:18:14 -06:00
Dustin 7ab3787798 r/nextcloud: Correct memcache config syntax
Nextcloud uses double backslashes in its fully-qualified path names.
Although single backslashes work, the application will replace them,
leading to a constant conflict between itself and the Ansible template.
2021-12-20 22:15:53 -06:00
Dustin e55fc8f5af r/homeassistant et al.: Increase start timeout
The first time launching a container after pulling a new image, it can
take several minutes for the container to actually start.  Podman has to
set up the overlay filesystems, which is very slow on a Raspberry Pi.

With the default start timeout, systemd may end up killing the process
before the container is completely set up.  Thus, we need to increase
the timeout to ensure there is plenty of time for Podman to work.
2021-12-20 09:59:14 -06:00
Dustin f8e3bdade0 r/z*2mqtt: Fix device node contexts at start
Processes running in containers only have access to a limited set of
devices, based on their SELinux type label.  The USB serial devices
exposed by the Zwave and Zigbee adapters are not labelled correctly by
default to allow them to be used in containers.

Using `chcon` to change the type label of the device before starting the
container seems to work, but seems a bit kludgy.  It would probably be
better to use a SELinux file context rule and/or a udev rule to ensure
the label is set correctly when the device node is created.
2021-12-18 16:45:53 -06:00
Dustin 6f9ff86788 r/homeassistant: Wait for network to start
Although Home Assistant itself will start fine if the network is not yet
available, some integrations will not.  Notably, the Matrix integration
will fail to load if it cannot contact the homeserver when it is first
initialized.  To avoid this problem, we can just delay starting Home
Assistant until the network is available.
2021-12-18 16:45:53 -06:00
Dustin 1f9e13a33b r/z*2mqtt: Wait for network before starting
The Zigbee2MQTT and ZWaveJS2MQTT servers do not start correctly if the
network is not yet available.
2021-12-18 16:45:52 -06:00
Dustin 739ffb2845 home-assistant: Configure BURP backups
Take a snapshot of the history database first, then back up everything
in `/var/lib/homeassistant`.
2021-12-17 20:57:38 -06:00
Dustin fdfdaa6fe6 bitwarden_rs: Update burp backup path
Vaultwarden data are stored in a different location since the migration
to Podman.
2021-12-17 20:33:31 -06:00
Dustin 80b267d6e5 r/burp: Enable progress counter for ad-hoc runs
Before the `burp` tool gained the `-Q` option, the only way to disable
the progress counter was through the configuration file.  Since we do
not want any output from automatic backups (except of course
catastrophic failures), since it would end up being e-mailed by cron,
the progress counter had to be disabled globally.  This meant that
on-demand runs on a terminal could not have a progress counter, which
was pretty disappointing.

Now that `burp` has `-Q`, this is no longer the case.  Scheduled backups
can run with `-Q`, but ad-hoc runs can omit it to get a progress
counter.
2021-12-17 20:19:30 -06:00
Dustin 948079dafa r/samba-dc: Configure samba logging
Send logs to the systemd journal for easier viewing and disable logging
to a file.  Also, the `samba_dc_log_level` variable can control the log
level (0-10, 0 being off, 10 being insane debugging).
2021-11-07 16:18:51 -06:00
Dustin e3b5b4d5ff r/bitwarden_rs: Migrate to podman
Docker is effectively deprecated by Fedora/Red Hat.  It is a pain in the
ass to work with anyway.  Podman integrates better with systemd, and is
in general more aligned with how I prefer to deploy and manage
applications.

I am following the same pattern here that I have used for Home
Assistant, ZWaveJS2MQTT, etc.  The systemd service starts the container
with `podman`, passing the necessary arguments for UID/GID mapping, etc.
Note that, by default, Vaultwarden expects to be able to bind to port
80; since the container is unprivileged, we have to configure it (or
rather, its embedded HTTP server [Rocket](https://rocket.rs)) to listen
on a different port.  We also configure it to listen only on the
loopback, since it is being proxied by Apache to the outside network.

To migrate the data from the Docker volume, we just have to copy the
files and fix their ownership.

The *bitwarden_rs* project was recently renamed to *Vaultwarden*, so I
took this opportunity to update the name in most places within the
*bitwarden_rs* role.
2021-11-06 19:33:33 -05:00
Dustin d39b2bcb19 r/winbind: Add domain-join tag
Sometimes I need to configure a machine to be a domain member without
actually adding it to the domain.  Now I can by running
`ansible-playbook` with `--skip-tags domain-join`
2021-11-06 18:12:29 -05:00
Dustin 3f9b8c1d9b r/vmhost: Install libvirt storage driver
The *libvirt-daemon-driver-storage-core* package provides the libvirt
plugin needed for storage management, e.g. `virsh blockresize`.
2021-11-06 18:10:32 -05:00
Dustin 7bb1eb677e r/samba-dc: Use rfc2307 on all DCs
I honestly don't remember why the `use rfc2307` setting was only enabled
on the first DC.  All DCs seem to need this setting in order to use the
UID/GID numbers from the directory, instead of using auto-generated
numbers.
2021-10-31 21:07:49 -05:00
Dustin 803fd5ef2a r/systemd-networkd: Enable and start the service
Obviously, the *systemd-networkd* service needs to be running in order
for it to manage the network connections.
2021-10-31 14:29:30 -05:00
Dustin ff7c58ae71 r/collectd-nut: Configure nut plugin for collectd
The *nut* plugin for *collectd* fetches data from Network UPS Tools.
This is useful for monitoring UPS statistics over time.
2021-10-31 14:26:26 -05:00
Dustin 4beade5465 r/nut: Add role for Network UPS Tools
The *nut* role installs and configures Network UPS Tools.
2021-10-31 14:25:59 -05:00
Dustin 19330ac555 r/protonvpn: watchdog: reconfigure at startup
If the remote address configuration for strongSwan is not valid when the
Proton VPN watchdog starts, it will now regenerate it immediately.  This
can happen, for example, if the Internet has been down for a while, and
the watchdog has iterated through all of the servers in the cache.
Restarting the service will now force it to reconfigure the tunnel and
bring the VPN back up.
2021-10-31 01:24:52 -05:00
Dustin d3592f1162 hosts: Add serial0.pyrocufflink.blue
This is a Raspberry Pi 3 on the DIN rail that has USB-to-RS232 adapters
connected to the VM hosts and the Firewall.
2021-10-31 00:54:10 -05:00
Dustin a178dc4af9 r/collectd-version: Add OS version plugin
The `collectd-version` script uses the *collectd* UNIX socket to send
custom values to *collectd* to track the OS version.  Since these values
obviously cannot change while the system is running, the values are
specified with a very long interval.  This avoids having to continuously
insert the values, either with a long-running process or by repeatedly
running a script.  The values only need to be inserted once when
*collectd* starts.
2021-10-30 16:50:37 -05:00
Dustin 12c3fb950b r/collectd: Add custom types database
All values sent to *collectd* must have an associated type.  The type
defines the acceptable range of values.  Types are defined in a simple
text file database.  *collectd* loads all of the databases specified by
`TypesDB` directives in its configuration file.  When configuring a
custom types database, the default database needs to be specified
explicitly; it will not be loaded automatically if there are any
`TypesDB` directives in the configuration.
2021-10-30 16:47:29 -05:00
Dustin 32d1e0ff6f r/collectd: Enable unixsock plugin
The *unixsock* plugin for *collectd* provides a socket-based interface
that other software can use to communicate with *collectd*.  Notably,
this can be used to publish custom values, query existing values, and
flush caches.

The socket is created at `/run/collectd/socket`.  The `/run/collectd`
directory is managed by systemd; it will be created automatically when
the service starts and cleaned up when it stops.
2021-10-30 16:46:01 -05:00
Dustin 689d53abfd r/collectd: Disable network plugin by default
The default configuration for *collectd* no longer needs the network
plugin enabled, as hosts are scraped directly by Prometheus now.
2021-10-30 16:41:17 -05:00
Dustin b78af05fd8 r/collectd-prometheus: Allow scraping from outside
The *collectd-prometheus* role now has a
`collectd_prometheus_allow_outsize` variable.  This variable controls
whether or not external hosts are allowed to scrape data from *collectd*.
When set to `false`, as is the default value, *collectd* will be
configured to listen on the loopback interface only, and the TCP port
will not be opened in the firewall.
2021-10-30 16:41:17 -05:00
Dustin 3127b9b8f7 r/synapse: Enable Prometheus metrics
Synapse supports exporting metrics in Prometheus format.  It can do this
either as part of the main server, or in a separate listener.  I chose
to use a separate listener so that the metrics are not exposed
publicly.
2021-10-18 18:08:50 -05:00
Dustin 6df0d7bea4 r/gitea: Enable Prometheus metrics
Gitea provides a Prometheus-compatible metrics endpoint at `/metrics`,
but it is disabled by default.
2021-10-18 10:11:44 -05:00
Dustin 8eeccc0f65 hosts: dc2: Add RADIUS server certificate 2021-10-17 14:03:52 -05:00
Dustin 93bf6593d7 r/collectd: Add missing processes.conf template
I forgot to `git add` the template file.
2021-10-17 09:13:34 -05:00
Dustin f3c4b4d174 Merge remote-tracking branch 'refs/remotes/origin/master' 2021-10-16 21:54:36 -05:00
Dustin e2c5549f35 hosts: Add dc2.p.b
*dc2.pyrocufflink.blue* acts as a second Active Directory Domain
Controller with *samba*.
2021-10-16 21:53:02 -05:00
Dustin 3e08588d98 collectd: Configure the processes plugin
The *processes* plugin for collectd can be configured to monitor
additional information about specific processes.  By specifying one or
more `Process` or `ProcessMatch` directives in the plugin configuration,
collectd will start monitoring the listed processes in detail.

The `collectd_processes` Ansible variable can contain a list of
processes to monitor.  Each item must at least have a `name` property,
and may also have a `regex` property.  If the latter is present, a
`ProcessMatch` directive will be emitted instead of a `Process`
directive.
2021-10-16 16:25:02 -05:00
Dustin d6fff04985 r/base: Set SSH authorized keys for root
To ensure all machines have the same keys to allow root to log in via
SSH (in case Active Directory is unavailable or something).
2021-10-16 15:39:19 -05:00
Dustin 815240983f r/base: Set root password
The *base* role will now set the password for the *root* user, if the
`root_password_hash` variable is defined.  This ensures that there is a
way to log into machines directly, even if other authentication
mechanisms like Active Directory are unavailable.
2021-10-16 15:20:49 -05:00
Dustin 8b91265ffe r/serial-console: Enable getty on serial console
The *serial-console* Ansible role enables and starts a systemd service
unit to activate a console getty on the specified serial console device
(by default: ttyS0).  This is particularly useful for virtual machines,
allowing one to control them in absence of a graphical VM management
tool.
2021-10-16 14:34:51 -05:00
Dustin 3be9c40f2b r/vmhost: Install mount helpers
Filesystems like NFS and CIFS require "helper" utilities (i.e.
`mount.nfs` and `mount.cifs`, respectively).  These need to be installed
in order for a system to be able to mount those filesystems.

The current shared storage system uses NFSv4, and as such, the
*nfs-utils* package needs to be installed on the VM hosts.
2021-10-10 16:09:15 -05:00
Dustin 9c97d0318c r/vmhost: mount shared filesystems
With the transition away from *dhcpcd* on the VM hosts, there is no
longer any need for a custom wait script that must run prior to
attempting to mount the shared filesystem.  This dramatically simplifies
the configuration necessary for shared storage.

I don't really see any reason why the shared storage configuration needs
to be managed by a separate role.  The *vmhost* role is not really
generic anyway, and will probably not work for any other VM host
deployment besides the two machines running now.  As such, I think it
makes sense to move the task to mount the shared filesystem into the
*vmhost* role and drop the *dch-storage-net* role.
2021-10-10 16:09:15 -05:00
Dustin dac34a3620 r/vmhost: Switch to pure YAML syntax 2021-10-10 16:09:15 -05:00
Dustin 3c8f26cf8d r/vmhost: Install libvirt network driver
The *libvirt-daemon-driver-network* package provides support for
managing virtual networks with libvirt.  It is necessary in order to use
managed networks in VM configuration, as opposed to directly specifying
VM network interfaces in their domain configuration.
2021-10-10 16:09:15 -05:00
Dustin 2708dfe3f2 r/systemd-networkd: Role to configure networkd
*systemd-networkd* is (currently) my preferred way to manage network
interfaces on machines running Fedora.  The *systemd-networkd* role
provides a generic way to configure network links, devices, and
interfaces, using Ansible variables to generate network unit
configuration files.
2021-10-10 16:09:15 -05:00
Dustin cbcc0318f6 r/web/p-nextcloud: Set ProxyPreserveHost
The Internet-facing reverse proxy needs to pass the correct Host header
value in order for Nextcloud to correctly determine its own name.

https://github.com/nextcloud/desktop/issues/1284
2021-10-02 11:27:49 -05:00
Dustin 58832b392b collectd: Add collectd_df variable
The `collectd_df` variable can be used to configure the *df* plugin for
collectd.  It should contain a map on key-value pairs that correspond
exactly to the plugin's configuration options.
2021-08-22 11:38:40 -05:00
Dustin b7ba6a59ab hosts: Add nvr0.p.b
*nvr0.pyrocufflink.blue* hosts Frigate.  It is deployed on a separate
subnet, for two reasons:

* To avoid streaming video from the cameras through the firewall
* To prevent any hosts on the LAN except Home Assistant from
  communicating with Frigate, since it does not have any kind of
  authentication or access control
2021-08-21 17:20:19 -05:00
Dustin 997760968e r/frigate: Add role to deploy Frigate
Frigate is an NVR that uses machine learning to detect objects on camera
in real time.  It integrates with Home Assistant to expose sensors which
can be used for automation, etc.

The only official way to deploy Frigate is with a container, so we use
Podman and systemd to manage it.
2021-08-21 17:16:58 -05:00
Dustin 7d2b3887c2 Add ability to update HA-related containers
Home Assistant, Zigbee2MQTT, and ZWaveJS2MQTT can now be updated by
setting the corresponding Ansible variable.
2021-08-12 19:02:34 -05:00
Dustin 8f6f553820 Add HTTPS certificate for hass2.p.b 2021-07-24 18:39:45 -05:00
Dustin d78257326a Merge branch 'tabitha-website' 2021-07-24 18:37:05 -05:00
Dustin 910d430e1e website: Deploy Tabitha's website
Tabihta's website is a very simple, static HTML site.  It uploaded via
SFTP and served at *tabitha.biz*.
2021-07-24 18:36:13 -05:00
Dustin 5d7ebbaa05 r/hass-dhcp: Clean up DHCP/DNS service
The production deployment of *dnsmasq* for Home Assistant has deviated
from how the *hass-dhcp* role configures it.  Bringing the role back in
sync with how things really are.
2021-07-24 18:33:15 -05:00
Dustin ceeb61cdb0 roles/homeassistant: Proxy ZwaveJS2Mqtt Web UI
ZwaveJS2Mqtt includes a very powerful web-based UI for configuring and
controlling the Z-Wave network.  This functionality is no longer
available within Home Assistant itself, so being able to access the
ZwaveJS2Mqtt UI is crucial to operating the network.

I wanted to make the UI available at */zwave/*, which requires using
*mod_rewrite* to conditionally proxy requests based on the `Connection`
HTTP header, since the UI passes both HTTP and WebSocket requests to the
same paths.  *mod_rewrite* configuration is not inherited from the main
server configuration to virtual hosts, so the
`RewriteRule`/`RewriteCond` directives have to be specified within the
`<VirtualHost>` block.  This means that the Home Assistant proxy
configuration has to be within its own virtual host, and the
Zwavejs2Mqtt configuration has to be there as well.
2021-07-19 15:58:58 -05:00
Dustin b826d8355e hosts: Add hass2.p.b
*hass2.pyrocufflink.blue* is a Raspberry Pi Compute Module 4-based
system, currently mounted in a WaveShare CM4 Mini Base Board (A).  With
an NVMe SSD for primary storage, it runs significantly faster than a
standard Raspberry Pi 4, and blows the old Raspberry Pi 3-based Home
Assistant deployment out of the water. It has a Zooz 700 series Z-Wave
Plus S2 USB stick and a ConBee II Zigbee USB stick attached to its USB
2.0 ports.  It runs a customized Fedora Minimal distribution.
2021-07-19 15:58:58 -05:00
Dustin 2f3d0f74a1 roles/Zigbee2MQTT: Deploy using Podman
Zigbee2MQTT is very similar to ZwaveJS2Mqtt: it is a daemon process that
communicates with the Zigbee radio and integrates with Home Assistant
using MQTT.  Naturally, I decided to deploy it in the same way as
ZwaveJS2Mqtt, using a systemd unit to run it in a container with Podman.
2021-07-19 15:58:58 -05:00
Dustin 57b3039f2c roles/mosquitto: Update for Mosquitto 2.x
Mosquitto 2.x included two significant changes from 1.6:

* There is no longer a "default" listener; all listeners are configured
  in the same way
* The daemon drops privileges *before* reading TLS certificates and
  private keys
2021-07-19 15:58:58 -05:00
Dustin 0f70a5b6ba roles/zwavejs2mqtt: Deploy Z2M using Podman
Home Assistant no longer recommends using the built-in libopenzwave
integration for communicating with Z-Wave devices.  Evidently, OpenZWave
is no longer maintained, and community efforts have shifted toward
Z-Wave JS.

Z-Wave JS is architecturally much different than the legacy Z-Wave
integration.  Instead of running the network controller inside the Home
Assistant process, a separate daemon communicates with the Z-Wave radio.
Home Assistant integrates with that daemon using a WebSockets API.  This
has the advantage of decoupling the network operation from the lifecycle
of the Home Assistant process: restarting Home Assistant (e.g. to load
new configuration changes) does not take the Z-Wave network offline.

ZwaveJS2Mqtt is a distribution of the Z-Wave JS daemon, as well as a
web-based user interface for configuring it.  Although its name implies
that it uses MQTT for communication, this feature is actually optional,
and the native WebSockets API can still be used for integration with
Home Assistant.

I decided to follow the same deployment pattern for ZwaveJS2Mqtt as for
Home Assistant itself: run the application from a container image using
Podman.  This of course simplifies the installation of the application
significantly, leaving most of that work up to the maintainer of the
container image.  Podman provides the container runtime, managing the
privileges, etc.  The systemd service unit starts Podman, configuring an
ephemeral container on each run.  The container uses the default network
namespace, avoiding the unnecessary overhead of port mapping.  It uses
Podman's "rootless" mode, via the `--uidmap` and `--gidmap` arguments,
mapping users inside the container, including root, to unprivileged
users on the host.  The Z-Wave radio, which is specified by the
`zwavejs_device` Ansible variable,  is passed into the container via the
`--device` argument.
2021-07-19 15:58:52 -05:00
Dustin 288b050a33 roles/homeassistant: Deploy container with Podman
Installing Home Assistant in a Python virtualenv is rather tedious,
especially on non-x86 machines.  The main issue is Python packages that
include native extensions, as many of these do not have binary wheels
available for aarch64, etc. on PyPI.  Thus, to install these, they have
to be built from source, which then requires the appropriate development
packages to be installed.  Additionally, compiling native code on a
Raspberry Pi is excruciatingly slow.  I have considered various ways of
mitigating this, but all would require a substantial time investment,
both up front and ongoing, making them rather pointless.  Eventually, I
settled on just deploying the official Home Assistant container image
with Podman.

Although Podman includes a tool for generating systemd service unit
files for running containers, I ended up creating my own for several
reasons.  First and foremost, the generated unit files configure the
containers to run as *root*, but I wanted to run Home Assistant as an
unprivileged user.  Unfortunately, I could not seem to get the container
to work when dropping privileges using the `User` directive of the unit.
Fortunately, `podman` has `--uidmap` and `--gidmap` arguments, which I
was able to use to map UID/GID 0 in the container to the *homeassistant*
user on the host.  Another drawback of the generated unit files is that
they specify a "forking" type service, which is not really necessary.
Podman/conmon supports the systemd notify protocol, but the generator
has not been updated to make use of that yet.

Recent versions of Home Assistant are more strict with respect to how
reverse proxies are handled.  In order to use one, it must be explicitly
listed in the configuration file.  Therefore, the *homeassistant*
Ansible role will now create a stub `configuration.yaml`, based on the
one generated by Home Assistant itslf when it starts for the first time
on a new machine, that includes the appropriate configuration for a
reverse proxy running on the same machine.  The stub configuration will
not overwrite an existing configuration file, so it is only useful when
deploying Home Assistant for the first time on a new machine.

Overall, although I think a 300+ MB container image is ridiculous,
deploying Home Assistant this way should make it a lot easier to manage,
especially when updating.
2021-07-19 13:38:08 -05:00
Dustin 4aa3cdddd9 hosts: Add zezere0.p.b
*zezere0.pyrocufflink.blue* hosts the local deployment of the Fedora
Zezere provisioning service.
2021-07-05 09:34:25 -05:00
Dustin ccdaad40bf zezere: role/playbook to deploy Zezere
Zezere is the Fedora IoT device provisioning service.  It is the
software that runs *provision.fedoraproject.org*, but it can be
self-hosted (if you can figure it out; there is no documentation
whatsoever).

The main use case for running Zezere locally is to automatically add
trusted SSH public keys to Fedora IoT devices, without depending on a
cloud service.  This playbook sets up Zezere with the very minimal
configuration needed to meet this goal.
2021-07-05 09:34:25 -05:00
Dustin 9565b740b0 hosts: add stats0.p.b
*stats0.pyrocufflink.blue* hosts Grafana (for now, adding Victoria
Metrics, etc. later)
2021-07-02 21:55:02 -05:00
Dustin 5e61e93cea roles/grafana: Deploy Grafana
This commit introduces the *grafana* role and the corresponding
`grafana.yml` playbook.  The role installs Grafana using the system
package manager, and configures the server (including LDAP
authentication).
2021-07-02 21:47:33 -05:00
Dustin 5de8f3e612 roles/nginx: Add role for nginx
This role installs nginx and provides a base/skeleton configuration
suitable for most deployments.
2021-06-29 21:00:46 -05:00
Dustin 1fcfc80254 r/protonvpn: watchdog: Also watch for EAP/FAIL
Occasionally, ProtonVPN servers randomly reject the EAP authentication
credentials.  When this happens, the tunnel fails and is not restarted
automatically by strongSwan.  As such, the watchdog needs to react to
this event as well.
2021-06-27 09:23:46 -05:00
Dustin 6b9b87a406 roles/nextcloud: Configure outbound email
Since the Nextcloud configuration file is managed by the configuration
policy, all of the settings configurable through the web UI need to be
templated.  One important group of settings is the outbound email
configuration.  This can now be configured using the `nextcloud_smtp`
Ansible variable.
2021-06-25 11:12:38 -05:00
Dustin c68f10d771 roles/nextcloud: Use Redis for caching
The Nextcloud community [recommends][0] using Redis as a cache provider,
to improve response times and file locking reliability.
2021-06-25 11:12:12 -05:00
Dustin 05a414100a roles/redis: Add role to deploy Redis
This simple role installs the *redis* package and starts the associated
service.  It leaves the configuration as provided by upstream, at least
for now.
2021-06-25 11:10:10 -05:00
Dustin b86e0d8f29 roles/nextcloud: Switch to Fedora package
Fedora now includes a packaged version of Nextcloud.  This will be
_much_ easier to maintain than the tarball-based distribution method.
There are some minor differences in how the Fedora package works,
compared to the upstream tarball.  Notably, it puts the configuration
file in `/etc/` and makes it read-only, and it stores persistent data
separate from the application.  These differences require modifications
to the Apache and PHP-FPM configuration, but the package also included
examples to make this easier.  Since the `config.php` is read-only now,
it has to be managed by the configuration policy; it cannot be modified
by the Administration web UI.
2021-06-24 20:21:48 -05:00
Dustin 0add34a9a3 roles/protonvpn: Add watchdog script
One major problem with the current DNS-over-VPN implementation is that
the ProtonVPN servers are prone to random outages.  When the server
we're using goes down, there is not a straightforward way to switch to
another one.  At first I tried creating a fake DNS zone with A records
for each ProtonVPN server, all for the same name.  This ultimately did
not work, but I am not sure I understand why.  strongSwan would
correctly resolve the name each time it tried to connect, and send IKE
initialization requests to a different address each time, but would
reject the responses from all except the first address it used.  The
only way to get it working again was to restart the daemon.

Since strongSwan is apparently not going to be able to handle this kind
of fallback on its own, I decided to write a script to do it externally.
Enter `protonvpn-watchdog.py`.  This script reads the syslog messages
from strongSwan (via the systemd journal, using `journalctl`'s JSON
output) and reacts when it receives the "giving up after X tries"
message.  This message indicates that strongSwan has lost connection to
the current server and has not been able to reestablish it within the
retry period.  When this happens, the script will consult the cached
list of ProtonVPN servers and find the next one available.  It keeps
track of the ones that have failed in the past, and will not connect to
them again, so as not to simply bounce back-and-forth between two
(possibly dead) servers.  Approximately every hour, it will attempt to
refresh the server list, to ensure that the most accurate server scores
and availability are known.
2021-06-21 20:48:23 -05:00
Dustin bb6186b90e roles/mosquitto: Add role to deploy MQTT server
*Mosquitto* implements an MQTT server.  It is the recommended
implementation for using MQTT with Home Assistant.

I have added this role to deploy Mosquitto on the Home Assistant server.
It will be used to send data from custom sensors, such as the
temperature/pressure/humidity sensor connected to the living room wall
display.
2021-05-02 19:10:17 -05:00
Dustin 7b04326146 roles/websites/chmod777: Remove HTTP vhost
Since there are no other plain HTTP virtual hosts, the one defined for
chmod777.sh became the "default."  Since it explicitly redirects all
requests to https://chmod777.sh, it caused all non-HTTPS requests to be
redirected there, regardless of the requested name.  This was
particularly confusing for Tabitha, as she frequently forgets to put
https://…, and would find herself at my stupid blog instead of
Nextcloud.
2021-03-11 19:57:37 -06:00
Dustin 6aaf1b7dbb roles/strongswan-swanctl: Load esp4 module at boot
The *esp4* kernel module does not load automatically on Fedora.  Without
this module, strongSwan can establish IKE SAs, but not ESP SAs.  Listing
the module name in a file in `/etc/modules-load.d` configures the
*systemd-modules-load* service to load it at boot.
2021-02-17 20:33:41 -06:00
Dustin 243510e74a roles/protonvpn: Fix swanctl syntax
I believe the reason the VPN was not auto-restarting was because I had
incorrectly specified the `keyingtries` and `dpd_delay` configuration options.
These are properties of the top-level connection, not the child. I must
have placed them in the `children` block by accident.
2021-02-09 07:17:32 -06:00
Dustin 81417068c2 roles/synapse: Add cert role dependency
The *cert* role must be defined as a role dependency now, so that the
role can define a handler to "listen" for the "certificate changed"
event.  This change happened on *master*, before the *matrix* branch was
merged.
2021-01-31 15:38:18 -06:00
Dustin 7f8a9ce114 roles/graylog: Update Graylog repository RPM URL
Graylog 3.3 is currently installed on logs0.  Attempting to install the
*graylog-3.1-repository* package causes a transaction conflict, making
the task and playbook fail.
2021-01-31 15:33:42 -06:00
Dustin ee93586a95 roles/apache: Add previously-ignored cert symlinks
Before the advent of `ansible-vault`, and  long before `certbot`/`lego`,
I used to keep certificate files (and especially private key files) out
of the Git repository.  Now that certificates are stored in a separate
repository, and only symlinks are stored in the configuration policy,
this no longer makes any sense.  In particular, it prevents the continuous
enforcement process from installing Let's Encrypt certificates that have
been automatically renewed.
2021-01-24 17:08:00 -06:00