This is a service that allows command line commands to be run on the host it is running on.
It is distributed as a self contained package with all dependencies included.
It is not required to install nodejs on the host system.
rc-client is the official client library for interacting with this service.
!! DO NOT INSTALL THIS PACKAGE VIA NPM !!
RPM:
yum install remote-control
*Note: creation of an RPM package is still on the TODO list
Other:
- Download the
remote-controlNAR file appropriate for your system (linux/MacOS(darwin)) from the releases - Make the downloaded file executable
Example Init Script (RedHat/Centos):
#!/bin/bash
#
# /etc/rc.d/init.d/rc
#
# This is a service that allows command line commands to be run on the host it is running on.
#
# chkconfig: 2345 20 80
# description: This is a service that allows command line commands to be run on the host it is running on.
# processname: rc
# config: /etc/rc/config.json
# pidfile: /var/run/rc.pid
#
# Source function library.
. /etc/init.d/functions
PROGNAME=rc
PROG=/usr/local/sbin/$PROGNAME
PIDFILE=/var/run/${PROGNAME}.pid
CONFIGFILE=/etc/$PROGNAME/config.json
LOCKFILE=/var/lock/subsys/$PROGNAME
start() {
if [ -d /.nar ]; then
# ensure clean start (nar agressively caches code)
rm -rf /.nar
fi
echo -n "Starting $PROGNAME: "
daemon $PROG --configFile $CONFIGFILE
ret=$?
echo ""
touch $LOCKFILE
return $ret
}
stop() {
echo -n "Shutting down $PROGNAME: "
killproc -p $PIDFILE $PROG
ret=$?
echo ""
rm -f $LOCKFILE
return $ret
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p $PIDFILE -l $LOCKFILE
;;
restart)
stop
start
;;
*)
echo "Usage: <servicename> {start|stop|status|reload|restart[|probe]"
exit 1
;;
esac
exit $?npm install -g nar
IMPORTANT: DO NOT USE [email protected] it has a bug where it will not bundle the application files ([email protected] is known to work)
Mac OS:
remote-control version >= 1.1.0:
nar create --executable --os darwin --arch x64 --node 6.9.5
remote-control version <= 1.0.0:
nar create --executable --os darwin --arch x86 --node 0.12.7
nar create --executable --os darwin --arch x64 --node 0.12.7
Linux:
remote-control version >= 1.1.0:
nar create --executable --os linux --arch x86 --node 6.9.5
nar create --executable --os linux --arch x64 --node 6.9.5
remote-control version <= 1.0.0:
nar create --executable --os linux --arch x86 --node 0.12.7
nar create --executable --os linux --arch x64 --node 0.12.7
Configuration is specified in a JSON formated file and passed to the service using the --configFile command line flag.
remote-control exec [--configFile FILE] [--version]
The configuration file understands the following options:
port: the port to listen on (default:4515)host: the interface to bind to (default:::)certDir: the directory where authorized users' public keys are stored (default:/etc/rc/certs)ciphers: the list of cyphers to useengineOptions:pingTimeout: ping timeout in ms (default:5000)pingInterval: pint interval in ms (default:1000)
pidFile: the pid file to write (default:null)cmdOptions: the options used by the child processes running the commands (default:{}). Can be overriden by options set on the message. Seechild_process_exec_command_optionsfor valid options
The server authenticates clients by requiring that they provide a signature in the Authorization header on the initial upgrade request.
The signature header should be in the following format:
Authorization: RC <name>;<iso_8601_timestamp>;<signature>
<name>: the server will verfiy the signature using a certificate stored in<certDir>/<name>.keyon the server<iso_8601_timestamp>: anISO-8601formatted timestamp. This is the data that has been signed<sig>: aRSA-SHA256signature inbase64format
DEBUG: sets the level(s) for logging (default:error,warn,info).mainandserverlevels are also available for verbose logging.
You can test client actions with test/scripts/client.js
NOTES:
- set the
SZ_RC_CERT_NAMEandSZ_RC_CERT_DIRenvironment variables before running the client test script. - place your public key in
/tmp/rcPubKeys - run the server:
node app.js --configFile ./test/config/config.json
If your version of engine.io-client is <=1.5.2, it must be patched.
First update engine.io-client to version 1.5.2, then follow the steps below:
cd node_modules/engine.io-client
patch -p1 < ../../package/patches/engine.io-client/1.5.2-master-2015-07-16.patch
#
# when prompted for files to modify, just hit enter and then
# select 'Y' to skip the file
#
npm installSZ_RC_CERT_NAME: the name of the cert for the client to use for authorization (seenamein the config options)SZ_RC_CERT_DIR: the path to the directory that contains the cert
ISC License (ISC)
Copyright (c) 2016, Sazze, Inc.
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.