worker: tlsa bug fixes
All checks were successful
Build Docker / Build Bot (push) Successful in 25s
Build Docker / Build Master (push) Successful in 27s

This commit is contained in:
Nathan Woodburn 2023-08-17 13:48:08 +10:00
parent fccfddca51
commit d50f130b0e
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 8 additions and 8 deletions

View File

@ -38,9 +38,14 @@ def tlsa():
domain = request.args.get('domain') domain = request.args.get('domain')
if domain == None: if domain == None:
return jsonify({'error': 'Invalid domain', 'success': 'false'}) return jsonify({'error': 'Invalid domain', 'success': 'false'})
script = 'bash tlsa.sh ' + domain
# Get output from script tlsa = None
tlsa = os.popen(script).read() try:
tlsa_file = open('wordpress-'+domain+'/tlsa.txt', 'r')
tlsa = tlsa_file.readlines()
tlsa_file.close()
except FileNotFoundError:
return jsonify({'error': 'TLSA record not found', 'success': 'false'})
return jsonify({'domain': domain, 'tlsa': tlsa}) return jsonify({'domain': domain, 'tlsa': tlsa})

View File

@ -9,7 +9,6 @@
# [port offset] is the offset you want to use for the port numbers. # [port offset] is the offset you want to use for the port numbers.
# This is used if you want to run multiple instances of WordPress on the same server. (e.g. 0, 1, 2, 3, etc.) # This is used if you want to run multiple instances of WordPress on the same server. (e.g. 0, 1, 2, 3, etc.)
# Variables # Variables
# Set the domain name # Set the domain name
@ -74,9 +73,6 @@ volumes:
# Start the containers # Start the containers
docker-compose up -d docker-compose up -d
# Create the NGINX
sudo apt install nginx -y
URL="http://localhost:$WORDPRESS_PORT" URL="http://localhost:$WORDPRESS_PORT"
# Setup NGINX config # Setup NGINX config
@ -118,7 +114,6 @@ echo "Add this TLSA Record to your DNS:"
echo -n "3 1 1 " && openssl x509 -in cert.crt -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | xxd -p -u -c 32 echo -n "3 1 1 " && openssl x509 -in cert.crt -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | xxd -p -u -c 32
# Save TLSA to file # Save TLSA to file
echo "Add this TLSA Record to your DNS:" > tlsa.txt
echo -n "3 1 1 " >> tlsa.txt echo -n "3 1 1 " >> tlsa.txt
echo -n "" && openssl x509 -in cert.crt -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | xxd -p -u -c 32 >> tlsa.txt echo -n "" && openssl x509 -in cert.crt -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | xxd -p -u -c 32 >> tlsa.txt