Last active
November 25, 2024 04:06
-
-
Save jniltinho/7ef1c3e13e5d2789b53a161e21b8ad17 to your computer and use it in GitHub Desktop.
Install PowerDNS Ubuntu
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
#!/bin/bash | |
# | |
# https://www.howtoforge.com/how-to-install-powerdns-on-ubuntu-22-04/ | |
# https://www.cloudwizard.nl/powerdns-part-1-master-server-installation-ubuntu/ | |
# https://github.com/PowerDNS-Admin/PowerDNS-Admin/blob/master/docker-compose.yml | |
# https://github.com/PowerDNS-Admin/PowerDNS-Admin | |
# https://sempreupdate.com.br/linux/tutoriais/como-instalar-o-powerdns-e-o-powerdns-admin-no-ubuntu/ | |
# https://kifarunix.com/install-and-setup-powerdns-admin-on-ubuntu-22-04/ | |
# https://www.reddit.com/r/dns/comments/yzxk12/independent_powerdns_authoritative_and_two/ | |
# https://gist.github.com/maxivak/1daa03229493e22a7263c83dd52af76f (pdns-recursor) | |
apt update | |
apt dist-upgrade | |
apt install -y mariadb-server | |
apt install -y pdns-server pdns-backend-mysql | |
systemctl disable --now systemd-resolved | |
rm -rf /etc/resolv.conf | |
echo "nameserver 8.8.8.8" > /etc/resolv.conf | |
cat <<EOF > /tmp/user_pdns.sql | |
CREATE DATABASE pdns; | |
GRANT ALL ON pdns.* TO pdnsadmin@localhost identified by 'password'; | |
EOF | |
mysql -p < /tmp/user_pdns.sql | |
mysql -u pdnsadmin -p pdns < /usr/share/pdns-backend-mysql/schema/schema.mysql.sql | |
cat <<EOF > /etc/powerdns/pdns.d/pdns.local.gmysql.conf | |
# MySQL Configuration | |
# Launch gmysql backend | |
launch+=gmysql | |
# gmysql parameters | |
gmysql-host=127.0.0.1 | |
gmysql-port=3306 | |
gmysql-dbname=pdns | |
gmysql-user=pdnsadmin | |
gmysql-password=password | |
gmysql-dnssec=yes | |
# gmysql-socket= | |
EOF | |
chmod 640 /etc/powerdns/pdns.d/pdns.local.gmysql.conf | |
chown pdns:pdns /etc/powerdns/pdns.d/pdns.local.gmysql.conf |
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
#version: "3" | |
services: | |
app: | |
image: powerdnsadmin/pda-legacy:latest | |
container_name: powerdns_admin | |
ports: | |
- "9191:80" | |
logging: | |
driver: json-file | |
options: | |
max-size: 50m | |
environment: | |
- SQLALCHEMY_DATABASE_URI=mysql://pda:[email protected]/pda | |
- GUNICORN_TIMEOUT=60 | |
- GUNICORN_WORKERS=2 | |
- GUNICORN_LOGLEVEL=DEBUG |
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
use pdns; | |
SELECT count(*) FROM sessions; | |
DELETE FROM sessions WHERE expiry is NULL; | |
DELETE FROM sessions WHERE expiry > CONVERT_TZ(NOW(), "America/Sao_Paulo", "UTC"); | |
DELETE FROM sessions WHERE expiry > NOW(); | |
DELETE FROM sessions WHERE sessions.expiry < '2024-11-25 00:52:24.908710'; | |
SELECT count(*) FROM sessions; | |
OPTIMIZE TABLE sessions; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment