Table of Contents

Console Monitoring with Conserver

Conserver

Conserver is an application that allows multiple users to watch a serial console at the same time while logging console activity.

Console monitoring can be used to monitor the following:

Special hardware required:

URL: http://www.conserer.com

Installation

Reference (long): http://www.conserver.com/INSTALL

Installation on FC3

wget http://www.conserver.com/conserver-8.1.11.tar.gz
tar xzvf conserver-8.1.11.tar.gz
./configure  --with-logfile=/var/log/conserver/conserver
#./configure --with-openssl --with-master=`hostname` --with-logfile=/var/log/conserver/conserver
make
make test
sudo make install

Configuration files:

Need to define the conserver port in /etc/services:

console      782/tcp    conserver    # console server

Make sure that conserver gets started at boot. The file may need to be changed to point to the correct bin dirs.

sudo cp contrib/redhat-rpm/conserver.init /etc/init.d/conserver
sudo chkconfig --level 345 conserver on

Create conserver.cf file, my sample is included below

/usr/local/etc/conserver.cf

Usage

cntl-ec? - help
cntl-ec. - detach

Conserver Configuration

 ### Sample conserver config file 

 # conserver.cf
 # 12/28/04 Greg Sidelinger
 #   Created first draft based on conserver samples
 
 ### set up some custom break sequences
 #break 4 { string "+\d+\d+"; delay 300; }
 #break 5 { string "\033c"; }
 
 ### define a group of users that will have full rw access
 group sysadmins { users root, gate; }
 
 ### define a group of users who have read only access
 ### helpers is everyone but the sysadmin group
 group helpers { users *, !sysadmin; }
 
 ### define our defaults
 # again, these get applied before anything else
 default * {
     # The '&' character is substituted with the console name
     logfile /var/log/conserver/&;
     timestamp 5m;
     rw sysadmins;
     ro helpers;
     master localhost;
 }
 
 ### define our defaults for serial devices
 default serial {
     type device;
     baud 9600;
     parity none;
 }
 
 ### define our defaults for ssh
 # it too uses pattern substitution and such to get the job done
 default ssh {
     type exec;
     port 22;
     #exec ssh -p P -l tsuser H;
     exec ssh -p P H;
     execsubst H=hs,P=Pd;
 }
 
 ### define a list of our consoles
 ### list our com port connections first
 console sparc  { include serial; device /dev/ttyS0; }
 console ultra1 { include serial; device /dev/ttyS1; }
 
 ### setup some ssh connections
 console magius  { include ssh; host magius.ilive4code.net; }
 console dalamar { include ssh; host dalamar.ilive4code.net; }
 console tas     { include ssh; host tas.ilive4code.net; }
 console cable   { include ssh; host cable.ilive4code.net; port 5022; }
 
 ### list of clients we allow
 access * {
     allowed 127.0.0.1 172.21.100.15 magius.ilive4code.net;
     trusted 127.0.0.1;
 }
 
 ### do some server configuration
 config * {
     defaultaccess rejected;
     daemonmode on;
     logfile /var/log/conserver/conserver;
 }
 
 ##### End of conserver.cf config file.
 

Conserver Access

Sample conserver password file

$ cat conserver.passwd
root:*passwd*
bob:*passwd*
jane:*passwd*

With PAM support:

$ cat /etc/pam.d/conserver
#%PAM-1.0
auth       required     pam_stack.so service=system-auth
account    required     pam_stack.so service=system-auth
password   required     pam_stack.so service=system-auth
session    required     pam_stack.so service=system-auth
$ cat /usr/local/etc/conserver.passwd
# use the system password (which uses PAM if compiled)
*any*:*passwd*

Sample init script

##### Sample init script for Fedora
 
 #!/bin/sh
 #
 # conserver -- serial-port console daemon
 #
 # chkconfig: 2345 92 08
 # description: conserver is a serial-port console daemon
 # config: /usr/local/etc/conserver.cf
 
 # Source function library.
 . /etc/rc.d/init.d/functions
 
 # Source networking configuration.
 . /etc/sysconfig/network
 
 # Check that networking is up.
 [  ${NETWORKING} = "no" ] && exit 0
 
 # make sure conserver is installed and executable
 [ -x /usr/local/sbin/conserver  ] || exit 1
  
 # See how we were called.
 case "$1" in
   start)
     echo -n "Starting conserver: "
     daemon /usr/local/sbin/conserver -d
     echo
     touch /var/lock/subsys/conserver
     ;;
   stop)
     echo -n "Shutting down conserver: "
     killproc conserver
     echo
     rm -f /var/lock/subsys/conserver
     ;;
   status)
     status conserver
     ;;
   restart)
     echo -n "Restarting conserver: "
     killproc conserver -HUP
     echo
     ;;
   *)
     echo "Usage: conserver {start|stop|restart|status}"
     exit 1
 esac
 
 exit 0
 
 ##### End on conserver init script

RS-232 PIN Layout

References:

 
# rs232 pin layouts
# 9 pin

 |-----------|
 | 1 2 3 4 5 |
  \ 6 7 8 9 /
   \-------/

 1 - Data Carrier Con 1
 2 - Received Data 2
 3 - Transmitted Data 3
 4 - Data Terminal Ready
 5 - Signal Ground
 6 - Data Set Ready 
 7 - Request to Send
 8 - Clear to Send
 9 - Ring Indicator

Linux Console Setup

Reference: /usr/src/linux-2.4/Documentation/serial-console.txt

  1. Add the following kernel parameter at boot time:
    append = "console=ttyS0,9600"
  2. Add the following to ”/etc/securetty”:
    ttyS0
  3. Configure a getty for serial port login. This is done by adding a line like this to /etc/inittab (exact syntax depends on your getty):
    S1:23:respawn:/sbin/getty -L ttyS0 9600 vt100
  4. If exists, remove this file ”/etc/ioctl.save”

Older versions of (Xfree86, svgalib, gpm, SVGATextMode) may need configured for /dev/console

Lilo Setup

Add the following lines to lilo.conf

serial=0,9600n8
#serial=com port1, baud, parity, stop bits
append="console=ttyS0,115200 console=tty0"

Remember to run lilo after editing the config file.

Grub Setup

Reference: http://www.gnu.org/software/grub/manual/html_node/Serial-terminal.html#Serial%20terminal Add the following line to /etc/grub.conf

serial --port=0 --speed=9600 --word=8 --parity=no --stop=1

Append “console=ttyS0,115200 console=tty0” to the kernel line(s).

FreeBSD Console Setup

Changelog