main: Added tlsa and a few bug fixes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
11
worker/tlsa.sh
Normal 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
|
||||
Reference in New Issue
Block a user