Skip to content

Instantly share code, notes, and snippets.

# nginx-reverse-proxy und Zertifikatsbeschaffer
# in ein Unterverzeichnis "le" legen und dort mit
# docker-compose starten; dann stimmen die erwähnten
# Präfixe aus c't 4/18, S. 88
# aktualisiert 7.2.19 für Compose v3
# (volumes_from nicht mehr unterstützt)
version: '3'
# user defined network für funktionierende Namensauflösung
networks:
ext:
@psct
psct / luftdaten2mqtt.txt
Created May 22, 2019 17:39
luftdaten.info per Node-Red in MQTT schieben
// Verarbeitet die JSON-Daten, die ein Sensor per Web-API abliefert
// und spuckt sie fertig formatiert zur Verarbeitung durch einen
// mqtt-Output-Node wieder aus. Funktioniert für Sensoren, die mit einem
// oder zwei Temperaturfühlern ausgestattet sind.
// Zur Entgegennahme in Node-Red eignet sich ein http-Input-Node, den
// man für die POST-Methode konfiguriert und uploads akzeptieren lässt.
var output_msgs = [];
for ( i= 0; i < 7; i++) {
@psct
psct / ddclient.patch
Created June 18, 2019 14:39
Fügt Debian Stretch ddclient Änderungen aus modernerem ddclient hinzu und ergänzt dynv6.com als Anbieter
--- /usr/sbin/ddclient.stretch 2016-07-02 13:16:57.000000000 +0200
+++ /usr/sbin/ddclient 2019-06-18 16:29:09.370194169 +0200
@@ -1,7 +1,6 @@
#!/usr/bin/perl -w
#!/usr/local/bin/perl -w
######################################################################
-# $Id: ddclient 184 2015-05-28 19:59:34Z wimpunk $
#
# DDCLIENT - a Perl client for updating DynDNS information
#
@psct
psct / wg_raspizero_beispiel
Last active July 3, 2019 16:09
Konfigurationsdateien für WireGuard-Server auf Raspberry Pi Zero
./etc/ddclient/ddclient.conf
protocol=dynv6
use=web,if=wlan0
password='Bwt...C9e'
meinwgv4.dynv6.net
protocol=dynv6
usev6=if,if=wlan0
password='Bwt...C9e'
meinwgv6.dynv6.net
@psct
psct / wg_debian_beispiel
Created July 3, 2019 16:06
Konfigurationsdateien für WireGuard-Server auf Debian
./etc/apt/preferences.d/limit-unstable
Package: *
Pin: release a=unstable
Pin-Priority: 90
./etc/apt/sources.list.d/unstable.list
deb http://deb.debian.org/debian/ unstable main
./etc/ddclient/ddclient.conf
protocol=dynv6
@psct
psct / init.cfg
Created August 15, 2019 20:45
Konfigurationsdatei für darkstat: /etc/darkstat/init.cfg
# Turn this to yes when you have configured the options below.
START_DARKSTAT=yes
# Don't forget to read the man page.
# You must set this option, else darkstat may not listen to
# the interface you want
INTERFACE="-i wg0"
DIR="/var/lib/darkstat"
@psct
psct / wgaddclient.sh
Created August 15, 2019 20:53
Bash-Skriptgerüst zum Anlegen eines WireGuard-Zugangs inkl. hosts-Eintrag, Name und IP-Adressanteil sind als Parameter anzugeben
#!/bin/bash
NAME=$1
IP=$2
[ -e /etc/wireguard/$NAME.key ] && echo "Already present" && exit
DNS="1.1.1.1,2606:4700:4700::1111"
HOST="wg.example.com:12345"
SRVPUB=$(cat /etc/wireguard/private.key | wg pubkey)
@psct
psct / wgstrap.sh
Last active May 27, 2022 06:17
WireGuard-Server per Skript einrichten
#!/bin/bash
# Wireguard auf Debian/Raspbian einrichten,
# nach c't 15/2019, S. 166
# * läuft auf Raspbian oder Debian Netinst (Buster)
# * bitte nur auf frischen Installationen verwenden
# * Skript überschreibt Netzwerkkonfiguration
# * als pi (Raspbian) oder als root/passwortloses sudo (Debian) ausführen
# * schreibt Protokoll nach /var/log/wgstrap.log
# * zweistufiger Prozess, der einen Reboot erfordert
@psct
psct / debansstrap.sh
Created February 26, 2021 16:33
Prepare fresh Debian for ansible management by created user "ansible" in sudoers (needs public ssh-Key in PUBKEY)
#!/bin/bash
# enable host for ansible
set -e
PUBKEY=""
id -u ansible > /dev/null 2>&1 || \
adduser ansible --disabled-password \
--gecos "" --quiet
mkdir -p /home/ansible/.ssh
echo "$PUBKEY" \
> /home/ansible/.ssh/authorized_keys
@psct
psct / myroot.yml
Created February 26, 2021 16:38
Add ssh key for root access and disable PasswordAuthentication
---
- name: add ssh, deploy root key
hosts: all
become: yes
tasks:
- name: disable password authentication
lineinfile:
path: /etc/ssh/sshd_config
regexp: '^PasswordAuthentication'