-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
❓ Setup a wireguard server instead of a client #12
Comments
Hi Alex, I'll try to answer your question here, however this utility is only for providing wireguard services on boot; configuration and support of wireguard itself is outside the scope of this project. Bastion hostA bastion is basically a heavily restricted / monitored host that is exposed publicly that generally enables proxies and jumps to another network through it. Client/Server MonikersThese used were to clarify mental models for folks setting it up. Both machines are wireguard clients connecting to each other or through a bastion host. In the documented instructions, the homeserver is a wg client that connects to a bastion host on boot; and you can use another machine to connect to the bastion host; once these connections are established, both machines would be able to send traffic to each other over wireguard (if configured properly). Both are wg clients; the bastion host is a wg client as well, but acts as a traditional vpn endpoint in this case (server). This model enables the bastion to essentially be anywhere on a well-known (e.g. public IP or DNS space) for the clients to connect to; inside or outside of your internal network. Direct ConnectionsThe alternative method for setting it up is directly connecting both WG clients to each other; which in your case would require exposing the WG port through your firewall so that another client (e.g. your machine connecting externally) can route traffic to it. The clients would be directly connecting to each other. In this model (which you are talking about) the homeserver is essentially the vpn endpoint, so the WG port would need to be exposed publically so your machine could connect to it outside of your home network. Wireguard GotchasWireguard is a bit heavy to wrap your head around if you are new to it or don't come from a networking background. I highly, highly recommend setting up wireguard and verifying everything is working the way you intend it to before setting up wireguard-initramfs -- this tool checks for static errors but will not fix broken or incorrect wireguard configs; so you have to know it is working before you use it. Some good documentation:
Reporting issuesBoth cases should be supported with the current configuration. However, if you find that it is not, please file a bug with details including both configurations to validate the bug. Hopefully this helps you out. Feel free to ask more questions, but please post your configurations with secrets obfuscated. Always test your configuration with clients before moving to the configuring wireguard-initramfs tool |
Hey there, thank you very much for your long answer. I have been using WireGuard for several years now, so I am familiar with it. I also watched the presentation from Donenfeld and was especially impressed by its non-chatty behavior, so that a port scan will not reveal that there is a WireGuard server listening for connections. I am using it only at home for my home server as an endpoint. Clients connect to it. The server is fully encrypted and I want to be able to reboot the server and then decrypt it from the outside. My problem is, I don’t know how to set up your config file to achieve this. I did set up a minimal Debian 12 VM for testing and I am able to connect from my VM to an endpoint. But I don’t know how to set up your config file to run the VM as the endpoint. In the end, I tried to “hack” some code to run the VM as the endpoint into the init-premount script and added a port variable in the config file. So in case the endpoint variable is empty and the port variable is set, the WG-server should be up and running and waiting for clients to connect to it to decrypt the server but that didn’t work as intended. My code worked, but not automatically on startup. I don’t know why, but for sure, because I am a total noob in coding. XD When I am back at my laptop I can show you the modifications I did and how my config file looks like. |
This is my config file:
and here the modified premount script:
Dont be scared because of my keys posted, it is all in a test environment locally on ma laptop and a vm |
Hi there,
thanks a lot for sharing this. Running wireguard in initramfs is excatly what I want since I am using full disk encryption on my homeserver. The only problem I have with your code / config file is: I don't understand how to setup a wireguard server instead of a wireguard client.
After a reboot of my homeserver, i want it to wait for a wireguard client to connect to it. After successful connection the client will create the ssh connection and unlock the encrypted drive.
So instead of connecting to the outside from my server I want the opposite: connect into my server from the outside.
Is there a way to setup the /etc/wireguard-initramfs/config file for that or is that use case not implemented yet?
Thank u and best wishes,
Alex.
The text was updated successfully, but these errors were encountered: