• 2 Posts
  • 18 Comments
Joined 3 years ago
cake
Cake day: December 12th, 2023

help-circle



  • This is great, thank you for taking the time for this write up :) The provided scripts are a huge help to me

    So far my only question I have is about the directories you use. I was wondering if you could provide the directories you use or even just an example so I could better understand the file tree. I’m very particular with my files and have a whole system dedicated to maintaining neat and organized files

    I agree about not using /etc for server related stuff. I keep all my server/container related stuff in /srv so it’s easier for me to manage



  • Impossible? There are people who still write code by hand. There are people who oppose AI, some more actively (or destructively) than others.

    Harder to avoid seems like a more reasonable take.

    However I am coping, by actively seeking, talking about and supporting alternatives with the hope of spreading that knowledge to those who would like to avoid the use of AI or enable those who support AI.

    Human creativity has a much longer and far more interesting history when compared to AI or machine learning. AI hasn’t always existed and does not need to have complete influence over our future.







  • Aah you did mention that, my eyes just decided to skip that when I read your post.

    This reminds me of another issue I ran into but I use Alpine Linux so I don’t know if it’s a distribution specific issue. I’ll share the issue and workaround solution anyways as something to consider.

    Networking on Alpine Linux is controlled by a process called networking and for reasons I don’t understand and can’t see by any logs, it just stops working. I can’t ssh or access the reverse proxy port. I don’t remember if ping was working or not as it’s been a while since I dealt with it now.

    My work around was to have a script on my server ping a known location and restart networking if it couldn’t ping out. If a second ping after restarting the process failed, it would then restart the device. This script would run every 15 minutes.

    It’s a bandage solution that doesn’t solve the problem but it does keep my server running. However it seems like pings still work with your server so you might need to get creative in how you test your server’s connectivity.


  • It sounds to me like ssdh may have stopped working. That may explain why you can’t ssh into your server but pings still respond. I have a Raspberry Pi4 and a Pi5 and have had similar issues in the past.

    I would probably approach this issue by writing a small script that checks every so often if the process sshd is still alive and if not restart sshd. Maybe SystemD can so something similar but I am not familiar with SystemD.

    Edit: A quick and simple script looks like this

    #!/bin/sh
    
    # Check if `sshd` process is running; If not running, `pgrep` returns
    # an exit status of '1' and restarts `sshd`
    pgrep 'sshd' > /dev/null || systemctl restart sshd
    

    Make the script executable with chmod +x /home/user_name/sshd_check

    Add the following line to /etc/crontabs/root to run the script every 15 minutes

     */15    *       *       *       *       /home/user_name/sshd-check
    

    I don’t use SystemD but I am pretty sure systemctl restart sshd is correct, otherwise it can be changed to whatever your operating system uses to control services



  • I tried what you said. I sent a ping from my computer to the server and this was the output of nft monitor trace:

    trace id 1d01c81e ip ping_trace prerouting packet: iif "eth0" ether saddr b0:7d:64:e8:8f:3c ether daddr d8:3a:dd:de:28:99 ip saddr 192.168.40.201 ip daddr 192.168.40.203 ip dscp cs0 ip ecn not-ect ip ttl 64 ip id 65074 ip length 84 icmp type echo-request icmp code 0 icmp id 35586 icmp sequence 0 
    trace id 1d01c81e ip ping_trace prerouting rule icmp type { echo-reply, echo-request } meta nftrace set 1 (verdict continue)
    trace id 1d01c81e ip ping_trace prerouting policy accept 
    trace id 1d01c81e inet filter input conntrack: ct direction original ct state new ct id 271120081 
    trace id 1d01c81e inet filter input packet: iif "eth0" ether saddr b0:7d:64:e8:8f:3c ether daddr d8:3a:dd:de:28:99 ip saddr 192.168.40.201 ip daddr 192.168.40.203 ip dscp cs0 ip ecn not-ect ip ttl 64 ip id 65074 ip protocol icmp ip length 84 icmp type echo-request icmp code 0 icmp id 35586 icmp sequence 0 
    trace id 1d01c81e inet filter input rule ip protocol icmp icmp type { echo-reply, destination-unreachable, echo-request, time-exceeded, parameter-problem } accept comment "Accept ICMP" (verdict accept)
    

    I sort of get what’s happening and it looks like the ping request has been accepted.

    From my computer when I send a ping it shows:

    15:55 dell:/tmp/ $ ping -c1 192.168.40.203
    PING 192.168.40.203 (192.168.40.203): 56 data bytes
    
    --- 192.168.40.203 ping statistics ---
    1 packets transmitted, 0 packets received, 100% packet loss
    

    So even though it’s being accepted, I still get nothing going back to my computer, at least that’s how I understand it.


  • I tried your suggested rules and still nothing

    I went a step further and simply enabled all incoming connections with:

    table inet filter {
    	chain input {
    		type filter hook input priority 0; policy allow;
    	}
    }
    

    Again I can connect with SSH and WireGuard but I still can’t ping my server. If I restore to my last backup with iptables, I can get a response from ping again.

    I also tried directly translating the rules from iptables with:

    iptables-save > /tmp/iptables.dump
    iptables-restore-translate -f /tmp/iptables.dump > nftables.dump
    

    and adding the rules:

    #!/usr/sbin/nft -f
    
    define WIREGUARD_PORT = 51820
    define WIREGUARD_ADDRESS = 10.0.0.0/24
    define SSH_PORT = 5025
    define SSH_ADDRESSES = { $WIREGUARD_ADDRESS . $SSH_PORT, 192.168.40.204 . $SSH_PORT }
    define PUBLIC_PORTS = { 5050 }
    
    table inet filter {
            chain input {
                    udp dport $WIREGUARD_PORT accept \
                    comment "Accept WireGuard connections"
    
                    ip saddr . tcp dport $SSH_ADDRESSES accept \
                    comment "Accept SSH connections from known devices or WireGuard"
    
                    tcp dport $PUBLIC_PORTS accept \
                    comment "Accept public connections"
    
                    icmp type echo-request limit rate 5/second burst 10 packets counter accept
                    icmp type echo-request limit rate 30/minute burst 120 packets counter accept
                    icmp type echo-request limit rate 1/minute burst 2 packets counter log prefix " PING-PONG-FLOOD "
                    icmp type echo-request counter drop
    
                    icmp type destination-unreachable counter accept
                    icmp type time-exceeded counter accept
                    icmp type parameter-problem counter accept
                    icmp type echo-request counter accept
            }
            chain forward {
                    icmp type destination-unreachable counter accept
                    icmp type time-exceeded counter accept
                    icmp type parameter-problem counter accept
                    icmp type echo-request counter accept
            }
    }
    

    and still no ping from my server…

    I will agree, the documentation for nftables is just not as accessible or consistent as iptables. It’s a bit frustrating.




  • I used to work as an electrician in the automation industry (robots that welded the frame of automobiles) but I was only an apprentice. I worked alongside robot and PLC programmers and absorbed information through them. I lost the motivation to finish my apprenticeship due to a changed perspective on the harmful affects of too much progress. That was as close as I got to any coding.

    I decided to enjoy a mid-life retirement after protesting my way into getting fired which gave me time to explore hobbies. Along the way I ended up buying a used Raspberry Pi 4 and 5 and found some joy in both self hosting and shell scripting. Fortunately shell scripting supplements self hosting. I have been slowly crafting a low resource, low maintenance, minimal server.

    Both Pi’s run Alpine Linux, the Pi 4 is dedicated to HomeAssistant which controls a handful of lights and switches. The Pi 5 runs Caddy and Kiwix. Right now it just hosts a bunch of wikis and a static file server with Caddy. Eventually I plan to run a blog created only by a single Bash script.

    This is all completely outside of any workplace skill and I think I’d like to keep it that way. Programming for money would likely kill the wonder I still have for computers.


  • I’ve been to Gay pride parades, gay bars and gay clubs. The gayest experience I’ve had in my life was working in the trades with straight men doing everything they can to prove their masculinity at all costs.

    These men will use women as mere possessive objects in order to prove to their masculinity towards other men. By oversexualizing all women while at the same time belittling all that their partner does. As if women were merely currency for respect among men.

    They hated gays and trans people so much that they would spend an extremely uncomfortable amount of time telling you how much they were “disgusted” by these people.

    They hated on any man who who did not possess physical masculine traits. Those traits that they hated? Not being muscular. Not being tall. Not being fat (what???). Having longer hair.

    But the gayest thing these guys refused to do was stand up for themselves against unjust authority. They would spend the most all their free time explicitly telling you how much they hate their boss. How stupid their boss is. How much of an asshole their boss is. How they would kick their bosses ass. Just talk an absolute big game.

    Then the boss would come around the corner and you’d never see a bunch of grown ass men tuck their dicks between their legs faster than these guys. Their voices raise up a couple pitches and suddenly they are acting as subservient as how they believe their wives should be.

    It’s in this unspoken idea of respect for Men in Authority that you see the “gayest” trait in these toxic men. But not in a good gay way. A toxic gay trait that comes from a deep place built on oppression and repression of ones self. Where respect from your fellow man at all costs is the most valuable thing they crave. Where respect from your boss holds even higher value. Where respect from men in higher positions is held at even higher value.

    All they care about is to be noticed by other men. That’s kinda gay dude.

    The cost of all this effort to gain respect from exclusively other men is their dignity. And they are more than willing to give up their dignity to be noticed by men in positions of authority.

    To these guys, questioning or standing up to authority is gay. Standing up for yourself is gay. Demanding to be treated with dignity is gay. They will be the first ones to kick you down for disrespecting authority.

    I’ve walked into a club bathroom and saw two guys giving another guy a blowjob. That’s still not as gay as watching “straight” acting men grovel at the feet of boss in any trades.

    Ick…