Flensburg:Gateway-Liste
Hier den unformatierten Text eingeben== Gateways ==
| Hostname | IPv4 (WAN) | IPv6 (WAN) | IPv4 (LAN) | IPv6 (LAN) | MAC (mesh vpn) | DHCP-Range(GW/DNS) | Links | Kommentar | Verantwortliche(r) |
|---|---|---|---|---|---|---|---|---|---|
| snowden.mesh.freifunk-flensburg.de | 10.129.1.1 | fddf:bf7:10:1:1::1 | 9E:99:81:75:B5:61 | 10.129.5.1 - .20.254 | Keine Services | ||||
| gw02.mesh.freifunk-flensburg.de | 10.129.1.2 | fddf:bf7:10:1:1::2 | 9E:99:81:75:B5:62 | 10.129.21.1 - .40.254 | Keine Services | ||||
| nerdisch.ent | 152.228.240.18 | 2001:41d0:305:2100::1:8745 | 10.129.1.3 | fddf:bf7:10:1:1::3 | 00:00:ff:f1:01:03 | 10.129.41.1 - .60.254 | Stats | OVH FR Debian 13 | Nymphadora |
Systemanforderungen
CPU: Mindestens 2 Kerne mit guter Single-Thread-Leistung RAM: Mindestens 512 MB Speicher: Mindestens 10 GB Datenverkehr: Mindestens 5 TB monatlich (gerne auch unlimitiert) Virtualisierung: Kernel-Anpassungen müssen möglich sein (kein OpenVZ) Netzwerk: Mindestens 100 Mbit/s empfohlen VPN: VPN-Anbieter zur Weiterleitung und verschleirung des Netzwerkverkehrs empfohlen
Beispiel Hoster
| Anbieter | Bandbreite) | Traffic) | Standort) | IPv4) | IPv6) | Kosten) | Bemerkung) |
|---|---|---|---|---|---|---|---|
| OVH VPS | 500 Mbit/s öffentliche Bandbreite) | flat | Frankreich | JA | JA | netplan | |
| webtropia VPS | 1GBit (200 Mbit/s garantierte Peak-Bandbreite) | 40 TB Traffic bei VPS | Düsseldorf | JA | JA | netplan |
Eine detaillierte Liste findest du hier: pinneberg
SSH key einrichten
ssh key erstellen
ssh-keygen -t ed25519
ssh key auf den Server übertragen
ssh-copy-id benutzer@ip_adresse
mit den server verbinden
ssh benutzer@IP-Adresse
User erstellen (falls notwendig)
adduser user
ssh absichern
nano /etc/ssh/sshd_config
# ========================================== # SSH-Härtung für das Freifunk-Gateway # ========================================== # ------------------------------------------ # Netzwerk und Zugriffskontrolle # ------------------------------------------ # SSH-Port ändern zum Beispiel 3022 Port 3022 # IPv4 und IPv6 erlauben AddressFamily any # Direkten Root-Login verbieten PermitRootLogin no # Nur diesen Benutzer für SSH zulassen # WICHTIG: Benutzernamen ersetzen! AllowUsers dein_username # Maximal 3 Authentifizierungsversuche MaxAuthTries 3 # Login-Zeitfenster auf 30 Sekunden begrenzen LoginGraceTime 30 # Maximal 2 Sitzungen pro SSH-Verbindung MaxSessions 2 # Unauthentifizierte Verbindungen begrenzen MaxStartups 3:30:10 # ------------------------------------------ # Authentifizierung # ------------------------------------------ # Public-Key-Authentifizierung aktivieren PubkeyAuthentication yes # Passwort-Authentifizierung deaktivieren PasswordAuthentication no # Interaktive Authentifizierung deaktivieren KbdInteractiveAuthentication no # Ausschließlich Public-Key-Authentifizierung verlangen AuthenticationMethods publickey # Anmeldung mit leeren Passwörtern verbieten PermitEmptyPasswords no # ------------------------------------------ # SSH-Schlüssel # ------------------------------------------ # Nur die reguläre Schlüsseldatei verwenden AuthorizedKeysFile .ssh/authorized_keys # ------------------------------------------ # Weiterleitungen und Tunnel # ------------------------------------------ # SSH-Agent-Weiterleitung deaktivieren AllowAgentForwarding no # TCP-Port-Weiterleitungen deaktivieren AllowTcpForwarding no # X11-Weiterleitung deaktivieren X11Forwarding no # SSH-TUN/TAP-Tunnel deaktivieren PermitTunnel no # Benutzerdefinierte Umgebungsvariablen verbieten PermitUserEnvironment no # ------------------------------------------ # Sicherheitsprüfung und Protokollierung # ------------------------------------------ # Rechte und Eigentümer der SSH-Dateien prüfen StrictModes yes # Authentifizierungsereignisse detaillierter protokollieren LogLevel VERBOSE
Server aktualisieren
apt update && apt upgrade
Fail2ban Installieren und Konfiguration
apt install fail2ban python3-systemd
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
nano /etc/fail2ban/jail.local
[…] (Fail2Ban Multiplikator)
[DEFAULT] # # MISCELLANEOUS OPTIONS # # "bantime.increment" allows to use database for searching of previously banned ip's to increase a # default ban time using special formula, default it is banTime * 1, 2, 4, 8, 16, 32... DIESER WERT MUSS TRUE SEIN #bantime.increment = true # "bantime.rndtime" is the max number of seconds using for mixing with random time # to prevent "clever" botnets calculate exact time IP can be unbanned again: DIESER WERT auf 10m setzen bantime.rndtime = 10m # "bantime.maxtime" is the max number of seconds using the ban time can reach (doesn't grow further) DIESER WERT AUF 7d setzen bantime.maxtime = 7d # "bantime.factor" is a coefficient to calculate exponent growing of the formula or common multiplier, # default value of factor is 1 and with default value of formula, the ban time # grows by 1, 2, 4, 8, 16 ... DIESER WERT auf 1 setzen bantime.factor = 1 # "bantime.formula" used by default to calculate next value of ban time, default value below, # the same ban time growing will be reached by multipliers 1, 2, 4, 8, 16, 32... #bantime.formula = ban.Time * (1<<(ban.Count if ban.Count<20 else 20)) * banFactor # # more aggressive example of formula has the same values only for factor "2.0 / 2.885385" : #bantime.formula = ban.Time * math.exp(float(ban.Count+1)*banFactor)/math.exp(1*banFactor) # "bantime.multipliers" used to calculate next value of ban time instead of formula, corresponding # previously ban count and given "bantime.factor" (for multipliers default is 1); # following example grows ban time by 1, 2, 4, 8, 16 ... and if last ban count greater as multipliers count, # always used last multiplier (64 in example), for factor '1' and original ban time 600 - 10.6 hours #bantime.multipliers = 1 2 4 8 16 32 64 # following example can be used for small initial ban time (bantime=60) - it grows more aggressive at begin, # for bantime=60 the multipliers are minutes and equal: 1 min, 5 min, 30 min, 1 hour, 5 hour, 12 hour, 1 day, 2 day #bantime.multipliers = 1 5 30 60 300 720 1440 2880 # "bantime.overalljails" (if true) specifies the search of IP in the database will be executed # cross over all jails, if false (default), only current jail of the ban IP will be searched DIESER WERT MUSS TRUE SEIN bantime.overalljails = true
[…] IP-Sperren und Schutzparameter
# "ignoreself" specifies whether the local resp. own IP addresses should be ignored # (default is true). Fail2ban will not ban a host which matches such addresses. #ignoreself = true # "ignoreip" can be a list of IP addresses, CIDR masks or DNS hosts. Fail2ban # will not ban a host which matches an address in this list. Several addresses # can be defined using space (and/or comma) separator. ignoreip = 127.0.0.1/8 ::1 # External command that will take an tagged arguments to ignore, e.g. <ip>, # and return true if the IP is to be ignored. False otherwise. # # ignorecommand = /path/to/command <ip> ignorecommand = # "bantime" is the number of seconds that a host is banned. # 3600 = 1 Stunde bantime = 3600 # A host is banned if it has generated "maxretry" during the last "findtime" # seconds. findtime = 600 # "maxretry" is the number of failures before a host get banned. maxretry = 3 # Wenn es sich hierbei ein systemd System handelt muss dies umgestellt werden. backend = systemd
[…] (SSH-Login absichern:')
# # SSH servers # [sshd] enabled = true # Hier muss derselbe Port eingetragen werden, der in der SSH-Konfiguration steht. port = 3022 filter = sshd #logpath = /var/log/auth.log maxretry = 4 findtime = 1d bantime = 20160 ignoreip = 127.0.0.1/8
Fail2ban SSH Filter für Public Key
nano /etc/fail2ban/filter.d/sshd.conf
Unter dem Punkt „cmnfailre“ muss folgendes hinzugefügt werden:
^%(__prefix_line)sConnection closed by authenticating user <F-USER>.+</F-USER> <HOST> port \d+ \[preauth\]$
[…] (SSH-Filtermodus auf „aggressive“ setzen)
# Parameter "mode": normal (default), ddos, extra or aggressive (combines all) # Usage example (for jail.local): # [sshd] # mode = extra # # or another jail (rewrite filter parameters of jail): # [sshd-aggressive] # filter = sshd[mode=aggressive] # DIESER MUSS VON ,,normal" auf aggressive gestellt werden. mode = normal
Fail2ban muss neu gestartet werden
systemctl restart fail2ban.service
Software installieren
Wir haben uns an die Beschreibungen und Tipps von anderen gehalten und es ist empfohlen, die folgenden Pakete zu installieren:
^ Paket ^ Beschreibung | sudo | Ausführung von Befehlen mit Root-Rechten | | bridge-utils | Verwaltung von Netzwerkbrücken | | batctl | B.A.T.M.A.N. Verwaltungstools | | wireguard | VPN für Verbindung zur Anonymisierung | | haveged | Entropie | | fastd | VPN für Verbindung zu den Knoten | | radvd | IPv6 Router Advertisements | | isc-dhcp-server | DHCP Server | | bind9 | DNS Server | | git | Versionsverwaltungssystem | | alfred | A.L.F.R.E.D. Datenübertragung | | alfred-json | A.L.F.R.E.D. Datenausgabe | | batman-adv-dkms | Batman-Kernelmodul in Version 2016.01 V5 | | ntpsec | Zeitsynchronisation | | curl | Linux Tool | | screen | Terminal-Multiplexer | | htop | Prozessmonitor | | iftop | Traffic live pro Verbindung | | mtr-tiny | traceroute + ping kombiniert | | mc | Midnight Commander | | bash-completion | Tab-Vervollständigung | | nano | Editor | | ca-certificates | CA-Zertifikate | | unbound | rekursiver DNS-Resolver | | iptables-persistent| iptables-Regeln persistent speichern | | apt-transport-https| HTTPS für apt |
Die Installation erfolgt über die folgende Befehlszeile als root:
apt-get install screen htop iftop traceroute mtr-tiny mc openvpn bash-completion nano ca-certificates haveged ntp unbound isc-dhcp-server radvd iptables-persistent apt-transport-https bind9 sudo git apt-transport-https vnstat
Netzwerkkonfiguration netplan für VPS OVH/Webtropia
Serveranbieter wie OVH oder Webtropia verwenden auf ihren VPS Netplan zur Netzwerkkonfiguration. Die Konfiguration erfolgt über eine YAML-Datei, beispielsweise:
nano /etc/netplan/60-fffl.yaml
network:
version: 2
renderer: networkd
bridges:
br-fffl:
interfaces: []
parameters:
stp: false
forward-delay: 0
addresses:
- 10.129.1.[GW_Number]/16
- fddf:bf7:10:1:1::[GW_Number]/64
dhcp4: false
dhcp6: false
accept-ra: false
routes:
- to: 10.129.0.0/16
scope: link
table: 42
- to: fddf:bf7:10:1::/64
scope: link
table: 42
routing-policy:
- from: 10.129.0.0/16
table: 42
priority: 100
- from: fddf:bf7:10:1::/64
table: 42
priority: 100
Konfiguration auf Fehler prüfen:
sudo netplan generate
Konfiguration testen:
sudo netplan try
Konfiguration dauerhaft übernehmen:
sudo netplan apply
Netzwerkkonfiguration ifupdown
nano /etc/network/interfaces
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
# Batman
auto br-fffl
allow-hotplug bat0
iface eth0 inet6 static
address [your public ipv6] # don't change
netmask [your public ipv6 netmask] # don't change
gateway [your public ipv6 gateway] # don't change
# HOSTER: Everything above this line is the config from your hoster
# <----------------------------------------------------------------------
# FREEMESH: Everything after this line is the config for your community
# Batman
up /sbin/brctl addbr br-fffl
iface br-fffl inet static
address 10.129.1.[GW_Number]
netmask 255.255.0.0
bridge-ports none
iface br-fffl inet6 static
address fddf:bf7:10:1:1::[GW_Number]
netmask 64
# batman interface
iface bat0 inet6 manual
pre-up /usr/sbin/batctl if add tap0
up /bin/ip link set dev bat0 up
post-up /sbin/brctl addif br-fffl bat0
post-up /usr/sbin/batctl it 10000
post-up /usr/sbin/batctl gw_mode server #Activate the gateway announcements on a node
#post-up /usr/sbin/batctl gw_mode off #Disabled the gateway announcements on a node
post-up /sbin/ip rule add from all fwmark 0x1 table 42
post-up /sbin/ip route add 10.129.0.0/16 dev br-fffl table 42
post-up /sbin/ip -6 rule add from all fwmark 0x1 table 42
post-up /sbin/ip -6 route add fddf:bf7:10:1:1::[GW_Number]/64 dev br-fffl table 42
pre-down /sbin/brctl delif br-fffl bat0 || true
down /bin/ip link set dev bat0 down
# this is for adding the gateway to the map later, not necessarily necessary.
# post-up start-stop-daemon -b --start --exec /usr/local/sbin/alfred -- -i br-$FREEMESH_TLD -b bat0 -m
# post-up start-stop-daemon -b --start --exec /usr/local/sbin/batadv-vis -- -i bat0 -s