apt-key deprecated

apt-key has been deprecated. The reason is explained in 1 (the way apt-key works, adding all the keys to a single /etc/apt/trusted.gpg file, and trusting all the keys for packages irrespective of ) From the apt-key manpage: DEPRECATION Except for using apt-key del in maintainer scripts, the use of apt-key is deprecated.

Install multiple versions of Python

We will follow the procedure below to install a version of Python different than the system installed one. In this system (WSL Debian 11), the distro provided Python is 3.9. We will install a newer release (3.12.3) Install required dependencies (follow the python dev guide docs) # For debian 11, Add the following in /etc/apt/sources.

Use Grafana/Loki to list ssh logins

Configure Loki to log journald. Promtail configuration in the target hosts should contain something like: scrape_configs: ... - job_name: journal journal: labels: host: nix job: systemd-journal max_age: 12h relabel_configs: - source_labels: - __journal__systemd_unit target_label: unit To confirm ssh logs are being retrieved, in grafana explore use a query like:

Ansible Vault

Encrypt single string > ansible-vault encrypt_string 'Xiquei8iek4hahgeedoo0ohfooj2ocheeFe3de8niomuo' --name 'secret_key' secret_key: !vault | $ANSIBLE_VAULT;1.1;AES256 39346530333932626233643963653230346533656162316430396461343530303635353161393765 ... ... 62343732356532366639663663376266316632613362666661353339383032653761393338316237 626337313062636436613439663365313633 Encryption successful => Add string to host_vars of myhost Decrypt single string ansible myhost -m debug -a var="secret_key" ... ok: [myhost] => secret_key: Xiquei8iek4hahgeedoo0ohfooj2ocheeFe3de8niomuo .

UFW Logs

By default, UFW in ubuntu logs blocked packets in 3 different files: /var/log/ufw.log, /var/log/kern.log, and /var/log/syslog. The UFW package creates the following /etc/rsyslog.d/20-ufw.conf (in ubuntu 22.04): $ cat /etc/rsyslog.d/20-ufw.conf # Log kernel generated UFW log messages to file :msg,contains,"[UFW " /var/log/ufw.log # Uncomment the following to stop logging anything that matches the last rule.