Skip to content

Instantly share code, notes, and snippets.

@MagnusOxlund
MagnusOxlund / certbot-renewal-notes.md
Last active December 9, 2024 11:35
How to renew Let's Encrypt certificates with Certbot

How to renew Let's Encrypt certificates with Certbot

Acquire a certificate (certbot certonly)

Certificates are initially acquired with the certbot certonly command.

Certificates expire 90 days after being issued and need to be renewed (or replaced).

When acquiring a certificate, a list of options is specificed. These include domain names and an authentication method. The official manual refers to authentication methods as "plugins". The term "plugins" also refers to "installation plugins", which are optional components used to install certificates on webservers.

@MagnusOxlund
MagnusOxlund / certbot-renewal-hook-priority-test.sh
Last active December 6, 2024 05:59
Certbot renewal hook priority
# Script that tests the order and priority of Certbot's four renewal hook types:
# * Command line argument hooks
# * Certificate renewal configuration hooks
# * Global configuration hooks
# * Renewal directory hooks
# The script has not been verified to be safe. Use at your own risk.
# --------------
# WARNING PROMPT
@MagnusOxlund
MagnusOxlund / peewee_two_mysql_users_least_privilege.py
Last active February 3, 2024 08:28
Using Peewee with two (or more) MySQL users to implement principle of least privilege
# Naive approach:
# 1. Create two MySQLDatabase instances for the same MySQL database:
# * One instantiated with your CRUD-privileged user
# * One instantiated with your DDL-privileged user
#
# 2. Next, define your test model with `database=crud_instance` in
# its Meta subclass.
#
# 3. Then establish a database connection from the ddl_instance and
# issue `create_tables()`.