mirror of
				https://github.com/optim-enterprises-bv/Mailu.git
				synced 2025-10-31 18:18:05 +00:00 
			
		
		
		
	 cb68cb312b
			
		
	
	cb68cb312b
	
	
	
		
			
			This is already generous for certificates that have a 3month validity! We rekey every single time.
		
			
				
	
	
		
			30 lines
		
	
	
		
			630 B
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			630 B
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/python3
 | |
| 
 | |
| import os
 | |
| import time
 | |
| import subprocess
 | |
| 
 | |
| 
 | |
| command = [
 | |
|     "certbot",
 | |
|     "-n", "--agree-tos", # non-interactive
 | |
|     "-d", os.environ["HOSTNAMES"],
 | |
|     "-m", "{}@{}".format(os.environ["POSTMASTER"], os.environ["DOMAIN"]),
 | |
|     "certonly", "--standalone",
 | |
|     "--cert-name", "mailu",
 | |
|     "--preferred-challenges", "http", "--http-01-port", "8008",
 | |
|     "--keep-until-expiring",
 | |
|     "--rsa-key-size", "3072",
 | |
|     "--config-dir", "/certs/letsencrypt",
 | |
|     "--post-hook", "/config.py"
 | |
| ]
 | |
| 
 | |
| # Wait for nginx to start
 | |
| time.sleep(5)
 | |
| 
 | |
| # Run certbot every hour
 | |
| while True:
 | |
|     subprocess.call(command)
 | |
|     time.sleep(3600)
 | |
| 
 |