====== Information ====== * Let's Encrypt ((https://letsencrypt.org)) * Certbot ((https://certbot.eff.org)) * [[Information:Realm of Espionage]] ===== Prerequisites ===== * [[windows;10|Windows 10 (21H2)]] * [[servers;windows;nginx_php_php-cgi|nginx]] ====== Install ====== ===== Python ===== * https://www.python.org/downloads/windows/ * Last tested: ''python-3.14.0-amd64.exe'' ((2025/11/13: ''python-3.15.0a1-amd64.exe'' needed a VC++ package for ''certbot'' and [[windows;10#vc_redist|abbodi1406/vcredist]] didn't cover it)) * Install ''pip'' ((nothing else (admin, PATH, etc) is required and can be unchecked)) ===== Certbot ===== **** "%LocalAppData%\Programs\Python\Python314\Scripts\pip.exe" install "certbot" ====== Settings ====== MKDIR "%SystemDrive%\www\certbot" "notepad.exe" "%SystemDrive%\www\certbot\cli-custom.ini" verbose = "true" text = "true" non-interactive = "true" standalone = "true" force-renewal = "true" agree-tos = "true" ################################################## email = espionage724@x ################################################## no-eff-email = "true" rsa-key-size = "4096" redirect = "true" hsts = "true" uir = "true" staple-ocsp = "false" domains = "realmofespionage.xyz, blog.realmofespionage.xyz, files.realmofespionage.xyz, forums.realmofespionage.xyz, media.realmofespionage.xyz, wiki.realmofespionage.xyz, social.realmofespionage.xyz, test.realmofespionage.xyz" # End ====== Obtain Certs Test ====== "netsh.exe" advfirewall firewall add rule name="Certbot (Standalone)" dir="in" action="allow" program="%LocalAppData%\Programs\Python\Python314\python.exe" protocol="tcp" localport="80" "%LocalAppData%\Programs\Python\Python314\Scripts\certbot.exe" "certonly" --config "%SystemDrive%\www\certbot\cli-custom.ini" --dry-run "netsh.exe" advfirewall firewall delete rule name="Certbot (Standalone)" ====== Scripts ====== MKDIR "%SystemDrive%\www\scripts\certbot" "explorer.exe" "%SystemDrive%\www\scripts\certbot" ===== Renewal ===== "notepad.exe" "%SystemDrive%\www\scripts\certbot\Renewal.bat" @echo off CALL "%SystemDrive%\www\scripts\certbot\Update.bat" CALL "%SystemDrive%\www\scripts\nginx\Stop.bat" "netsh.exe" advfirewall firewall add rule name="Certbot (Standalone)" dir="in" action="allow" program="%LocalAppData%\Programs\Python\Python314\python.exe" protocol="tcp" localport="80" "%LocalAppData%\Programs\Python\Python314\Scripts\certbot.exe" "certonly" --config "%SystemDrive%\www\certbot\cli-custom.ini" --quiet "netsh.exe" advfirewall firewall delete rule name="Certbot (Standalone)" CALL "%SystemDrive%\www\scripts\nginx\Start.bat" :: End "%SystemDrive%\www\scripts\certbot\Renewal.bat" ===== Update ===== "notepad.exe" "%SystemDrive%\www\scripts\certbot\Update.bat" @echo off "%LocalAppData%\Programs\Python\Python314\python.exe" -m "pip" install --upgrade "pip" --quiet "%LocalAppData%\Programs\Python\Python314\Scripts\pip.exe" install --upgrade "certbot" --quiet :: End "%SystemDrive%\www\scripts\certbot\Update.bat" ====== Task Scheduler ====== **** taskschd.msc ===== Renewal ===== * Weekly -> Recur every ''1'' weeks on ''Sunday'' * ''7:00:00 AM'' Certbot Renewal "%SystemDrive%\www\scripts\certbot\Renewal.bat"