Giter Club home page Giter Club logo

admin-tools's Introduction

#! Admin Tools

Ansible playbooks and other admin tools/docs for maintaining the #! network.

Requirements

  • Recent version of Ansible
  • Local #! pass database
  • User with sudo access on all servers

Git configuration

You might also want to use the following snippet in ~/.gitconfig:

[diff "gpg"]
	textconv = gpg --no-tty --decrypt
	cachetextconv = false
[diff "ansible-vault"]
	textconv = ansible-vault view
	cachetextconv = false

SSH configuration

All the “service servers” (as opposed to shell servers) listen for SSH on port 8993 (ASCII-encoding of #!), and the user is core, with the following exceptions:

  • lon1.irc.hashbang.sh and sfo1.irc.hashbang.sh do not yet follow that convention;
  • git-infra.hashbang.sh is a service hosted on nyc3.apps.hashbang.sh which uses port 22.

This is expressed in the following .ssh/config snippet:

Host da1.hashbang.sh ny1.hashbang.sh sf1.hashbang.sh to1.hashbang.sh
     User your_nick

Host git-infra.hashbang.sh
     User git

Host sfo1.irc.hashbang.sh ldap.hashbang.sh
     User core

Host *.hashbang.sh hashbang.sh
     User core
     Port 8993

Playbooks

There are several playbooks present here:

  • shell.yml is used to synchronise the configuration (incl. installed packages) across the shell servers.

  • credentials.yml is used to deploy the admin's SSH keys across all servers:

    • admins can login as root on the shell servers;
    • they can login as core on the CoreOS servers.
  • coreos.yml performs CoreOS-specific tasks. Currently, it only bootstraps the Ansible agent's dependencies.

  • mail.yml deploy the mail aliases and Postfix configuration.

  • irc.yml deploys static and templated configuration to the IRC servers, including oper blocks for users defined in group_vars/all/users.yml.

  • ldap_ban.yml disables user accounts in LDAP and terminates their sessions on the shell servers; it requires python-ldap installed. Invoke as follows:

      ansible-playbook ldap_ban.yml
    

    For scripting purposes, the script accepts a comma-separated list of users, (users), and a Boolean determining if the homedirs should be deleted (delete).

Usage

Install a package

See doc/Installing_packages.md.

Making a configuration change

  1. Prepare your change for shell-etc, test it locally.
  2. Create a pull-request for it on Github, wait for a review.
  3. Perform a signed merge into master: git merge -S --no-ff branch
    Only merge into master things that you will deploy immediately. Do not merge if you aren't in a position to follow-up with a deploy.
  4. Run the shell.yml playbook, see below.

Sync packages & configuration across all shell servers

Simply run the appropriate Ansible playbook:

ansible-playbook shell.yml

admin-tools's People

Contributors

aagat avatar benharri avatar chickennuggers avatar connerbrooks avatar daurnimator avatar deviavir avatar dpflug avatar drgrove avatar infrastation avatar kellerfuchs avatar lrvick avatar necrophcodr avatar picardrulez avatar ryansquared avatar singlerider avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

admin-tools's Issues

Manage LDAP groups through Ansible

We could manage the users in various LDAP groups (mainly sudo) through Ansible.
This would be convenient, since it reduces the number of places where the list of admins must be kept in sync.

This is safe, because admins do not need their in-LDAP credentials to login to ldap.hashbang.sh (this is done through a public key) and re-establish their access, should something go terribly wrong.

Document access recovery procedures

As @AlissaSquared pointed out in #2, we need to document how to regain access to the various services we use.

That includes:

  • Atlantic.net:
    • the Atlantic account itself;
    • the shell boxes;
  • DigitalOcean:
    • account;
    • service boxes;
  • Github organisation;
  • GlobalSign account.

Enforce signing of shell-etc

Currently, Github is ultimately trusted, since we pull configuration from it, build containers based on repo's contents, ... As a first step away from this (not from using Github, but from trusting it), I suggest we use OpenPGP signatures to protect the authenticity of the git tree.

This is (mostly) straightforward:

  • Create a GnuPG homedir in /etc/gpg/, used only for signature checking.
    This allows us to keep the keyring and the GnuPG config (in particular, trust-model direct) in shell-etc.
  • Agree to only merge PRs in shell-etc using signed merge commits, as can be created with git merge --no-ff -S.
    When switching to this practice, create an empty, signed commit at the head of shell-etc (if needed).
  • Replace etckeeper vcs pull --ff-only in sync.yml with etckeeper vcs pull --ff-only --verify-signatures, with the GNUPG_HOME environment variable set to /etc/gpg/.

There are 2 main issues:

  • It doesn't currently seem possible, on Github, to enforce that only signed commits get pushed.
    I've been in touch with Github's support regarding that.
  • How do we deal cleanly with commits created by apt(8)?

Template the IRCd configuration

This requires two things:

  • actually writing the config template;
  • setting up an encrypted Ansible Vault to store the oper's password hashes in.

Encrypting that is a very good idea, given that some of the oper passwords might be not-so-strong, and we will likely need to store secrets here in the long run (API keys, ...).

Agree on a baseline Ansible version

It would be much easier to improve the playbooks and roles if we know which version of Ansible we are targetting.

Currently, we use some v1.9 features (v1.9 is in jessie-backports), but cleaning up on error (in #12 for instance) is much easier using blocks ... which are a v2.0 feature.
Ansible 2.0 is available in Debian Stretch, and it looks like the pin shouldn't be problematic (unlike the weechat one, which ran into ABI breakages).

Admins in agreement:

Playbook needed for IPSec management

I would like to propose a way to setup IPSec in transport mode between all our machines, because:

  • we can ;)
  • it makes sure that communication between our boxes is authenticated and encrypted (I haven't reviewed the TLS settings for everything, and that would be a daunting task...)
  • it hides some communication metadata (protocol & port).

However, managing a full mesh by hand is not going to be fun, so we should have a playbook that:

  • fetches the IPSec pubkeys, and make the server generate keys if needed;
  • sends the pubkeys to all servers (or as a hash in the config?);
  • generate the StrongSwan config from a template;
  • reloads.

Complete the list of admins and SSH keys

All the other admins should add themselves and their SSH keys here.

Then, we can make ansible remove all the SSH keys that aren't listed here, and the state of the repo will faithfully describe what is on the servers.

  • daurnimator
  • lrvick
  • dgrove
  • KellerFuchs
  • Alissa

(Expand onto this list when needed)

Update documentation

The documentation (at least README and doc/Installing_packages.md) need to be updated, as they document an obsolete situation.

Playbook needed for OpenSSH CA

It would be really convenient to have a playbook for fetching the SSH hostkeys, signing them locally, and uploading the result back as a a HostCertificate.

SSH keys for etckeeper not found

No compatible private key for etckeeper was found; no packages are installable by any user using two factor authentication until this is fixed or a user adds in a key of their own. Currently I'm setting one up on my own account but I'm unsure of how to set it for the whole organization.

irc.hashbang.sh geoDNS setup is unreliable

We currently have an outage where lon1.irc.hashbang.sh fails all TLS handshakes.
All users in Europe are only sent a record for lon1.

  • The health check should actually perform a TLS handshake and validate the cert, if AWS can even do that.
  • We should, longer-term, make sure that all users get at least 2 IRCds in any request.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.