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

help-circle

  • I don’t expect perfection out of anyone. I would not make friends if I held them to such high standards or expectations. Everyone learns, adapts and grows at their own pace and I would do better to support them along the way through their journey

    Myself and the people around me are doing our best in this situation we are in with the tools that are currently available to us

    I don’t believe trying to reduce the complex human experience to 100% right or 100% wrong will lead to any useful discussion when there’s so much in the middle we could be discussing







  • 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.



  • That’s fair

    I have a very different view on data, physical property and familial relationships. Everything is temporary to me and I’ve prefer my stuff to be reused rather than act as an archive to my own life.

    My pictures, music and technology related projects are just for myself. Anything I wish to share after my death is stored on an unencrypted drive connected to a Raspberry Pi that acts as my web facing server that serves only static data. It’s mainly a bunch of wikis, linux/shell scripting references, some of my git repositories, some survival type ebooks and some other random stuff.

    I’ve lost data multiple times throughout my life so I know I’d be disappointed but not sad if I lost all my data one more time. I do have multiple backups now so I at least have some data resilience compared to the past.