forked from putsi/privatecollaborator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,41 @@ | ||
#!/bin/bash | ||
|
||
# Zonefile must be used because certbot tries to start multiple DNS-resolvers for wildcards. | ||
echo "_acme-challenge.$CERTBOT_DOMAIN. 10 IN TXT \"$CERTBOT_VALIDATION\"" >> /tmp/collab.zonefile | ||
MYPRIVATEIP=$1 | ||
MYPUBLICIP=$(curl -s http://checkip.amazonaws.com/) | ||
|
||
# Ensure CERTBOT_DOMAIN and CERTBOT_VALIDATION are set | ||
if [[ -z "$CERTBOT_DOMAIN" || -z "$CERTBOT_VALIDATION" ]]; then | ||
echo "CERTBOT_DOMAIN and CERTBOT_VALIDATION must be set" | ||
exit 1 | ||
fi | ||
|
||
# Create the DNS zone file | ||
cat <<EOF > /tmp/collab.zonefile | ||
\$TTL 10 | ||
@ IN SOA ns1.$CERTBOT_DOMAIN. hostmaster.$CERTBOT_DOMAIN. ( | ||
2024062501 ; serial | ||
3600 ; refresh (1 hour) | ||
1800 ; retry (30 minutes) | ||
1209600 ; expire (2 weeks) | ||
3600 ; minimum (1 hour) | ||
) | ||
@ IN NS ns1.$CERTBOT_DOMAIN. | ||
@ IN A $MYPUBLICIP | ||
_acme-challenge.$CERTBOT_DOMAIN. 10 IN TXT "$CERTBOT_VALIDATION" | ||
$CERTBOT_DOMAIN. 10 IN CAA 0 issue "letsencrypt.org" | ||
EOF | ||
|
||
# Kill any existing dnslib.fixedresolver processes | ||
pkill -f dnslib.fixedresolver &>/dev/null | ||
|
||
# Echo burp service status for CERTBOT_AUTH_OUTPUT so that cleanup can start Burp service if it was started before. | ||
echo "$(systemctl show -p ActiveState --value burpcollaborator)" | ||
service burpcollaborator stop &>/dev/null | ||
|
||
python3 -m dnslib.fixedresolver -a $1 --zonefile /tmp/collab.zonefile &>/dev/null &disown | ||
python3 -m dnslib.fixedresolver -a $MYPRIVATEIP --zonefile /tmp/collab.zonefile &>/dev/null & | ||
|
||
# Sleep to avoid DNS propagation issues. | ||
sleep 15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters