Remotely lock/unlock your computer (Linux) using HTTP/JSON, SSH Key & IP whitelisting
- node.js and npm
- SSH Private Key (a password must be set)
.env
file for setting up required configurations
git clone https://github.com/arafathusayn/remote-box-locker.git && cd remote-box-locker && npm install
Create a .env
file in the remote-box-locker
directory, then you can set these environment variables:
SERVER_PORT=3333
USERNAME=<your computer username>
TRUST_PROXY=true or false
IP_WHITELIST=<comma seperated IP addresses> eg. 192.168.0.100,192.168.0.101
PRIVATE_KEY_PATH=/home/<USERNAME>/.ssh/id_rsa
USERNAME
env variable is required.- If your computer network is behind a trustable proxy, set
TRUST_PROXY=true
so thatIP_WHITELIST
can work properly. Default:false
. IP_WHITELIST
always includeslocalhost,127.0.0.1
as whitelistedPRIVATE_KEY_PATH
is your SSH private key path. It's optional. Default:/home/<USERNAME>/.ssh/id_rsa
node app.js
pm2 start -f app.js
To lock the computer running the server, send HTTP POST
request to
Endpoint: /lock
eg. http://localhost:3333/lock
along with HTTP Header Content-Type:
application/json
and the JSON data in POST Body:
{
"password": "<Your SSH Private Key Password>"
}
To unlock the computer running the server, send HTTP POST
request to
Endpoint: /unlock
eg. http://localhost:3333/unlock
along with HTTP Header Content-Type:
application/json
and the JSON data in POST Body:
{
"password": "<Your SSH Private Key Password>"
}