Skip to content

Instantly share code, notes, and snippets.

View ergoz's full-sized avatar
😈
let's rock

Sergey Morozov ergoz

😈
let's rock
View GitHub Profile
malwareips=newNMG()
malwareips:addMasks(dofile("blacklist.ip"))
function postresolve(dq)
-- print("postresolve called for ",dq.qname:toString())
local records = dq:getRecords()
local changed = false
for k,v in pairs(records) do
if v.type == pdns.A or v.type == pdns.AAAA
then
googleset = newDS()
-- https://www.google.com/supported_domains
-- (echo 'return{' ; for a in $(curl https://www.google.com/supported_domains | sed s/^\\.//) ; do echo \"$a\",; done ; echo '}') > googledomains.lua
googleset:add(dofile("googledomains.lua"))
function handleSafeSearch(dq)
if(googleset:check(dq.qname)) then
@ergoz
ergoz / lua.md
Created July 18, 2024 17:53 — forked from ahupowerdns/lua.md
The LUA record type for Lua-powered DNS records

LUA Record Type for Lua-powered DNS records for standards based fail-over and geographical load balancing

GitHub branch -> https://github.com/ahupowerdns/pdns/tree/luarec

Recently, many zone owners could not migrate away from Dyn since they were benefiting from non-standardised DNS-based failover and geographical loadbalancing features. What you see below is an attempt to get standards based but flexible equivalents of these currently proprietary features. Here is a zone:

$TTL 60
lua.br. IN      SOA     a.lua.br. nstld.verisign-grs.com. (
        2016032300      ; Serial
        14400           ; Refresh
$ORIGIN .
v6.powerdns.org 3600 IN NS lua-ns-v6.powerdns.org.
v6.powerdns.org 3600 IN SOA lua-ns-v6.powerdns.org hostmaster.v6.powerdns.org 1 10800 3600 604800 3600
whoami-ecs.v6.powerdns.org 60 IN LUA TXT "'ip: '..who:toString()..', netmask: '..(ecswho and ecswho:toString() or 'no ECS')"
whoami-port.v6.powerdns.org 60 IN LUA TXT "who:toStringWithPort()"
whoami.v6.powerdns.org 60 IN LUA AAAA "who:toString()"
whoami.v6.powerdns.org 60 IN LUA TXT "who:toString()"
;;;;;;;;;;;;;;
@ergoz
ergoz / simple-adblock-powerdns.md
Created July 18, 2024 17:47 — forked from ahupowerdns/simple-adblock-powerdns.md
How to do really simple adblocking with the PowerDNS Recursor 4.x

First, clone the Mozilla focus project and make it fetch its list:

$ git clone https://github.com/mozilla/focus.git
$ cd focus
$ ./checkout.sh
$ cd Lists

This delivers several JSON formatted files, of which we are going to use disconnect-advertising.json. We'll filter out the good bits using jq, and create a Lua representation:

(
#!/bin/bash
# Removes the "You do not have a valid subscription for this server" popup message while logging in
# https://johnscs.com/remove-proxmox51-subscription-notice/
#
# Manual steps:
# cd /usr/share/javascript/proxmox-widget-toolkit
# cp proxmoxlib.js proxmoxlib.js.bak
# nano proxmoxlib.js
# search for "function(orig_cmd) {" and add "orig_cmd();" and "return;" just after it
# systemctl restart pveproxy.service
@ergoz
ergoz / reset-proxmox-cluster.sh
Created July 15, 2024 19:09 — forked from nderjung/reset-proxmox-cluster.sh
Reset proxmox cluster
#/bin/bash -xe
systemctl stop pvestatd.service
systemctl stop pvedaemon.service
systemctl stop pve-cluster.service
systemctl stop corosync
systemctl stop pve-cluster
sqlite3 /var/lib/pve-cluster/config.db "delete from tree where name = 'corosync.conf';"
@ergoz
ergoz / .zshrc
Created July 4, 2024 15:41 — forked from fcaldera/.zshrc
zsh configuration with zplug
export ZPLUG_HOME=/usr/local/opt/zplug
# Essential
source $ZPLUG_HOME/init.zsh
# Async for zsh, used by pure
zplug "mafredri/zsh-async", from:github, defer:0
# oh-my-zsh
zplug "lib/completion", from:oh-my-zsh
blueprint:
name: Notifications & Announcements
description: >
# 📢 Notifications & Announcements
**Version: 1.0**
State your trigger and spread the word 💬 🔉
@ergoz
ergoz / renew_ssl_cert.yaml
Created June 17, 2024 16:56 — forked from TJ-developer/renew_ssl_cert.yaml
Homeassistant Blueprint for SSL-Certificate renewal
blueprint:
name: Renew Let's Encrypt Certificate
description: Renew Certificate when due date is below given value
domain: automation
input:
cert_expiry_sensor:
name: Certificate Expiry Sensor
description: Sensor from the Certificate Expiry Integration (https://www.home-assistant.io/integrations/cert_expiry)
selector:
entity: