Skip to main content

This is a logging console server that can also be accessed over ssh.

Project description

This is a console server. It can connect to 1 or more serial ports and make these available over SSH. The data to and from the serial port can be logged to local disk. There is also a cli interface that can be used to reconfigure the serial ports.

The reason for writing this is the off the self solutions, Cyclades etc., are not cheap, a similar solution can be acheived using a raspberry pi and readily available usb to serial adaptors. e.g. this 16 port one for under £200 http://www.easysync-ltd.com/product/636/usb2-h-1016-m.html

Authentication

Version 0.2 and later uses unix password file and users authorised keys for logon.

Priviledges

The consoleserver has to run as root currently to access password file for user authentication to work at ssh login.

The CLI interface is only allowed by users who are members of the groups root or sudo.

Issues

USB hot plug

On ubuntu modem-manager is run against all serial ports to probe for it being a modem, this interferes with the monitored console collection. You may want to add a blacklist udev rule to prevent this. 99-usb-blacklist.rules is a sample rule file and goes into /etc/udev/rules.d

Group membership

By default serial devices belong to the dialout group so the user running the console server needs to be a member of this group or to run as root.

CLI Interface

There is a CLI interface accessible over SSH that can be used to reconfigure the server and serial ports, as of version 0.3 this can only be accessed by users belonging to the root or sudo groups - i.e. they have admin rights on the server. This by default is on port 8022 so ssh -p <username>@<address>.

The configuration of active serial ports is not acted on immediatly issue reload <port name> this is so you can change multiple parameters.

Configuration changes are not committed to disk until they are committed using the commit command. This allows for temporary changes to try and get a port working.

Port names are the full device name, i.e. /dev/ttyUSB0

Commands

help

Simple help.

list

List configured ports, these may not all exists on the system.

status

Show active ports.

exit

exit and close CLI connection.

create <portname>

Create a new port configuration in the config file. The default config already lists 32 ports.

reload <portname>

Close and reopen the named port

show <portname>

Show current configuration of the port

stop <portname>

Close the port

start <portname>

Open the port

enable <portname> <0,1>

Mark port for auto open as soon as it is seen. Note it may be a USB device that is not yet plugged in but will be opened once plugged in.

baud <portname> <baud>

Change port baud rate.

bytesize <portname> <5,6,7,8>

Change port number of data bits.

stopbits <portname> <1,2>”,

Change port number of stop bits.

parity <portname> <N,E,O,M,S>”,

Change port parity, None, Even, Odd, Mark, Space.

rtscts <portname> <0,1>”,

Change port to use RTSCTS for flow control - hardware flow control.

xonxoff <portname> <0,1>”,

Change port to use XON XOFF for flow control - software flow control.

sshport <portname> <nnnn>”,

Change ssh port that directly connects to the serial port.

logfile <portname> <logfile>”,

Change The name of the log file for this port. logfile can be blank in which case the port is not logged. If the logfile is not an absolute path then it is relative to /var/log/consoleserver, the extension .log i forced.

portmonitor <location>

Change the directory to monitor for new serial ports, the port (device) names must alredy exist in the config for the consoleserver to open them as soon as they are plugged in.

Installation

The package is set up to install on Ubuntu at present dropping relevnt files where required on the file system. You should be able to install and then enter sudo /etc/init.d/consoleserver start to get it running as a daemon. sudo consoleserver will run it in a terminal window logging to the screen.

File locations

Config File

The system will create a default config file in /etc/consoleserver called config.ini this will be created to access serial ports ttyUSB0..ttyUSB31. The default management port is 8022 and the default serial ports are on 8023..8054.

LogFiles

The default entries are setup to create logfiles in /var/log/consoleserver. If installed with pip install consoleserver then a logrotate file will be installed to rotate these files daily.

Others

/etc/init.d/consoleserver /etc/logrotate.d/consoleserver /etc/udev/rules.d/99-usb-blacklist.rules

You will have to make /etc/init.d/consoleserver executable if you wish to run this as a daemon.

Unit Tests

Most of the code is unit tested.

Licence

The code is licenced using the GPL, see included LICENCE file. At present any other licence is subject to negotiation.

(C) Copyright L P Klyne 2013

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ConsoleServer-0.9.tar.gz (26.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page