Project

General

Profile

README

DuckCorp Infrastructure

This is the root of the DuckCorp Admin Team materials used to install, configure and manage services.

DuckCorp is commited to Free Software, thus all materials are published under the GPL v3 License (see details of the license in the COPYING file).

Materials

All sensitive materials are encrypted, read the Dealing with Secrets chapter to know more about this.

Configuration Management & Deployment

We use Ansible to help us automate as much as possible; you'll find more about it in the ansible directory.

Still, many things are handled manually, this is WIP.

PKI

Our TLS certificates are managed using mkcert. The mkcert.conf file holds the DuckCorp-specific configuration, and services contains the specific service names not in /etc/services. The keys configuration and resulting certificates are stored in the pki directory.

With this layout, mkcert can be run in-place (at the top-level of this repository), automagically finding its configuration and work directories.

Scripts

In the scripts directory are the following scripts:

  • adm_check_*: this series of scripts check various resources hosted by DuckCorp against the outside world to see if there is any misconfiguration or if the hosting became obsolete (without the user telling us, which happen very often…)
  • adm_publish_tlsa: compute TLSA DNS RR for DNSSEC-enabled DNS zones based on the available TLS certificates
  • check_certs_expiration: warn when certificates are nearly expired (or already expired)

They are meant to be run in-place from the top of this repository. The lib subdirectory contains code factorized between the scripts.

Documentation

The admin-oriented documentation can be found alongside the other materials, but for some topics we might write a dedicated explanation and store it in the doc directory.

For Admin Team Members

Requirements

First, clone [the repository](ssh://vcs-git.duckcorp.org/srv/vcs/git/duckcorp/duckcorp-infra.git). You should probably have a look at the Requirements in the underlying directories too.

Git configuration

  • Always create a merge commit : $ git config --local merge.ff false
  • Allow fast-forward merges when using pull : $ git config --local pull.ff only
  • All commits must be GPG signed : $ git config --local commit.gpgSign true

Dealing with Secrets

We use Ansible Vault to hide some parameters like service credentials, user personal information or emails to avoid SPAM.

To make it easy git attributes are defined to make diff-ing and merging easy.

Your configuration needs to be enhanced to tel git how to handle these files. This is very easy, look at this URL for more info:

: https://github.com/building5/ansible-vault-tools

Because ansible-vault is called at the top level directory of the repository, this setup requires to define either ANSIBLE_VAULT_PASSWORD_FILE or ANSIBLE_CONFIG environment variable (otherwise ansible-vault would not know the path of the ansible vault password file).

Shell Helper

You might want to use this little bashrc snippet to simplify setting ANSIBLE_CONFIG correctly:

ansprep () {
    local git_topdir
    git_topdir=$(git rev-parse --show-toplevel 2>/dev/null)
    if [ $? -ne 0 ]; then
        echo "Not a git repository" >&2
        return 1
    fi

    local ansible_config
    ansible_config=$(find $git_topdir -name ansible.cfg)
    if [ $? -ne 0  -o -z "$ansible_config" ]; then
        echo "Not an Ansible project" >&2
        return 1
    fi

    export ANSIBLE_CONFIG=$ansible_config
    export ANSIBLE_FORCE_COLOR=true
}

Once in the git repository (anywhere inside) you can just run the ansprep command to setup everything. This way the ansible-vault-tools features will work wherever you are in the repository.

Ansible Vault Password

The Ansible Vault Password is encrypted with GPG in ansible/vault_pass.asc.

It is read by ansible/decrypt-vault-password.sh script which is automatically called by Ansible, being the Ansible Vault Password File.

When the list of admins (in admins_gpg_keys file) change this file needs to be updated (and the secret may also need to be changed):

admins_gpg_keys="$(cat admins_gpg_keys | awk 'match($0, "^(0x)?[0-9A-F]{40}\\>") { printf "%s ",$1 }')" # ignore comments if any
gpg --group duckcorp="${admins_gpg_keys}" --recipient duckcorp \
    --trust-model=always --no-encrypt-to --no-throw-keyids \
    --encrypt --armor ansible/vault_pass

Git usage

When merging a branch, use --verify-signatures switch. If this fails, then DO NOT MERGE!!!

When adding submodule, please use the HTTPs URL to allow contributors to clone. Also use --name to set the submodule name or the path is taken by default. Then, you can ask git to automatically rewrite the URL to the right form with this command:

git config --global url.ssh://vcs-git.duckcorp.org/srv/vcs/git/.insteadOf https://vcs-git.duckcorp.org/

For External Contributor

You're welcome to contribute ideas, report problems, send patches… using our Ticket Tracker (in the Contribution tracker).

You can clone this repository or browse it.

Statistics
| Branch: | Revision:
Name Size Revision Age Author Comment
  ansible 54c6f1ee about 1 month Marc Dequènes lint: ignore no-role-prefix for now
  attic fc1357ef over 4 years Marc Dequènes add attic to keep some old backup scripts as re...
  doc dc328c80 over 2 years Pierre-Louis Bonicoli List TCP ports forwarded to Orthos
  pki ffe125db 3 months Marc Dequènes Update DC CA and depending certs
  scripts 4da9d21a over 3 years Marc Dequènes adm_check_web: check CNAMEs until final RR
.gitattributes 49 Bytes 67bdda4a over 4 years Marc Dequènes Include the Ansible Vault Key The key is GPG-e...
.gitignore 265 Bytes 67bdda4a over 4 years Marc Dequènes Include the Ansible Vault Key The key is GPG-e...
.gitmodules 3.4 KB 15888fae over 1 year Marc Dequènes roles/prometheus: re-add as a submodule
COPYING 34.3 KB 5d76f2d8 about 7 years Marc Dequènes First public version
README.md 5.51 KB ae647f1f about 4 years Marc Dequènes doc: add a shell snippet to help with the vault...
admins_gpg_keys 146 Bytes 67bdda4a over 4 years Marc Dequènes Include the Ansible Vault Key The key is GPG-e...
checks_whitelist.yml 822 Bytes 00b10d21 over 5 years Marc Dequènes adm_check_dns: implement partial whitelisting
mkcert.conf 154 Bytes 5d76f2d8 about 7 years Marc Dequènes First public version
services 347 Bytes e9b7d9a0 over 6 years Marc Dequènes removed obsolete im_gateway service #2

Latest revisions

# Date Author Comment
54c6f1ee 2024-11-12 08:39 Marc Dequènes

lint: ignore no-role-prefix for now

5366a54c 2024-11-12 08:39 Marc Dequènes

Update DC CA and depending certs §3

18860d37 2024-10-07 06:09 Marc Dequènes

redis: restart when certs are updated

9281a7aa 2024-09-27 06:05 Marc Dequènes

stuff.milkypond.org: define maintenance window start

83538afe 2024-09-27 06:00 Marc Dequènes

dc-web: adjust opcache parameters for Nextcloud

c83f8c68 2024-09-27 05:43 Marc Dequènes

Update DC CA and depending certs §2

3c64c15f 2024-09-27 05:28 Marc Dequènes

dc-base: cleanup Nextcloud files

ffe125db 2024-09-25 21:46 Marc Dequènes

Update DC CA and depending certs

41220096 2024-09-25 21:46 Marc Dequènes

dl: disable LV when done

02a14411 2024-09-25 21:46 Marc Dequènes

dl: back stop on error

View all revisions | View revisions

Also available in: Atom