Fixes in apache

This commit is contained in:
Antonio de la Rosa 2024-09-05 23:23:57 +02:00
parent d9303437a9
commit 8231aa715c
2 changed files with 27 additions and 4 deletions

View file

@ -131,7 +131,11 @@ if linux_distro=='rocky' or linux_distro=='almalinux' or linux_distro=='fedora':
# Copy file
linux.shell_command('sudo cp modules/apache/scripts/check_mod_md.py /usr/local/bin && sudo chmod 755 /usr/local/bin/check_mod_md.py')
#linux.shell_command('sudo cp modules/apache/scripts/check_mod_md.py /usr/local/bin && sudo chmod 755 /usr/local/bin/check_mod_md.py')
# echo "0 0,12 * * * root /opt/certbot/bin/python -c 'import random; import time; time.sleep(random.random() * 3600)' && sudo certbot renew -q" | sudo tee -a /etc/cron.d/certbot > /dev/null
#linux.shell_command('echo "* * * * * root python /usr/local/bin/check_mod_md.py" | sudo tee -a /etc/cron.d/mod_md > /dev/null')
#Restart apache

View file

@ -181,7 +181,7 @@ def manage():
SSLEngine on
"""
"""
vhost_ssl=vhost_ssl.replace('$port', args.ssl_port)
vhost_ssl=vhost_ssl.replace('$ip', args.ip)
vhost_ssl=vhost_ssl.replace('$email', args.email)
@ -218,8 +218,8 @@ def manage():
json_return={'error':0, 'status': 0, 'progress': 100, 'no_progress':0, 'message': 'Creating SSL Cert with Letsencrypt using mod_md...'}
print(json.dumps(json_return))
"""
ssl_debug=''
if debug:
@ -292,7 +292,7 @@ def manage():
vhost+="\n\n"+vhost_ssl
pass
"""
if type_ssl==2:
vhost_ssl=vhost_ssl.replace('$port', args.ssl_port)
vhost_ssl=vhost_ssl.replace('$ip', args.ip)
@ -589,6 +589,25 @@ def manage():
print(json.dumps(json_return))
#time.sleep(1)
# Delete certbot certificate if exists
#sudo /opt/certbot/bin/certbot delete --cert-name server1.yotex.net -n
if call("sudo /opt/certbot/bin/certbot delete --cert-name {} -n".format(args.domain), shell=True) > 0:
json_return['error']=0
json_return['status']=0
json_return['progress']=100
json_return['message']='I cannot delete the certificate, please, if exists, clean manually'
print(json.dumps(json_return))
else:
json_return['error']=0
json_return['status']=0
json_return['progress']=100
json_return['message']='Cleaning certbot ssl certificate for the domain'
print(json.dumps(json_return))
# Delete root_dir if exists
# Change effective uid