Friday 10 March 2023

My Raspi setup routine

How I set up my Raspberry PI

This time I try the SanDisk Max Endurance 32GByte card (claims 100MB/40MB R/W-rate)

Other cards lasted 2 to 5 years. I wonder if this one will be more durable. My Pi is a model 2b that has been running more or less non-stop since 2015 and ate a couple of microSDs in the process.

Imager

Download Imager (in my case windows) and choose Raspbian

Set hostname, activate ssh (as I'm running headless), set credentials (not user "pi") - pretty easy these days.

Getting started

insert card and boot

connect via ssh (always the same Addressm as my router has a fixed dhcp entry for the Raspberry pi's MAC

sudo apt-get update

sudo apt-get upgrade

sudo apt autoremove

sudo reboot

Log2ram

Install as outlined here:

https://github.com/azlux/log2ram

I needed to set the size to 80M.

Snowflake

And as I care about a free (like in "free speech", not "free beer") Internet, I install a snowflake proxy:

https://www.areresearch.net/2022/09/fight-internet-censorship-run-snowflake.html

Fail2ban

sudo apt install fail2ban

as described here https://pimylifeup.com/raspberry-pi-fail2ban/

check with

sudo service fail2ban status

(I had some syntax-issues in jail.local)

Set timezone with sudo raspi-config

And it makes a lot of sense to run fail2ban. I have SSH open and within a day, I've been attacked from around the planet, with an amazing concentration of taiwanese IP adresses. The map only shows the location of IPs that tried often enough to actually get banned.

Atttackers connecting to my ssh server during one day
This map was created feeding the output of:
grep Ban /var/log/fail2ban.log | cut -d ' ' -f 16 | sort -u