this post was submitted on 20 Oct 2023
2 points (100.0% liked)

Self-Hosted Main

502 readers
1 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

For Example

We welcome posts that include suggestions for good self-hosted alternatives to popular online services, how they are better, or how they give back control of your data. Also include hints and tips for less technical readers.

Useful Lists

founded 1 year ago
MODERATORS
 

I do have my own web server running centos 7 i could use. I am planning to buy a small mini-pc that will be running home assistant and frigate for recording my camera's and integrating AI detection into my smart home. It seems the best installation for that is debian.

I have a router that is using a wireguard vpn, that does not allow port forwarding, so i need an alternative to access the mini-pc.

Now, of course there's some things to be found when googling, but my preference goes to the most easy-to-use solution as i'm not great with linux, i just mess around digging through configs, copy-pasting instructions and getting stuff done that way. This is why I wanted to ask you guys for advice =)

Would appriciate assistance!

top 16 comments
sorted by: hot top controversial new old
[–] jerwong@alien.top 2 points 11 months ago (1 children)

Set up a reverse tunnel to the outside box that you want to get in from.

For example, from the inside machine:

ssh outsidemachine -R 2222:localhost:22

Then on your outsidemachine:

ssh -p 2222 localhost

Maybe run top or something just to keep traffic going across so that firewalls don't drop your connection.

[–] jwink3101@alien.top 1 points 11 months ago

This is what I've done too. I am almost certain it is less performant than some of the other options out there but I like that it is simple and using a tool I know. If this was a major use case of mine, I'd probably do more playing and get it working with something else but this works for now.

Also check out autossh and some of those tools

[–] yolomoonie@alien.top 1 points 11 months ago (1 children)

What do you mean "a router that is using a wireguard vpn" ? Why not just add your device as an endpoint in wireguard?

[–] borgqueenx@alien.top 1 points 11 months ago (1 children)

I want the whole house to be automatically protected. Incl many smart home devices. So every device that connects to the router, is going through the vpn.

[–] yolomoonie@alien.top 1 points 11 months ago

And from there to the linux pc? Why not just add tunnel to your external device?

[–] magic-pangolin@alien.top 1 points 11 months ago

I'm using Twingate, it's safe and works fine !

[–] talent_deprived@alien.top 1 points 11 months ago

I run Wireguard at my public VPS. I run Wireguard on my clients at home. I have Wireguard on the server configured to route via iptables, the ports I desire to send that traffic to my home machines.

This is a good resource: https://www.linuxbabe.com/ubuntu/wireguard-vpn-server-ubuntu

If this pastes correctly, here is a redacted version of my server and client config:

#
# Client (the actual self-host local server)
#
[Interface]
## This Desktop/client's private key ##
PrivateKey =

## Client ip address ##
Address = 10.10.123.2/24

[Peer]
## Ubuntu 20.04 server public key ##
PublicKey =

## set ACL ##
#AllowedIPs = 10.10.123.0/24
# setting to 0.0.0.0/0 routes all outbound through the vpn and out the public vps
AllowedIPs = 0.0.0.0/0

## Your Ubuntu 20.04 LTS server's public IPv4/IPv6 address and port ##
Endpoint = :12345

## Key connection alive ##
PersistentKeepalive = 15
#
# Server (in the Wireguard context, exposed to the Internet)
#
[Interface]
## My VPN server private IP address ##
Address = 10.10.123.1/24

## My VPN server port ##
ListenPort = 12345

## VPN server's private key i.e. /etc/wireguard/privatekey ##
PrivateKey =
PostUp = iptables -i eth0 -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.10.123.2
PostUp = iptables -i eth0 -t nat -A PREROUTING -p tcp --dport 25 -j DNAT --to-destination 10.10.123.2
PostUp = iptables -i eth0 -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.10.123.2
PostUp = iptables -i eth0 -t nat -A PREROUTING -p tcp --dport 465 -j DNAT --to-destination 10.10.123.2
PostUp = iptables -i eth0 -t nat -A PREROUTING -p tcp --dport 993 -j DNAT --to-destination 10.10.123.2
PostUp = iptables -i eth0 -t nat -A PREROUTING -p tcp --dport 995 -j DNAT --to-destination 10.10.123.2
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -i eth0 -t nat -D PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.10.123.2
PostDown = iptables -i eth0 -t nat -D PREROUTING -p tcp --dport 25 -j DNAT --to-destination 10.10.123.2
PostDown = iptables -i eth0 -t nat -D PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.10.123.2
PostDown = iptables -i eth0 -t nat -D PREROUTING -p tcp --dport 465 -j DNAT --to-destination 10.10.123.2
PostDown = iptables -i eth0 -t nat -D PREROUTING -p tcp --dport 993 -j DNAT --to-destination 10.10.123.2
PostDown = iptables -i eth0 -t nat -D PREROUTING -p tcp --dport 995 -j DNAT --to-destination 10.10.123.2
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
[Peer]
## Desktop/client VPN public key ##
PublicKey =

## client VPN IP address (note the /32 subnet) ##
AllowedIPs = 10.10.123.2/32
#
# Server - Ensure these are set in the server if using Ubuntu ufw firewall (or similar?)
#
Anywhere on ens3 ALLOW FWD Anywhere on wg0
Anywhere on wg0 ALLOW FWD Anywhere on ens3
Anywhere on wg0 ALLOW FWD Anywhere on wg0
Anywhere (v6) on ens3 ALLOW FWD Anywhere (v6) on wg0
Anywhere (v6) on wg0 ALLOW FWD Anywhere (v6) on ens3
Anywhere (v6) on wg0 ALLOW FWD Anywhere (v6) on wg0
#
# Server - Ensure ipv4 routing is on (and ipv6 if you're using it)
#
# In /etc/sysctl.conf
net.ipv4.ip_forward=1

[–] EndlessHiway@alien.top 1 points 11 months ago (1 children)

If you haven't read this information in the 100's of other post on this subject or the wiki what good would it do to answer it again?

[–] borgqueenx@alien.top 1 points 11 months ago

I want the easiest solution

[–] arond3@alien.top 1 points 11 months ago

Setup a vpn pn a vps. Then connect your server as a client. Connect your other device as client and use the vpn nerxork address to access your server

[–] HeroinPigeon@alien.top 1 points 11 months ago

Ipv6 only is an option or use tailscale

[–] MRP_yt@alien.top 1 points 11 months ago

Tailscale or Cloudflare Tunnel with Access Rules

[–] Ouity@alien.top 1 points 11 months ago (1 children)

If you have a VPN router, your router literally has remote access built in as a feature. The VPN can be connected to remotely, and allow you to access locally hosted services. I use mine for such a purpose. When configured correctly, your VPN connection makes your device get treated like it's on the local network.

[–] borgqueenx@alien.top 1 points 11 months ago

I had so much trouble setting up the router with vpn that i'd really rather not make big changes...

[–] PrivacyDemonologist@alien.top 1 points 11 months ago

I would suggest ZeroTier, its opensourse and pretty smart. Clients for all platforms are available

[–] masquerade-ball@alien.top 1 points 11 months ago

Personally I use wireguard on custom port, but you can try Tailscale or zerotier?