Score:0

Accessing server behind wireguard not possible

in flag

I am running a VM at hetzner (named gateway in the diagram below) that is used as a wireguard server. I hand out public IPv6 addresses via wireguard to clients. It is possible to ping all systems from every other system. I can ssh into both the gateway and the server from outside of my VPN, however I cannot ssh from the server to the gateway (or the other way around) and I cannot access any other service than ssh on the server. I am not sure if these are two separate issues or just one issue and I am not sure how to debug this issue further. tcpdump -i wg0 tcp port 22 shows that packages are received when I try to ssh, but the client gets a timeout.

 ┌────────────┐
 │            │  ssh server       ✓
 │  Macbook   │  ssh gateway      ✓
 │            │  wget server      ✕
 └─────┬──────┘  
       │
 ┌─────┴──────┐
 │            │
 │   Router   │
 │            │
 └─────┬──────┘
       │ public IPv6, CGNAT IPv4
┌──────┴─────┐
│            │       ┌────────────┐             ┌─────────────┐
│            │       │            │  Wireguard  │             │
│  Internet  ├───────┤  Gateway   ├─────────────┤   Server    │
│            │       │            │ public IPv6 │             │
│            │       └────────────┘             └─────────────┘
└────────────┘        ssh server  ✕             ssh gateway   ✕
                      ping server ✓             ping gateway  ✓

ufw is disabled on the server. The gateway configuration looks like this

# ufw status
Status: active

To                         Action      From
--                         ------      ----
51820/udp                  ALLOW       Anywhere                  
OpenSSH                    ALLOW       Anywhere                  
53/tcp                     ALLOW       Anywhere                   # Open port DNS tcp port 53
53/udp                     ALLOW       Anywhere                   # Open port DNS udp port 53
Lighttpd Full              DENY        Anywhere                  
Anywhere on wg0            ALLOW       Anywhere                  
51820/udp (v6)             ALLOW       Anywhere (v6)             
OpenSSH (v6)               ALLOW       Anywhere (v6)             
53/tcp (v6)                ALLOW       Anywhere (v6)              # Open port DNS tcp port 53
53/udp (v6)                ALLOW       Anywhere (v6)              # Open port DNS udp port 53
Lighttpd Full (v6)         DENY        Anywhere (v6)             
Anywhere (v6) on wg0       ALLOW       Anywhere (v6)             

Anywhere on eth0           ALLOW FWD   Anywhere on wg0           
Anywhere on wg0            ALLOW FWD   Anywhere on eth0          
Anywhere (v6) on eth0      ALLOW FWD   Anywhere (v6) on wg0      
Anywhere (v6) on wg0       ALLOW FWD   Anywhere (v6) on eth0     
Score:1
in flag

I solved the issue by enabling the debug log of the wireguard module via echo module wireguard +p | sudo tee /sys/kernel/debug/dynamic_debug/control and than checking dmesg. It turns out the wireguard tunnel to the server was regularly failing. I fixed this changing the endpoint address on the server to use an IPv6 connection. I can only speculate on why this seemingly fixes the issue, but since it took me days to figure this out, I thought I may help someone else in the future.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.