Skip to content

Instantly share code, notes, and snippets.

View alainwolf's full-sized avatar

Alain Wolf alainwolf

View GitHub Profile
@alainwolf
alainwolf / ssh_config
Last active December 19, 2023 22:35
Make SSH use my IPv4 jump host only if the target host is unreachable by IPv6
# /etc/ssh/ssh_config
#
# All my hosts are reachable by IPv6 only. IPv6 addresses don't get spammed with SSH login probes.
# But what if I need to connect from a network which has no IPv6 enabled?
# Setup an SSH jump host which is reachable over IPv4 and use that only if the target host is unreachable by IPv6
#
Match host *.example.net,!ipv4.example.net !exec "ip route get $(host %h | grep 'IPv6 address' | awk '{print $NF}') &> /dev/null"
ProxyJump ipv4.example.net
@alainwolf
alainwolf / ip-blocklist-update
Last active July 25, 2024 17:11
AbuseDBIP on Turris Omnia and Opeenwrt
#!/usr/bin/env ash
# shellcheck shell=dash
# ---------------------------------------------------------------------------
#
# Download and update ip blacklist
# for Turris Omnia 7.x or earlier or Openwrt before 22.03 (fw3/iptables)
# See
# - https://www.abuseipdb.com/
# - https://github.com/borestad/blocklist-abuseipdb
#
@alainwolf
alainwolf / sshd_config
Created August 16, 2024 18:09
SSH Server Configuration for Jump Hosts
# ************************************************************************
# SSH Server Configuration for a router be used as SSH jump host
# OpenSSH_9.8p1, OpenSSL 1.1.1w 11 Sep 2023
# ************************************************************************
#
# Updated on Fri, 16. Aug 2024 19:37 by Alain Wolf
#
Include /etc/ssh/sshd_config.d/*.conf
@alainwolf
alainwolf / random_cron
Last active December 24, 2024 17:51
Create crontab lines with scheduled random times
#!/usr/bin/env bash
# ****************************************************************************
# Create radom cron job starting times
# for hourly, daily, weekly, monthly or yearly jobs
#
# https://gist.github.com/alainwolf/931316e4f5af0c45b352a1823ec3321c
# Copyright (C) 2024 Alain Wolf
# ****************************************************************************
# What kind of shedule do you want to create?
@alainwolf
alainwolf / librespeed-cli.sh
Created April 1, 2025 16:01
Override of the default `librespeed` cron job command as provided by Turris Omnia
#!/usr/bin/env bash
# *****************************************************************************
# Override of the default `librespeed` cron job command as provided by
# Turris Omnia
# See https://forum.turris.cz/t/turris-os-7-1-4-is-out/21639/12?u=milkandhoney
#
# Required packages: coreutils-date, jq
# opkg update && opkg install coreutils-date jq
#
# *****************************************************************************
@alainwolf
alainwolf / crossref.py
Last active April 9, 2025 11:13
cross-references IP addresses from a text file with a CSV file
# This script cross-references IP addresses from a text file with a CSV file
# and outputs the matched IPs to stdout.
# Its purpose was to find IPs from UptimeRobot that are in the Turris greylist.
import csv
import requests
# File URLs
uptimerobot_ips_url = "https://uptimerobot.com/inc/files/ips/IPv4andIPv6.txt"
turris_greylist_url = "https://view.sentinel.turris.cz/greylist-data/greylist-latest.csv"
@alainwolf
alainwolf / README.md
Last active April 12, 2025 17:37
Nextcloud 31 Database Upgrades

Nextcloud 31 Database Upgrades

After upgrading from Nextcloud 30.x to 31.x I get the following warning in the admin interface:

Incorrect row format found in your database. ROW_FORMAT=Dynamic offers the best database performances for Nextcloud. Please update row format on the following list: oc_collres_collections, oc_phonetrack_geofences, oc_storages, ...

For more details see the documentation↗.