cnremctrl

Section: (1)
Updated: 0.1.1
Index Back
 

NAME

cnremctrl - remote control server application  

SYNTAX

cnremctrl [-st] [-l /path/logfile] [--cmd01=/path/cmd] [--cmd02=/path/cmd] ... [--cmd10=/path/cmd]  

DESCRIPTION

This application is the receiver or server of a remote control for your linux server. The sender or client is a Microsoft Windows program called cnRemoteControl.exe.
The client has 1 to 10 buttons. If the user pushes e.g. button no. 3, the client sends a string Button03 via TCP/IP on a reserved port (default 26056/tcp) to the linux server.
cnremctrl uses the well known TCP wrapper xinetd(8). xinetd is bind on the cnremctrl port and verifies, if the sender IP address is allowed to communicate to the server. If the result is ok, xinetd pipes the string Button03 to cnremctrl.
cnremctrl looks for an appropriate command in its conf file /etc/xinetd.d/cnremctrl. If program option --cmd03 is defined, it will be executed via a system call. All command output to stdout and the command exitstate is piped back to the client. The client has an log window to display this output and statusinfo.

Configuration

The whole program configuration is under control of /etc/xinetd.d/cnremctrl. If xinetd starts, the daemon scans the directory /etc/xinetd.d and parses each file. The default file for cnremctrl is:

  service cnremctrl
  {
    type           = UNLISTED
    port           = 26056
    socket_type    = stream
    protocol       = tcp
    user           = root
    server         = /usr/local/bin/cnremctrl
    server_args    = -s --cmd01=/path/to/command1 --cmd02=/command2%20-para       
    wait           = no
    instances      = 1
    per_source     = 1
    only_from      = 1.2.3.4 1.2.3.5 192.168.0.0/24
    log_type       = SYSLOG daemon
    log_on_success = PID HOST EXIT DURATION
    log_on_failure = HOST ATTEMPT
  }

Usually you have to change only:


  server_args
server commands and the way of logging

  only_from
One or more IP addresses or a range of IPs in CIDR notation the server has to accept

All xinetd options are well documented in the man page xinetd(8).

Note: If you change the conf file, you have to reload the configuration! On Red Hat type /etc/rc.d/init.d/xinted reload, under SuSE type rcxinetd reload. Look for the exit value of xinetd after restarting. If the conf file is buggy, xinetd might not start properly.

Space workaround

If a command contains one or more spaces, e.g. ls -al, you have to replace every space with %20, so the correct command string runs --cmdXY=ls%20-al.
You have to proceed this way because the string has to be interpreted as one program option and xinetd is incapable of handling quotes on server-args.

Security

Be aware which commands should be called by cnremctrl. Be aware which IP addresses should have access to the server (parameter only_from). cnremctrl is not insecure as long as you do not configure it inproper.
The only strings the client sends to the server are ButtonXY. No system calls were send over TCP/IP! If someone wants to hack your system, he cannot use this communication. If you configure commands like --cmd01=/bin/rm%20-rf%20/ and set only_from = 0.0.0.0/32 you might accept to send the server into nirvana ;)

cnremctrl behind a firewall

If your linux server is blocked with iptables(8), you have to install two rules to let pass cnremctrl communication. Example:

  iptables -A INPUT  -i eth0 -s 192.168.0.0/24 -p tcp --dport 26056 -j ACCEPT
  iptables -A OUTPUT -o eth0 -d 192.168.0.0/24 -p tcp --sport 26056 -j ACCEPT
 

OPTIONS

-s, --syslog
Log to syslog.
-t, --test
Testmode. No command will be executed but logged.
-l/path/logfile, --logfile=/path/logfile
Log to logfile.
--cmd01=/path/cmd
Server command 1. This command will be executed if cnRemCtrl receives Button01 on stdin.

(...)

--cmd10=/path/cmd
Server command 10. This command will be executed if cnRemCtrl receives Button10 on stdin.
-?, --help
Output help information and exit.
--usage
Display brief usage message.
 

FILES

/usr/local/bin/cnremctrl
/etc/xinetd.d/cnremctrl
/usr/share/man/man1/cnremctrl.1.gz  

EXAMPLES

cnremctrl is normally called from xinetd.

For test purposes you can start cnremctrl on commandline. Example:

  cnremctrl -t --cmd01=ls%20-al
  Button01
As result you should see:
  Testmode: System command "ls -al" not executed
 

LICENSE

Copyright (c) 2020 Christian Nause-Müller. This software is released for free use under the terms of the GNU General Public License, version 2 or higher.  

VERSION

Version 0.1.1, January 29, 2020  

AUTHORS

Written by Christian Nause-Müller <cn at cntec dot de>
Newest version, the Windows client cnRemoteControl.exe and more information: https://sourceforge.net/projects/cnremctrl  

SEE ALSO


 

Index

NAME
SYNTAX
DESCRIPTION
OPTIONS
FILES
EXAMPLES
LICENSE
VERSION
AUTHORS
SEE ALSO

This document was created by man2html, using the manual pages.