An easy-to-use web application that allows for remote waking, monitoring, suspending and rebooting of your home server/computer.
- Save energy by suspending your server when it's unused. When needed, wake it anywhere.
- Accidentally shut down your server over SSH? Turn it back on without having to walk up to it.
- Compared to PiKVM, this app doesn't require buying a video capture device, saving you money if KVM features aren't needed.
Whilst I do use this myself, there are lots of things that have to be improved before I'd consider this fully usable without the need for some kind of "plan B" in case the app breaks and doesn't wake your PC when you're in another country. Don't use this for mission critical systems or if you cannot troubleshoot issues on your own.
OWoW consists of two Node.js web applications that connect to each other and allow for remote waking and monitoring of your system.
- The first (pi) web application, located in the
pi_server
directory, is meant to be run on a single-board computer that's always on and connected to a VPN such as ZeroTier or Tailscale. It exposes the web interface for OWoW and allows for control of your machine anywhere - even when it's turned off. - The second (target, also called "companion") web application located in the
target_server
directory, is meant to be run on the computer you want to control. It exposes the endpoints used to get system information as well as reboot/suspend your machine to the first web app.
Windows servers fully supported. Linux support is untested and might require the companion server to be run as root.
- a Raspberry Pi (a Zero works just fine, and is even preferred for its extremely low power consumption)
- a PC with Wake on LAN enabled, and the MAC address of its Ethernet interface
- Tailscale or ZeroTier installed on both the Pi and target machine to improve security and ensure better stability
- Install Node.js and npm.
- Clone this repository to a place where you won't accidentally delete it and navigate to
./target_server
in a terminal. - Copy
example.env
to.env
. - Edit
.env
to match your system: change the value ofCOMPANION_SECRET
to a secure password and keep it somewhere safe - the Pi server will need this password. - Run
npm install
to install the required dependencies for the script. Then, executenode hash-server-password.js
in a terminal (being in the./target_server
directory) to create a server password. You need to remember this password, because it allows you to remotely suspend or reboot your machine. - Install pm2, a process manager for Node.js:
npm install --global pm2
- If you're on Windows, install the pm2 windows service:
npm install pm2-windows-startup --global
- Configure automatic startup for the script:
pm2 startup
(linux) orpm2-startup install
(windows) - For remote suspending to work properly, hibernation should be disabled with
powercfg -hibernate off
. - Start the script with the following command:
pm2 start index.js
- Enable automatic startup for the script:
pm2 save
This guide assumes that you already have an operating system installed on the Pi with internet connectivity.
- Install Node.js and npm:
# Install build-essential, needed for nvm
sudo apt install build-essential -y
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
# Load nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Install Node.js using nvm. Be patient; this will take a while on SBCs with weak processors.
nvm install --lts
- Clone this repository and navigate to
./server
. - Copy
example.env
to.env
:cp example.env .env
- Edit
.env
to match your system:
COMPANION_SECRET
is the secret that is used to safely communicate with your computer. This value MUST be the same as what you've set on your computer! If your computer'sCOMPANION_SECRET
ispassword123
, then the Pi'sCOMPANION_SECRET
must also bepassword123
.MAC_ADDRESS
is the MAC address of your computer's network interface. This will be used for Wake on LAN.COMPANION_URL
is the URL for the companion server, i.e. what you've just configured on your PC. The companion server runs on port 4617, so use the following format to get the URL:http://<COMPUTER_IP>:4617
. For security reasons, you should use the IP address from your VPN such as ZeroTier or Tailscale here.URL_TO_PING
is the web server that OWoL can automatically monitor for you. This is useful if you're running something like Nextcloud or Plex on your machine. Set this to the value ofCOMPANION_URL
if you don't have such a server.
- Install pm2, a process manager that will automatically start the script when the Pi is rebooted (if it loses power, for example):
sudo npm install --global pm2
- Install the required dependencies for the script:
npm install
. - Start the script with the following command:
pm2 start index.js
- Configure automatic startup for the script:
pm2 startup
- Enable automatic startup for the script:
pm2 save
- Go to
[PI_IP]:3000
to access the web interface.
HTTPS is optional if you are using Tailscale or ZeroTier, as both of which encrypt your traffic already. In order to use HTTPS, you need to get the HTTPS certificate and private key for your domain (see here for Tailscale) and add the paths for these files in .env
(regardless of whether you're adding HTTPS to the Pi or target server).
- Use
pm2 unstartup
on Linux and macOS to disable automatic startup for the script. For Windows, usepm2-startup uninstall
. - Reboot your machine.
- Delete the script files.
- Optionally, delete pm2:
npm remove pm2 -g
Several important security improvements have been introduced since the first iteration of this project. Most notably, it is now possible to encrypt all traffic between the you, the Pi and the target server using HTTPS, which adds an extra layer of protection on top of a VPN. A server password is also now required, that contols whether somebody can reboot or suspend your server. This password is not known in cleartext by the Pi or server, because it's hashed using Argon2 by default, ensuring that nobody except you can control your machine - even if the .env
file is compromised.
Thanks to the way this project has been architectured, little damage can be done if somebody gets your companion secret or server password. Because the API endpoints never execute user input, an attacker is only able to reboot, sleep or wake your machine and get basic information about it, such as CPU, memory and motherboard information.
Nonetheless, usage of a VPN such as Tailscale or ZeroTier is highly recommended. These services have strict access control and encrypt the traffic between you, your Raspberry Pi, and your computer on top of TLS. You should only use the IP addresses or domains provided by ZeroTier/Tailscale in configuration files.
- Cleanup code
- Test Linux support
- Improve website: show detailed error information, including failed HTTP requests.