Skip to content

Instantly share code, notes, and snippets.

@Ne00n
Last active October 16, 2023 18:21
Show Gist options
  • Save Ne00n/5c58308988d2a474ab0df8ae2ebea635 to your computer and use it in GitHub Desktop.
Save Ne00n/5c58308988d2a474ab0df8ae2ebea635 to your computer and use it in GitHub Desktop.
haproxy-protection basedflare
cd /root
apt-get install git pgp lua5.3 liblua5.3-dev argon2 libargon2-dev luarocks -y
sudo git config --global url."https://".insteadOf git:// #don't ask.
sudo luarocks install argon2
git clone https://gitgud.io/fatchan/haproxy-protection.git
curl https://haproxy.debian.net/bernat.debian.org.gpg \
| gpg --dearmor > /usr/share/keyrings/haproxy.debian.net.gpg
echo deb "[signed-by=/usr/share/keyrings/haproxy.debian.net.gpg]" \
http://haproxy.debian.net bookworm-backports-2.8 main \
> /etc/apt/sources.list.d/haproxy.list
echo deb "[signed-by=/usr/share/keyrings/haproxy.debian.net.gpg]" \
http://haproxy.debian.net bullseye-backports-2.8 main \
> /etc/apt/sources.list.d/haproxy.list
apt-get update
apt-get install -y haproxy=2.8.\*
cp haproxy-protection/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg
#you will have to change host: 0.0.0.0 and remove haproxy_bin: /usr/local/sbin/haproxy
cp haproxy-protection/haproxy/dataplaneapi.yml /etc/haproxy/dataplaneapi.yml
cp -r haproxy-protection/src/lua/scripts/ /etc/haproxy/scripts
cp -r haproxy-protection/src/lua/libs/ /etc/haproxy/libs
cp -r haproxy-protection/haproxy/template/ /etc/haproxy/template
cp -r haproxy-protection/src/js/ /etc/haproxy/js
cp -r haproxy-protection/haproxy/map/ /etc/haproxy/map
cp -r haproxy-protection/haproxy/errors/* /etc/haproxy/errors
cp -r haproxy-protection/src/locales/ /etc/haproxy/
cat <<EOT >> /etc/default/haproxy
HCAPTCHA_SITEKEY=20000000-ffff-ffff-ffff-000000000002
HCAPTCHA_SECRET=0x0000000000000000000000000000000000000000
#- RECAPTCHA_SECRET=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
#- RECAPTCHA_SITEKEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
CAPTCHA_COOKIE_SECRET=changeme
POW_COOKIE_SECRET=changeme
HMAC_COOKIE_SECRET=changeme
RAY_ID=test
CHALLENGE_EXPIRY=43200
BACKEND_NAME=servers
SERVER_PREFIX=websrv
CHALLENGE_INCLUDES_IP=true
ARGON_TIME=2
ARGON_KB=512
POW_DIFFICULTY=20
POW_TYPE=argon2
TOR_CONTROL_PORT_PASSWORD=changeme
EOT
wget https://github.com/haproxytech/dataplaneapi/releases/download/v2.8.1/dataplaneapi_2.8.1_linux_amd64.deb
dpkg -i dataplaneapi_2.8.1_linux_amd64.deb
systemctl restart haproxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment