main: Added tlsa and a few bug fixes
All checks were successful
Build Docker / Build Master (push) Successful in 26s
Build Docker / Build Bot (push) Successful in 25s

This commit is contained in:
2023-08-17 13:27:57 +10:00
parent 1f316e3a94
commit d6db4adf50
6 changed files with 65 additions and 7 deletions

View File

@@ -21,4 +21,4 @@ sudo apt install nginx -y
sudo apt install python3-pip -y
python3 -m pip install -r requirements.txt
cp .env.example .env
chmod +x wp.sh
chmod +x wp.sh tlsa.sh

View File

@@ -24,13 +24,24 @@ def new_site():
sites_file.write(domain + '\n')
sites_file.close()
# Setup site run wp.sh
# Get num sites
os.system('bash wp.sh ' + domain + ' '+ str(count))
# New site in background
new_site(domain,5000+count)
# Return the domain and the number of sites
return jsonify({'domain': domain, 'count': count})
@app.route('/tlsa', methods=['GET'])
def tlsa():
domain = request.args.get('domain')
if domain == None:
return jsonify({'error': 'Invalid domain', 'success': 'false'})
script = 'bash tlsa.sh ' + domain
# Get output from script
tlsa = os.popen(script).read()
return jsonify({'domain': domain, 'tlsa': tlsa})
# Return status
@app.route('/status', methods=['GET'])
def status():
@@ -71,6 +82,10 @@ def site_exists(domain):
return True
else:
return False
async def new_site(domain,port):
script = 'bash wp.sh ' + domain + ' '+ str(port)
os.system(script)
# Start the server
if __name__ == '__main__':

11
worker/tlsa.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
domain=$1
# Check if args passed
if [ -z "$1" ]
then
echo "No domain name supplied"
exit 1
fi
echo -n "3 1 1 " && openssl x509 -in /etc/ssl/$domain.crt -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | xxd -p -u -c 32