Skip to content

Instantly share code, notes, and snippets.

View lyonzy's full-sized avatar

Matt Lyons-Wood lyonzy

  • IBM (opinions my own)
  • Melbourne, Australia
View GitHub Profile
@catchdave
catchdave / replace_synology_ssl_certs.sh
Last active March 31, 2025 06:31
CLI script to programmatically replace SSL certs on Synology NAS
# MOVED to public repo: https://github.com/catchdave/ssl-certs/blob/main/replace_synology_ssl_certs.sh
@mrgarymartin
mrgarymartin / firewall.sh
Created February 23, 2018 20:35
Updated version to whitelist all cloudflare ips in firewalld
#!/usr/bin/env bash
#https://techstat.net/automatic-whitelist-cloudflare-ips-firewalld-bash-script-via-cron-job/
SERVER_IP=xxx.xxx.xxx.xxx
for i in $(curl "https://www.cloudflare.com/ips-v4"); do sudo firewall-cmd --permanent --zone=public --add-rich-rule 'rule family="ipv4" source address="'$i'" port port=80 protocol=tcp accept'; done
for i in $(curl "https://www.cloudflare.com/ips-v4"); do sudo firewall-cmd --permanent --zone=public --add-rich-rule 'rule family="ipv4" source address="'$i'" port port=443 protocol=tcp accept'; done
for i in $(curl "https://www.cloudflare.com/ips-v6"); do sudo firewall-cmd --permanent --zone=public --add-rich-rule 'rule family="ipv6" source address="'$i'" port port=80 protocol=tcp accept'; done
for i in $(curl "https://www.cloudflare.com/ips-v6"); do sudo firewall-cmd --permanent --zone=public --add-rich-rule 'rule family="ipv6" source address="'$i'" port port=443 protocol=tcp accept'; done
@AndrewJDR
AndrewJDR / cfipt.sh
Last active August 10, 2024 23:38
Cloudflare whitelist iptables update cron script
#!/bin/bash
# Based on a template iptables config file, create a new
# iptables file that includes whitelist rules for CloudFlare's
# servers to connect to our HTTP and HTTPS ports. This is useful
# if you want to really lock down your web server so that it only
# communicates with cloudflare's servers, not with the general public.
# It works like this:
# * Get an up-to-date list of CloudFlare's server IPs
# * Read in config template from /etc/sysconfig/iptables.template
# * Output an iptables configuration file /etc/sysconfig/iptables