Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# This script backs up files using restic and sends emails on success or errors.
#
# Files that the script expects:
# /usr/local/etc/restic/repo.env: shell variables that define the restic repository
# /usr/local/etc/restic/include.txt: paths to back up
# /usr/local/etc/restic/exclude.txt: paths to not include in the backup, even if they are in include.txt
#
# Inspired by https://gist.github.com/perfecto25/18abbd6cfbaa4e9eb30251470e9b7504
@ruanbekker
ruanbekker / promtail_docker_logs.md
Last active May 31, 2024 23:52
Docker Container Logging using Promtail
@drmalex07
drmalex07 / README-fail2ban-openvpn.md
Created March 3, 2019 13:34
Block unauthorized requests to OpenVPN using fail2ban. #openvpn #fail2ban

Block unauthorized requests to OpenVPN using fail2ban.

The following is based on https://stefan.angrick.me/block-unauthorized-openvpn-logins-using-fail2ban.

1. Create filter confifuration

Add a filter configuration under /etc/fail2ban/filter.d/openvpn.conf. The contents would be something like (regular expressions may need adjustments):

[INCLUDES]
before = common.conf
@velizarn
velizarn / ip6tables_setup.bash
Last active May 24, 2024 09:19
Basic setup for ip6tables - drop all traffic except local, ICMP and DHCPv6 traffic.
#!/bin/bash
# http://serverfault.com/questions/410321/debian-ip6tables-rules-setup-for-ipv6/410327#410327
# http://ipset.netfilter.org/iptables.man.html
# https://www.sixxs.net/wiki/IPv6_Firewalling
# https://www.cyberciti.biz/faq/ip6tables-ipv6-firewall-for-linux/
# https://gist.github.com/thomasfr/9712418
# https://gist.github.com/SnakeDrak/f4150f6e517e5a1d525f
# http://www.thegeekstuff.com/2011/06/iptables-rules-examples
# http://www.thegeekstuff.com/scripts/iptables-rules
@dunkelstern
dunkelstern / rc.local
Created August 7, 2016 19:14
iptables rules for vpn config
# for ISAKMP (handling of security associations)
iptables -A INPUT -p udp --dport 500 --j ACCEPT
# for NAT-T (handling of IPsec between natted devices)
iptables -A INPUT -p udp --dport 4500 --j ACCEPT
# for ESP payload (the encrypted data packets)
iptables -A INPUT -p esp -j ACCEPT
# for the routing of packets on the server
iptables -t nat -A POSTROUTING -j SNAT --to-source %IP% -o eth0
# internet access
iptables -t nat -A POSTROUTING -s 10.0.42.0/24 -o eth0 -m policy --dir out --pol ipsec -j ACCEPT