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
Jarmo Puttonen
committed
Jan 10, 2020
1 parent
aea4f1b
commit 16f35e0
Showing
3 changed files
with
40 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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
# Yeah, my bash scripting skills suck. | ||
|
||
# Use public IP in case not running on AWS or Digitalocean. | ||
MYPRIVATEIP=$(curl http://checkip.amazonaws.com/ -s) | ||
|
||
# Get private IP if running on AWS. | ||
curl http://169.254.169.254/latest -s --output /dev/null -f -m 1 | ||
if [ 0 -eq $? ]; then | ||
MYPRIVATEIP=$(curl http://169.254.169.254/latest/meta-data/local-ipv4 -s) | ||
fi; | ||
|
||
# Get private IP if running on Digitalocean. | ||
curl http://169.254.169.254/metadata/v1/id -s --output /dev/null -f -m1 | ||
if [ 0 -eq $? ]; then | ||
# Use Floating IP if the VM has it enabled. | ||
FLOATING=$(curl http://169.254.169.254/metadata/v1/floating_ip/ipv4/active -s) | ||
if [ "$FLOATING" == "true" ]; then | ||
MYPRIVATEIP=$(curl http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address -s) | ||
fi | ||
if [ "$FLOATING" == "false" ]; then | ||
MYPRIVATEIP=$(curl http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address -s) | ||
fi | ||
fi; | ||
|
||
# Only stop&start burp collaborator if it's already running. | ||
systemctl is-active --quiet burpcollaborator | ||
[ $? -eq "0" ] && \ | ||
/usr/local/collaborator/certbot-auto renew --manual-auth-hook "./dnshook.sh $MYPRIVATEIP" --manual-cleanup-hook ./cleanup.sh \ | ||
--server https://acme-v02.api.letsencrypt.org/directory \ | ||
--pre-hook "service burpcollaborator stop;service dnsmitm stop" --post-hook "service burpcollaborator start;service dnsmitm start" \ | ||
--manual --agree-tos --no-eff-email --manual-public-ip-logging-ok --preferred-challenges dns-01 \ | ||
||/usr/local/collaborator/certbot-auto renew --manual-auth-hook "./dnshook.sh $MYPRIVATEIP" --manual-cleanup-hook ./cleanup.sh \ | ||
--server https://acme-v02.api.letsencrypt.org/directory \ | ||
--manual --agree-tos --no-eff-email --manual-public-ip-logging-ok --preferred-challenges dns-01 | ||
|
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