Skip to content

Instantly share code, notes, and snippets.

@QueuingKoala
QueuingKoala / v22.03-dnsmasq-addnmount.patch
Created January 18, 2023 03:28
Interim patch for OpenWRT dnsmasq addnmount v22.03 backport
diff --git a/dhcp.conf b/dhcp.conf
index 8c42ef782e..87fe45a7e0 100644
--- a/dhcp.conf
+++ b/dhcp.conf
@@ -21,6 +21,7 @@ config dnsmasq
#list bogusnxdomain '64.94.110.11'
option localservice 1 # disable to allow DNS requests from non-local subnets
option ednspacket_max 1232
+ #list addnmount /some/path # read-only mount path to expose it to dnsmasq
@QueuingKoala
QueuingKoala / bogon-updater
Last active January 6, 2020 23:45
OpenWRT bogon-updater called from cron or on-boot
#!/bin/sh
# Designed for OpenWRT and requires associated "bogons" UCI file.
#
# This is still pretty raw now and not formally published.
# Copyright 2018.
#
# Feel free to use, edit, and re-distribute under the BSD 3-clause License.
# https://opensource.org/licenses/BSD-3-Clause
@QueuingKoala
QueuingKoala / v4-features.sh
Created December 29, 2014 05:49
Netfilter rules by feature script
#!/bin/sh
# Extremely-basic Netfilter conditional rule loading example.
# This uses a pipeline to iptables-restore(8) for atomic loading.
# In particular, only the filter table is adjusted.
# Available under the BSD 3-clause license in the hopes this may be a useful
# example or template.
# http://opensource.org/licenses/BSD-3-Clause
@QueuingKoala
QueuingKoala / setup.sh
Last active May 16, 2024 09:32
Sub-CA example
# Assumptions: easyrsa3 available in current dir, and functional openssl.
# This basic example puts the "offline" and "sub" PKI dirs on the same system.
# A real-world setup would use different systems and transport the public components.
# Build root CA:
EASYRSA_PKI=offline ./easyrsa init-pki
EASYRSA_PKI=offline ./easyrsa build-ca nopass
# Build sub-CA request:
EASYRSA_PKI=sub ./easyrsa init-pki
#!/bin/sh
# This code available under a BSD 3-clause license
# http://opensource.org/licenses/BSD-3-Clause
# argument processing. Pass one of these to effect changes:
while [ -n "$1" ]
do
case "$1" in
@QueuingKoala
QueuingKoala / dns-soa-mon.sh
Created November 8, 2013 23:27
SOA Update Monitor
#!/bin/sh
usage() {
printf "%s\n" "
$0 Usage:
Mandatory params:
--serial=X set SOA serial to watch for
--nameserver=NS set nameserver to query
@QueuingKoala
QueuingKoala / nf-reset.sh.HAS.MOVED
Last active December 21, 2015 18:49
Reset netfilter the less-abusive way
This document is now part of my netfilter-samples git project.
See the project component for resetting netfilter rules by sciprt here:
https://github.com/QueuingKoala/netfilter-samples/tree/master/reset-rules
@QueuingKoala
QueuingKoala / ovpn-man2html.awk
Last active December 19, 2015 16:48
awk script to clean up openvpn.8 man2html output
# awk script for converting man2html openvpn output
{
# Matching lines means we skip this many
if ( match($0, "^Content-type: ") ) skip=2
if ( match($0, "Return to Main Contents") ) skip=1
# Rip out the "Updated" date as it's wrong:
if ( match($0, "^Section: ") )
sub("Updated: .*<BR>", "")
@QueuingKoala
QueuingKoala / gist:5911334
Last active December 19, 2015 06:28
A fairly basic netfilter edge router ruleset
# A fairly basic and somewhat extensible router core ruleset
# Do not use unless you understand this example as
# modification for your usage may be required.
# Assumptions:
# * 192.168.7.0/24 is your LAN, connected to if_lan
# * if_wan is your uplink, with a dynamic public IP
# Note: in particular, no local ports are opened, including ssh.
# Add whatever remote-access you need to prevent lockouts if this
# is not a console-accessible box. You have been warned.
@QueuingKoala
QueuingKoala / gist:5867909
Last active December 19, 2015 00:19
Simple example of piping a dynamically-generated fw ruleset into iptables-restore
cat <<-EOF | iptables-restore
*nat
:PREROUTING ACCEPT
:INPUT ACCEPT
:OUTPUT ACCEPT
:POSTROUTING ACCEPT
-A POSTROUTING -o $WAN_IFACE_HERE -j MASQUERADE
COMMIT
*filter
:INPUT DROP