Icecast: auth to server failed with could not resolve host

The problem Consider this configuration in icecast.xml /your-mount … resulting in this error: WARN auth_url/url_add_listener auth to server http://example.com/auth_mount failed with Could not resolve host: example.com To debug, you wget -O /dev/null http://example.com/auth_mount on the same server and it works file. That means it’s Icecast itself (the daemon) that cannot resolve the hostname. This typically… Continue reading Icecast: auth to server failed with could not resolve host

FreeBSD Certbot: AttributeError: ‘Meta’ object has no attribute ‘profiles’

The problem Requesting a certificate for example.com An unexpected error occurred: AttributeError: ‘Meta’ object has no attribute ‘profiles’ The solution Upgrade or reinstall py311-acme Debugging Check /var/log/letsencrypt/letsencrypt.log for JSON dump of the Directory object: DEBUG:acme.client:Sending GET request to https://acme-v02.api.letsencrypt.org/directory. DEBUG:acme.client:Received response: { "keyChange": "https://acme-v02.api.letsencrypt.org/acme/key-change", "meta": { "caaIdentities": [ "letsencrypt.org" ], "profiles": { "classic": "https://letsencrypt.org/docs/profiles#classic", "shortlived":… Continue reading FreeBSD Certbot: AttributeError: ‘Meta’ object has no attribute ‘profiles’

Using peewee with mysql-connector-python

The problem You already import mysql.connector in your project and you want to use peewee, only problem is: peewee.ImproperlyConfigured: MySQL driver not installed! It’s a known issue since 2018: Why does not peewee support mysql-connector-python? · Issue #1501 · coleifer/peewee. The advice is to: either install pymysql or implement a proxy driver for the mysql.connector… Continue reading Using peewee with mysql-connector-python

Python script for certbot –manual-auth-hook and –manual-cleanup-hook for DNS-01 challenge

You can use a custom Python script as a hook for manual DNS-01 challenge. Example: certbot certonly –non-interactive –agree-tos \ –email webmaster@example.com \ –manual –preferred-challenges dns \ –manual-auth-hook /path/to/certbot-hook.py auth \ –manual-cleanup-hook /path/to/certbot-hook.py cleanup \ -d example.com -d *.example.com You can use the same script for both auth and clean up – pass auth or… Continue reading Python script for certbot –manual-auth-hook and –manual-cleanup-hook for DNS-01 challenge

Creating API credentials for certbot-dns-oci

The setup You want to generate Letsencrypt certificates using DNS-01 challenge (e.g. wildcard certificates) and you host your domain on Oracle Cloud. Your code is in Python and you want to use certbot-dns-oci for updating the TXT DNS records for the DNS-01 challenge. The problem You need to provide some OCI credentials to certbot-dns-oci and… Continue reading Creating API credentials for certbot-dns-oci

Debugging cron environment on Azure Web App Service

I wrote a service script in Python and I wanted it to run daily on Azure Web App Service. The catch? Same script will run differently when launched manually via SSH and when triggered with cron. Most notably, it will be missing all your environment variables. So how do you know what actually is in… Continue reading Debugging cron environment on Azure Web App Service

Server migration cheat sheet

Have history with timestamps May not be enabled by default on a new server ~/.bash_profile: if [ -f ~/.bashrc ]; then . ~/.bashrc fi ~/.bashrc: # Enable timestamp in history export HISTTIMEFORMAT=”%F %T ” # Make history append instead of overwrite shopt -s histappend # Increase history size export HISTSIZE=1000000 export HISTFILESIZE=2000000 (optional) Automatically cd… Continue reading Server migration cheat sheet

Automate connecting to temporary and rotating development servers

I rotate a lot of short-lived VPS instances for testing and development. A lot of them are hosted with Oracle Cloud free tier, and so rotating them is effortless: they are all created using the same instance configuration, recognize the same SSH keys etc. On my Mac OS, however, it took me a while to… Continue reading Automate connecting to temporary and rotating development servers