Compare commits

..

21 Commits

Author SHA1 Message Date
c418af32c7 Imported from conserver-8.1.13.tar.gz 2006-01-15 09:22:12 -08:00
3cec1dde71 Imported from conserver-8.1.12.tar.gz 2005-09-05 16:15:33 -07:00
892f52dbd4 Imported from conserver-8.1.11.tar.gz 2004-11-09 01:34:27 -08:00
4ce124e121 Imported from conserver-8.1.10.tar.gz 2004-09-21 16:48:49 -07:00
faad858599 Imported from conserver-8.1.9.tar.gz 2004-07-14 16:21:13 -07:00
27475bdd30 Imported from conserver-8.1.8.tar.gz 2004-06-09 15:28:27 -07:00
c0f8de9c24 Imported from conserver-8.1.7.tar.gz 2004-05-28 11:03:33 -07:00
cf461c7ce8 Imported from conserver-8.1.6.tar.gz 2004-05-25 17:41:29 -07:00
5c430d220b Imported from conserver-8.1.5.tar.gz 2004-05-07 09:05:25 -07:00
8cd506c093 Imported from conserver-8.1.4.tar.gz 2004-04-13 13:30:28 -07:00
29b909ee59 Imported from conserver-8.1.3.tar.gz 2004-03-22 17:14:45 -08:00
aea0e2a547 Imported from conserver-8.1.2.tar.gz 2004-03-11 09:54:13 -08:00
9eed9f2d8f Imported from conserver-8.1.1.tar.gz 2004-02-10 07:26:45 -08:00
25a4dcb0fd Imported from conserver-8.1.0.tar.gz 2004-01-18 09:31:24 -08:00
75cfd02f7a Imported from conserver-8.0.9.tar.gz 2003-12-10 10:37:48 -08:00
ad7a90dd69 Imported from conserver-8.0.8.tar.gz 2003-12-02 08:40:59 -08:00
691c3102c9 Imported from conserver-8.0.7.tar.gz 2003-11-20 06:49:09 -08:00
eafae7c27d Imported from conserver-8.0.6.tar.gz 2003-11-16 11:33:39 -08:00
92cf41a9f2 Imported from conserver-8.0.5.tar.gz 2003-10-31 10:15:09 -08:00
1c188a41d6 Imported from conserver-8.0.4.tar.gz 2003-10-10 13:39:21 -07:00
aeb8ac0057 Imported from conserver-8.0.3.tar.gz 2003-10-06 10:08:22 -07:00
75 changed files with 12995 additions and 4654 deletions

269
CHANGES
View File

@ -1,6 +1,273 @@
CHANGES
=======
version 8.1.13 (Jan 15, 2006):
- use SIOCGIFNUM for interface count (if available) and catch
EINVAL on Solaris - patch by Peter Jeremy
<peter.jeremy@alcatel.com.au>
- console output now resets idle timer - suggested by Peter
Saunders <pajs@fodder.org.uk>
- bug fix for conserver process running out of control and using
up cpu - debugged with Alexandra N. Kossovsky
<Alexandra.Kossovsky@oktetlabs.ru>
version 8.1.12 (Sep 5, 2005):
- printf() fix for autologin - patch by Menno Duursma
<druiloor@zonnet.nl>
- newly spawned (from SIGHUP) processes didn't properly close
primary socket
- SSL certificates now work again (anonymous ciphers are not
allowed if a certificate is used)
- client options -x, -u, -w, and -i can now take a console name
to restrict output - suggested by Evan McClure
<emcclure@internap.com>
- convert program now installed in $libdir/conserver - patch by
Petter Reinholdtsen <pere@hungry.com>
- we now ignore SIGXFSZ, if it exists
- added 'limited' access option to remove certain functionality
from users - suggested by Sven Michels <sven@darkman.de>
- added client option -z/-Z for sending commands to servers
(reload, quit, etc) - based on suggestion by Joshua Pincus
<Joshua.Pincus@Sun.COM>
- added 'execrunas' and 'initrunas' console options to allow
'exec' and 'initcmd' execution as another user and/or group -
based on patch by Gary Mills <mills@cc.umanitoba.ca>
- the east coast mirror had to shut down (for now, at least)
- crash from bad pointer manipulation during log replay - reported by
Ryan Kirkpatrick <linux@rkirkpat.net>
version 8.1.11 (Nov 9, 2004):
- fixed array bounds and stack tromping - reported by Emmett
Hogan <hogan@bigcityit.com>
- most recent client to ask for read-write now gets it (used to
be first client to connect)
- client read-write mode now separate from console up/down state
- 'make autologin.install' now compiles autologin - reported by
Graham Merrill <teddgram@sbcglobal.net>
- new 'autocomplete' option for controlling shortest-prefix
console name matching (which has always been on)
- client now blocks on ^Eco, waiting for status of connection
- added 'a' and 'A' for upper and lowercase alphanumeric
(0-9a-z) conversions to the *subst config items - based on
patch by Jonathan Chen <jon+conserver@spock.org>
version 8.1.10 (Sep 21, 2004):
- fix "forwarding level too deep" issue with '^Ec;' - reported
by Han Pilmeyer <han.pilmeyer@hp.com>
version 8.1.9 (Jul 14, 2004):
- fixed bug processing access lists when duplicates exist in the
list - reported by Phil Dibowitz <phil@usc.edu>
- fixed bug where 'idletimeout' was not recognized in default
blocks - reported by John Cagle <jcagle@gmail.com>
- added an 'autocomplete' config option to set the console name
autocompletion behavior - suggested by John Stoffel
<stoffel@lucent.com>
version 8.1.8 (Jun 9, 2004):
- added 'initspinmax' and 'initspintimer' console options to
help calm console initialization "spinning"
- fixed setsockopt() error on 64bit solaris - reported by Trond
Hagen <trond@basefarm.no>
version 8.1.7 (May 28, 2004):
- cleaned up the manpages a bit to make things clearer and more
standard - reported by Dave Stuit <djs@tellme.com>
- added an east coast mirror! http://conserver.syr.edu/ -
thanks to Christopher T. Beers <ctbeers@syr.edu>
- primary group of users not included in '@group' syntax -
reported by Phil Dibowitz <phil@usc.edu>
- changed '@group' behavior such that groups are checked when
needed, instead of cached at startup, which is more logical
- missing variables when building convert with tcp_wrappers -
reported by Nikolaos Papavassiliou
<Nikolaos.Papavassiliou@reuters.com>
- added --with-rpath option - suggested by Phil Dibowitz
<phil@usc.edu>
version 8.1.6 (May 25, 2004):
- added ability to configure client via system-wide console.cf
file and per-user .consolerc - suggested (independently) by
Erik Sjolund <erik.sjolund@sbc.su.se> and Trevor Fiatal
<trevor@fiatal.net>
- fixed bug where break strings were not properly sent -
reported by Tim Small <tim@buttersideup.com>
- fixed bug in config file 'protocol' value handling - reported
by Kees Cook <kees@osdl.org>
- conserver no longer uses the local domain name in the default
access list (the default list is only created if no access
list is specified in the configuration file) - inspired by
William P LePera <lepera@us.ibm.com>
- added a 'terminal' console configuration block for printing
strings when attaching and detaching from consoles - suggested
by Richard Threadgill <richardt@tellme.com>
version 8.1.5 (May 7, 2004):
- changed remaining O_NDELAY flags to O_NONBLOCK
- added PROTOCOLS file to describe the client/server protocol
- added '#include' capability to conserver.cf file
- added '@group' syntax to conserver.cf file to support use of
system groups
- added -U client option to allow client to ask for encryption
but fall back to non-encrypted connections otherwise -
suggested by Mike Hendon <mike.hendon@uk.nomura.com>
- fixed bug where socket not properly deleted on exit - reported
by William P LePera <lepera@us.ibm.com>
- added 'initdelay' option for throttling startup of consoles -
suggested by Jay McCanta <mccantaj@amgen.com>
version 8.1.4 (Apr 13, 2004):
- fixed macro use in manpages to hopefully be more compatible
- removed extra newline of --MARK-- range output
- fixed bug where server -b option wasn't working - reported by
Nathan R. Hruby <nhruby@uga.edu>
- fixed client segfault when using -R, -t, -d, and -b options
- added a --with-uds configure option to have all client/server
communication happen via unix domain sockets - suggested by
William P LePera <lepera@us.ibm.com>
version 8.1.3 (Mar 22, 2004):
- fixed small memory and file descriptor leak in client when
using '^Ec;'
- '^Ec;' now only disconnects from the previous console only
after a successfully move to a new console, allowing you to
abort the move - suggested by Christopher T. Beers
<ctbeers@syr.edu>
version 8.1.2 (Mar 11, 2004):
- better handling of client command (^Ec|) when user is bumped,
conserver is reconfigured, etc
- added 'initsubst' option for 'initcmd' substitutions like
'devicesubst' and 'execsubst' - based on patch by Bill
Sommerfeld <sommerfeld@east.sun.com>
- modified and added to *subst (initsubst, etc) syntax to allow
for flexibility and future enhancement
- changed 'port' and 'portinc' minimums from 1 to 0 - it allows
more flexibility and helps with 0-based counting
- removed unportable sys/cdefs.h from contrib/chat/chat.c -
patch by Bill Sommerfeld <sommerfeld@east.sun.com>
- added --with-extmsgs configure switch to enable entertaining
messages
- marked various undocumented client commands as deprecated so
that they can be removed in a future version
- added ability to "move" to a new console via '^Ec;' -
suggested by Christopher T. Beers <ctbeers@syr.edu>
- added a dump of console information when -S is used twice -
suggested by Todd Stansell <todd@stansell.org>
version 8.1.1 (Feb 10, 2004):
- fixed mistake in Makefiles where rpmbuild fails - reported by
Martin Evans <m.d.t.evans@qmul.ac.uk>
- fixed a couple typos - reported by Matt Selsky
<selsky@columbia.edu>
version 8.1.0 (Jan 18, 2004):
- fixes for HP-UX compilation - patch by Petter Reinholdtsen
<pere@hungry.com>
- fixes for compilation under various operating systems -
patch by Albert Chin <conserver-users@mlists.thewrittenword.com>
- added a 'protocol' option for either 'telnet' or 'raw' socket
communication - also reflected in -i output
- changed the client/server protocol to use 0xff as a command
character for sending control commands - similiar to the
telnet protocol - improves the ^Ec| interaction
- client -E option now disables ssl encryption attempts, useful
for broken SSL environents - suggested by Graydon Dodson
<grdodson@lexmark.com>
- bad error message connecting non-ssl client with ssl-required
server - reported by Graydon Dodson <grdodson@lexmark.com>
- added note about pam configuration to conserver.passwd.man -
suggested by Erik Sjolund <erik.sjolund@sbc.su.se>
- improved telnet protocol option handling such that connections
to standard telnet ports should work properly
version 8.0.9 (Dec 10, 2003):
- fixed major bug in connect() handling which causes most
socket-based consoles to timeout after 10 seconds - reported
by Tom Rataski <trataski@intlsteel.com>
- added a couple details to the 'logfilemax' manpage entry
version 8.0.8 (Dec 2, 2003):
- added client ^Ec| sequence for running a command on the client
and having it's I/O directed to the console - inspired by
discussions with David Williamson
<david+conserver@williamsons.net> years ago ;-)
- touched up Makefiles to test against .h files
- fixed inability to replay the console log while the console is
down - reported by Matt Selsky <selsky@columbia.edu>
- added a console 'logfilemax' option for rotating the console
logfile once the file is greater than the specified size
- added sample configuration files to conserver.cf/samples
- tweaked some failure messages and initcmd notifications
version 8.0.7 (Nov 20, 2003):
- renamed util.[ch] to cutil.[ch] to prevent name conflict with
system util.h, reordered some #includes, and fixed a configure
test for sys/proc.h to build on OpenBSD 3.4 (and probably
others) - reported by Kurt Raschke <kurt@raschke.net>
- fixed missing semi-colon for cygwin build - reported by
Raymond Richmond <raymond.richmond@ualberta.ca>
version 8.0.6 (Nov 16, 2003):
- code was missing regarding the 'setproctitle' option - patch
by Dmitry Morozovsky <marck@rinet.ru>
- fixed the order of access list checking when
--with-trustrevdns is used
- fixed various spelling errors - patches by Matt Selsky
<selsky@columbia.edu>
- added console 'idletimeout' and 'idlestring' options to
trigger the sending of 'idlestring' after a lack of activity
for 'idletimeout' seconds - suggested by Ian Potts
<ian.potts@db.com>
- added console 'portbase' and 'portinc' options to allow
specifying a formula for referencing ports - inspired by Todd
Stansell <todd@stansell.org>
- fixed problem where console 'port' option didn't take port
names (manpage said it did)
- added server -U option and configuration option 'unifiedlog'
to allow a copy of all console activity to go to a single file
- removed all sprintf() calls
- added 'devicesubst' and 'execsubst' console options for doing
replacements with calculated port numbers on the 'device' and
'exec' values
- NULL characters in console data caused data loss because of
strlen() usage - reported by Toby Gerhart <toby.gerhart@eds.com>
- fixed a couple errors in contrib/redhat-rpm/conserver.spec -
reported by Martin Evans <m.d.t.evans@qmul.ac.uk>
- added capability to use '!' in user access lists to prevent a
user from having access - suggested by Matt Selsky
<selsky@columbia.edu>
version 8.0.5 (Oct 31, 2003):
- added 'loghostnames' config option (default is on) to log
client hostnames instead of ip addresses (like pre-8.0.0) -
suggested by Han Pilmeyer <han@zk3.dec.com>
- fixed bug where 'daemonmode' config file option wasn't being
used
- fixed potential logfile (-L) opening problem processing SIGHUP
- fixed various potential conserver.cf issues with 'config'
block values processing SIGHUP
- added 'setproctitle' config option (default is off) to enable
changing the process title to contain runtime information -
patch by Dmitry Morozovsky <marck@rinet.ru>
version 8.0.4 (Oct 10, 2003):
- fixed client rejection bug that can nearly never happen -
reported by Han Pilmeyer <han@zk3.dec.com>
- fixed bug where client is reconnected to the previous console
when non-exact console names are used - reported by Rolf
Petter Halle <rph@online.no>
- fixed bug where exact matchs on a remote console name never
happened - reported by Toby Gerhart <toby.gerhart@eds.com>
- fixed bug where SIGHUP fails to update console aliases -
reported by Han Pilmeyer <han@zk3.dec.com>
version 8.0.3 (Oct 6, 2003):
- the SIGHUP process fails to pick up changes to certain fields
because of a horribly broken SwapStr() function [broken in
all previous 8.0.x versions] - reported by Toby Gerhart
<toby.gerhart@eds.com>
version 8.0.2 (Oct 5, 2003):
- reworked the i/o calls to better buffer data
- added console 'motd' option for holding a "message of the
@ -556,5 +823,5 @@ before version 6.05:
and enhancements of various types were applied.
#
# $Id: CHANGES,v 1.115 2003-10-05 18:04:09-07 bryan Exp $
# $Id: CHANGES,v 1.212 2006/01/15 17:11:42 bryan Exp $
#

2
FAQ
View File

@ -186,5 +186,5 @@ directed to faq@conserver.com. The FAQ answers the following questions:
through the same problem?
#
# $Id: FAQ,v 1.9 2003-08-23 12:27:10-07 bryan Exp $
# $Id: FAQ,v 1.9 2003/08/23 19:27:10 bryan Exp $
#

41
INSTALL
View File

@ -10,6 +10,25 @@ Upgrading?
new features added to the client if you're considering *not*
upgrading.
Version 8.1.3
- The '^Ec;' sequence won't work correctly with 8.1.2 (where it
was introduced).
Version 8.1.2
- The 'devicesubst' and 'execsubst' formats have changed from
8.1.1. It's fairly simple to update your config file to the
new format...just check the conserver.cf manpage. Sorry for
having to change things, but it's for a good reason (I should
have though ahead when designing the original format).
Version 8.1.0
- The client/server protocol has changed to better protect 8-bit
data and to allow programs invoked with '^Ec|' not have to
worry about accidentally sending the escape sequence to the
server. Though it will look like things are mostly
backward-compatible, don't count on it and just upgrade.
Version 8.0.2
- I've added a '^Ec;' sequence to allow the client to signal the
@ -146,6 +165,9 @@ Detailed Instructions
--with-maxmemb=MAXMEMB Specify maximum consoles per process [16]
--with-timeout=TIMEOUT Specify connect() timeout in seconds [10]
--with-trustrevdns Trust reverse DNS information
--with-extmsgs Produce extended messages
--with-uds[=DIR] Use Unix domain sockets for client/server
communication [/tmp/conserver]
--with-libwrap[=PATH] Compile in libwrap (tcp_wrappers) support
--with-openssl[=PATH] Compile in OpenSSL support
--with-dmalloc[=PATH] Compile in dmalloc support
@ -163,10 +185,11 @@ Detailed Instructions
A couple of notes. First, --with-libwrap will add tcp_wrappers
lookups to all socket connections in the server. --with-openssl
will add encryption between the client and server when you connect
to a console. things such as 'console -q', 'console -w', etc. are
still unencrypted, as well as connections from conserver to any
terminal servers. --with-dmalloc should only be used to do memory
allocation debugging and not used in production.
to a console. --with-uds will cause the client and server to use
unix domain sockets for their communication, eliminating the
tcp communication they normally do (which means --with-master and
--with-port are not used). --with-dmalloc should only be used to
do memory allocation debugging and not used in production.
- Run './configure'. This will detect system specific
information. The --prefix option will redirect where things are
@ -205,10 +228,10 @@ Detailed Instructions
step.
+ Next, make sure conserver runs during boot. The init script we
use under Solaris is installed in <PREFIX>/etc/conserver.rc.
Use that or some form of it for your own /etc/init.d script or
an entry in startup files (/etc/rc, /etc/rc.local, or
whatever).
use under Solaris is installed in
<DATADIR>/examples/conserver/conserver.rc. Use that or some
form of it for your own /etc/init.d script or an entry in
startup files (/etc/rc, /etc/rc.local, or whatever).
+ Now for the fun stuff. You need to create a conserver.cf and
conserver.passwd file. Those are defined with the
@ -255,5 +278,5 @@ Other Information And Gotchas
#
# $Id: INSTALL,v 1.34 2003-10-03 10:52:31-07 bryan Exp $
# $Id: INSTALL,v 1.39 2005/05/21 13:47:16 bryan Exp $
#

306
PROTOCOL Normal file
View File

@ -0,0 +1,306 @@
Conserver Protocol
==================
What Is This?
-------------
The following is an attempt to describe the client/server protocol used
between the server (conserver) and the client (console). This document
bases it's information on conserver version 8.1.4, as it's the release
currently available. If there are changes to the client/server
protocol, the INSTALL file should reference them and, ideally, this
document will be updated.
The information is looked at from the point of the server, since it's
the server that controls all information and triggers actions on the
client (like a suspend). The client's perspective should be obvious
from this information.
SSL
---
The client and server can negotiate an SSL connection. As far as the
code is concerned, the SSL "layer" is transparent. Data is sent and
received just as if it was unencrypted. Therefore, aside bringing up
the SSL connection, the SSL bits are unimportant from a protocol
standpoint. The client and server still send and receive the same
information - it just happens to be encrypted to everyone else.
"On-The-Wire" Data
------------------
The low-level, "on-the-wire" data is encapsulated similar to the telnet
protocol. All data is sent "as-is" with the exception of 0xFF. 0xFF is
used as a "command character" and both the client and server expect to
see a predefined option after it. The possible options are: 0xFF, 'E',
'G', 'Z', and '.'.
The 0xFF option says to use the literal character 0xFF. So, if there is
a 0xFF character in the data stream to be sent, the code will send two
0xFF characters (it's similar to using '\\' in C strings to embed a
'\').
The other options are used in various contexts, which will be described
in detail below.
Life As A Server
----------------
There are three different interfaces presented to clients by the server.
I'm going to name the three modes "master", "group", and "console". The
first two are line-based, and the third is character-based.
To understand the differences, I must outline how conserver manages
consoles. When conserver starts, it reads the configuration file,
listens on the master socket, and, for each group of consoles it must
manage (where the group size is set by -m), it forks off a copy of
itself. Those child processes are what actually connect to the consoles
and they each listen on a new socket for client connections. So, you
end up with a parent process (that knows about all consoles) that
manages the child processes (that know only about consoles it manages),
and everyone is listening on an individual socket for connections from
clients.
The parent process interacts with clients in "master" mode. That mode
expects line-based commands and responds similarly. Because it's the
master, it understands a certain set of commands that are different than
in "group" mode.
The child processes interact with clients in "group" mode first, and
negotiate a change to "console" mode when a client requests a connection
to a specific console.
"master" Mode
-------------
When parent process gets a connection from a client, it either sends an
"ok" string to signal it's ready or an error message (like "access from
your host is refused") and the connection is dropped. At this point,
there are a small number of commands recognized by the server, since
most are restricted to "logged in" clients. Here's the list of
available commands:
exit disconnect
help this help message
login log in
ssl start ssl session
An "exit" is sent a "goodbye" response and the connection is dropped. A
"help" is sent the list above. A "ssl" is sent an "ok" response and
then the server expects the client to negotiate an ssl connection. A
"login" requires one argument (the username) and is either sent an "ok",
meaning the client is logged in, or a "passwd?" followed by the local
hostname, asking for the user's password, which it expects next. If the
client sends a valid password, an "ok" is sent, otherwise an error
message and the connection is dropped.
Upon successful login, the commands available are:
call provide port for given console
exit disconnect
groups provide ports for group leaders
help this help message
master provide a list of master servers
newlogs* close and open all logfiles (SIGUSR2)
pid provide pid of master process
quit* terminate conserver (SIGTERM)
restart* restart conserver (SIGHUP) - deprecated
reconfig* reread config file (SIGHUP)
version provide version info for server
up* bring up all downed consoles (SIGUSR1)
* = requires admin privileges
"exit" and "help" are the same as before the client logged login.
The "call" command expects one argument, the console name to connect to.
The server will respond with either a port number (if it's a locally
managed console), an "@hostname" where hostname is the name of the
remote conserver host managing the console (if it's a remotely managed
console), or an error message (possibly multi-line). The client is not
disconnected, whatever the response.
The "groups" command responds with a colon-separated list of port
numbers, which correspond to each of the child processes running on the
local host. The client is not disconnected.
The "master" command responds with a colon-separated list of "@hostname"
names. The list includes any hosts (including the possibility of the
local host) which have locally managed consoles. The client is not
disconnected.
The "newlogs" command reopens all logfiles used by conserver, assuming
the user has administrative access. It responds with a message starting
with "ok" if successful and an error message otherwise (like
"unauthorized command"). The client is disconnected if it's successful.
The "pid" command responds with the pid of the master process (in this
case, the one the client is talking to). The client is not
disconnected.
The "quit" command will shut down conserver, assuming the user has
administrative access. It responds with a message starting with "ok" if
successful and an error message otherwise (like "unauthorized command").
The client is disconnected if it's successful.
The "restart" command has been deprecated. You should use "reconfig".
The "reconfig" command will cause conserver to reread the configuration
file and apply any changes, assuming the user has administrative access.
It responds with a message starting with "ok" if successful and an error
message otherwise (like "unauthorized command"). The client is not
disconnected.
The "version" command responds with the version string. The client is
not disconnected.
The "up" command tries to "bring up" all disconnected consoles, assuming
the user has administrative access. It responds with a message starting
with "ok" if successful and an error message otherwise (like
"unauthorized command"). The client is disconnected if it's successful.
"group" Mode
------------
When a child process gets a connection from a client, it either sends an
"ok" string to signal it's ready or an error message (like "access from
your host is refused") and the connection is dropped. At this point,
"group" mode acts just like "master" mode. Once the client successfully
logs in, however, "group" mode has the recognizes the following
commands:
broadcast send broadcast message
call connect to given console
disconnect* disconnect the given user(s)
examine examine port and baud rates
exit disconnect
group show users in this group
help this help message
hosts show host status and user
info show console information
textmsg send a text message
* = requires admin privileges
The "exit" and "help" commands are like the others documented above.
The "broadcast" command expects a text string of the message to be sent
to all users connected to this process. An "ok" is sent as a response.
The "call" command expects one argument, the console name to connect to,
just like in "master" mode. The difference here is that this requests
the server to attach the client to the console and go into "console"
mode. If the attachment is successful, the response will begin with a
'[' character. If not, an error message is returned. The success
responses are:
[console is read-only] - console is read only
[read-only -- initializing] - console is initializing, and
read-only for the time being
[line to console is down] - console is down
[attached] - attached read-write
[spy] - attached read-only
The "disconnect" command expects an argument of the form "user@console"
where either the "user" or "@console" part may be omitted. Upon
success, a response of the form "ok -- disconnected X users" is sent,
where X is the number of users disconnected. If a user is unauthorized
or some other problem occurs, an error message (like "unauthorized
command") is sent.
The "examine" command returns a list of console information of the form
that 'console -x' shows.
The "group" command returns a list of console information of the form
that 'console -w' shows.
The "hosts" command returns a list of console information of the form
that 'console -u' shows.
The "info" command returns a list of console information of the form
that 'console -i' shows.
The "textmsg" command expects two arguments, the first being the
recipient of the message in the form "user@console" (again, where the
"user" or "@console" portion may be omitted) and the second being the
string, like the "broadcast" command. The server returns "ok".
"console" Mode
--------------
As mentioned above, "console" mode is obtained by using the "call"
command when connected to a child processes operating in "group" mode.
"console" mode should look very familiar to a user of conserver, as it's
what the user interacts with when connected to a console. There's
really nothings special here. Each character received from the client
is compared to the escape sequence, and if it matches, an action occurs
on the server side. If it doesn't match the escape sequence, the data
is sent on to the console. All data received from the console is sent
to the client(s). Of course, there are certain exceptions to these
rules, based on the state of the console and the state of the client.
And, certain escape sequences cause special behaviors to occur.
Most escape sequences cause the server to send information back to the
user. Stuff like "^Ecw", "^Eci", and "^Ecu" are examples. The escape
sequence is absorbed by the server, the server sends the client a
variety of information, and things continue as before.
The more "interesting" escape sequences are the following.
"^Ec;" The server sends a 0xFF,'G' command sequence to the client, to
signal a wish to move to a new console. The client then gets
put into the same state as the "^Ecz" sequence (paused), which
gives the client a chance to either resume the connection or
disconnect.
"^Ec|" The server sends a 0xFF,'E' command sequence to the client, to
signal a wish to have the client program interact with a
program, as opposed to the user. The server discards all data
until it receives one of the following command sequences from
the client:
0xFF,'E' Signals successful redirection of interaction to
a program. The server then responds with "[rw]"
or "[ro]" to tell the client whether or not they
have read-write access. If not, the client
should abort the program and send the abort
command sequence below, as other data received by
the server will just get dropped.
0xFF,'.' Abort the operation. The server assumes the
redirection didn't happen and returns the client
to it's normal mode.
The server keeps the client in the "redirected" state until it
receives a 0xFF,'.' command sequence from the client (which
usually occurs when the client command terminates).
If the client is "bumped" from read-write to read-only by
another user, the server will send the client a 0xFF,'.' command
sequence to tell it to abort the redirection and return control
back to the user.
"^Ecz" The server sends a 0xFF,'Z' command sequence to the client, to
signal a wish to suspend to client process. The client is then
put into a "paused" state where it receives no more data from
the server. When the client is ready to resume receiving data,
it sends a character of data to the server, at which point the
server discards the character and sends back a status message of
the form " -- MSG]". The current set of possible messages are:
" -- line down]"
" -- read-only]"
" -- attached (nologging)]"
" -- attached]"
" -- spy mode]"
#
# $Id: PROTOCOL,v 1.2 2005/09/05 21:54:03 bryan Exp $
#

8
README
View File

@ -16,6 +16,12 @@ Documentation
Downloading
The latest version can be found at http://www.conserver.com/
(US-West).
Mirrors of the site are at:
Australia http://planetmirror.com/pub/conserver/
Russia http://conserver.rinet.ru/
Systems Tested
@ -55,5 +61,5 @@ Contributions
http://www.columbia.edu/acis/sy/unixdev/zinc
#
# $Id: README,v 1.22 2003-08-23 12:34:24-07 bryan Exp $
# $Id: README,v 1.24 2005/09/05 21:46:43 bryan Exp $
#

51
TODO
View File

@ -10,17 +10,11 @@ Bryan Stansell
---------------------------------------------------------------------------
- Singular logging so that swatch/logsurfer can watch for errors across
the board - unloved output comes close
- Telnet protocol should be improved
- Not even RFC 854 compliant
- Option negotiation ignored - should we negotiate anything?
- Not even RFC 854 compliant...or maybe it is (as of 8.1.0)
- Option negotiation semi-ignored - should we negotiate anything more?
- Others?
- better shadow file support
- what does this mean? i've forgotten.
- syslog?
Daniel E. Singer <des@cs.duke.edu> would like to see it - especially
in regards to --use-libwrap code
@ -30,14 +24,20 @@ Bryan Stansell
- hpux has bigcrypt() also, which we support, so maybe we're covered
- config file examples for various configurations
- sample conserver.cf has some...but it's not explained well
- per-line timestamps
- only when not connected?
- pipe input/output (console <-> program) via 'console'
- some apps (net-ups thing, gdb) might need to talk to user
- ^Ec| does this, but the interact with user bits might not work
- actually, ^Ec| does work right with 8.1.0...one change that might
be nice is the ability to NOT watch the i/o pass to the local
command - try sending a big file to the local host with xmodem.
- autologout? setting per console? gack, would have to interpret data.
- this will never happen...i don't want to interpret data
- "listen" capability (watch all/multiple consoles)
@ -50,6 +50,7 @@ Bryan Stansell
- passphrase...hmmm..could really use some sort of send/expect
thing here. you could write a wrapper script of sorts, but it
really would be nice to have a raw socket and do the right thing.
- this does work, using the 'initcmd' option, so, all done?
- cyclades ts1000/2000 port : "Moses, Joel" <jmoses@deloitte.com>
@ -61,8 +62,7 @@ Bryan Stansell
- server -M flag should accept multiple addresses (comma separated)
- should client as well?
- logfile rotation based on size
- this may never happen...does anyone really need it?
- automatic log rotation in general : Egan Ford <egan@us.ibm.com>
@ -73,6 +73,7 @@ Bryan Stansell
- suggestions by Trevor Fiatal <trevor@seven.com>
- include server hostname on 'console -x' output
- i think the -i output covers it, but maybe not
- ability to configure strings to be sent to a console periodically :
Greg A. Woods <woods@planix.com>
@ -80,6 +81,34 @@ Bryan Stansell
- show attach/detach events to/of spy console clients : Greg A. Woods
<woods@planix.com>
- redefine client escape sequence in conserver.cf : Toby Gerhart
<toby.gerhart@eds.com>
- not even sure if this is possible w/o confusing the client,
but maybe with the new 8.1.0 client-server protocol, we can!
- allow for very long replays (hundres of lines) : John Stoffel
<stoffel@lucent.com>
- log rotation by date : Tom Pachla <tom.pachla@nlc-bnc.ca>
- strict file permission checks on conserver.passwd/conserver.cf : Erik
Sjolund <erik.sjolund@sbc.su.se>
- netgroup support? : Nikolaos Papavassiliou
<Nikolaos.Papavassiliou@reuters.com> and Phil Dibowitz <phil@usc.edu>
- send sequences to console on client connect? (to repaint screen,
for example) : John Cagle <jcagle@gmail.com>
- uucp locks : Sebastian Zagrodzki <sebek@heron.net.icm.edu.pl>
- support more than 9 break sequences : Danish Mirza <Danish@lehman.com>
thought it was easy, but adding more than could break things with
current encoding. doable, will have to think harder about it.
- reintroduce console grouping : Martin Turba
<martin.turba@igd.fraunhofer.de>
#
# $Id: TODO,v 1.37 2003-09-28 12:23:23-07 bryan Exp $
# $Id: TODO,v 1.55 2005/06/06 23:02:36 bryan Exp $
#

View File

@ -1,4 +1,4 @@
# $Id: INSTALL,v 1.3 94/07/11 12:38:19 ksb Exp $
# $Id: INSTALL.old,v 1.1 2003/11/04 02:36:24 bryan Exp $
To install this program you need root access and access to the physical
console of the machine (either through the console server or via the physical

View File

@ -31,6 +31,8 @@ ALL = autologin
all: $(ALL)
$(AUTOLOGIN_OBJS): $(AUTOLOGIN_HDRS)
autologin: $(AUTOLOGIN_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o autologin $(AUTOLOGIN_OBJS) $(LIBS)
@ -43,7 +45,7 @@ clean:
distclean: clean
rm -f Makefile
install:
install: autologin
$(MKDIR) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) autologin $(DESTDIR)$(bindir)

View File

@ -17,5 +17,5 @@ Good luck.
Bryan Stansell
#
# $Id: README,v 1.2 2002-09-23 14:08:42-07 bryan Exp $
# $Id: README,v 1.2 2002/09/23 21:08:42 bryan Exp $
#

View File

@ -1,4 +1,4 @@
# $Id: README,v 1.3 93/04/21 16:13:37 ksb Exp $
# $Id: README.old,v 1.1 2003/11/04 02:36:24 bryan Exp $
This program can be used to put a root shell on the console at boot time.
See the manual page.

View File

@ -69,7 +69,7 @@
*/
#ifndef lint
char *rcsid = "$Id: autologin.c,v 1.23 2002-09-20 23:29:39-07 bryan Exp $";
char *rcsid = "$Id: autologin.c,v 1.24 2004/12/12 07:36:07 bryan Exp $";
#endif /* not lint */
extern char *progname;
gid_t awGrps[NGROUPS_MAX];
@ -126,7 +126,7 @@ Process()
#if defined(HAVE_BSM_AUDIT_H) && defined(HAVE_LIBBSM)
if (0 != gethostname(my_hostname, sizeof(my_hostname))) {
(void) fprintf(stderr, "%s: gethostname: %s\n", strerror(errno));
(void) fprintf(stderr, "%s: gethostname: %s\n", progname, strerror(errno));
exit(1);
/* NOTREACHED */
}

View File

@ -1,7 +1,7 @@
# mkcmd parser for autologin program
%%
static char *rcsid =
"$Id: autologin.m,v 1.2 92/07/28 13:18:34 ksb Exp $";
"$Id: autologin.m,v 1.1 2003/11/04 02:36:24 bryan Exp $";
%%
integer variable "iErrs" {

View File

@ -1,4 +1,4 @@
.\" $Id: autologin.man,v 1.3 93/03/16 16:41:45 ksb Exp $
.\" $Id: autologin.man,v 1.2 2004/03/23 18:32:06 bryan Exp $
.TH AUTOLOGIN 8L PUCC
.SH NAME
autologin \- create an automatic login session from /etc/inittab
@ -112,12 +112,21 @@ environment variable set to
ss10:2:respawn:/usr/local/etc/autologin \-e TERM=reg20 \-t/dev/tty10 \-lssinfo
.ad
.PP
Adding the following line to \fI/etc/ttytab\fP on a Sun 4.1.\fIx\fP
Adding the following line to
.I /etc/ttytab
on a Sun
.RI 4.1. x
machine establishes a root login on the console device:
.br
.na
console "/usr/local/etc/autologin \-lroot \-t" xterm on local secure
.ad
Note that \fIinit\fP provides the \fItty\fP argument on the end of the command.
.PP
Note that
.I init
provides the
.I tty
argument on the end of the command.
.SH FILES
/bin/su
.br

View File

@ -80,7 +80,7 @@ char **nargv, *ostr;
#endif /* ! HAVE_GETOPT */
char
*progname = "$Id$",
*progname = "$Id: main.c,v 1.1 2003/11/04 02:36:24 bryan Exp $",
*au_terse[] = {
" [-u] [-c cmd] [-e env=value] [-g group] [-l login] [-t tty]",
" -h",
@ -111,7 +111,7 @@ int
#endif
static char *rcsid =
"$Id: autologin.m,v 1.2 92/07/28 13:18:34 ksb Exp $";
"$Id: main.c,v 1.1 2003/11/04 02:36:24 bryan Exp $";
/*
* parser

View File

@ -7,8 +7,11 @@
#include <sys/file.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#if USE_UNIX_DOMAIN_SOCKETS
#include <sys/un.h>
#endif
#include <arpa/inet.h>
#include <netdb.h>
#include <ctype.h>
#include <signal.h>
@ -287,6 +290,10 @@ typedef int socklen_t;
#define ONLRET 0
#endif
#ifndef SEEK_SET
#define SEEK_SET L_SET
#endif
#ifndef PARAMS
# if PROTOTYPES
# define PARAMS(protos) protos

625
config.guess vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,8 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* Client config file path */
#undef CLIENTCONFIGFILE
/* Config file path */
#undef CONFIGFILE
@ -57,6 +60,9 @@
/* Define to 1 if you have the `getspnam' function. */
#undef HAVE_GETSPNAM
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the `getuserattr' function. */
#undef HAVE_GETUSERATTR
@ -144,6 +150,9 @@
/* Define to 1 if you have the `setpgrp' function. */
#undef HAVE_SETPGRP
/* Define to 1 if you have the `setproctitle' function. */
#undef HAVE_SETPROCTITLE
/* Define to 1 if you have the `setsid' function. */
#undef HAVE_SETSID
@ -204,6 +213,9 @@
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/proc.h> header file. */
#undef HAVE_SYS_PROC_H
@ -318,9 +330,18 @@
/* Defined if we trust reverse DNS */
#undef TRUST_REVERSE_DNS
/* Directory for Unix domain sockets */
#undef UDSDIR
/* Defined if we produce extended messages */
#undef USE_EXTENDED_MESSAGES
/* use tcp_wrappers libwrap */
#undef USE_LIBWRAP
/* Defined if we use Unix domain sockets */
#undef USE_UNIX_DOMAIN_SOCKETS
/* Define to 1 if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
@ -334,6 +355,9 @@
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define to `int' if <sys/types.h> does not define. */
#undef mode_t
@ -342,3 +366,9 @@
/* Define if <signal.h> does not define sig_atomic_t */
#undef sig_atomic_t
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t

194
config.sub vendored
View File

@ -1,9 +1,9 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
timestamp='2003-08-18'
timestamp='2006-01-02'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -21,14 +21,15 @@ timestamp='2003-08-18'
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
#
@ -70,7 +71,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@ -83,11 +84,11 @@ Try \`$me --help' for more information."
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit 0 ;;
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit 0 ;;
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
@ -99,7 +100,7 @@ while test $# -gt 0 ; do
*local*)
# First pass through any local machine types.
echo $1
exit 0;;
exit ;;
* )
break ;;
@ -118,7 +119,9 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@ -144,7 +147,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis)
-apple | -axis | -knuth | -cray)
os=
basic_machine=$1
;;
@ -169,6 +172,10 @@ case $os in
-hiux*)
os=-hiuxwe2
;;
-sco6)
os=-sco5v6
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@ -185,6 +192,10 @@ case $os in
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@ -230,13 +241,14 @@ case $basic_machine in
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| m32r | m68000 | m68k | m88k | mcore \
| m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@ -245,30 +257,37 @@ case $basic_machine in
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| mt \
| msp430 \
| ns16k | ns32k \
| openrisc | or32 \
| or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| we32k \
| x86 | xscale | xstormy16 | xtensa \
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
basic_machine=$basic_machine-unknown
;;
m32c)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
@ -276,6 +295,9 @@ case $basic_machine in
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
ms1)
basic_machine=mt-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
@ -296,9 +318,9 @@ case $basic_machine in
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
| bs2000-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| clipper-* | cydra-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
@ -306,9 +328,9 @@ case $basic_machine in
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| m32r-* \
| m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
| m88110-* | m88k-* | maxq-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@ -317,33 +339,40 @@ case $basic_machine in
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
| xtensa-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa-* \
| ymp-* \
| z8k-*)
;;
m32c-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
@ -360,6 +389,9 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
@ -377,6 +409,9 @@ case $basic_machine in
amd64)
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
@ -436,12 +471,27 @@ case $basic_machine in
basic_machine=j90-cray
os=-unicos
;;
craynv)
basic_machine=craynv-cray
os=-unicosmp
;;
cr16c)
basic_machine=cr16c-unknown
os=-elf
;;
crds | unos)
basic_machine=m68k-crds
;;
crisv32 | crisv32-* | etraxfs*)
basic_machine=crisv32-axis
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
@ -464,6 +514,10 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
@ -642,10 +696,6 @@ case $basic_machine in
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
mmix*)
basic_machine=mmix-knuth
os=-mmixware
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
@ -658,6 +708,9 @@ case $basic_machine in
basic_machine=i386-pc
os=-msdos
;;
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
mvs)
basic_machine=i370-ibm
os=-mvs
@ -726,10 +779,6 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
nv1)
basic_machine=nv1-cray
os=-unicosmp
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@ -737,9 +786,12 @@ case $basic_machine in
basic_machine=hppa1.1-oki
os=-proelf
;;
or32 | or32-*)
openrisc | openrisc-*)
basic_machine=or32-unknown
os=-coff
;;
os400)
basic_machine=powerpc-ibm
os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
@ -766,6 +818,12 @@ case $basic_machine in
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pc98)
basic_machine=i386-pc
;;
pc98-*)
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
@ -822,6 +880,10 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
rdos)
basic_machine=i386-pc
os=-rdos
;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
@ -961,6 +1023,10 @@ case $basic_machine in
tower | tower-32)
basic_machine=m68k-ncr
;;
tpf)
basic_machine=s390x-ibm
os=-tpf
;;
udi29k)
basic_machine=a29k-amd
os=-udi
@ -1004,6 +1070,10 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
xbox)
basic_machine=i686-pc
os=-mingw32
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
@ -1034,6 +1104,9 @@ case $basic_machine in
romp)
basic_machine=romp-ibm
;;
mmix)
basic_machine=mmix-knuth
;;
rs6000)
basic_machine=rs6000-ibm
;;
@ -1050,13 +1123,10 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
sparc | sparcv9 | sparcv9b)
sparc | sparcv8 | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
cydra)
@ -1129,19 +1199,23 @@ case $os in
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@ -1159,7 +1233,7 @@ case $os in
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
@ -1180,6 +1254,9 @@ case $os in
-opened*)
os=-openedition
;;
-os400*)
os=-os400
;;
-wince*)
os=-wince
;;
@ -1201,6 +1278,9 @@ case $os in
-atheos*)
os=-atheos
;;
-syllable*)
os=-syllable
;;
-386bsd)
os=-bsd
;;
@ -1223,6 +1303,9 @@ case $os in
-sinix*)
os=-sysv4
;;
-tpf*)
os=-tpf
;;
-triton*)
os=-sysv3
;;
@ -1259,6 +1342,9 @@ case $os in
-kaos*)
os=-kaos
;;
-zvmoe)
os=-zvmoe
;;
-none)
;;
*)
@ -1336,9 +1422,15 @@ case $basic_machine in
*-be)
os=-beos
;;
*-haiku)
os=-haiku
;;
*-ibm)
os=-aix
;;
*-knuth)
os=-mmixware
;;
*-wec)
os=-proelf
;;
@ -1471,9 +1563,15 @@ case $basic_machine in
-mvs* | -opened*)
vendor=ibm
;;
-os400*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-tpf*)
vendor=ibm
;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
@ -1498,7 +1596,7 @@ case $basic_machine in
esac
echo $basic_machine$os
exit 0
exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)

2071
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,7 @@ AH_TEMPLATE([DEFPORT], [Socket used to communicate])
AH_TEMPLATE([DEFBASEPORT], [Base socket used for secondary channel])
AH_TEMPLATE([MASTERHOST], [Hostname of console server])
AH_TEMPLATE([CONFIGFILE], [Config file path])
AH_TEMPLATE([CLIENTCONFIGFILE], [Client config file path])
AH_TEMPLATE([PASSWDFILE], [Password file path])
AH_TEMPLATE([LOGFILEPATH], [Logfile path])
AH_TEMPLATE([MAXMEMB], [Number of consoles per child process])
@ -16,9 +17,13 @@ AH_TEMPLATE([HAVE_OPENSSL], [have openssl support])
AH_TEMPLATE([HAVE_DMALLOC], [have dmalloc support])
AH_TEMPLATE([HAVE_SA_LEN],[Defined if sa_len member exists in struct sockaddr])
AH_TEMPLATE([TRUST_REVERSE_DNS],[Defined if we trust reverse DNS])
AH_TEMPLATE([USE_EXTENDED_MESSAGES],[Defined if we produce extended messages])
AH_TEMPLATE([USE_UNIX_DOMAIN_SOCKETS],[Defined if we use Unix domain sockets])
AH_TEMPLATE([UDSDIR], [Directory for Unix domain sockets])
dnl ### Normal initialization. ######################################
AC_INIT
AC_PREREQ(2.59)
AC_CONFIG_SRCDIR([conserver/main.c])
AC_CONFIG_HEADER(config.h)
@ -48,7 +53,7 @@ dnl AC_MSG_RESULT($with_64bit)
AC_MSG_CHECKING(for port number specification)
AC_ARG_WITH(port,
AC_HELP_STRING([--with-port=PORT],[Specify port number @<:@conserver@:>@]),
AS_HELP_STRING([--with-port=PORT],[Specify port number @<:@conserver@:>@]),
[case "$withval" in
yes|no)
AC_DEFINE_UNQUOTED(DEFPORT, "conserver")
@ -64,7 +69,7 @@ AC_ARG_WITH(port,
AC_MSG_CHECKING(for secondary channel base port)
AC_ARG_WITH(base,
AC_HELP_STRING([--with-base=PORT], [Base port for secondary channel @<:@0@:>@]),
AS_HELP_STRING([--with-base=PORT], [Base port for secondary channel @<:@0@:>@]),
[case "$withval" in
yes|no)
AC_DEFINE_UNQUOTED(DEFBASEPORT, "0")
@ -80,7 +85,7 @@ AC_ARG_WITH(base,
AC_MSG_CHECKING(for master conserver hostname)
AC_ARG_WITH(master,
AC_HELP_STRING([--with-master=MASTER],[Specify master server hostname @<:@console@:>@]),
AS_HELP_STRING([--with-master=MASTER],[Specify master server hostname @<:@console@:>@]),
[case "$withval" in
yes|no)
AC_DEFINE_UNQUOTED(MASTERHOST, "console")
@ -94,9 +99,29 @@ AC_ARG_WITH(master,
[AC_DEFINE_UNQUOTED(MASTERHOST, "console")
AC_MSG_RESULT('console')])
AC_MSG_CHECKING(for client configuration filename)
AC_ARG_WITH(ccffile,
AS_HELP_STRING([--with-ccffile=CFFILE],[Specify client config filename @<:@SYSCONFDIR/console.cf@:>@]),
[case "$withval" in
yes|no)
AC_DEFINE_UNQUOTED(CLIENTCONFIGFILE, [SYSCONFDIR "/console.cf"])
AC_MSG_RESULT('$sysconfdir/console.cf')
;;
[[\\/]]* | ?:[[\\/]]* )
AC_DEFINE_UNQUOTED(CLIENTCONFIGFILE, ["$withval"])
AC_MSG_RESULT('$withval')
;;
*)
AC_DEFINE_UNQUOTED(CLIENTCONFIGFILE, [SYSCONFDIR "/$withval"])
AC_MSG_RESULT('$sysconfdir/$withval')
;;
esac],
[AC_DEFINE_UNQUOTED(CLIENTCONFIGFILE, [SYSCONFDIR "/console.cf"])
AC_MSG_RESULT('$sysconfdir/console.cf')])
AC_MSG_CHECKING(for configuration filename)
AC_ARG_WITH(cffile,
AC_HELP_STRING([--with-cffile=CFFILE],[Specify config filename @<:@SYSCONFDIR/conserver.cf@:>@]),
AS_HELP_STRING([--with-cffile=CFFILE],[Specify config filename @<:@SYSCONFDIR/conserver.cf@:>@]),
[case "$withval" in
yes|no)
AC_DEFINE_UNQUOTED(CONFIGFILE, [SYSCONFDIR "/conserver.cf"])
@ -116,7 +141,7 @@ AC_ARG_WITH(cffile,
AC_MSG_CHECKING(for password filename)
AC_ARG_WITH(pwdfile,
AC_HELP_STRING([--with-pwdfile=PWDFILE],[Specify password filename @<:@SYSCONFDIR/conserver.passwd@:>@]),
AS_HELP_STRING([--with-pwdfile=PWDFILE],[Specify password filename @<:@SYSCONFDIR/conserver.passwd@:>@]),
[case "$withval" in
yes|no)
AC_DEFINE_UNQUOTED(PASSWDFILE, [SYSCONFDIR "/conserver.passwd"])
@ -136,7 +161,7 @@ AC_ARG_WITH(pwdfile,
AC_MSG_CHECKING(for log filename)
AC_ARG_WITH(logfile,
AC_HELP_STRING([--with-logfile=LOGFILE],[Specify log filename @<:@/var/log/conserver@:>@]),
AS_HELP_STRING([--with-logfile=LOGFILE],[Specify log filename @<:@/var/log/conserver@:>@]),
[case "$withval" in
yes|no)
AC_DEFINE_UNQUOTED(LOGFILEPATH, "/var/log/conserver")
@ -153,7 +178,7 @@ AC_ARG_WITH(logfile,
AC_SUBST(PIDFILE)
AC_MSG_CHECKING(for PID filename)
AC_ARG_WITH(pidfile,
AC_HELP_STRING([--with-pidfile=PIDFILE],[Specify PID filepath @<:@/var/run/conserver.pid@:>@]),
AS_HELP_STRING([--with-pidfile=PIDFILE],[Specify PID filepath @<:@/var/run/conserver.pid@:>@]),
[case "$withval" in
yes|no)
PIDFILE="/var/run/conserver.pid"
@ -168,7 +193,7 @@ AC_MSG_RESULT('$PIDFILE')
AC_MSG_CHECKING(for MAXMEMB setting)
AC_ARG_WITH(maxmemb,
AC_HELP_STRING([--with-maxmemb=MAXMEMB],[Specify maximum consoles per process @<:@16@:>@]),
AS_HELP_STRING([--with-maxmemb=MAXMEMB],[Specify maximum consoles per process @<:@16@:>@]),
[case "$withval" in
yes|no)
AC_DEFINE_UNQUOTED(MAXMEMB, 16)
@ -190,7 +215,7 @@ AC_ARG_WITH(maxmemb,
AC_MSG_CHECKING(for connect() timeout)
AC_ARG_WITH(timeout,
AC_HELP_STRING([--with-timeout=TIMEOUT],[Specify connect() timeout in seconds @<:@10@:>@]),
AS_HELP_STRING([--with-timeout=TIMEOUT],[Specify connect() timeout in seconds @<:@10@:>@]),
[if expr "$withval" : '[[0-9]]*$' >/dev/null 2>&1 &&
test "$withval" -gt 0 -a "$withval" -lt 300; then
AC_DEFINE_UNQUOTED(CONNECTTIMEOUT, $withval)
@ -204,7 +229,7 @@ AC_ARG_WITH(timeout,
AC_MSG_CHECKING(whether to trust reverse DNS)
AC_ARG_WITH(trustrevdns,
AC_HELP_STRING([--with-trustrevdns],[Trust reverse DNS information]),
AS_HELP_STRING([--with-trustrevdns],[Trust reverse DNS information]),
[case "$withval" in
yes)
AC_DEFINE(TRUST_REVERSE_DNS)
@ -215,6 +240,63 @@ AC_ARG_WITH(trustrevdns,
;;
esac],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(whether to display extended messages)
AC_ARG_WITH(extmsgs,
AS_HELP_STRING([--with-extmsgs],[Produce extended messages]),
[case "$withval" in
yes)
AC_DEFINE(USE_EXTENDED_MESSAGES)
AC_MSG_RESULT(yes)
;;
*)
AC_MSG_RESULT(no)
;;
esac],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(whether to use Unix domain sockets)
cons_with_uds="NO"
AC_ARG_WITH(uds,
AS_HELP_STRING([--with-uds@<:@=DIR@:>@ ],
[Use Unix domain sockets for client/server communication @<:@/tmp/conserver@:>@]),
[case "$withval" in
yes)
AC_DEFINE_UNQUOTED(UDSDIR, "/tmp/conserver")
AC_DEFINE(USE_UNIX_DOMAIN_SOCKETS)
AC_MSG_RESULT([/tmp/conserver])
cons_with_uds="YES"
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_DEFINE_UNQUOTED(UDSDIR, "$withval")
AC_DEFINE(USE_UNIX_DOMAIN_SOCKETS)
AC_MSG_RESULT('$withval')
cons_with_uds="YES"
if expr "$withval" : '/' >/dev/null 2>&1; then
:
else
echo "*** WARNING *** you may have better success using a fully-qualified path"
echo "*** WARNING *** instead of '$withval'"
fi
;;
esac],[AC_MSG_RESULT(no)])
use_dash_r=no
AC_MSG_CHECKING(whether to use -R paths as well as -L)
AC_ARG_WITH(rpath,
AS_HELP_STRING([--with-rpath],[Use -R as well as -L for libraries]),
[case "$withval" in
yes|no)
AC_MSG_RESULT($withval)
use_dash_r=$withval
;;
*)
AC_MSG_RESULT(no)
;;
esac],
[AC_MSG_RESULT(no)])
dnl ### Check for compiler et al. ###################################
AC_PROG_CC
AC_PROG_INSTALL
@ -244,12 +326,20 @@ if test "$ac_cv_sys_posix_termios" != "yes"; then
AC_MSG_ERROR([POSIX termios interface required])
fi
AC_CHECK_HEADERS(unistd.h getopt.h sys/vlimit.h sys/resource.h ttyent.h sys/ttold.h sys/uio.h sys/proc.h sys/ioctl_compat.h usersec.h sys/select.h stropts.h sys/audit.h shadow.h sys/time.h crypt.h sysexits.h types.h sys/sockio.h)
AC_CHECK_HEADERS(unistd.h getopt.h sys/vlimit.h sys/resource.h ttyent.h sys/ttold.h sys/uio.h sys/ioctl_compat.h usersec.h sys/select.h stropts.h sys/audit.h shadow.h sys/time.h crypt.h sysexits.h types.h sys/sockio.h sys/param.h)
dnl sys/proc.h needs sys/param.h on openbsd, apparently
AC_CHECK_HEADERS(sys/proc.h, [], [],
[#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
])
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_TYPE_MODE_T
AC_TYPE_SIGNAL
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_CHECK_TYPE([sig_atomic_t],,
AC_DEFINE(sig_atomic_t, volatile int,
@ -293,13 +383,18 @@ AC_SEARCH_LIBS(crypt,crypt)
AC_SUBST(CONSLIBS)
AC_SUBST(CONSCPPFLAGS)
AC_SUBST(CONSLDFLAGS)
cons_with_libwrap="NO"
AC_ARG_WITH(libwrap,
AC_HELP_STRING([--with-libwrap@<:@=PATH@:>@],
AS_HELP_STRING([--with-libwrap@<:@=PATH@:>@],
[Compile in libwrap (tcp_wrappers) support]),
[if test "$withval" != "no"; then
if test "$withval" != "yes"; then
WRAPCPPFLAGS="-I$withval/include"
WRAPLDFLAGS="-L$withval/lib"
if test "$use_dash_r" != "yes"; then
WRAPLDFLAGS="-L$withval/lib"
else
WRAPLDFLAGS="-L$withval/lib -R$withval/lib"
fi
else
WRAPCPPFLAGS=""
WRAPLDFLAGS=""
@ -320,6 +415,7 @@ AC_ARG_WITH(libwrap,
int deny_severity = 0;
],[hosts_access((void *)0)],
[AC_MSG_RESULT(yes)
cons_with_libwrap="YES"
AC_DEFINE(USE_LIBWRAP)
CONSLIBS="$CONSLIBS -lwrap"
CONSLDFLAGS="$CONSLDFLAGS $WRAPLDFLAGS"
@ -332,6 +428,7 @@ AC_ARG_WITH(libwrap,
int deny_severity = 0;
],[hosts_access((void *)0)],
[AC_MSG_RESULT(yes)
cons_with_libwrap="YES"
AC_DEFINE(USE_LIBWRAP)
CONSLIBS="$CONSLIBS -lwrap -lnsl"
CONSLDFLAGS="$CONSLDFLAGS $WRAPLDFLAGS"
@ -343,13 +440,18 @@ AC_ARG_WITH(libwrap,
fi]
)
cons_with_openssl="NO"
AC_ARG_WITH(openssl,
AC_HELP_STRING([--with-openssl@<:@=PATH@:>@],
AS_HELP_STRING([--with-openssl@<:@=PATH@:>@],
[Compile in OpenSSL support]),
[if test "$withval" != "no"; then
if test "$withval" != "yes"; then
OPENSSLCPPFLAGS="-I$withval/include"
OPENSSLLDFLAGS="-L$withval/lib"
if test "$use_dash_r" != "yes"; then
OPENSSLLDFLAGS="-L$withval/lib"
else
OPENSSLLDFLAGS="-L$withval/lib -R$withval/lib"
fi
else
OPENSSLCPPFLAGS=""
OPENSSLLDFLAGS=""
@ -369,6 +471,7 @@ AC_ARG_WITH(openssl,
AC_TRY_LINK([#include <openssl/ssl.h>
],[SSL_library_init()],
[AC_MSG_RESULT(yes)
cons_with_openssl="YES"
AC_DEFINE(HAVE_OPENSSL)
have_openssl=yes],
[AC_MSG_RESULT(no)])],)
@ -381,13 +484,18 @@ AC_ARG_WITH(openssl,
fi]
)
cons_with_dmalloc="NO"
AC_ARG_WITH(dmalloc,
AC_HELP_STRING([--with-dmalloc@<:@=PATH@:>@],
AS_HELP_STRING([--with-dmalloc@<:@=PATH@:>@],
[Compile in dmalloc support]),
[if test "$withval" != "no"; then
if test "$withval" != "yes"; then
DMALLOCCPPFLAGS="-I$withval/include"
DMALLOCLDFLAGS="-L$withval/lib"
if test "$use_dash_r" != "yes"; then
DMALLOCLDFLAGS="-L$withval/lib"
else
DMALLOCLDFLAGS="-L$withval/lib -R$withval/lib"
fi
else
DMALLOCCPPFLAGS=""
DMALLOCLDFLAGS=""
@ -407,6 +515,7 @@ AC_ARG_WITH(dmalloc,
AC_TRY_LINK([#include <dmalloc.h>
],[dmalloc_debug(0)],
[AC_MSG_RESULT(yes)
cons_with_dmalloc="YES"
AC_DEFINE(HAVE_DMALLOC)
have_dmalloc=yes],
[AC_MSG_RESULT(no)])],)
@ -455,9 +564,10 @@ dnl else
dnl AC_MSG_RESULT(no)
dnl fi],[AC_MSG_RESULT(no)])
cons_with_pam="NO"
AC_MSG_CHECKING(for PAM support)
AC_ARG_WITH(pam,
AC_HELP_STRING([--with-pam],
AS_HELP_STRING([--with-pam],
[Enable PAM support]),
[if test "$withval" = yes; then
oLIBS="$LIBS"
@ -467,6 +577,7 @@ AC_ARG_WITH(pam,
AC_MSG_CHECKING(for PAM library -lpam)
AC_TRY_LINK_FUNC([pam_start],
[AC_MSG_RESULT(yes)
cons_with_pam="YES"
AC_DEFINE(HAVE_PAM)
CONSLIBS="$CONSLIBS -lpam"],
[LIBS="$LIBS -ldl"
@ -474,6 +585,7 @@ AC_ARG_WITH(pam,
AC_MSG_CHECKING(for PAM library -lpam with -ldl)
AC_TRY_LINK_FUNC([pam_end],
[AC_MSG_RESULT(yes)
cons_with_pam="YES"
AC_DEFINE(HAVE_PAM)
CONSLIBS="$CONSLIBS -lpam -ldl"],
[AC_MSG_RESULT(no)])])],)
@ -498,7 +610,7 @@ AC_CHECK_HEADERS(pty.h libutil.h util.h)
AC_CHECK_LIB(util, openpty)
AC_CHECK_FUNCS(openpty)
AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt sigaction setsockopt getdtablesize putenv memset memcpy memcmp memmove sysconf getlogin inet_aton)
AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt sigaction setsockopt getdtablesize putenv memset memcpy memcmp memmove sysconf getlogin inet_aton setproctitle gettimeofday)
AC_FUNC_SETPGRP
AC_CHECK_FUNC(strcasecmp,
[AC_DEFINE(HAVE_STRCASECMP, 1, [Define if strcasecmp is available])],
@ -516,3 +628,16 @@ dnl ### Create output files. #######################################
AC_CONFIG_FILES([Makefile conserver/Makefile conserver.cf/Makefile console/Makefile autologin/Makefile contrib/chat/Makefile])
AC_CONFIG_FILES([conserver/conserver.rc], [chmod +x conserver/conserver.rc])
AC_OUTPUT
[
echo "=============================================================="
echo " Feature Summary"
echo ""
echo " Unix domain sockets (--with-uds) : $cons_with_uds"
echo " TCP wrappers (--with-libwrap): $cons_with_libwrap"
echo " OpenSSL (--with-openssl): $cons_with_openssl"
echo " dmalloc (--with-dmalloc): $cons_with_dmalloc"
echo " PAM support (--with-pam) : $cons_with_pam"
echo ""
echo "=============================================================="
]

View File

@ -1,11 +1,11 @@
The two files you need to set up are the conserver.cf and conserver.passwd
files. See the sample conserver.cf and conserver.passwd files
for examples. You can start with those and then modify extensively.
The man page for conserver.cf and conserver.passwd should explain the
files with enough detail to get you going.
files. See the sample conserver.cf and conserver.passwd files for examples
(installed in <DATADIR>/examples/conserver). You can start with those and
then modify extensively. The man page for conserver.cf and conserver.passwd
should explain the files with enough detail to get you going.
That's about it. Good luck.
#
# $Id: INSTALL,v 1.3 2003-07-04 11:21:21-07 bryan Exp $
# $Id: INSTALL,v 1.4 2005/05/21 13:47:18 bryan Exp $
#

View File

@ -3,7 +3,8 @@ srcdir = @srcdir@
prefix = @prefix@
mandir = @mandir@
sysconfdir = @sysconfdir@
exampledir = $(prefix)/share/examples/conserver
datadir = @datadir@
exampledir = $(datadir)/examples/conserver
### Installation programs and flags
INSTALL = @INSTALL@

View File

@ -1,54 +1,114 @@
#
# $Id: conserver.cf,v 1.5 2003-07-04 11:05:04-07 bryan Exp $
# Sample conserver.cf file, to give you ideas of what you can do with
# the various configuration items.
#
# The character '&' in logfile names are substituted with the console
# name.
#
default full {
rw *;
}
### set up global access
default full { rw *; }
### define some terminal server specifics
# we set portbase and portinc so we can reference the ports in a
# physical representation and let conserver do the math to figure
# out the actual socket address
default cisco { type host; portbase 2000; portinc 1; }
default xyplex { type host; portbase 2000; portinc 100; }
default iolan { type host; portbase 10000; portinc 1; }
### set up some custom break sequences
break 4 { string "+\d+\d+"; delay 300; }
break 5 { string "\033c"; }
### set the defaults for all the consoles
# these get applied before anything else
default * {
# The '&' character is substituted with the console name
logfile /var/consoles/&;
timestamp "";
# timestamps every hour with activity and break logging
timestamp 1hab;
# include the 'full' default
include full;
}
#
# list of consoles we serve
#
console tweety {
# master server is localhost
master localhost;
type host;
host ts1;
port 2002;
}
console bambam {
master localhost;
type host;
host ts1;
port 2003;
### define the first terminal server
default ts1.conserver.com {
# use the xyplex defaults
include xyplex;
# host to connect to is ts1.conserver.com
host ts1.conserver.com;
# run login-xyplex when connecting to the term server
initcmd /usr/local/sbin/login-xyplex;
}
console shell {
master localhost;
logfile /dev/null;
# now define the consoles on ts1.conserver.com
# bryan isn't allowed on web1.conserver.com
console web1.conserver.com { include ts1.conserver.com; port 2; rw !bryan; }
console ns1.conserver.com { include ts1.conserver.com; port 10; }
console ns2.conserver.com { include ts1.conserver.com; port 8; }
### define the second terminal server
# this one is a cisco, with simple socket connections
default ts2.conserver.com { include cisco; host ts2.conserver.com; }
# and the consoles on ts2.conserver.com
console ldap1.conserver.com { include ts2.conserver.com; port 7; }
### and now some one-off consoles
# we still inherit the '*' default set
# a simple ssh invocation
console ssh {
type exec;
exec "";
}
console telnet {
master localhost;
logfile /dev/null;
type exec;
exec telnet host;
exec ssh localhost;
# provide a 'message-of-the-day'
motd "just a simple ssh to localhost";
}
# connect to /dev/ttya
console ttya {
master localhost;
type device;
device /dev/ttya;
device /dev/ttya; parity none; baud 9600;
idlestring "#";
idletimeout 5m; # send a '#' every 5 minutes of idle
timestamp ""; # no timestamps on this console
}
### define a group of users
group sysadmin {
users bryan, todd;
users dave;
}
### reset the defaults for the next set of consoles
# again, these get applied before anything else
default * {
# The '&' character is substituted with the console name
logfile /var/consoles/&;
timestamp 5m;
rw sysadmin; # use the group defined above
master localhost;
}
default cyclades {
# sets up /dev/ttyC0 through /dev/ttyC31, for a 32 port card
# referenced as ports 1 through 32
type device;
device /dev/ttyC.;
devicesubst .=Pd;
portbase -1;
portinc 1;
host none; # not really used, since devicesubst doesn't use it
baud 9600;
parity none;
}
#
# list of clients we allow
#
console modem1.conserver.com { include cyclades; port 2; break 4; }
# todd isn't allowed on modem2.conserver.com
console modem2.conserver.com { include cyclades; port 6; rw !todd; }
### list of clients we allow
access * {
allowed 127.0.0.1 gnac.com;
allowed 10.0.0.0/8 192.168.0.0/16;
allowed cs1.conserver.com cs2.conserver.com cs3.conserver.com;
trusted 127.0.0.1;
}

View File

@ -1,5 +1,5 @@
.\" $Id: conserver.cf.man,v 1.43 2003-10-02 19:01:05-07 bryan Exp $
.TH CONSERVER.CF 5 "2003-10-02" "conserver-8.0.2" "conserver"
.\" $Id: conserver.cf.man,v 1.73 2005/06/09 07:09:31 bryan Exp $
.TH CONSERVER.CF 5 "2005/06/09" "conserver-8.1.13" "conserver"
.SH NAME
conserver.cf \- console configuration file for
.BR conserver (8)
@ -65,12 +65,12 @@ The parser has six characters that it considers special.
These are: ``{'', ``}'', ``;'', ``#'', ``\e'', and ``"''.
The first three (hereby called tokens) define the format of the
configuration blocks and are used as word
seperators, the next is the comment character, and the last two are
separators, the next is the comment character, and the last two are
quoting characters.
.PP
Word seperation occurs when the parser encounters an unquoted token
Word separation occurs when the parser encounters an unquoted token
and, in certain cases, whitespace.
Whitespace is only used as a word seperator when the parser is
Whitespace is only used as a word separator when the parser is
looking for a block-type or keyword.
When it's looking for a block-name or value, whitespace is like any
other character, which allows you to embed whitespace in a block-name
@ -107,10 +107,27 @@ of things, we have:
"defa"ult my\e defs { rw *; in\eclude "other defs" ; }
.fi
.ft
.PP
There is one special line the parser recognizes: a ``#include'' statement.
It is of the form:
.IP
.B #include
.I filename
.PP
Any whitespace around
.I filename
is ignored, but whitespace embedded inside is preserved.
Everything in
.I filename
is taken literally, so none of the normal parser quoting applies.
The
.B #include
must begin in ``column 0'' - no whitespace is allowed between it and
the start of the physical line.
There is an include file depth limit of 10 to prevent infinite recursion.
.SH BLOCKS
.TP 8
.B access
.RI [ " hostname " | " ipaddr " ]
.TP
\f3access\fP \f2hostname\fP|\f2ipaddr\fP
.br
Define an access block for the host named
.I hostname
@ -121,59 +138,89 @@ all conserver hosts.
Access lists are used in a first match
fashion (top down), so order is important.
.RS
.TP 15
.B admin
.RI [ " username" ,...
| "" ]
.TP
\f3admin\fP [\f3!\fP]\f2username\fP[\f3,\fP...]|\f3""\fP
.br
Define a list of users making up the admin list for the console server.
If
.I username
matches a previously defined group name, all members of the previous
group are added to the admin list.
If the null string (``""'') is used, any
group are applied to the admin list (with access reversed if prefixed
with a `!').
If
.I username
doesn't match a previously defined group and
.I username
begins with `@', the name (minus the `@') is checked against the
host's group database.
All users found in the group will be granted (or denied, if prefixed
with `!') access.
If
.I username
doesn't match a previous group and doesn't begin with `@', the users
will be granted (or denied, if prefixed with `!') access.
If the null string (``\f3""\fP'') is used, any
users previously defined for the console servers's admin list are removed.
.TP
.B allowed
.IR hostname ", ..."
\f3allowed\fP \f2hostname\fP[\f3,\fP...]
.br
The list of hostnames are added to the ``allowed'' list, which grants
connections from the hosts but requires username authentication.
.TP
.B include
.I accessgroup
\f3include\fP \f2accessgroup\fP
.br
The access lists defined using the name
.I accessgroup
are applied to the current access block.
The included access block must be previously defined.
.TP
.B rejected
.IR hostname ", ..."
\f3limited\fP [\f3!\fP]\f2username\fP[\f3,\fP...]|\f3""\fP
.br
Define a list of users with limited functionality on the console server.
These users will not be allowed to suspend their connection,
shift to another console, or attach to a local command.
If
.I username
matches a previously defined group name, all members of the previous
group are applied to the admin list (with access reversed if prefixed
with a `!').
If
.I username
doesn't match a previously defined group and
.I username
begins with `@', the name (minus the `@') is checked against the
host's group database.
All users found in the group will be granted (or denied, if prefixed
with `!') access.
If
.I username
doesn't match a previous group and doesn't begin with `@', the users
will be granted (or denied, if prefixed with `!') access.
If the null string (``\f3""\fP'') is used, any
users previously defined for the console server's limited list are removed.
.TP
\f3rejected\fP \f2hostname\fP[\f3,\fP...]
.br
The list of hostnames are added to the ``rejected'' list, which rejects
connections from the hosts.
.TP
.B trusted
.IR hostname ", ..."
\f3trusted\fP \f2hostname\fP[\f3,\fP...]
.br
The list of hostnames are added to the ``trusted'' list, which grants
connections from the hosts without username authentication.
.RE
.TP 8
.B break
.I n
.TP
\f3break\fP \f2n\fP
.br
Define a break sequence where 0 <
.I n
< 10.
Break sequences are accessed via the
.RI ``^El n ''
.RI ``^Ecl n ''
client escape sequence.
.RS
.TP 15
.B delay
.I n
.TP
\f3delay\fP \f2n\fP
.br
Set the time delay for the
.B \ed
@ -182,8 +229,7 @@ sequence to
milliseconds.
The default time delay is 250ms.
.TP
.B string
.I breakseq
\f3string\fP \f2breakseq\fP
.br
Assign the string
.IR breakseq
@ -192,6 +238,7 @@ to the specified slot
A break sequence is a simple character string with the exception of `\e'
and `^':
.RS
.RS
.sp
.PD 0
.TP 6
@ -202,7 +249,9 @@ alert
backspace
.TP
.B \ed
0.33 second delay
delay specified by the
.B delay
option.
.TP
.B \ef
form-feed
@ -247,9 +296,9 @@ is ``and''ed with 0x1f)
.PD
.RE
.RE
.TP 8
.B config
.RI [ " hostname " | " ipaddr " ]
.RE
.TP
\f3config\fP \f2hostname\fP|\f2ipaddr\fP
.br
Define a configuration block for the host named
.I hostname
@ -258,66 +307,99 @@ or using the address
If the value of ``*'' is used, the configuration block will be applied to
all conserver hosts.
.RS
.TP 15
.B defaultaccess
.RB [ " rejected " | " trusted " | " allowed " ]
.TP
\f3autocomplete\fP \f3yes\fP|\f3true\fP|\f3on\fP|\f3no\fP|\f3false\fP|\f3off
.br
Turn the console name autocompletion feature on or off.
If autocompletion is on, a client can use any unique leading portion of a
console name when connecting to a console.
Autocompletion is on by default.
.TP
\f3defaultaccess\fP \f3rejected\fP|\f3trusted\fP|\f3allowed\fP
.br
Set the default access permission for all hosts not matched by
an access list (see the
.B \-a
command-line flag).
.TP
.B daemonmode
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
\f3daemonmode\fP \f3yes\fP|\f3true\fP|\f3on\fP|\f3no\fP|\f3false\fP|\f3off
.br
Set whether or not to become a daemon when run (see the
.B \-d
command-line flag).
.TP
.B logfile
.I filename
\f3initdelay\fP \f2number\fP
.br
Set the number of seconds between console initializations.
All consoles with the same
.B host
value will be throttled as a group (those without a
.B host
value are their own group).
In other words, each console within a group will only be initialized after
.I number
seconds passes from the previous initialization of a console in that group.
Different throttle groups are initialized simultaneously.
One warning: since consoles are split up and managed by seperate conserver
processes, it's possible for more than one conserver process to
have a throttle group based on a particular
.B host
value.
If this happens, each conserver process will throttle their groups
independently of the other conserver processes, which results in a
more rapid initialization (per
.B host
value) than one might otherwise expect.
If
.I number
is zero, all consoles are initialized without delay.
.TP
\f3logfile\fP \f2filename\fP
.br
Set the logfile to write to when in daemon mode (see the
.B \-L
command-line flag).
.TP
.B passwdfile
.I filename
\f3passwdfile\fP \f2filename\fP
.br
Set the password file location used for authentication (see the
.B \-P
command-line flag).
.TP
.B primaryport
.RI [ " number " | " name " ]
\f3primaryport\fP \f2number\fP|\f2name\fP
.br
Set the port used by the master conserver process (see the
.B \-p
command-line flag).
.TP
.B redirect
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
\f3redirect\fP \f3yes\fP|\f3true\fP|\f3on\fP|\f3no\fP|\f3false\fP|\f3off
.br
Turn redirection on or off (see the
.B \-R
command-line flag).
.TP
.B reinitcheck
.I number
\f3reinitcheck\fP \f2number\fP
.br
Set the number of seconds used between reinitialization checks (see the
Set the number of minutes used between reinitialization checks (see the
.B \-O
command-line flag).
.TP
.B secondaryport
.RI [ " number " | " name " ]
\f3secondaryport\fP \f2number\fP|\f2name\fP
.br
Set the base port number used by child processes (see the
.B \-b
command-line flag).
.TP
.B sslcredentials
.I filename
\f3setproctitle\fP \f3yes\fP|\f3true\fP|\f3on\fP|\f3no\fP|\f3false\fP|\f3off
.br
Set whether or not the process title shows master/group functionality
as well as the port number the process is listening on and how many
consoles it is managing.
The operating system must support the
.BR setproctitle ()
call.
.TP
\f3sslcredentials\fP \f2filename\fP
.br
Set the
.SM SSL
@ -325,16 +407,22 @@ credentials file location (see the
.B \-c
command-line flag).
.TP
.B sslrequired
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
\f3sslrequired\fP \f3yes\fP|\f3true\fP|\f3on\fP|\f3no\fP|\f3false\fP|\f3off
.br
Set whether or not encryption is required when talking to clients (see the
.B \-E
command-line flag).
.TP
\f3unifiedlog\fP \f2filename\fP
.br
Set the location of the unified log to
.IR filename .
See the
.B \-U
command-line flag for details.
.RE
.TP 8
.B console
.I name
.TP
\f3console\fP \f2name\fP
.br
Define a console identified as
.IR name .
@ -342,67 +430,157 @@ The keywords are the same as the
.B default
block with the following addition.
.RS
.TP 15
.B aliases
.RI [ " name" ", ..."
| "" ]
.TP
\f3aliases\fP \f2name\fP[\f3,\fP...]|\f3""\fP
.br
Define a list of console aliases.
If the null string (``""'') is used, any
If the null string (``\f3""\fP'') is used, any
aliases previously defined for the console are removed.
.RE
.TP 8
.B default
.I name
.TP
\f3default\fP \f2name\fP
.br
Define a block of defaults identified as
.IR name .
If
.I name
is ``*'', the automatically applied default block is defined (basically
all consoles have an implicit ``include "*";'' at the begining
all consoles have an implicit ``include "*";'' at the beginning
of their definition).
.RS
.TP 15
.B baud
.RB [ " 300 " | " 600 " | " 1800 " | " 2400 " | " 4800"
.RB | " 9600 " | " 19200 " | " 38400 " | " 57600 " | " 115200 " ]
.TP
\f3baud\fP \f3300\fP|\f3600\fP|\f31800\fP|\f32400\fP|\f34800\fP|\f39600\fP|\f319200\fP|\f338400\fP|\f357600\fP|\f3115200\fP
.br
Assign the baud rate to the console.
Only consoles of type ``device'' will use this value.
.TP
.B break
.I n
\f3break\fP \f2n\fP
.br
Assign the break sequence
.I n
as the default for the console, which is used by
the ``^Ecl0'' client escape sequence.
.TP
.B device
.I filename
\f3device\fP \f2filename\fP
.br
Assign the serial device
.I filename
as the access to the console.
Only consoles of type ``device'' will use this value.
.TP
.B exec
.RI [ " command "
| "" ]
\f3devicesubst\fP \f2c\fP\f3=\fP\f2t\fP[\f2n\fP]\f2f\fP[\f3,\fP...]|\f3""\fP
.br
Perform character substitutions on the
.B device
value.
A series of replacements can be defined by specifying a
comma-separated list of
\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP
sequences where
.I c
is any printable character,
.I t
specifies the replacement value,
.I n
is a field length (optional),
and
.I f
is the format string.
.I t
can be one of the characters below, catagorized as a string replacement
or a numeric replacement, which dictates the use of the
.I n
and
.I f
fields.
.RS
.RS
.sp
.PD 0
.TP
String Replacement
.TP
.B h
.B host
value
.TP
.B c
console name
.sp
.PP
Numeric Replacement
.TP
.B p
config
.B port
value
.TP
.B P
calculated port value
.PD
.RE
.RE
.IP
For string replacements, if the replacement isn't at least
.I n
characters, it will be padded with space characters on the left.
.I f
must be `s'.
For numeric replacements, the value will be formatted to at least
.I n
characters, padded with 0s if
.I n
begins with a 0, and space characters otherwise.
.I f
must be either `d', `x', `X', `a', or `A', specifying a decimal, lowercase
hexadecimal (0-9a-f), uppercase hexadecimal (0-9A-F), lowercase
alphanumeric (0-9a-z), or uppercase alphanumeric (0-9A-Z) conversion.
If the null string (``\f3""\fP'') is used, no replacements will be done.
.TP
\f3exec\fP \f2command|\f3""\fP
.br
Assign the string
.I command
as the command to access the console.
Conserver will run the command by
invoking ``/bin/sh -ce "\fIcommand\fP"''.
If the null string (``""'') is used or no
invoking ``/bin/sh -ce "\f2command\fP"''.
If the null string (``\f3""\fP'') is used or no
.B exec
keyword is specified, conserver will use the command ``/bin/sh -i''.
Only consoles of type ``device'' will use this value.
Only consoles of type ``exec'' will use this value.
.TP
.B host
.I hostname
\f3execrunas\fP [\f2user\fP][:\f2group\fP]|\f3""\fP
.br
By default, the command invoked by
.B exec
is run with the same privileges as the server.
If the server is running with root privileges, this option resets the user
and/or group of the invoked process to
.I user
and
.I group
respectively.
.I user
may be a username or numeric uid and
.I group
may be a group name or numeric gid.
Either one is optional.
If the server is not running with root privileges, these values
are not used.
If the null string (``\f3""\fP'') is specified, the default of running
with the same privileges as the server is restored.
.TP
\f3execsubst\fP \f2c\fP\f3=\fP\f2t\fP[\f2n\fP]\f2f\fP[\f3,\fP...]|\f3""\fP
.br
Perform character substitutions on the
.B exec
value.
See the
.B devicesubst
option for an explanation of the format string.
If the null string (``\f3""\fP'') is used, no replacements will be done.
.TP
\f3host\fP \f2hostname\fP
.br
Assign
.I hostname
@ -410,19 +588,49 @@ as the host to connect to for accessing the console.
You must also set the
.B port
option as well.
Only consoles of type ``host'' will use this value.
Normally, only consoles of type ``host'' will use this value, however
if the
.BR devicesubst ,
.BR execsubst ,
or
.B initsubst
keywords are used in any console type, this value is used.
.TP
.B include
.I default
\f3idlestring\fP \f2string\fP|\f3""\fP
.br
Assign the
.I string
that is sent to the console once the console is idle for an
.I idletimeout
amount of time.
If the null string (``\f3""\fP'') is used, the string is unset and
the default is used.
The string is interpreted just as a
.B break
string is interpreted (see the
.B break
configuration items for details) where all delays specified (via ``\ed'')
use the default delay time.
The default string is ``\en''.
.TP
\f3idletimeout\fP \f2number\fP[\f3s\fP|\f3m\fP|\f3h\fP]
.br
Set the idle timeout of the console to
.I number
seconds.
If an `s', `m', or `h' is used after
.IR number ,
the specified time is interpreted as seconds, minutes, or hours.
Set the timeout to zero to disable the idle timeout (the default).
.TP
\f3include\fP \f2default\fP
.br
The default block defined using the name
.I default
is applied to the current console or default block.
The included default block must be previously defined.
.TP
.B initcmd
.RI [ " command "
| "" ]
\f3initcmd\fP \f2command\fP|\f3""\fP
.br
Invoke
.I command
@ -432,23 +640,124 @@ to stdin, stdout, and stderr of
The
.I command
is passed as an argument to ``/bin/sh -ce''.
If the null string (``""'') is used, the command is unset and
If the null string (``\f3""\fP'') is used, the command is unset and
nothing is invoked.
.TP
.B logfile
.RI [ " filename "
| "" ]
\f3initrunas\fP [\f2user\fP][:\f2group\fP]|\f3""\fP
.br
By default, the command invoked by
.B initcmd
is run with the same privileges as the server.
If the server is running with root privileges, this option resets the user
and/or group of the invoked process to
.I user
and
.I group
respectively.
.I user
may be a username or numeric uid and
.I group
may be a group name or numeric gid.
Either one is optional.
If the server is not running with root privileges, these values
are not used.
If the null string (``\f3""\fP'') is specified, the default of running
with the same privileges as the server is restored.
.TP
\f3initspinmax\fP \f2n\fP|\f3""\fP
.br
Set the maximum number of ``spins'' allowed for the console to
.IR n ,
where 0 <=
.I n
<= 254.
A console is determined to be ``spinning'' if an attempt to initialize
the console occurs in under
.B initspintimer
seconds from its previous initialization and this quick
initialization occurs
.B initspinmax
times in a row.
If, at any point, the time between initializations is greater than
.BR initspintimer ,
the counter for reaching
.B initspinmax
resets to zero.
When a console is determined to be ``spinning'' it is forced down.
If the null string (``\f3""\fP'') is specified, the default of
.B 5
is used.
.TP
\f3initspintimer\fP \f2t\fP|\f3""\fP
.br
Set the number of seconds a console must be ``up'' to not be
considered ``spinning'' to
.IR t ,
where 0 <=
.I t
<= 254.
See
.B initspinmax
for a full description of console ``spinning.''
If the null string (``\f3""\fP'') is specified, the default of
.B 1
is used.
.TP
\f3initsubst\fP \f2c\fP\f3=\fP\f2t\fP[\f2n\fP]\f2f\fP[\f3,\fP...]|\f3""\fP
.br
Perform character substitutions on the
.B initcmd
value.
See the
.B devicesubst
option for an explanation of the format string.
If the null string (``\f3""\fP'') is used, no replacements will be done.
.TP
\f3logfile\fP \f2filename\fP|\f3""\fP
.br
Assign the logfile specified by
.I filename
to the console. Any occurance of ``&'' in
to the console.
Any occurrence of ``&'' in
.I filename
will be replaced with the name of the console.
If the null string (``""'') is used, the logfile name is unset and
If the null string (``\f3""\fP'') is used, the logfile name is unset and
no logging will occur.
.TP
.B master
.RI [ " hostname " | " ipaddr " ]
\f3logfilemax\fP \f2number\fP[\f3k\fP|\f3m\fP]
.br
Enable automatic rotation of
.B logfile
once its size exceeds
.I number
bytes.
Specifying
.B k
or
.B m
interpret
.I number
as kilobytes and megabytes.
.I number
must be at least 2048 bytes.
A value of zero will turn off automatic rotation of
.BR logfile .
The
.B logfile
.I filename
will be renamed
.IR filename -\s-1YYYYMMDD\s0-\s-1HHMMSS\s0,
where the extension is the current GMT year, month, day, hour,
minute, and second (to prevent issues with clock rollbacks).
File sizes are checked every 5 minutes with an additional initial
pseudo-random delay of up to one minute (to help prevent all processes
checking all consoles simultaneously).
2.5% (minimum 100 bytes, maximum 4000 bytes) of the old
logfile is read from the end of the file.
All data past the first newline is moved (not copied) to the new logfile
so that a replay of the console works and starts on a line boundary.
.TP
\f3master\fP \f2hostname\fP|\f3ipaddr\fP
.br
Define which conserver host manages the console.
The host may be specified by
@ -456,19 +765,15 @@ The host may be specified by
or using the address
.IR ipaddr .
.TP
.B motd
.RI [ " message "
| "" ]
\f3motd\fP \f2message\fP|\f3""\fP
.br
Set the "message of the day" for the console to
.IR message ,
which gets displayed when a client attaches to the console.
If the null string (``""'') is used, the MOTD is unset and
If the null string (``\f3""\fP'') is used, the MOTD is unset and
no message will occur.
.TP
.B options
.RI [ " option" ,...
| "" ]
\f3options\fP [\f3!\fP]option[\f3,\fP...]|\f3""\fP
.br
You can negate the option by prefixing it with a
.RB `` ! ''
@ -544,7 +849,7 @@ The conserver option
.B \-7
will set this flag for all consoles.
Default is
.BR !stiphigh .
.BR !striphigh .
.TP
.B reinitoncc
Automatically reinitialize (``bring up'') a downed console when a client
@ -572,7 +877,7 @@ Default is
.BR autoreinit .
.TP
.B unloved
Enable the sending of this console's output (prefixed with it's
Enable the sending of this console's output (prefixed with its
name) to the daemon's stdout (or the logfile if in daemon mode) when no
clients are connected to the console.
The conserver option
@ -583,58 +888,136 @@ Default is
.PD
.RE
.TP
.B parity
.RB [ " even " | " mark " | " none " | " odd " | " space " ]
\f3parity\fP \f3even\fP|\f3mark\fP|\f3none\fP|\f3odd\fP|\f3space\fP
.br
Set the parity option for the console.
Only consoles of type ``device'' will use this value.
.TP
.B port
.RI [ " number " | " name " ]
\f3port\fP \f2number\fP|\f2name\fP
.br
Set the port used to access the console.
The port may be specified as a
.I number
or a
.IR name ,
in which case it will use
.IR name .
A
.I name
will cause a
.BR getservbyname (3)
to look up a port number.
call to look up the port number.
The
.BR port ,
.BR portbase ,
and
.B portinc
values are all used to calculate the final port number to connect to.
The formula used is
.IR finalport " = "
.BR portbase " + "
.BR portinc " * " port .
By using proper values in the formula, you can reference ports on a
terminal server by their physical numbering of
.RI 0.. n
or
.RI 1.. n
(depending on if you like zero-based or one-based numbering).
Warning: you can generate a \-1 value with this formula,
which will become a very high numbered positive
value (since things are stored unsigned).
You must also set the
.B host
option as well.
Only consoles of type ``host'' will use this value.
Normally, only consoles of type ``host'' will use this value, however
if the
.BR devicesubst ,
.BR execsubst ,
or
.B initsubst
keywords are used in any console type, this value is used.
.TP
.B ro
.RI [ " username" ,...
| "" ]
\f3portbase\fP \f2number\fP
.br
Set the base value for the port calculation formula.
.I number
must be 0 or greater.
The default is zero.
See
.B port
for the details of the formula.
.TP
\f3portinc\fP \f2number\fP
.br
Set the increment value for the port calculation formula.
.I number
must be 0 or greater.
The default is one.
See
.B port
for the details of the formula.
.TP
\f3protocol\fP \f3telnet\fP|\f3raw\fP
.br
Set the protocol used to send and receive data from the console.
If
.B raw
is used, all data is sent ``as is'', unprotected by any protocol specification.
If
.B telnet
is used (which is the default), data is encapsulated in the telnet protocol.
The
.B striphigh
console option still applies when data is read by the server, and if enabled,
can impact the encapsulation process.
.TP
\f3ro\fP [\f3!\fP]\f2username\fP[\f3,\fP...]|\f3""\fP
.br
Define a list of users making up the read-only access list
for the console.
If
.I username
matches a previously defined group name, all members of the previous
group are added to the read-only access list.
If the null string (``""'') is used, any
group are applied to the read-only access list (with access reversed
if prefixed with a `!').
If
.I username
doesn't match a previously defined group and
.I username
begins with `@', the name (minus the `@') is checked against the
host's group database.
All users found in the group will be granted (or denied, if prefixed
with `!') read-only access.
If
.I username
doesn't match a previous group and doesn't begin with `@', the users
will be granted (or denied, if prefixed with `!') read-only access.
If the null string (``\f3""\fP'') is used, any
users previously defined for the console's read-only list are removed.
.TP
.B rw
.RI [ " username" ,...
| "" ]
\f3rw\fP [\f3!\fP]\f2username\fP[\f3,\fP...]|\f3""\fP
.br
Define a list of users making up the read-write access list
for the console.
If
.I username
matches a previously defined group name, all members of the previous
group are added to the read-write access list.
If the null string (``""'') is used, any
group are applied to the read-write access list (with access reversed
if prefixed with a `!').
If
.I username
doesn't match a previously defined group and
.I username
begins with `@', the name (minus the `@') is checked against the
host's group database.
All users found in the group will be granted (or denied, if prefixed
with `!') read-write access.
If
.I username
doesn't match a previous group and doesn't begin with `@', the users
will be granted (or denied, if prefixed with `!') read-write access.
If the null string (``\f3""\fP'') is used, any
users previously defined for the console's read-write list are removed.
.TP
.B timestamp
[
.RB [ \fInumber\fP [ m | h | d | l ]][ a ][ b ]
| "" ]
\f3timestamp\fP [\f2number\fP[\f3m\fP|\f3h\fP|\f3d\fP|\f3l\fP]][\f3a\fP][\f3b\fP]|\f3""\fP
.br
Specifies the time between timestamps applied to the console
log file and whether to log read/write connection actions.
@ -663,10 +1046,10 @@ A
.RB ` b '
can be specified to add logging of break sequences sent to the console.
.TP
.B type
.RB [ " device " | " exec " | " host " ]
\f3type\fP \f3device\fP|\f3exec\fP|\f3host\fP
.br
Set the type of console. The type
Set the type of console.
The type
.RB `` device ''
should be used for local serial ports (also set the
.B device
@ -683,25 +1066,35 @@ and
.B port
options).
.RE
.TP 8
.B group
.I name
.TP
\f3group\fP \f2name\fP
.br
Define a user group identified as
.I name
.RS
.TP 15
.B users
.RI [ " username" ,...
| "" ]
.TP
\f3users\fP [\f3!\fP]\f2username\fP[\f3,\fP...]|\f3""\fP
.br
Define a list of users making up the group
.IR name .
If
.I username
matches a previously defined group name, all members of the previous
group are added to the current group.
If the null string (``""'') is used, any
group are applied to the current group (with access reversed
if prefixed with a `!').
If
.I username
doesn't match a previously defined group and
.I username
begins with `@', the name (minus the `@') is checked against the
host's group database.
All users found in the group will be recorded with (or without, if prefixed
with `!') access.
If
.I username
doesn't match a previous group and doesn't begin with `@', the users
will be recorded with (or without, if prefixed with `!') access.
If the null string (``\f3""\fP'') is used, any
users previously defined for this group are removed.
.RE
.SH AUTHORS

View File

@ -1,5 +1,5 @@
.\" $Id: conserver.passwd.man,v 1.9 2003-07-04 13:20:52-07 bryan Exp $
.TH CONSERVER.PASSWD 5 "2003-07-04" "conserver-8.0.2" "conserver"
.\" $Id: conserver.passwd.man,v 1.10 2004/01/08 16:12:33 bryan Exp $
.TH CONSERVER.PASSWD 5 "2004/01/08" "conserver-8.1.13" "conserver"
.SH NAME
conserver.passwd \- user access information for
.BR conserver (8)
@ -59,7 +59,8 @@ in the system
If PAM support has been enabled
.RB ( --with-pam ),
PAM lookups will be done instead of
.BR passwd " (or " shadow ") lookups."
.BR passwd " (or " shadow ") lookups"
(you may need to edit /etc/pam.conf or create /etc/pam.d/conserver).
If this field is empty, password checking is bypassed for this user.
.SH EXAMPLE
.TP 24

View File

@ -1,5 +1,5 @@
%!PS-Adobe-2.0 EPSF-1.2
%%$Id: label.ps,v 1.8 94/01/21 09:37:42 ksb Exp $
%%$Id: label.ps,v 1.1 2003/11/04 02:36:26 bryan Exp $
%%Title: RJ-11
%%Creator: A Braunsdorf
%%CreationDate:

View File

@ -0,0 +1,21 @@
I put together the sample configuration files in this directory in hopes
that it would help folks see some of the possibilities of the
configuration file format. Each of the files are syntatically correct,
but have never actually been used.
Each file is basically built upon the previous...theoretically, if not
actually. Hopefully they'll help show some of the cool things you can
do with the configuration file and help those trying to figure out how
they should even start.
simple.cf - A very simple, one console config file
basic.cf - A config with a couple consoles, mostly using defaults
average.cf - A config for many consoles, using breaks, user lists,
etc...bascially customizing each area
average-distributed.cf - Taking average.cf to multiple conserver
hosts with overrides on those hosts
Bryan Stansell

View File

@ -0,0 +1,109 @@
#
# I took the average.cf file and expanded it to use a distributed
# conserver setup...two conserver hosts (conserver1 and conserver2), but
# the basic philosophy would hold for many more console and/or conserver
# hosts.
#
# ------ define a user group ------
group sysadmin {
users bryan, todd, dave;
}
# helpers is everyone but the sysadmin group
group helpers {
users *, !sysadmin;
}
# ------ make sure breaks are the way we want --------
break 1 { string "\z"; }
break 2 { string "\r\d~\d^b"; delay 600; }
break 3 { string "#."; }
# ----- define some console types ------
# yeah, just setting a break doesn't quite seem worth it, but perhaps,
# some day, there will be more host-specific stuff.
default sun-std { break 1; }
default sun-alt { break 2; }
default sun-lom { break 3; }
# ------ defaults ------
# we set a 'global' default so we can reuse the bits below. we're going
# to set the '*' default, then define consoles, reset the '*' default,
# define more consoles, etc.
default global {
logfile /var/consoles/&; # '&' is replaced with console name
timestamp 1hab; # write timestamps
rw sysadmin; # allow sysadmins full access
ro helpers; # allow helpers to watch
include sun-std;
}
# --------- define our terminal attributes ----------
# simple tcp connections are "easy"
default cisco { type host; portbase 2000; portinc 1; }
default xyplex { type host; portbase 2000; portinc 100; }
# this is a cyclades card referenced with /dev/ttyC0 through /dev/ttyC31
# (referenced as ports 1 through 32 in conserver.cf)
# we set the various port calculation bits and pattern substitution to
# come up with a generic definition
default cyclades { type device; device /dev/ttyC&; baud 9600; parity none;
devicesubst &=Pd; portbase -1; portinc 1; host unused; }
## this is a term server accessed with an ssh command
# it too uses pattern substitution and such to get the job done
default ciscossh { type exec; portbase 2000; portinc 1;
exec /usr/local/bin/ssh -p P -l tsuser H;
execsubst H=hs,P=Pd; }
# ------- set the global default for the first conserver host -------
# the consoles below (until the default is reset) are managed
# by conserver1.conserver.com
default * { include global; master conserver1.conserver.com; }
# ------- define the consoles on ts1.conserver.com --------
default ts1.conserver.com { include cisco; host ts1.conserver.com; }
console web1.conserver.com { include ts1.conserver.com; port 2; }
console ns1.conserver.com { include ts1.conserver.com; port 10; }
# ------- define the consoles on ts2.conserver.com --------
default ts2.conserver.com { include xyplex; host ts2.conserver.com; }
console web2.conserver.com { include ts2.conserver.com; port 4; }
console ns2.conserver.com { include ts2.conserver.com; port 22; }
# ------- set the global default for the second conserver host -------
# the following consoles are managed by conserver2.conserver.com
default * { include global; master conserver2.conserver.com; }
# ------- define the consoles on ts3.conserver.com --------
default ts3.conserver.com { include ciscossh; host ts3.conserver.com; }
console ftp1.conserver.com { include ts3.conserver.com; include sun-lom;
port 7; }
# ------- set up the an access list to avoid the default -------
# anything *not* matched here will fallback to the default access mode
access * {
trusted 127.0.0.1;
allowed 10.0.0.0/8;
}
# conserver2 has an extra leg that is trusted
access conserver2.conserver.com { trusted 192.168.0.0/16; }
# ------- do some server configuration ---------
# both conserver1.conserver.com and conserver2.conserver.com use the same
# set of defaults
config * {
defaultaccess rejected;
daemonmode on;
logfile /var/log/conserver;
}
# we're going to set the default access on conserver2 to allowed, because
# it's in a higher-trust network
config conserver2.conserver.com { defaultaccess allowed; }

View File

@ -0,0 +1,91 @@
#
# This would be what i'd expect a more common configuration file would
# look like. There are consoles attached to multiple devices, simple
# access lists, etc.
#
# ------ define a user group ------
group sysadmin {
users bryan, todd, dave;
}
# helpers is everyone but the sysadmin group
group helpers {
users *, !sysadmin;
}
# ------ make sure breaks are the way we want --------
break 1 { string "\z"; }
break 2 { string "\r\d~\d^b"; delay 600; }
break 3 { string "#."; }
# ----- define some console types ------
# yeah, just setting a break doesn't quite seem worth it, but perhaps,
# some day, there will be more host-specific stuff.
default sun-std { break 1; }
default sun-alt { break 2; }
default sun-lom { break 3; }
# ------ defaults ------
# now for some generic console defaults so that we don't have to
# duplicate them for each console.
default * {
logfile /var/consoles/&; # '&' is replaced with console name
timestamp 1hab; # write timestamps
rw sysadmin; # allow sysadmins full access
ro helpers; # allow helpers to watch
master localhost;
include sun-std;
}
# --------- define our terminal attributes ----------
# simple tcp connections are "easy"
default cisco { type host; portbase 2000; portinc 1; }
default xyplex { type host; portbase 2000; portinc 100; }
# this is a cyclades card referenced with /dev/ttyC0 through /dev/ttyC31
# (referenced as ports 1 through 32 in conserver.cf)
# we set the various port calculation bits and pattern substitution to
# come up with a generic definition
default cyclades { type device; device /dev/ttyC&; baud 9600; parity none;
devicesubst &=Pd; portbase -1; portinc 1; host unused; }
## this is a term server accessed with an ssh command
# it too uses pattern substitution and such to get the job done
default ciscossh { type exec; portbase 2000; portinc 1;
exec /usr/local/bin/ssh -p P -l tsuser H;
execsubst H=hs,P=Pd; }
# ------- define the consoles on ts1.conserver.com --------
default ts1.conserver.com { include cisco; host ts1.conserver.com; }
console web1.conserver.com { include ts1.conserver.com; port 2; }
console ns1.conserver.com { include ts1.conserver.com; port 10; }
# ------- define the consoles on ts2.conserver.com --------
default ts2.conserver.com { include xyplex; host ts2.conserver.com; }
console web2.conserver.com { include ts2.conserver.com; port 4; }
console ns2.conserver.com { include ts2.conserver.com; port 22; }
# ------- define the consoles on ts3.conserver.com --------
default ts3.conserver.com { include ciscossh; host ts3.conserver.com; }
console ftp1.conserver.com { include ts3.conserver.com; include sun-lom;
port 7; }
# ------- set up the an access list to avoid the default -------
# anything *not* matched here will fallback to the default access mode
access * {
trusted 127.0.0.1;
allowed 10.0.0.0/8;
}
# ------- do some server configuration ---------
config * {
defaultaccess rejected;
daemonmode on;
logfile /var/log/conserver;
}

View File

@ -0,0 +1,28 @@
#
# This is a fairly basic configuration file that interacts with one
# terminal server.
#
# first, we're going to set some generic console defaults so that we
# don't have to duplicate them for each console.
default * {
logfile /var/consoles/&; # '&' is replaced with console name
timestamp 1hab; # write timestamps
rw *; # allow all users
master localhost;
type host;
host ts1.conserver.com; # consoles on ts1.conserver.co
portbase 2000; # port numbers start at 2001 and
portinc 1; # go up by 1 (port #1 == 2001, etc)
}
# define two consoles on the terminal server
console web1.conserver.com { port 2; } # calculates to tcp port 2002
console ns1.conserver.com { port 10; } # calculates to tcp port 2010
# set up the an access list to avoid the default
# anything *not* matched here will fallback to the default access (-a)
# mode
access * {
trusted 127.0.0.1;
}

View File

@ -0,0 +1,11 @@
#
# I believe this is the smallest configuration file that is also fully
# functional. You have to be happy with the default access type (-a)
# as well as the default access list that gets used.
#
console simple {
master localhost;
type exec;
rw *;
}

View File

@ -1,6 +1,6 @@
# dummy conserver config file
#
# $Id: test.cf,v 1.2 2003-07-04 11:04:05-07 bryan Exp $
# $Id: test.cf,v 1.2 2003/07/04 18:04:05 bryan Exp $
#
default full {
rw *;

View File

@ -9,6 +9,7 @@
<META name="author" content=
"Bryan Stansell &lt;bryan@conserver.com&gt;">
<LINK rel="SHORTCUT ICON" href="conserver.ico">
<LINK rel="icon" href="conserver.ico">
<TITLE>Conserver</TITLE>
@ -35,7 +36,8 @@
<TD colspan="2" align="center">Please pick your closest
mirror: &nbsp;&nbsp;<A href=
"http://planetmirror.com/pub/conserver/">Australia</A>
&nbsp;&nbsp;<A href="http://www.conserver.com/">US
&nbsp;&nbsp;<A href="http://conserver.rinet.ru/">Russia</A>
&nbsp;&nbsp;<A href="http://www.conserver.com/">US-West
(Primary)</A><BR>
<BR>
</TD>
@ -55,11 +57,11 @@
<INPUT type="HIDDEN" name="method" value="and"> <INPUT
type="HIDDEN" name="format" value="builtin-long">
<INPUT type="HIDDEN" name="sort" value="score"> <INPUT
type="HIDDEN" name="config" value="htdig"> <INPUT type=
"HIDDEN" name="restrict" value=""> <INPUT type="HIDDEN"
name="exclude" value=""> <INPUT type="TEXT" size="20"
name="words" value=""> <INPUT type="SUBMIT" value=
"Search">
type="HIDDEN" name="config" value="conserver.com">
<INPUT type="HIDDEN" name="restrict" value=""> <INPUT
type="HIDDEN" name="exclude" value=""> <INPUT type=
"TEXT" size="20" name="words" value=""> <INPUT type=
"SUBMIT" value="Search">
</FORM>
</TD>
</TR>
@ -158,36 +160,33 @@
He isn't actively developing it, however, according to
the website. Next, there's Kevin Braunsdorf's version at
<A href=
"ftp://ftp.physics.purdue.edu/pub/pundits/">ftp://ftp.physics.purdue.edu/pub/pundits/</A>.
Kevin is semi-actively working on his thread. Doesn't
look like any new versions have been out since August
"http://www.npcguild.org/software/pundits/">http://www.npcguild.org/software/pundits/</A>.
It doesn't look like Kevin is working on his thread ony
more either. No new versions have been out since August
2000 (version 8.5), but maybe this info will be out of
date by the time you read this. Lastly, the conserver.com
version is based on Kevin's "5.21-Beta" distribution, but
since <B>HEAVILY</B> modified and enhanced (more details
in the "Origin" section above).</P>
date by the time you read this (I last checked Feb 10,
2004). Lastly, the conserver.com version is based on
Kevin's "5.21-Beta" distribution, but since
<B>HEAVILY</B> modified and enhanced (more details in the
"Origin" section above).</P>
<P>If I were looking for a conserver package I would
either use Kevin's latest distribution or the
conserver.com distribution. Which one? Well, obviously
I'm biased and believe the conserver.com distribution
should be your choice, but Kevin's does have UPS (serial
port line toggling bits) that the conserver.com version
doesn't have. What does the conserver.com distribution
have? Well, in reality, too many things to list. You'll
have to look at the <A href="CHANGES">CHANGES</A> file
and see the enhancements, bug fixes, and general
development since the original. Don't let the version
numbers fool you - you'll have to compare and contrast
for yourself.</P>
definitely use the conserver.com distribution. Why? It's
actively maintained, has many more features than the
other versions (see <A href="CHANGES">CHANGES</A> for a
semi-scary history), and has an active user community.
Kevin's version does have UPS support (basic serial port
line toggling bits) which is missing in the conserver.com
version, but no one has asked me for it, so does anyone
actually need it?</P>
<H3>Downloading</H3>
<P>The current version, released on Oct 5, 2003, is <A
href="8.0.2.tar.gz">8.0.2.tar.gz</A>. You can get it via
<A href=
"ftp://ftp.conserver.com/conserver/8.0.2.tar.gz">FTP</A>
or <A href="8.0.2.tar.gz">HTTP</A>. See the <A href=
<P>The current version, released on Jan 15, 2006, is <A
href="8.1.13.tar.gz">8.1.13.tar.gz</A>. You can get it
via <A href=
"ftp://ftp.conserver.com/conserver/8.1.13.tar.gz">FTP</A>
or <A href="8.1.13.tar.gz">HTTP</A>. See the <A href=
"CHANGES">CHANGES</A> file for information on the latest
updates.</P>
@ -208,6 +207,11 @@
<P>Check the <A href="INSTALL">INSTALL</A> file for
instructions.</P>
<H3>Online Documentation</H3>
<P>I've put a small set of documentation <A href=
"docs/">here</A>. I'm hoping to expand it over time.</P>
<H3>Systems Tested</H3>
<P>Here's a list of systems that I've been told can

View File

@ -6,7 +6,10 @@ exec_prefix = @exec_prefix@
sbindir = @sbindir@
sysconfdir = @sysconfdir@
mandir = @mandir@
exampledir = $(prefix)/share/examples/conserver
datadir = @datadir@
libdir = @libdir@
pkglibdir = $(libdir)/conserver
exampledir = $(datadir)/examples/conserver
### Installation programs and flags
INSTALL = @INSTALL@
@ -27,21 +30,24 @@ LIBS = @LIBS@ @CONSLIBS@
### Makefile rules - no user-servicable parts below
CONSERVER_OBJS = access.o client.o consent.o group.o main.o master.o \
readcfg.o fallback.o util.o
readcfg.o fallback.o cutil.o
CONSERVER_HDRS = ../config.h $(top_srcdir)/compat.h $(srcdir)/access.h \
$(srcdir)/client.h $(srcdir)/consent.h $(srcdir)/group.h \
$(srcdir)/main.h $(srcdir)/master.h $(srcdir)/readcfg.h \
$(srcdir)/util.h
$(srcdir)/client.h $(srcdir)/consent.h $(srcdir)/cutil.h \
$(srcdir)/group.h $(srcdir)/main.h $(srcdir)/master.h \
$(srcdir)/readcfg.h $(srcdir)/version.h
ALL = conserver convert
all: $(ALL)
$(CONSERVER_OBJS): $(CONSERVER_HDRS)
conserver: $(CONSERVER_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o conserver $(CONSERVER_OBJS) $(LIBS)
convert: convert.o util.o
$(CC) $(CFLAGS) $(LDFLAGS) -o convert convert.o util.o $(LIBS)
convert: convert.o cutil.o
$(CC) $(CFLAGS) $(LDFLAGS) -o convert convert.o cutil.o $(LIBS)
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
@ -59,5 +65,7 @@ install: conserver
$(INSTALL) conserver.man $(DESTDIR)$(mandir)/man8/conserver.8
$(MKDIR) $(DESTDIR)$(exampledir)
$(INSTALL) conserver.rc $(DESTDIR)$(exampledir)
$(MKDIR) $(DESTDIR)$(pkglibdir)
$(INSTALL) convert $(DESTDIR)$(pkglibdir)/convert
.PHONY: clean distclean install

View File

@ -1,4 +1,4 @@
# $Id: Sun-serial,v 2.1 93/02/09 11:45:12 ldv Exp $
# $Id: Sun-serial,v 1.1 2003/11/04 02:36:25 bryan Exp $
If you are going to be hooking Sun consoles to your console server, you
will run into a problem: The sun will halt whenever the cable is unplugged.

View File

@ -1,5 +1,5 @@
/*
* $Id: access.c,v 5.67 2003-10-03 06:32:34-07 bryan Exp $
* $Id: access.c,v 5.73 2004/05/23 16:44:25 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -36,7 +36,7 @@
#include <compat.h>
#include <util.h>
#include <cutil.h>
#include <access.h>
#include <consent.h>
#include <client.h>
@ -137,91 +137,139 @@ AccType(addr, peername)
socklen_t so;
struct hostent *he = (struct hostent *)0;
int a;
char ret;
#if TRUST_REVERSE_DNS
char *pcName;
int wlen;
char *hname;
int len;
char **revNames = (char **)0;
#endif
CONDDEBUG((1, "AccType(): ip=%s", inet_ntoa(*addr)));
ret = config->defaultaccess;
so = sizeof(*addr);
for (pACtmp = pACList; pACtmp != (ACCESS *)0; pACtmp = pACtmp->pACnext) {
CONDDEBUG((1, "AccType(): who=%s, trust=%c", pACtmp->pcwho,
pACtmp->ctrust));
if (pACtmp->isCIDR != 0) {
if (AddrCmp(addr, pACtmp->pcwho) == 0)
return pACtmp->ctrust;
continue;
}
if ((he = gethostbyname(pACtmp->pcwho)) == (struct hostent *)0) {
Error("AccType(): gethostbyname(%s): %s", pACtmp->pcwho,
hstrerror(h_errno));
continue;
}
if (4 != he->h_length || AF_INET != he->h_addrtype) {
Error
("AccType(): gethostbyname(%s): wrong address size (4 != %d) or address family (%d != %d)",
pACtmp->pcwho, he->h_length, AF_INET, he->h_addrtype);
continue;
}
for (a = 0; he->h_addr_list[a] != (char *)0; a++) {
CONDDEBUG((1, "AccType(): addr=%s",
inet_ntoa(*(struct in_addr *)
(he->h_addr_list[a]))));
if (
#if HAVE_MEMCMP
memcmp(&(addr->s_addr), he->h_addr_list[a],
he->h_length)
#else
bcmp(&(addr->s_addr), he->h_addr_list[a], he->h_length)
#endif
== 0)
return pACtmp->ctrust;
}
}
#if TRUST_REVERSE_DNS
/* if we trust reverse dns, we get the names associated with
* the address we're checking and then check each of those
* against the access list entries.
* we chop bits off client names so that we can put domain
* names in access lists or even top-level domains.
* allowed conserver.com, net;
* this allows anything from conserver.com and anything in
* the .net top-level. without TRUST_REVERSE_DNS, those names
* better map to ip addresses for them to take effect.
* against the access list entries (below).
*/
if ((he =
gethostbyaddr((char *)addr, so,
AF_INET)) == (struct hostent *)0) {
Error("AccType(): gethostbyaddr(%s): %s", inet_ntoa(*addr),
hstrerror(h_errno));
return config->defaultaccess;
}
for (pACtmp = pACList; pACtmp != (ACCESS *)0; pACtmp = pACtmp->pACnext) {
if (pACtmp->isCIDR != 0)
continue;
wlen = strlen(pACtmp->pcwho);
for (hname = he->h_name, a = 0; hname != (char *)0;
hname = he->h_aliases[a++]) {
for (pcName = hname, len = strlen(pcName); len >= wlen;
len = strlen(++pcName)) {
CONDDEBUG((1, "AccType(): name=%s", pcName));
if (strcasecmp(pcName, pACtmp->pcwho) == 0) {
*peername = hname;
return pACtmp->ctrust;
} else {
char *hname;
if (he->h_name != (char *)0) {
/* count up the number of names */
for (a = 0, hname = he->h_aliases[a]; hname != (char *)0;
hname = he->h_aliases[++a]);
a += 2; /* h_name + (char *)0 */
/* now duplicate them */
if ((revNames =
(char **)calloc(a, sizeof(char *))) != (char **)0) {
for (hname = he->h_name, a = 0; hname != (char *)0;
hname = he->h_aliases[a++]) {
if ((revNames[a] = StrDup(hname)) == (char *)0)
break;
CONDDEBUG((1, "AccType(): revNames[%d]='%s'", a,
hname));
}
pcName = strchr(pcName, '.');
if (pcName == (char *)0)
break;
}
}
}
#endif
return config->defaultaccess;
for (pACtmp = pACList; pACtmp != (ACCESS *)0; pACtmp = pACtmp->pACnext) {
CONDDEBUG((1, "AccType(): who=%s, trust=%c", pACtmp->pcwho,
pACtmp->ctrust));
if (pACtmp->isCIDR != 0) {
if (AddrCmp(addr, pACtmp->pcwho) == 0) {
ret = pACtmp->ctrust;
goto common_ret;
}
continue;
}
if ((he = gethostbyname(pACtmp->pcwho)) == (struct hostent *)0) {
Error("AccType(): gethostbyname(%s): %s", pACtmp->pcwho,
hstrerror(h_errno));
} else if (4 != he->h_length || AF_INET != he->h_addrtype) {
Error
("AccType(): gethostbyname(%s): wrong address size (4 != %d) or address family (%d != %d)",
pACtmp->pcwho, he->h_length, AF_INET, he->h_addrtype);
} else {
for (a = 0; he->h_addr_list[a] != (char *)0; a++) {
CONDDEBUG((1, "AccType(): addr=%s",
inet_ntoa(*(struct in_addr *)
(he->h_addr_list[a]))));
if (
#if HAVE_MEMCMP
memcmp(&(addr->s_addr), he->h_addr_list[a],
he->h_length)
#else
bcmp(&(addr->s_addr), he->h_addr_list[a],
he->h_length)
#endif
== 0) {
ret = pACtmp->ctrust;
goto common_ret;
}
}
}
#if TRUST_REVERSE_DNS
/* we chop bits off client names so that we can put domain
* names in access lists or even top-level domains.
* allowed conserver.com, net;
* this allows anything from conserver.com and anything in
* the .net top-level. without TRUST_REVERSE_DNS, those names
* better map to ip addresses for them to take effect.
*/
if (revNames != (char **)0) {
char *pcName;
int wlen;
int len;
wlen = strlen(pACtmp->pcwho);
for (a = 0; revNames[a] != (char *)0; a++) {
for (pcName = revNames[a], len = strlen(pcName);
len >= wlen; len = strlen(++pcName)) {
CONDDEBUG((1, "AccType(): name=%s", pcName));
if (strcasecmp(pcName, pACtmp->pcwho) == 0) {
if (peername != (char **)0)
*peername = StrDup(revNames[a]);
ret = pACtmp->ctrust;
goto common_ret2;
}
pcName = strchr(pcName, '.');
if (pcName == (char *)0)
break;
}
}
}
#endif
}
common_ret:
if (config->loghostnames == FLAGTRUE && peername != (char **)0) {
#if TRUST_REVERSE_DNS
if (revNames != (char **)0 && revNames[0] != (char *)0)
*peername = StrDup(revNames[0]);
#else
if ((he =
gethostbyaddr((char *)addr, so,
AF_INET)) != (struct hostent *)0) {
*peername = StrDup(he->h_name);
}
#endif
}
#if TRUST_REVERSE_DNS
common_ret2:
if (revNames != (char **)0) {
for (a = 0; revNames[a] != (char *)0; a++)
free(revNames[a]);
free(revNames);
}
#endif
return ret;
}
void
@ -233,11 +281,26 @@ SetDefAccess(pAddr, pHost)
char *pHost;
#endif
{
char *pcDomain;
char *addr;
ACCESS *a;
while (pACList != (ACCESS *)0) {
a = pACList->pACnext;
DestroyAccessList(pACList);
pACList = a;
}
#if USE_UNIX_DOMAIN_SOCKETS
if ((pACList = (ACCESS *)calloc(1, sizeof(ACCESS))) == (ACCESS *)0)
OutOfMem();
if ((pACList->pcwho = StrDup("127.0.0.1")) == (char *)0)
OutOfMem();
pACList->ctrust = 'a';
CONDDEBUG((1, "SetDefAccess(): trust=%c, who=%s", pACList->ctrust,
pACList->pcwho));
#else
while (pAddr->s_addr != (in_addr_t) 0) {
char *addr;
addr = inet_ntoa(*pAddr);
if ((a = (ACCESS *)calloc(1, sizeof(ACCESS))) == (ACCESS *)0)
OutOfMem();
@ -251,21 +314,7 @@ SetDefAccess(pAddr, pHost)
pACList->pcwho));
pAddr++;
}
if ((char *)0 == (pcDomain = strchr(pHost, '.')))
return;
++pcDomain;
if ((a = (ACCESS *)calloc(1, sizeof(ACCESS))) == (ACCESS *)0)
OutOfMem();
if ((a->pcwho = StrDup(pcDomain)) == (char *)0)
OutOfMem();
a->ctrust = 'a';
a->pACnext = pACList;
pACList = a;
CONDDEBUG((1, "SetDefAccess(): trust=%c, who=%s", pACList->ctrust,
pACList->pcwho));
#endif
}
void

View File

@ -1,5 +1,5 @@
/*
* $Id: access.h,v 5.26 2003-08-10 11:11:20-07 bryan Exp $
* $Id: access.h,v 5.26 2003/08/10 18:11:20 bryan Exp $
*
* Copyright conserver.com, 2000
*

View File

@ -1,5 +1,5 @@
/*
* $Id: client.c,v 5.72 2003-10-02 18:49:13-07 bryan Exp $
* $Id: client.c,v 5.89 2005/09/04 00:28:58 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -36,11 +36,12 @@
#include <compat.h>
#include <util.h>
#include <cutil.h>
#include <consent.h>
#include <access.h>
#include <client.h>
#include <group.h>
#include <readcfg.h>
#if defined(USE_LIBWRAP)
#include <syslog.h>
@ -67,9 +68,7 @@ FindWrite(pCE)
* most recent or some such... I guess it doesn't matter that
* much.
*/
if (pCE->pCLwr != (CONSCLIENT *)0 || pCE->fronly ||
!(pCE->fup && pCE->ioState == ISNORMAL &&
pCE->initfile == (CONSFILE *)0))
if (pCE->pCLwr != (CONSCLIENT *)0 || pCE->fronly)
return;
for (pCL = pCE->pCLon; (CONSCLIENT *)0 != pCL; pCL = pCL->pCLnext) {
@ -89,6 +88,25 @@ FindWrite(pCE)
}
}
void
#if PROTOTYPES
BumpClient(CONSENT *pCE, char *message)
#else
BumpClient(pCE, message)
CONSENT *pCE;
char *message;
#endif
{
if ((CONSCLIENT *)0 == pCE->pCLwr)
return;
if ((char *)0 != message)
FileWrite(pCE->pCLwr->fd, FLAGFALSE, message, -1);
pCE->pCLwr->fwantwr = 0;
pCE->pCLwr->fwr = 0;
pCE->pCLwr = (CONSCLIENT *)0;
}
/* replay last iBack lines of the log file upon connect to console (ksb)
*
* NB: we know the console might be spewing when the replay happens,
@ -97,15 +115,15 @@ FindWrite(pCE)
*/
void
#if PROTOTYPES
Replay(CONSFILE *fdLog, CONSFILE *fdOut, int iBack)
Replay(CONSENT *pCE, CONSFILE *fdOut, int iBack)
#else
Replay(fdLog, fdOut, iBack)
CONSFILE *fdLog;
Replay(pCE, fdOut, iBack)
CONSENT *pCE;
CONSFILE *fdOut;
int iBack;
#endif
{
CONSFILE *fdLog = (CONSFILE *)0;
off_t file_pos;
off_t buf_pos;
char *buf;
@ -130,7 +148,16 @@ Replay(fdLog, fdOut, iBack)
unsigned long dmallocMarkReplay = 0;
#endif
if ((CONSFILE *)0 == fdLog) {
if (pCE != (CONSENT *)0) {
fdLog = pCE->fdlog;
/* no logfile and down and logfile defined? try and open it */
if (fdLog == (CONSFILE *)0 && !pCE->fup &&
pCE->logfile != (char *)0)
fdLog = FileOpen(pCE->logfile, O_RDONLY, 0644);
}
if (fdLog == (CONSFILE *)0) {
FileWrite(fdOut, FLAGFALSE, "[no log file on this console]\r\n",
-1);
return;
@ -179,17 +206,9 @@ Replay(fdLog, fdOut, iBack)
* the rest (as we work our way back in the file) should be
*/
buf_pos = (file_pos / BUFSIZ) * BUFSIZ;
#if defined(SEEK_SET)
/* PTX and maybe other Posix systems
*/
if (FileSeek(fdLog, buf_pos, SEEK_SET) < 0) {
goto common_exit;
}
#else
if (FileSeek(fdLog, buf_pos, L_SET) < 0) {
goto common_exit;
}
#endif
if ((r = FileRead(fdLog, buf, BUFSIZ)) < 0) {
goto common_exit;
}
@ -232,24 +251,21 @@ Replay(fdLog, fdOut, iBack)
/* this is a mark and the previous line is also
* a mark, so make (or continue) that range
*/
if (0 == lines[ln - 1].mark_end->allocated) {
if (0 == lines[ln - 1].mark_end->used) {
/* this is a new range - shuffle pointers
*
* remember that we are moving backward
*/
*(lines[ln - 1].mark_end) = *(lines[ln - 1].line);
InitString(lines[ln - 1].line);
}
/* if unallocated, cheat and shuffle pointers */
if (0 == lines[ln - 1].line->allocated) {
*(lines[ln - 1].line) = *(lines[ln].line);
InitString(lines[ln].line);
} else {
BuildStringN(lines[ln - 1].line->string,
lines[ln - 1].line->used - 1,
lines[ln - 1].mark_end);
BuildString((char *)0, lines[ln - 1].line);
BuildString(lines[ln].line->string,
lines[ln - 1].line);
BuildString((char *)0, lines[ln].line);
}
BuildString((char *)0, lines[ln - 1].line);
BuildStringN(lines[ln].line->string,
lines[ln].line->used - 1,
lines[ln - 1].line);
BuildString((char *)0, lines[ln].line);
ln--;
}
lines[ln].is_mark = is_mark;
@ -314,7 +330,7 @@ Replay(fdLog, fdOut, iBack)
*s = '\000';
}
FileWrite(fdOut, FLAGTRUE, lines[i].line->string, -1);
FileWrite(fdOut, FLAGTRUE, " .. ", -1);
FileWrite(fdOut, FLAGTRUE, " .. ", 4);
/* build the end string by removing the leading "[-- MARK -- "
* and replacing "]\r\n" on the end with " -- MARK --]\r\n"
@ -331,11 +347,16 @@ Replay(fdLog, fdOut, iBack)
u = lines[i].mark_end->used;
s = lines[i].mark_end->string;
} else
FileWrite(fdOut, FLAGFALSE, lines[i].line->string, -1);
FileWrite(fdOut, FLAGFALSE, lines[i].line->string,
lines[i].line->used - 1);
}
common_exit:
/* if we opened the logfile, close it */
if (fdLog != pCE->fdlog)
FileClose(&fdLog);
if ((struct lines *)0 != lines) {
for (i = 0; i < n_lines; i++) {
DestroyString(lines[i].mark_end);
@ -359,9 +380,9 @@ Replay(fdLog, fdOut, iBack)
*/
#define WHEN_SPY 0x01
#define WHEN_ATTACH 0x02
#define WHEN_VT100 0x04
#define WHEN_EXPERT 0x08 /* ZZZ no way to set his yet */
#define WHEN_EXPERT 0x04 /* ZZZ no way to set his yet */
#define WHEN_ALWAYS 0x40
#define IS_LIMITED 0x100
#define HALFLINE 40
@ -372,6 +393,7 @@ typedef struct HLnode {
static HELP aHLTable[] = {
{WHEN_ALWAYS, ". disconnect"},
{WHEN_ALWAYS | IS_LIMITED, "; move to another console"},
{WHEN_ALWAYS, "a attach read/write"},
{WHEN_ALWAYS, "b send broadcast message"},
{WHEN_ATTACH, "c toggle flow control"},
@ -393,18 +415,14 @@ static HELP aHLTable[] = {
{WHEN_ALWAYS, "v show version info"},
{WHEN_ALWAYS, "w who is on this console"},
{WHEN_ALWAYS, "x show console baud info"},
{WHEN_ALWAYS, "z suspend the connection"},
{WHEN_ALWAYS, "<cr> ignore/abort command"},
{WHEN_ALWAYS | IS_LIMITED, "z suspend the connection"},
{WHEN_ATTACH | IS_LIMITED, "| attach local command"},
{WHEN_ALWAYS, "? print this message"},
{WHEN_ALWAYS, "<cr> ignore/abort command"},
{WHEN_ALWAYS, "^R replay the last line"},
{WHEN_ATTACH, "\\ooo send character by octal code"},
{WHEN_EXPERT, "^I toggle tab expansion"},
{WHEN_EXPERT, "; change to another console"},
{WHEN_EXPERT, "+(-) do (not) drop line"},
{WHEN_VT100, "PF1 print this message"},
{WHEN_VT100, "PF2 disconnect"},
{WHEN_VT100, "PF3 replay the last 20 lines"},
{WHEN_VT100, "PF4 spy read only"}
};
/* list the commands we know for the user (ksb)
@ -413,7 +431,7 @@ void
#if PROTOTYPES
HelpUser(CONSCLIENT *pCL)
#else
HelpUser(pCL)
HelpUser(pCL, pCE)
CONSCLIENT *pCL;
#endif
{
@ -433,15 +451,16 @@ HelpUser(pCL)
} else {
FileWrite(pCL->fd, FLAGTRUE, acH2, sizeof(acH2) - 1);
}
if ('\033' == pCL->ic[0] && 'O' == pCL->ic[1]) {
iCmp |= WHEN_VT100;
}
BuildString((char *)0, acLine);
for (i = 0; i < sizeof(aHLTable) / sizeof(HELP); ++i) {
if (0 == (aHLTable[i].iwhen & iCmp)) {
if (aHLTable[i].iwhen & IS_LIMITED &&
ConsentUserOk(pLUList, pCL->username->string) == 1)
continue;
}
if (0 == (aHLTable[i].iwhen & iCmp))
continue;
if (acLine->used != 0) { /* second part of line */
if (strlen(aHLTable[i].actext) < HALFLINE) {
for (j = acLine->used; j <= HALFLINE; ++j) {
@ -449,12 +468,14 @@ HelpUser(pCL)
}
BuildString(aHLTable[i].actext, acLine);
BuildString(acEoln, acLine);
FileWrite(pCL->fd, FLAGTRUE, acLine->string, -1);
FileWrite(pCL->fd, FLAGTRUE, acLine->string,
acLine->used - 1);
BuildString((char *)0, acLine);
continue;
} else {
BuildString(acEoln, acLine);
FileWrite(pCL->fd, FLAGTRUE, acLine->string, -1);
FileWrite(pCL->fd, FLAGTRUE, acLine->string,
acLine->used - 1);
BuildString((char *)0, acLine);
}
}
@ -463,14 +484,15 @@ HelpUser(pCL)
BuildString(aHLTable[i].actext, acLine);
if (acLine->used > HALFLINE) {
BuildString(acEoln, acLine);
FileWrite(pCL->fd, FLAGTRUE, acLine->string, -1);
FileWrite(pCL->fd, FLAGTRUE, acLine->string,
acLine->used - 1);
BuildString((char *)0, acLine);
}
}
}
if (acLine->used != 0) {
BuildString(acEoln, acLine);
FileWrite(pCL->fd, FLAGTRUE, acLine->string, -1);
FileWrite(pCL->fd, FLAGTRUE, acLine->string, acLine->used - 1);
}
FileWrite(pCL->fd, FLAGFALSE, (char *)0, 0);
}
@ -484,17 +506,34 @@ ClientAccessOk(pCL)
#endif
{
char *peername = (char *)0;
int retval = 1;
#if USE_UNIX_DOMAIN_SOCKETS
struct in_addr addr;
# if HAVE_INET_ATON
inet_aton("127.0.0.1", &addr);
# else
addr.s_addr = inet_addr("127.0.0.1");
# endif
pCL->caccess = AccType(&addr, &peername);
if (pCL->caccess == 'r') {
FileWrite(pCL->fd, FLAGFALSE, "access from your host refused\r\n",
-1);
retval = 0;
}
#else
socklen_t so;
int cfd;
struct sockaddr_in in_port;
int retval = 1;
int getpeer = -1;
cfd = FileFDNum(pCL->fd);
pCL->caccess = 'r';
#if defined(USE_LIBWRAP)
# if defined(USE_LIBWRAP)
{
struct request_info request;
CONDDEBUG((1, "ClientAccessOk(): doing tcpwrappers check"));
request_init(&request, RQ_DAEMON, progname, RQ_FILE, cfd, 0);
fromhost(&request);
if (!hosts_access(&request)) {
@ -504,7 +543,7 @@ ClientAccessOk(pCL)
goto setpeer;
}
}
#endif
# endif
so = sizeof(in_port);
if (-1 ==
@ -519,16 +558,24 @@ ClientAccessOk(pCL)
-1);
retval = 0;
}
setpeer:
#endif
if (pCL->peername != (STRING *)0) {
BuildString((char *)0, pCL->peername);
if (peername != (char *)0)
BuildString(peername, pCL->peername);
#if USE_UNIX_DOMAIN_SOCKETS
else
BuildString("127.0.0.1", pCL->peername);
#else
else if (getpeer != -1)
BuildString(inet_ntoa(in_port.sin_addr), pCL->peername);
else
BuildString("<unknown>", pCL->peername);
#endif
}
if (peername != (char *)0)
free(peername);
return retval;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: client.h,v 5.32 2003-09-28 08:41:20-07 bryan Exp $
* $Id: client.h,v 5.40 2005/06/07 19:55:51 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -46,7 +46,9 @@ typedef enum clientState {
S_IDENT, /* probational connection (who is this) */
S_PASSWD, /* still needs a passwd to connect */
S_QUOTE, /* send any character we can spell */
S_BCAST /* send a broadcast message to all clients */
S_BCAST, /* send a broadcast message to all clients */
S_CWAIT, /* wait for client */
S_CEXEC /* client execing a program */
} CLIENTSTATE;
typedef struct client { /* Connection Information: */
@ -56,6 +58,7 @@ typedef struct client { /* Connection Information: */
short fwantwr; /* (client) wants to write */
short fro; /* read-only permission */
short fecho; /* echo commands (not set by machines) */
short fiwait; /* client wanting for console init */
STRING *acid; /* login and location of client */
STRING *peername; /* location of client */
STRING *username; /* login of client */
@ -63,7 +66,6 @@ typedef struct client { /* Connection Information: */
time_t typetym; /* time of last keystroke */
char actym[32]; /* pre-formatted time */
struct consent
*pCEwant, /* what machine we would like to be on */
*pCEto; /* host a client gets output from */
struct client
**ppCLbscan, /* back link for scan ptr */
@ -83,7 +85,8 @@ typedef struct client { /* Connection Information: */
cnct_port; /* where from */
} CONSCLIENT;
extern void Replay PARAMS((CONSFILE *, CONSFILE *, int));
extern void Replay PARAMS((CONSENT *, CONSFILE *, int));
extern void HelpUser PARAMS((CONSCLIENT *));
extern void FindWrite PARAMS((CONSENT *));
extern int ClientAccessOk PARAMS((CONSCLIENT *));
extern void BumpClient PARAMS((CONSENT *, char *));

View File

@ -1,5 +1,5 @@
/*
* $Id: consent.c,v 5.128 2003-09-30 13:14:04-07 bryan Exp $
* $Id: consent.c,v 5.145 2005/06/08 18:09:40 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -42,7 +42,7 @@
#include <pwd.h>
#include <util.h>
#include <cutil.h>
#include <consent.h>
#include <client.h>
#include <group.h>
@ -236,6 +236,23 @@ TtyDev(pCE)
ConsDown(pCE, FLAGTRUE, FLAGTRUE);
return -1;
}
if (fDebug >= 2) {
int i;
Debug(2, "TtyDev(): [%s] termp.c_iflag=%lu", pCE->server,
(unsigned long)termp.c_iflag);
Debug(2, "TtyDev(): [%s] termp.c_oflag=%lu", pCE->server,
(unsigned long)termp.c_oflag);
Debug(2, "TtyDev(): [%s] termp.c_cflag=%lu", pCE->server,
(unsigned long)termp.c_cflag);
Debug(2, "TtyDev(): [%s] termp.c_lflag=%lu", pCE->server,
(unsigned long)termp.c_lflag);
#if defined(NCCS)
for (i = 0; i < NCCS; i++) {
Debug(2, "TtyDev(): [%s] termp.c_cc[%d]=%lu", pCE->server, i,
(unsigned long)termp.c_cc[i]);
}
#endif
}
# if HAVE_STROPTS_H
/*
* eat all the streams modules upto and including ttcompat
@ -261,12 +278,12 @@ StopInit(pCE)
if (pCE->initpid != 0) {
kill(pCE->initpid, SIGHUP);
pCE->initpid = 0;
Verbose("[%s] initcmd terminated: pid %lu", pCE->server,
(unsigned long)pCE->initpid);
TagLogfileAct(pCE, "initcmd terminated");
CONDDEBUG((1, "StopInit(): sending initcmd pid %lu signal %d",
(unsigned long)pCE->initpid, SIGHUP));
Msg("[%s] initcmd terminated: pid %lu", pCE->server,
(unsigned long)pCE->initpid);
TagLogfileAct(pCE, "initcmd terminated");
pCE->initpid = 0;
}
if (pCE->initfile != (CONSFILE *)0) {
@ -307,20 +324,6 @@ StartInit(pCE)
StopInit(pCE);
}
if (pCE->pCLwr != (CONSCLIENT *)0) {
CONSCLIENT *pCL = pCE->pCLwr;
pCL->fwr = 0;
pCL->fwantwr = 1;
/*
FileWrite(pCL->fd,
"[forced to `spy' mode by initialization command]\r\n",
-1);
TagLogfileAct(pCE, "initialization command bumped %s",
pCL->acid->string);
*/
pCE->pCLwr = (CONSCLIENT *)0;
}
/* pin[0] = parent read, pin[1] = child write */
if (pipe(pin) != 0) {
Error("[%s] StartInit(): pipe(): %s", pCE->server,
@ -359,8 +362,8 @@ StartInit(pCE)
pCE->initpid = 0;
return;
}
Verbose("[%s] initcmd started: pid %lu", pCE->server,
(unsigned long)pCE->initpid);
Msg("[%s] initcmd started: pid %lu", pCE->server,
(unsigned long)pCE->initpid);
TagLogfileAct(pCE, "initcmd started");
FD_SET(pin[0], &rinit);
if (maxfd < pin[0] + 1)
@ -418,6 +421,13 @@ StartInit(pCE)
close(pout[0]);
close(pin[1]);
if (geteuid() == 0) {
if (pCE->initgid != 0)
setgid(pCE->initgid);
if (pCE->inituid != 0)
setuid(pCE->inituid);
}
tcsetpgrp(0, iNewGrp);
apcArgv[2] = pCE->initcmd;
@ -507,6 +517,15 @@ VirtDev(pCE)
Error("[%s] fd sync error", pCE->server);
Bye(EX_OSERR);
}
if (geteuid() == 0) {
if (pCE->execgid != 0)
setgid(pCE->execgid);
if (pCE->execuid != 0) {
fchown(0, pCE->execuid, -1);
setuid(pCE->execuid);
}
}
# if HAVE_STROPTS_H && !defined(_AIX)
/* SYSVr4 semantics for opening stream ptys (gregf)
* under PTX (others?) we have to push the compatibility
@ -589,6 +608,39 @@ VirtDev(pCE)
return -1;
}
char *
#if PROTOTYPES
ConsState(CONSENT *pCE)
#else
ConsState(pCE)
CONSENT *pCE;
#endif
{
if (!pCE->fup)
return "down";
if (pCE->initfile != (CONSFILE *)0)
return "initializing";
switch (pCE->ioState) {
case ISNORMAL:
return "up";
case INCONNECT:
return "connecting";
case ISDISCONNECTED:
return "disconnected";
#if HAVE_OPENSSL
case INSSLACCEPT:
return "SSL_accept";
case INSSLSHUTDOWN:
return "SSL_shutdown";
#endif
case ISFLUSHING:
return "flushing";
}
return "in unknown state";
}
/* down a console, virtual or real (ksb)
*
* this should be kept pretty simple, 'cause the config file reading code
@ -661,6 +713,40 @@ ConsInit(pCE)
extern int FallBack PARAMS((char **, int *));
int cofile = -1;
int ret;
#if HAVE_GETTIMEOFDAY
struct timeval tv;
#else
time_t tv;
#endif
if (pCE->spintimer > 0 && pCE->spinmax > 0) {
#if HAVE_GETTIMEOFDAY
if (gettimeofday(&tv, (void *)0) == 0) {
/* less than pCE->spintimer seconds gone by? */
if ((tv.tv_sec <= pCE->lastInit.tv_sec + pCE->spintimer - 1)
|| (tv.tv_sec == pCE->lastInit.tv_sec + 1 &&
tv.tv_usec <= pCE->lastInit.tv_usec)) {
#else
if ((tv = time((time_t *)0)) != (time_t)-1) {
/* less than pCE->spintimer seconds gone by? (approx) */
if (tv <= pCE->lastInit + pCE->spintimer) {
#endif
pCE->spincount++;
if (pCE->spincount >= pCE->spinmax) {
pCE->spincount = 0;
pCE->lastInit = tv;
Error
("[%s] initialization rate exceeded: forcing down",
pCE->server);
ConsDown(pCE, FLAGTRUE, FLAGTRUE);
return;
}
} else
pCE->spincount = 0;
pCE->lastInit = tv;
} else
pCE->spincount = 0;
}
/* clean up old stuff
*/
@ -691,7 +777,7 @@ ConsInit(pCE)
TagLogfile(pCE, "Console up");
switch (pCE->type) {
case UNKNOWN: /* shut up gcc */
case UNKNOWNTYPE: /* shut up gcc */
break;
case EXEC:
if ((cofile =
@ -717,7 +803,9 @@ ConsInit(pCE)
{
struct sockaddr_in port;
struct hostent *hp;
size_t one = 1;
#if HAVE_SETSOCKOPT
int one = 1;
#endif
usleep(100000); /* Not all terminal servers can keep up */
@ -741,7 +829,7 @@ ConsInit(pCE)
hp->h_length);
#endif
port.sin_family = hp->h_addrtype;
port.sin_port = htons(pCE->port);
port.sin_port = htons(pCE->netport);
if ((cofile = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
Error
@ -750,6 +838,7 @@ ConsInit(pCE)
ConsDown(pCE, FLAGTRUE, FLAGTRUE);
return;
}
#if HAVE_SETSOCKOPT
if (setsockopt
(cofile, SOL_SOCKET, SO_KEEPALIVE, (char *)&one,
sizeof(one)) < 0) {
@ -759,6 +848,7 @@ ConsInit(pCE)
ConsDown(pCE, FLAGTRUE, FLAGTRUE);
return;
}
#endif
if (!SetFlags(cofile, O_NONBLOCK, 0)) {
ConsDown(pCE, FLAGTRUE, FLAGTRUE);
@ -788,16 +878,18 @@ ConsInit(pCE)
if (ret == 0) {
pCE->ioState = ISNORMAL;
pCE->stateTimer = 0;
pCE->fup = 1;
} else {
pCE->ioState = INCONNECT;
pCE->stateTimer = time((time_t *)0) + CONNECTTIMEOUT;
pCE->fup = 1;
if (timers[T_STATE] == (time_t)0 ||
timers[T_STATE] > pCE->stateTimer)
timers[T_STATE] = pCE->stateTimer;
}
pCE->fup = 1;
break;
case DEVICE:
if (-1 ==
(cofile = open(pCE->device, O_RDWR | O_NDELAY, 0600))) {
(cofile = open(pCE->device, O_RDWR | O_NONBLOCK, 0600))) {
Error("[%s] open(%s): %s: forcing down", pCE->server,
pCE->device, strerror(errno));
@ -823,14 +915,14 @@ ConsInit(pCE)
}
switch (pCE->type) {
case UNKNOWN: /* shut up gcc */
case UNKNOWNTYPE: /* shut up gcc */
break;
case EXEC:
Verbose("[%s] pid %lu on %s", pCE->server, pCE->ipid,
pCE->execSlave);
break;
case HOST:
Verbose("[%s] port %hu on %s", pCE->server, pCE->port,
Verbose("[%s] port %hu on %s", pCE->server, pCE->netport,
pCE->host);
break;
case DEVICE:
@ -839,13 +931,28 @@ ConsInit(pCE)
break;
}
FD_SET(cofile, &rinit);
/* if we're waiting for connect() to finish, watch the
* write bit, otherwise watch for the read bit
*/
if (pCE->ioState == INCONNECT)
FD_SET(cofile, &winit);
else
FD_SET(cofile, &rinit);
if (maxfd < cofile + 1)
maxfd = cofile + 1;
tyme = time((time_t *)0);
if (pCE->ioState == ISNORMAL) {
pCE->lastWrite = tyme;
if (pCE->idletimeout != (time_t)0 &&
(timers[T_CIDLE] == (time_t)0 ||
timers[T_CIDLE] > pCE->lastWrite + pCE->idletimeout))
timers[T_CIDLE] = pCE->lastWrite + pCE->idletimeout;
}
/* If we have marks, adjust the next one so that it's in the future */
if (pCE->nextMark > 0) {
tyme = time((time_t *)0);
if (tyme >= pCE->nextMark) {
/* Add as many pCE->mark values as necessary so that we move
* beyond the current time.
@ -856,9 +963,19 @@ ConsInit(pCE)
}
if (pCE->downHard == FLAGTRUE) {
Msg("[%s] console up", pCE->server);
pCE->downHard = FLAGFALSE;
if (pCE->ioState == ISNORMAL) {
Msg("[%s] console up", pCE->server);
pCE->downHard = FLAGFALSE;
} else
Msg("[%s] console initializing", pCE->server);
}
#if HAVE_GETTIMEOFDAY
if (gettimeofday(&tv, (void *)0) == 0)
pCE->lastInit = tv;
#else
if ((tv = time((time_t *)0)) != (time_t)-1)
pCE->lastInit = tv;
#endif
if (pCE->ioState == ISNORMAL)
StartInit(pCE);

View File

@ -1,5 +1,5 @@
/*
* $Id: consent.h,v 5.48 2003-10-02 18:49:03-07 bryan Exp $
* $Id: consent.h,v 5.63 2005/06/08 18:09:40 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -52,7 +52,7 @@ typedef struct parity { /* a parity bits table */
} PARITY;
typedef enum consType {
UNKNOWN = 0,
UNKNOWNTYPE = 0,
DEVICE,
EXEC,
HOST
@ -65,6 +65,7 @@ typedef struct names {
typedef struct consentUsers {
NAMES *user;
short not;
struct consentUsers *next;
} CONSENTUSERS;
@ -78,6 +79,7 @@ typedef struct consent { /* console information */
NAMES *aliases; /* aliases for server name */
/* type == DEVICE */
char *device; /* device file */
char *devicesubst; /* device substitution pattern */
BAUD *baud; /* the baud on this console port */
PARITY *parity; /* the parity on this line */
FLAG hupcl; /* use HUPCL */
@ -90,15 +92,30 @@ typedef struct consent { /* console information */
#endif
/* type == HOST */
char *host; /* hostname */
unsigned short port; /* port number */
unsigned short netport; /* final port | netport = portbase + */
unsigned short port; /* port number | portinc * port */
unsigned short portbase; /* port base */
unsigned short portinc; /* port increment */
FLAG raw; /* raw or telnet protocol? */
/* type == EXEC */
char *exec; /* exec command */
char *execsubst; /* exec substitution pattern */
uid_t execuid; /* user to run exec as */
gid_t execgid; /* group to run exec as */
/* global stuff */
char *master; /* master hostname */
unsigned short breakNum; /* break type [1-9] */
char *logfile; /* logfile */
off_t logfilemax; /* size limit for rolling logfile */
char *initcmd; /* initcmd command */
char *initsubst; /* initcmd substitution pattern */
uid_t inituid; /* user to run initcmd as */
gid_t initgid; /* group to run initcmd as */
char *motd; /* motd */
time_t idletimeout; /* idle timeout */
char *idlestring; /* string to print when idle */
unsigned short spinmax; /* initialization spin maximum */
unsigned short spintimer; /* initialization spin timer */
/* timestamp stuff */
int mark; /* Mark (chime) interval */
long nextMark; /* Next mark (chime) time */
@ -123,6 +140,13 @@ typedef struct consent { /* console information */
int wbufIAC; /* next IAC location in wbuf */
IOSTATE ioState; /* state of the socket */
time_t stateTimer; /* timer for ioState states */
time_t lastWrite; /* time of last data sent to console */
#if HAVE_GETTIMEOFDAY
struct timeval lastInit; /* time of last initialization */
#else
time_t lastInit; /* time of last initialization */
#endif
unsigned short spincount; /* initialization spin counter */
/*** state information ***/
char acline[132 * 2 + 2]; /* max chars we will call a line */
@ -158,3 +182,4 @@ extern REMOTE *FindUniq PARAMS((REMOTE *));
extern void DestroyRemoteConsole PARAMS((REMOTE *));
extern void StartInit PARAMS((CONSENT *));
extern void StopInit PARAMS((CONSENT *));
extern char *ConsState PARAMS((CONSENT *));

View File

@ -1,6 +1,6 @@
.\" @(#)conserver.8 01/06/91 OSU CIS; Thomas A. Fine
.\" $Id: conserver.man,v 1.38 2003-09-22 08:33:41-07 bryan Exp $
.TH CONSERVER 8 "2003-09-22" "conserver-8.0.2" "conserver"
.\" $Id: conserver.man,v 1.51 2005/04/02 09:59:48 bryan Exp $
.TH CONSERVER 8 "2005/04/02" "conserver-8.1.13" "conserver"
.SH NAME
conserver \- console server daemon
.SH SYNOPSIS
@ -11,7 +11,7 @@ conserver \- console server daemon
.RB [ \-m
.IR max ]
.RB [ \-M
.IR addr ]
.IR master ]
.RB [ \-p
.IR port ]
.RB [ \-b
@ -26,6 +26,8 @@ conserver \- console server daemon
.IR logfile ]
.RB [ \-O
.IR min ]
.RB [ \-U
.IR logfile ]
.SH DESCRIPTION
.B Conserver
is the daemon that manages
@ -48,7 +50,7 @@ knowledge of the distribution of consoles among servers.)
.B Conserver
forks a child for each group of consoles it must manage
and assigns each process a port number to listen on.
The maximum number of consoles managed by each child process is set using
The maximum number of consoles managed by each child process is set using the
.B \-m
option.
The
@ -74,14 +76,31 @@ the
.BR conserver.cf (5)
access list.
.PP
When Unix domain sockets are used between the client and
server (enabled using
.BR --with-uds ),
authentication checks are done on the hardcoded address ``127.0.0.1''.
Automatic client redirection is also disabled (as if the
.B \-R
option was used) since the client cannot communicate with remote servers.
The directory used to hold the sockets is checked to make sure it's empty
when the server starts.
The server will
.B not
remove any files in the directory itself, just in case the directory is
accidentally specified as ``/etc'' or some other critical location.
The server will do its best to remove all the sockets when it shuts down,
but it could stop ungracefully (crash, ``kill -9'', etc)
and leave files behind.
It would then be up to the admin (or a creative startup script) to clean
up the directory before the server will start again.
.PP
.B Conserver
completely controls any connection to a console.
All escape sequences given by the user to
.B console
are passed to the server without interpretation.
The server recognizes and processes all escape sequences,
The suspend sequence is recognized by the server and sent back to the
client as a TCP out-of-band command, which the client processes.
The server recognizes and processes all escape sequences.
.PP
The
.B conserver
@ -93,7 +112,7 @@ Close all connections and exit.
.TP
SIGHUP
Reread the configuration file.
New consoles are managed by forking off new childen, deleted
New consoles are managed by forking off new children, deleted
consoles (and their clients) are dropped,
and changes to consoles are done "in place", resetting the console
port (bringing it down and up) only when necessary.
@ -147,7 +166,7 @@ the signing certificate must be properly trusted, which usually means
the public portion is in
.IB OPENSSL_ROOT /ssl/certs
(on both the client and server sides).
See the sample self-signing certficate making script
See the sample self-signing certificate making script
.B contrib/maketestcerts
for further clues.
To allow
@ -215,7 +234,7 @@ option.
.B \-d
Become a daemon.
Disconnects from the controlling terminal and sends
all output to the logfile (see
all output (including any debug output) to the logfile (see
.BR \-L ).
.TP
.B \-D
@ -269,11 +288,21 @@ may be changed at compile time using the
.B --with-maxmemb
option.
.TP
.BI \-M addr
Set the address to listen on.
This allows conserver to bind to a
.BI \-M master
Normally, this allows conserver to bind to a
particular IP address (like `127.0.0.1') instead of all interfaces.
The default is to bind to all addresses.
However, if
.B --with-uds
was used to enable Unix domain sockets for client/server communication,
this points conserver to the directory where it should store the sockets.
The default
.I master
directory
.RB (`` /tmp/conserver '')
may be changed at compile time using the
.B --with-uds
option.
.TP
.B \-n
Obsolete (now a no-op); see
@ -289,6 +318,9 @@ Enable periodic attempts (every
.I min
minutes) to open (``bring up'') all downed
consoles (similar to sending a SIGUSR1).
Without this option, or if
.I min
is zero, no periodic attempts occur.
.TP
.BI \-p port
Set the TCP port for the master process to listen on.
@ -299,6 +331,9 @@ The default
may be changed at compile time using the
.B --with-port
option.
If the
.B --with-uds
option was used, this option is ignored.
.TP
.BI \-P passwd
Read the table of authorized user data from the file
@ -322,6 +357,37 @@ connect to remote consoles will result in an informative message to the user.
.B \-S
Do not run the server, just perform a syntax check of configuration file and
exit with a non-zero value if there is an error.
Using more than one
.B \-S
will cause conserver to output various information about each console in 5
colon-separated fields, enclosed in curly-braces.
The philosophy behind the output is to provide information to allow external
detection of multiple consoles access the same physical port.
Since this is
.I highly
environment-specific, conserver cannot do the check internally.
.RS
.TP 9
.I name
The name of the console.
.TP
.I master
The hostname of the master conserver host for the console.
.TP
.I aliases
The console aliases in a comma-separated list.
.TP
.I type
The type of console.
Values will be a `/' for a local device, `|' for
a command, or `!' for a remote port.
.TP
.I details
Multiple values are comma-separated and depend on the type of the console.
Local devices will have the values of the device file and baud rate/parity.
Commands will have string to invoke.
Remote ports will have the values of the remote hostname and port number.
.RE
.TP
.B \-u
Send unloved console output to
@ -332,6 +398,17 @@ independent of whether logging of individual consoles is enabled via
.B conserver.cf
entries.
.TP
.BI \-U logfile
Copy all console data to the ``unified''
.IR logfile .
The output is the same as the
.B \-u
output, but all consoles, not
just those without a user, are logged.
Each line of output is prefixed with the console name.
If a user is attached read/write, a `*' is appended to the console name,
to allow log watching utilites to ignore potential user-introduced alarms.
.TP
.B \-v
Echo the configuration as it is being read (be verbose).
.TP
@ -350,7 +427,7 @@ The second style is the character-based, escape-sequence mode, while
connected to a console.
.PP
The initial line-based mode begins the same for both the master process
and it's children.
and its children.
Upon a successful (non-rejected) client connection, an ``ok'' is sent.
The client then issues a command and the server responds to it with a
result string (``ok'' being the sign of success for most commands).
@ -358,7 +435,7 @@ The commands available are ``help'', ``ssl'' (if
SSL was built into the code), ``login'', and ``exit''.
Using the ``login'' command, the client authenticates and gains access to
the extended command set.
This is where the master process and it's children differ.
This is where the master process and its children differ.
The master process gives the client access to global commands, and the
child provides commands for interacting with the consoles it manages.
The ``help'' command, in both cases, will provide a complete
@ -374,14 +451,16 @@ any interaction with the server is done with the default escape sequence.
This is, by no means, a complete description of the entire client/server
interaction.
It is, however, a brief explanation in order to give a idea of
what the program does.
what the program does. See the
.B \s-1PROTOCOL\s0
file in the distribution for further details.
.SH FILES
.PP
The following default file locations may be overridden
at compile time or by the command-line options described above.
Run
.B conserver \-V
(with no other options) to see the defaults set at compile time.
to see the defaults set at compile time.
.PP
.PD 0
.TP 25
@ -399,6 +478,9 @@ the master conserver process ID
.TP
.B /var/log/conserver
log of errors and informational messages
.TP
.B /tmp/conserver
directory to hold Unix domain sockets (if enabled)
.PD
.PP
Additionally, output from individual consoles may be logged

View File

@ -1,4 +0,0 @@
bryan:r71mXjfALB5Ak:any
djs:r71mXjfALB5Ak:login
chogan:*passwd*:foobar,login,shell
hogan:*passwd*:any

View File

@ -1,5 +1,5 @@
/*
* $Id: convert.c,v 1.7 2003-08-15 14:24:39-07 bryan Exp $
* $Id: convert.c,v 1.10 2004/05/28 01:08:28 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -32,7 +32,7 @@
#include <compat.h>
#include <util.h>
#include <cutil.h>
#include <consent.h>
#include <client.h>
#include <group.h>
@ -41,6 +41,16 @@
#include <master.h>
#include <main.h>
#if defined(USE_LIBWRAP)
/* we don't use it...but we link to it */
int allow_severity;
int deny_severity;
#endif
SECTION sections[] = {
{(char *)0, (void *)0, (void *)0, (void *)0, (void *)0}
};
void
DestroyDataStructures()
@ -139,7 +149,7 @@ ReadLine2(fp, save, iLine)
if (!peek && (ret == (char *)0)) {
(*iLine)++;
wholeline = BuildString(bufstr->string, wholestr);
if (wholeline[0] == '\000')
if (wholeline != (char *)0 && wholeline[0] == '\000')
wholeline = (char *)0;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
* $Id: util.h,v 1.55 2003-10-03 06:32:34-07 bryan Exp $
* $Id: cutil.h,v 1.64 2006/01/15 17:10:14 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -18,8 +18,11 @@
/* communication constants
*/
#define OB_IAC 0xff /* quote char */
#define OB_EXEC 'E' /* exec a command on the client */
#define OB_GOTO 'G' /* goto next console */
#define OB_SUSP 'Z' /* suspended by server */
#define OB_DROP '.' /* dropped by server */
#define OB_ABRT '.' /* abort */
/* Struct to wrap information about a "file"...
* This can be a socket, local file, whatever. We do this so
@ -67,6 +70,13 @@ typedef struct consFile {
int fd;
int fdout; /* only used when a simplePipe */
STRING *wbuf;
FLAG errored;
FLAG quoteiac;
FLAG sawiac;
FLAG sawiacsusp;
FLAG sawiacexec;
FLAG sawiacabrt;
FLAG sawiacgoto;
#if HAVE_OPENSSL
/* SSL stuff */
SSL *ssl;
@ -74,8 +84,43 @@ typedef struct consFile {
FLAG waitForRead;
#endif
/* Add crypto stuff to suit */
#if DEBUG_CONSFILE_IO
int debugrfd;
int debugwfd;
#endif
} CONSFILE;
typedef struct item {
char *id;
void (*reg) PARAMS((char *));
} ITEM;
typedef struct section {
char *id;
void (*begin) PARAMS((char *));
void (*end) PARAMS((void));
void (*abort) PARAMS((void));
void (*destroy) PARAMS((void));
ITEM *items;
} SECTION;
typedef enum substToken {
ISNOTHING = 0,
ISNUMBER,
ISSTRING
} SUBSTTOKEN;
typedef struct subst {
SUBSTTOKEN tokens[255];
/* data for callback function
*/
void *data;
/* function to retrieve a value (as a char* or int or both) for
* a substitution
*/
int (*callback) PARAMS((char, char **, int *));
} SUBST;
extern int isMultiProc, fDebug, fVerbose, fErrorPrinted;
extern char *progname;
extern pid_t thepid;
@ -87,6 +132,10 @@ extern fd_set winit;
extern int maxfd;
extern int debugLineNo;
extern char *debugFileName;
extern int line; /* used by ParseFile */
extern char *file; /* used by ParseFile */
extern SECTION sections[]; /* used by ParseFile */
extern int isMaster;
extern const char *StrTime PARAMS((time_t *));
extern void Debug PARAMS((int, char *, ...));
@ -114,6 +163,7 @@ extern int FileUnopen PARAMS((CONSFILE *));
extern void OutOfMem PARAMS(());
extern char *BuildTmpString PARAMS((const char *));
extern char *BuildTmpStringChar PARAMS((const char));
extern char *BuildTmpStringPrint PARAMS((char *, ...));
extern char *BuildString PARAMS((const char *, STRING *));
extern char *BuildStringChar PARAMS((const char, STRING *));
extern char *BuildStringPrint PARAMS((STRING *, char *, ...));
@ -126,6 +176,11 @@ extern STRING *AllocString PARAMS((void));
extern char *ReadLine PARAMS((FILE *, STRING *, int *));
extern enum consFileType FileGetType PARAMS((CONSFILE *));
extern void FileSetType PARAMS((CONSFILE *, enum consFileType));
extern void FileSetQuoteIAC PARAMS((CONSFILE *, FLAG));
extern FLAG FileSawQuoteSusp PARAMS((CONSFILE *));
extern FLAG FileSawQuoteExec PARAMS((CONSFILE *));
extern FLAG FileSawQuoteAbrt PARAMS((CONSFILE *));
extern FLAG FileSawQuoteGoto PARAMS((CONSFILE *));
extern void Bye PARAMS((int));
extern void DestroyDataStructures PARAMS((void));
extern int IsMe PARAMS((char *));
@ -135,6 +190,13 @@ extern int FileCanWrite PARAMS((CONSFILE *, fd_set *, fd_set *));
extern int FileBufEmpty PARAMS((CONSFILE *));
extern int SetFlags PARAMS((int, int, int));
extern char *StrDup PARAMS((char *));
extern int ParseIACBuf PARAMS((CONSFILE *, void *, int *));
extern void *MemMove PARAMS((void *, void *, size_t));
extern char *StringChar PARAMS((STRING *, int, char));
extern void ParseFile PARAMS((char *, FILE *, int));
extern void ProbeInterfaces PARAMS((in_addr_t));
extern void ProcessSubst
PARAMS((SUBST *, char **, char **, char *, char *));
#if HAVE_OPENSSL
extern SSL *FileGetSSL PARAMS((CONSFILE *));
extern void FileSetSSL PARAMS((CONSFILE *, SSL *));

View File

@ -1,5 +1,5 @@
/*
* $Id: fallback.c,v 5.59 2003-10-03 06:32:34-07 bryan Exp $
* $Id: fallback.c,v 5.61 2004/04/16 16:58:09 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -16,7 +16,7 @@
#include <compat.h>
#include <util.h>
#include <cutil.h>
/*
* get a pty for the user
@ -210,7 +210,7 @@ GetPseudoTTY(slave, slaveFD)
continue;
}
if (0 > (fd = open(acMaster, O_RDWR | O_NDELAY, 0))) {
if (0 > (fd = open(acMaster, O_RDWR | O_NONBLOCK, 0))) {
continue;
}
acSlave[iIndex] = *pcOne;

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
* $Id: group.h,v 5.38 2003-09-19 08:58:18-07 bryan Exp $
* $Id: group.h,v 5.48 2005/05/21 17:56:14 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -34,6 +34,16 @@
* 4. This notice may not be removed or altered.
*/
/* timers used to have various things happen */
#define T_STATE 0
#define T_CIDLE 1
#define T_MARK 2
#define T_REINIT 3
#define T_AUTOUP 4
#define T_ROLL 5
#define T_INITDELAY 6
#define T_MAX 7 /* T_MAX *must* be last */
/* return values used by CheckPass()
*/
#define AUTH_SUCCESS 0 /* ok */
@ -52,22 +62,26 @@ typedef struct grpent { /* group info */
struct grpent *pGEnext; /* next group entry */
} GRPENT;
extern void Spawn PARAMS((GRPENT *));
extern time_t timers[];
extern void Spawn PARAMS((GRPENT *, int));
extern int CheckPass PARAMS((char *, char *));
extern void TagLogfile PARAMS((const CONSENT *, char *, ...));
extern void TagLogfileAct PARAMS((const CONSENT *, char *, ...));
extern void CleanupBreak PARAMS((short));
extern void DestroyGroup PARAMS((GRPENT *));
extern void DestroyConsent PARAMS((GRPENT *, CONSENT *));
extern void SendClientsMsg PARAMS((CONSENT *, char *));
extern void ResetMark PARAMS((void));
extern void DestroyConsentUsers PARAMS((CONSENTUSERS **));
extern CONSENTUSERS *ConsentFindUser PARAMS((CONSENTUSERS *, char *));
extern int ConsentUserOk PARAMS((CONSENTUSERS *, char *));
extern void DisconnectClient
PARAMS((GRPENT *, CONSCLIENT *, char *, FLAG));
extern int ClientAccess PARAMS((CONSENT *, char *));
extern void DestroyClient PARAMS((CONSCLIENT *));
extern int CheckPasswd PARAMS((CONSCLIENT *, char *));
extern void DeUtmp PARAMS((GRPENT *, int));
extern void ClientWantsWrite PARAMS((CONSCLIENT *));
#if HAVE_OPENSSL
extern int AttemptSSL PARAMS((CONSCLIENT *));
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: main.c,v 5.161 2003-10-03 06:32:34-07 bryan Exp $
* $Id: main.c,v 5.196 2005/06/11 02:31:05 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -31,7 +31,7 @@
#include <pwd.h>
#include <util.h>
#include <cutil.h>
#include <consent.h>
#include <client.h>
#include <group.h>
@ -40,32 +40,38 @@
#include <readcfg.h>
#include <version.h>
#include <net/if.h>
#if HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
#endif
#include <dirent.h>
#if HAVE_OPENSSL
# include <openssl/opensslv.h>
#endif
int fAll = 0, fNoinit = 0, fVersion = 0, fStrip = 0, fDaemon = 0, fReopen =
int fAll = 0, fNoinit = 0, fVersion = 0, fStrip = 0, fReopen =
0, fNoautoreup = 0, fSyntaxOnly = 0;
char chDefAcc = 'r';
char *pcConfig = CONFIGFILE;
int isMaster = 1;
int cMaxMemb = MAXMEMB;
in_addr_t bindAddr;
in_addr_t bindAddr = INADDR_ANY;
unsigned short bindPort;
unsigned short bindBasePort;
static STRING *startedMsg = (STRING *)0;
CONFIG *optConf = (CONFIG *)0;
CONFIG *config = (CONFIG *)0;
char *interface = (char *)0;
CONFIG defConfig =
{ (STRING *)0, FLAGTRUE, 'r', FLAGFALSE, LOGFILEPATH, PASSWDFILE,
DEFPORT,
FLAGTRUE, FLAGTRUE, 0, DEFBASEPORT, (char *)0, 0
#if HAVE_SETPROCTITLE
, FLAGFALSE
#endif
#if HAVE_OPENSSL
, (char *)0, FLAGTRUE
#endif
};
struct sockaddr_in in_port;
CONSFILE *unifiedlog = (CONSFILE *)0;
#if HAVE_DMALLOC && DMALLOC_MARK_MAIN
unsigned long dmallocMarkMain = 0;
@ -317,6 +323,7 @@ SetupSSL()
#endif
{
if (ctx == (SSL_CTX *)0) {
char *ciphers;
SSL_load_error_strings();
if (!SSL_library_init()) {
Error("SetupSSL(): SSL_library_init() failed");
@ -346,6 +353,9 @@ SetupSSL()
config->sslcredentials);
Bye(EX_SOFTWARE);
}
ciphers = "ALL:!LOW:!EXP:!MD5:!aNULL:@STRENGTH";
} else {
ciphers = "ALL:!LOW:!EXP:!MD5:@STRENGTH";
}
SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, SSLVerifyCallback);
SSL_CTX_set_options(ctx,
@ -356,8 +366,7 @@ SetupSSL()
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER |
SSL_MODE_AUTO_RETRY);
SSL_CTX_set_tmp_dh_callback(ctx, TmpDHCallback);
if (SSL_CTX_set_cipher_list(ctx, "ALL:!LOW:!EXP:!MD5:@STRENGTH") !=
1) {
if (SSL_CTX_set_cipher_list(ctx, ciphers) != 1) {
Error("SetupSSL(): setting SSL cipher list failed");
Bye(EX_SOFTWARE);
}
@ -383,10 +392,23 @@ ReopenLogfile()
* after that, all bets are off...probably not see the errors (well,
* aside from the tail of the old logfile, if it was rolled).
*/
if (!fDaemon || config->logfile == (char *)0)
if (config->daemonmode != FLAGTRUE)
return;
close(1);
/* so, if we aren't in daemon mode, we just return before closing
* anything. if we are, there are two possibilities. first, if
* logfile is set, we close fd 1, open a file, etc. all should be
* well. if logfile isn't set, we end up closing fd 1 and 2 and
* returning (in case the logfile was set and then unset [config
* file change]).
*/
if (config->logfile == (char *)0) {
close(2);
return;
}
if (1 != open(config->logfile, O_WRONLY | O_CREAT | O_APPEND, 0644)) {
tag = 0;
Error("ReopenLogfile(): open(%s): %s", config->logfile,
@ -402,6 +424,31 @@ ReopenLogfile()
tag = 0;
}
void
#if PROTOTYPES
ReopenUnifiedlog(void)
#else
ReopenUnifiedlog()
#endif
{
/* close any existing */
if (unifiedlog != (CONSFILE *)0)
FileClose(&unifiedlog);
/* return if we aren't opening again */
if (config->unifiedlog == (char *)0)
return;
/* open a new one */
if ((unifiedlog =
FileOpen(config->unifiedlog, O_WRONLY | O_CREAT | O_APPEND,
0644)) == (CONSFILE *)0) {
Error("ReopenUnifiedlog(): open(%s): %s", config->unifiedlog,
strerror(errno));
return;
}
}
/* become a daemon (ksb)
*/
static void
@ -428,6 +475,9 @@ Daemonize()
#if defined(SIGTSTP)
SimpleSignal(SIGTSTP, SIG_IGN);
#endif
#if defined(SIGXFSZ)
SimpleSignal(SIGXFSZ, SIG_IGN);
#endif
fflush(stdout);
fflush(stderr);
@ -475,7 +525,7 @@ Usage(wantfull)
#endif
{
static char u_terse[] =
"[-7dDEFhinoRSuvV] [-a type] [-m max] [-M addr] [-p port] [-b port] [-c cred] [-C config] [-P passwd] [-L logfile] [-O min]";
"[-7dDEFhinoRSuvV] [-a type] [-m max] [-M master] [-p port] [-b port] [-c cred] [-C config] [-P passwd] [-L logfile] [-O min] [-U logfile]";
static char *full[] = {
"7 strip the high bit off all console data",
"a type set the default access type",
@ -498,15 +548,24 @@ Usage(wantfull)
"i initialize console connections on demand",
"L logfile give a new logfile path to the server process",
"m max maximum consoles managed per process",
"M addr address to listen on (all addresses by default)",
#if USE_UNIX_DOMAIN_SOCKETS
"M master directory that holds the Unix domain sockets",
#else
"M master address to listen on (all addresses by default)",
#endif
"n obsolete - see -u",
"o reopen downed console on client connect",
"O min reopen all downed consoles every <min> minutes",
#if USE_UNIX_DOMAIN_SOCKETS
"p port ignored - Unix domain sockets compiled into code",
#else
"p port port to listen on",
#endif
"P passwd give a new passwd file to the server process",
"R disable automatic client redirection",
"S syntax check of configuration file",
"u copy \"unloved\" console data to stdout",
"U logfile copy all console data to the \"unified\" logfile",
"v be verbose on startup",
"V output version info",
(char *)0
@ -543,6 +602,12 @@ Version()
#endif
#if HAVE_PAM
"pam",
#endif
#if TRUST_REVERSE_DNS
"trustrevdns",
#endif
#if USE_UNIX_DOMAIN_SOCKETS
"uds",
#endif
(char *)0
};
@ -555,17 +620,22 @@ Version()
isMultiProc = 0;
Msg("%s", THIS_VERSION);
Msg("default access type `%c'", chDefAcc);
Msg("default access type `%c'", defConfig.defaultaccess);
Msg("default escape sequence `%s%s'", FmtCtl(DEFATTN, acA1),
FmtCtl(DEFESC, acA2));
Msg("default configuration in `%s'", CONFIGFILE);
Msg("default password in `%s'", PASSWDFILE);
Msg("default logfile is `%s'", LOGFILEPATH);
Msg("default password in `%s'", defConfig.passwdfile);
Msg("default logfile is `%s'", defConfig.logfile);
Msg("default pidfile is `%s'", PIDFILE);
Msg("default limit is %d member%s per group", MAXMEMB,
MAXMEMB == 1 ? "" : "s");
Msg("default primary port referenced as `%s'", DEFPORT);
Msg("default secondary base port referenced as `%s'", DEFBASEPORT);
#if USE_UNIX_DOMAIN_SOCKETS
Msg("default socket directory `%s'", UDSDIR);
#else
Msg("default primary port referenced as `%s'", defConfig.primaryport);
Msg("default secondary base port referenced as `%s'",
defConfig.secondaryport);
#endif
BuildString((char *)0, acA1);
if (optionlist[0] == (char *)0)
@ -586,10 +656,12 @@ Version()
BuildStringChar('0' + DMALLOC_VERSION_MINOR, acA1);
BuildStringChar('.', acA1);
BuildStringChar('0' + DMALLOC_VERSION_PATCH, acA1);
#if defined(DMALLOC_VERSION_BETA)
if (DMALLOC_VERSION_BETA != 0) {
BuildString("-b", acA1);
BuildStringChar('0' + DMALLOC_VERSION_BETA, acA1);
}
#endif
Msg("dmalloc version: %s", acA1->string);
#endif
#if HAVE_OPENSSL
@ -631,6 +703,7 @@ DestroyDataStructures()
pACList = pAC;
}
DestroyConsentUsers(&pADList);
DestroyConsentUsers(&pLUList);
DestroyConfig(pConfig);
DestroyConfig(optConf);
@ -655,6 +728,8 @@ DestroyDataStructures()
DestroyBreakList();
DestroyStrings();
DestroyUserList();
if (substData != (SUBST *)0)
free(substData);
}
void
@ -704,6 +779,10 @@ SummarizeDataStructures()
size += strlen(pCE->initcmd);
if (pCE->execSlave != (char *)0)
size += strlen(pCE->execSlave);
if (pCE->motd != (char *)0)
size += strlen(pCE->motd);
if (pCE->idlestring != (char *)0)
size += strlen(pCE->idlestring);
if (pCE->fdlog != (CONSFILE *)0)
size += sizeof(CONSFILE);
if (pCE->cofile != (CONSFILE *)0)
@ -782,13 +861,13 @@ DumpDataStructures()
GRPENT *pGE;
CONSENT *pCE;
REMOTE *pRC;
char *empty = "<empty>";
#if HAVE_DMALLOC && DMALLOC_MARK_MAIN
CONDDEBUG((1, "DumpDataStructures(): dmalloc / MarkMain"));
dmalloc_log_changed(dmallocMarkMain, 1, 0, 1);
#endif
#define EMPTYSTR(x) x == (char *)0 ? empty : x
#define EMPTYSTR(x) x == (char *)0 ? "(null)" : x
#define FLAGSTR(x) x == FLAGTRUE ? "true" : (x == FLAGFALSE ? "false" : "unset")
if (!fDebug)
return;
@ -796,7 +875,7 @@ DumpDataStructures()
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext) {
CONDDEBUG((1,
"DumpDataStructures(): group: id=%u pid=%lu, port=%hu, imembers=%d",
"DumpDataStructures(): group: id=%u port=%hu, pid=%lu, imembers=%d",
pGE->id, pGE->port, (unsigned long)pGE->pid,
pGE->imembers));
@ -807,8 +886,9 @@ DumpDataStructures()
"DumpDataStructures(): server=%s, type=DEVICE",
EMPTYSTR(pCE->server)));
CONDDEBUG((1,
"DumpDataStructures(): baud=%s, parity=%s",
pCE->baud->acrate, pCE->parity->key));
"DumpDataStructures(): baud=%s, parity=%s, device=%s",
pCE->baud->acrate, pCE->parity->key,
EMPTYSTR(pCE->device)));
break;
case EXEC:
CONDDEBUG((1,
@ -819,6 +899,9 @@ DumpDataStructures()
EMPTYSTR(pCE->execSlave),
EMPTYSTR(pCE->exec),
(unsigned long)pCE->ipid));
CONDDEBUG((1,
"DumpDataStructures(): execuid=%d, execgid=%d",
pCE->execuid, pCE->execgid));
break;
case HOST:
@ -826,13 +909,13 @@ DumpDataStructures()
"DumpDataStructures(): server=%s, type=HOST",
EMPTYSTR(pCE->server)));
CONDDEBUG((1,
"DumpDataStructures(): host=%s, port=%hu, telnetState=%d",
EMPTYSTR(pCE->host), pCE->port,
pCE->telnetState));
"DumpDataStructures(): host=%s, raw=%s, netport=%hu, port=%hu, telnetState=%d",
EMPTYSTR(pCE->host), FLAGSTR(pCE->raw),
pCE->netport, pCE->port, pCE->telnetState));
break;
case UNKNOWN:
case UNKNOWNTYPE:
CONDDEBUG((1,
"DumpDataStructures(): server=%s, type=UNKNOWN",
"DumpDataStructures(): server=%s, type=UNKNOWNTYPE",
EMPTYSTR(pCE->server)));
break;
}
@ -850,48 +933,50 @@ DumpDataStructures()
CONDDEBUG((1,
"DumpDataStructures(): mark=%d, nextMark=%ld, autoReup=%hu, downHard=%s",
pCE->mark, pCE->nextMark, pCE->autoReUp,
pCE->downHard == FLAGTRUE ? "true" : "false"));
FLAGSTR(pCE->downHard)));
CONDDEBUG((1,
"DumpDataStructures(): nolog=%d, cofile=%d, activitylog=%s, breaklog=%s",
pCE->nolog, FileFDNum(pCE->cofile),
pCE->activitylog == FLAGTRUE ? "true" : "false",
pCE->breaklog == FLAGTRUE ? "true" : "false"));
FLAGSTR(pCE->activitylog), FLAGSTR(pCE->breaklog)));
CONDDEBUG((1,
"DumpDataStructures(): ixon=%s, ixany=%s, ixoff=%s",
pCE->ixon == FLAGTRUE ? "true" : "false",
pCE->ixany == FLAGTRUE ? "true" : "false",
pCE->ixoff == FLAGTRUE ? "true" : "false"));
FLAGSTR(pCE->ixon), FLAGSTR(pCE->ixany),
FLAGSTR(pCE->ixoff)));
CONDDEBUG((1,
"DumpDataStructures(): autoreinit=%s, hupcl=%s, cstopb=%s, ondemand=%s",
pCE->autoreinit == FLAGTRUE ? "true" : "false",
pCE->hupcl == FLAGTRUE ? "true" : "false",
pCE->cstopb == FLAGTRUE ? "true" : "false",
pCE->ondemand == FLAGTRUE ? "true" : "false"));
FLAGSTR(pCE->autoreinit), FLAGSTR(pCE->hupcl),
FLAGSTR(pCE->cstopb), FLAGSTR(pCE->ondemand)));
#if defined(CRTSCTS)
CONDDEBUG((1, "DumpDataStructures(): crtscts=%s",
pCE->crtscts == FLAGTRUE ? "true" : "false"));
FLAGSTR(pCE->crtscts)));
#endif
CONDDEBUG((1,
"DumpDataStructures(): reinitoncc=%s, striphigh=%s, unloved=%s",
pCE->reinitoncc == FLAGTRUE ? "true" : "false",
pCE->striphigh == FLAGTRUE ? "true" : "false",
pCE->unloved == FLAGTRUE ? "true" : "false"));
"DumpDataStructures(): reinitoncc=%s, striphigh=%s",
FLAGSTR(pCE->reinitoncc), FLAGSTR(pCE->striphigh)));
CONDDEBUG((1, "DumpDataStructures(): unloved=%s",
FLAGSTR(pCE->unloved)));
CONDDEBUG((1,
"DumpDataStructures(): initpid=%lu, initcmd=%s, initfile=%d",
(unsigned long)pCE->initpid, EMPTYSTR(pCE->initcmd),
FileFDNum(pCE->initfile)));
CONDDEBUG((1, "DumpDataStructures(): inituid=%d, initgid=%d",
pCE->inituid, pCE->initgid));
CONDDEBUG((1,
"DumpDataStructures(): motd=%s, idletimeout=%d, idlestring=%s",
EMPTYSTR(pCE->motd), pCE->idletimeout,
EMPTYSTR(pCE->idlestring)));
if (pCE->ro) {
CONSENTUSERS *u;
for (u = pCE->ro; u != (CONSENTUSERS *)0; u = u->next) {
CONDDEBUG((1, "DumpDataStructures(): ro=%s",
u->user->name));
CONDDEBUG((1, "DumpDataStructures(): ro=%s%s",
(u->not ? "!" : ""), u->user->name));
}
}
if (pCE->rw) {
CONSENTUSERS *u;
for (u = pCE->rw; u != (CONSENTUSERS *)0; u = u->next) {
CONDDEBUG((1, "DumpDataStructures(): rw=%s",
u->user->name));
CONDDEBUG((1, "DumpDataStructures(): rw=%s%s",
(u->not ? "!" : ""), u->user->name));
}
}
CONDDEBUG((1, "DumpDataStructures(): ------"));
@ -909,187 +994,93 @@ DumpDataStructures()
}
}
/* fills the myAddrs array with host interface addresses */
void
/* This makes sure a directory exists and tries to create it if it
* doesn't. returns 0 for success, -1 for error
*/
#if USE_UNIX_DOMAIN_SOCKETS
int
#if PROTOTYPES
ProbeInterfaces(void)
VerifyEmptyDirectory(char *d)
#else
ProbeInterfaces()
VerifyEmptyDirectory(d)
char *d;
#endif
{
#ifdef SIOCGIFCONF
struct ifconf ifc;
struct ifreq *ifr;
#ifdef SIOCGIFFLAGS
struct ifreq ifrcopy;
#endif
int sock;
int r = 0, m = 0;
int bufsize = 2048;
int count = 0;
struct stat dstat;
DIR *dir;
struct dirent *de;
STRING *path = (STRING *)0;
int retval = 0;
/* if we use -M, just fill the array with that interface */
if (bindAddr != INADDR_ANY) {
myAddrs = (struct in_addr *)calloc(2, sizeof(struct in_addr));
if (myAddrs == (struct in_addr *)0)
OutOfMem();
#if HAVE_MEMCPY
memcpy(&(myAddrs[0].s_addr), &bindAddr, sizeof(in_addr_t));
#else
bcopy(&bindAddr, &(myAddrs[0].s_addr), sizeof(in_addr_t));
#endif
Verbose("interface address %s (-M option)", inet_ntoa(myAddrs[0]));
return;
}
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
Error("ProbeInterfaces(): socket(): %s", strerror(errno));
Bye(EX_OSERR);
}
while (bufsize) {
ifc.ifc_len = bufsize;
ifc.ifc_req = (struct ifreq *)malloc(ifc.ifc_len);
if (ifc.ifc_req == (struct ifreq *)0)
OutOfMem();
if (ioctl(sock, SIOCGIFCONF, &ifc) != 0) {
free(ifc.ifc_req);
close(sock);
Error("ProbeInterfaces(): ioctl(SIOCGIFCONF): %s",
strerror(errno));
Bye(EX_OSERR);
}
/* if the return size plus a 512 byte "buffer zone" is less than
* the buffer we passed in (bufsize), we're done. otherwise
* allocate a bigger buffer and try again. with a too-small
* buffer, some implementations (freebsd) will fill the buffer
* best it can (leaving a gap - returning <=bufsize) and others
* (linux) will return a buffer length the same size as passed
* in (==bufsize). so, we'll assume a 512 byte gap would have
* been big enough to put one more record and as long as we have
* that "buffer zone", we should have all the interfaces.
*/
if (ifc.ifc_len + 512 < bufsize)
break;
free(ifc.ifc_req);
bufsize += 2048;
}
/* this is probably way overkill, but better to kill a few bytes
* than loop through looking for valid interfaces that are up
* twice, huh?
*/
count = ifc.ifc_len / sizeof(*ifr);
CONDDEBUG((1, "ProbeInterfaces(): ifc_len==%d max_count==%d",
ifc.ifc_len, count));
/* set up myAddrs array */
if (myAddrs != (struct in_addr *)0)
free(myAddrs);
myAddrs = (struct in_addr *)0;
if (count == 0) {
free(ifc.ifc_req);
close(sock);
return;
}
myAddrs = (struct in_addr *)calloc(count + 1, sizeof(struct in_addr));
if (myAddrs == (struct in_addr *)0)
OutOfMem();
for (m = r = 0; r < ifc.ifc_len;) {
struct sockaddr *sa;
ifr = (struct ifreq *)&ifc.ifc_buf[r];
sa = (struct sockaddr *)&ifr->ifr_addr;
/* don't use less than a ifreq sized chunk */
if ((ifc.ifc_len - r) < sizeof(*ifr))
break;
#ifdef HAVE_SA_LEN
if (sa->sa_len > sizeof(ifr->ifr_addr))
r += sizeof(ifr->ifr_name) + sa->sa_len;
else
#endif
r += sizeof(*ifr);
if (sa->sa_family == AF_INET) {
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
#ifdef SIOCGIFFLAGS
/* make sure the interface is up */
ifrcopy = *ifr;
if ((ioctl(sock, SIOCGIFFLAGS, &ifrcopy) == 0) &&
((ifrcopy.ifr_flags & IFF_UP) == 0))
while (1) {
if (stat(d, &dstat) == -1) {
if (errno == ENOENT) {
if (mkdir(d, 0755) == -1) {
Error("mkdir(%s): %s", d, strerror(errno));
return -1;
}
CONDDEBUG((1, "VerifyEmptyDirectory: created `%s'", d));
continue;
#endif
CONDDEBUG((1, "ProbeInterfaces(): name=%s addr=%s",
ifr->ifr_name, inet_ntoa(sin->sin_addr)));
#if HAVE_MEMCPY
memcpy(&myAddrs[m], &(sin->sin_addr), sizeof(struct in_addr));
#else
bcopy(&(sin->sin_addr), &myAddrs[m], sizeof(struct in_addr));
#endif
Verbose("interface address %s (%s)", inet_ntoa(myAddrs[m]),
ifr->ifr_name);
m++;
} else {
Error("stat(%s): %s", d, strerror(errno));
return -1;
}
}
}
if (m == 0) {
free(myAddrs);
myAddrs = (struct in_addr *)0;
}
close(sock);
free(ifc.ifc_req);
#else /* use the hostname like the old code did (but use all addresses!) */
int count;
struct hostent *he;
/* if we use -M, just fill the array with that interface */
if (bindAddr != INADDR_ANY) {
myAddrs = (struct in_addr *)calloc(2, sizeof(struct in_addr));
if (myAddrs == (struct in_addr *)0)
OutOfMem();
#if HAVE_MEMCPY
memcpy(&(myAddrs[0].s_addr), &bindAddr, sizeof(in_addr_t));
#else
bcopy(&bindAddr, &(myAddrs[0].s_addr), sizeof(in_addr_t));
#endif
Verbose("interface address %s (-M option)", inet_ntoa(myAddrs[0]));
return;
if (S_ISDIR(dstat.st_mode))
break;
return -1;
}
Verbose("using hostname for interface addresses");
if ((struct hostent *)0 == (he = gethostbyname(myHostname))) {
Error("ProbeInterfaces(): gethostbyname(%s): %s", myHostname,
hstrerror(h_errno));
return;
}
if (4 != he->h_length || AF_INET != he->h_addrtype) {
Error
("ProbeInterfaces(): gethostbyname(%s): wrong address size (4 != %d) or address family (%d != %d)",
myHostname, he->h_length, AF_INET, he->h_addrtype);
return;
/* now make sure it's empty...erase anything you see, etc */
if ((dir = opendir(d)) == (DIR *) 0) {
Error("opendir(%s): %s", d, strerror(errno));
return -1;
}
for (count = 0; he->h_addr_list[count] != (char *)0; count++);
if (myAddrs != (struct in_addr *)0)
free(myAddrs);
myAddrs = (struct in_addr *)0;
if (count == 0)
return;
myAddrs = (struct in_addr *)calloc(count + 1, sizeof(struct in_addr));
if (myAddrs == (struct in_addr *)0)
OutOfMem();
for (count--; count >= 0; count--) {
#if HAVE_MEMCPY
memcpy(&(myAddrs[count].s_addr), he->h_addr_list[count],
he->h_length);
#else
bcopy(he->h_addr_list[count], &(myAddrs[count].s_addr),
he->h_length);
while ((de = readdir(dir)) != (struct dirent *)0) {
if ((strcmp(de->d_name, ".") == 0) ||
(strcmp(de->d_name, "..") == 0))
continue;
/* we're going to just let the user deal with non-empty directories */
Error("non-empty directory `%s'", d);
retval = -1;
break;
/* this is probably too extreme. if someone happens to point conserver
* at /etc, for example, it could (if running as root) nuke the password
* database, config files, etc. too many important files could be
* shredded with a small typo.
*/
#if 0
if (path == (STRING *)0)
path = AllocString();
BuildStringPrint(path, "%s/%s", d, de->d_name);
if (stat(path->string, &dstat) == -1) {
Error("stat(%s): %s", path->string, strerror(errno));
retval = -1;
break;
}
if (S_ISDIR(dstat.st_mode)) {
if (rmdir(path->string) != 0) {
Error("rmdir(%s): %s", path->string, strerror(errno));
retval = -1;
break;
}
} else {
if (unlink(path->string) != 0) {
Error("unlink(%s): %s", path->string, strerror(errno));
retval = -1;
break;
}
}
#endif
Verbose("interface address %s (hostname address)",
inet_ntoa(myAddrs[count]));
}
#endif
if (path != (STRING *)0)
DestroyString(path);
return retval;
}
#endif
/* find out where/who we are (ksb)
* parse optons
@ -1110,7 +1101,7 @@ main(argc, argv)
{
int i;
FILE *fpConfig = (FILE *)0;
static char acOpts[] = "7a:b:c:C:dDEFhiL:m:M:noO:p:P:RSuVv";
static char acOpts[] = "7a:b:c:C:dDEFhiL:m:M:noO:p:P:RSuU:Vv";
extern int optopt;
extern char *optarg;
struct passwd *pwd;
@ -1118,8 +1109,10 @@ main(argc, argv)
char *curuser = (char *)0;
int curuid = 0;
GRPENT *pGE = (GRPENT *)0;
#if !USE_UNIX_DOMAIN_SOCKETS
#if HAVE_INET_ATON
struct in_addr inetaddr;
#endif
#endif
isMultiProc = 1; /* make sure stuff has the pid */
@ -1193,7 +1186,7 @@ main(argc, argv)
pcConfig = optarg;
break;
case 'd':
fDaemon = 1;
optConf->daemonmode = FLAGTRUE;
break;
case 'D':
fDebug++;
@ -1225,7 +1218,7 @@ main(argc, argv)
}
break;
case 'M':
interface = optarg;
interface = StrDup(optarg);
break;
case 'n':
/* noop now */
@ -1250,11 +1243,15 @@ main(argc, argv)
optConf->redirect = FLAGFALSE;
break;
case 'S':
fSyntaxOnly = 1;
fSyntaxOnly++;
break;
case 'u':
fAll = 1;
break;
case 'U':
if ((optConf->unifiedlog = StrDup(optarg)) == (char *)0)
OutOfMem();
break;
case 'V':
fVersion = 1;
break;
@ -1313,38 +1310,50 @@ main(argc, argv)
if (fSyntaxOnly)
Msg("performing configuration file syntax check");
#if USE_UNIX_DOMAIN_SOCKETS
/* Don't do any redirects if we're purely local
* (but it allows them to see where remote consoles are)
*/
optConf->redirect = FLAGFALSE;
if (interface == (char *)0)
interface = UDSDIR;
#else
/* set up the address to bind to */
if (interface == (char *)0 ||
(interface[0] == '*' && interface[1] == '\000'))
bindAddr = INADDR_ANY;
else {
#if HAVE_INET_ATON
# if HAVE_INET_ATON
if (inet_aton(interface, &inetaddr) == 0) {
Error("inet_aton(%s): %s", interface, "invalid IP address");
Bye(EX_OSERR);
}
bindAddr = inetaddr.s_addr;
#else
# else
bindAddr = inet_addr(interface);
if (bindAddr == (in_addr_t) (-1)) {
Error("inet_addr(%s): %s", interface, "invalid IP address");
Bye(EX_OSERR);
}
#endif
# endif
}
if (fDebug) {
struct in_addr ba;
ba.s_addr = bindAddr;
CONDDEBUG((1, "main(): bind address set to `%s'", inet_ntoa(ba)));
}
#endif
/* must do all this so IsMe() works right */
if (gethostname(myHostname, MAXHOSTNAME) != 0) {
Error("gethostname(): %s", interface, strerror(errno));
Error("gethostname(): %s", strerror(errno));
Bye(EX_OSERR);
}
ProbeInterfaces();
ProbeInterfaces(bindAddr);
/* initialize the timers */
for (i = 0; i < T_MAX; i++)
timers[i] = (time_t)0;
/* read the config file */
if ((FILE *)0 == (fpConfig = fopen(pcConfig, "r"))) {
@ -1354,13 +1363,14 @@ main(argc, argv)
ReadCfg(pcConfig, fpConfig);
fclose(fpConfig);
#if !USE_UNIX_DOMAIN_SOCKETS
/* set up the port to bind to */
if (optConf->primaryport != (char *)0)
config->primaryport = StrDup(optConf->primaryport);
else if (pConfig->primaryport != (char *)0)
config->primaryport = StrDup(pConfig->primaryport);
else
config->primaryport = StrDup(DEFPORT);
config->primaryport = StrDup(defConfig.primaryport);
if (config->primaryport == (char *)0)
OutOfMem();
@ -1377,8 +1387,7 @@ main(argc, argv)
struct servent *pSE;
if ((struct servent *)0 ==
(pSE = getservbyname(config->primaryport, "tcp"))) {
Error("getservbyname(%s): %s", config->primaryport,
strerror(errno));
Error("getservbyname(%s) failed", config->primaryport);
Bye(EX_OSERR);
} else {
bindPort = ntohs((unsigned short)pSE->s_port);
@ -1391,7 +1400,7 @@ main(argc, argv)
else if (pConfig->secondaryport != (char *)0)
config->secondaryport = StrDup(pConfig->secondaryport);
else
config->secondaryport = StrDup(DEFBASEPORT);
config->secondaryport = StrDup(defConfig.secondaryport);
if (config->secondaryport == (char *)0)
OutOfMem();
@ -1408,20 +1417,20 @@ main(argc, argv)
struct servent *pSE;
if ((struct servent *)0 ==
(pSE = getservbyname(config->secondaryport, "tcp"))) {
Error("getservbyname(%s): %s", config->secondaryport,
strerror(errno));
Error("getservbyname(%s) failed", config->secondaryport);
Bye(EX_OSERR);
} else {
bindBasePort = ntohs((unsigned short)pSE->s_port);
}
}
#endif
if (optConf->passwdfile != (char *)0)
config->passwdfile = StrDup(optConf->passwdfile);
else if (pConfig->passwdfile != (char *)0)
config->passwdfile = StrDup(pConfig->passwdfile);
else
config->passwdfile = StrDup(PASSWDFILE);
config->passwdfile = StrDup(defConfig.passwdfile);
if (config->passwdfile == (char *)0)
OutOfMem();
@ -1430,7 +1439,7 @@ main(argc, argv)
else if (pConfig->logfile != (char *)0)
config->logfile = StrDup(pConfig->logfile);
else
config->logfile = StrDup(LOGFILEPATH);
config->logfile = StrDup(defConfig.logfile);
if (config->logfile == (char *)0)
OutOfMem();
@ -1439,21 +1448,63 @@ main(argc, argv)
else if (pConfig->reinitcheck != 0)
config->reinitcheck = pConfig->reinitcheck;
else
config->reinitcheck = 0;
config->reinitcheck = defConfig.reinitcheck;
if (optConf->defaultaccess != '\000')
config->defaultaccess = optConf->defaultaccess;
else if (pConfig->defaultaccess != '\000')
config->defaultaccess = pConfig->defaultaccess;
else
config->defaultaccess = chDefAcc;
config->defaultaccess = defConfig.defaultaccess;
if (optConf->daemonmode != FLAGUNKNOWN)
config->daemonmode = optConf->daemonmode;
else if (pConfig->daemonmode != FLAGUNKNOWN)
config->daemonmode = pConfig->daemonmode;
else
config->daemonmode = defConfig.daemonmode;
if (optConf->redirect != FLAGUNKNOWN)
config->redirect = optConf->redirect;
else if (pConfig->redirect != FLAGUNKNOWN)
config->redirect = pConfig->redirect;
else
config->redirect = FLAGTRUE;
config->redirect = defConfig.redirect;
if (optConf->autocomplete != FLAGUNKNOWN)
config->autocomplete = optConf->autocomplete;
else if (pConfig->autocomplete != FLAGUNKNOWN)
config->autocomplete = pConfig->autocomplete;
else
config->autocomplete = defConfig.autocomplete;
if (optConf->loghostnames != FLAGUNKNOWN)
config->loghostnames = optConf->loghostnames;
else if (pConfig->loghostnames != FLAGUNKNOWN)
config->loghostnames = pConfig->loghostnames;
else
config->loghostnames = defConfig.loghostnames;
if (optConf->unifiedlog != (char *)0) {
config->unifiedlog = StrDup(optConf->unifiedlog);
if (config->unifiedlog == (char *)0)
OutOfMem();
} else if (pConfig->unifiedlog != (char *)0) {
config->unifiedlog = StrDup(pConfig->unifiedlog);
if (config->unifiedlog == (char *)0)
OutOfMem();
} else if (defConfig.unifiedlog != (char *)0) {
config->unifiedlog = StrDup(defConfig.unifiedlog);
if (config->unifiedlog == (char *)0)
OutOfMem();
}
if (optConf->initdelay != 0)
config->initdelay = optConf->initdelay;
else if (pConfig->initdelay != 0)
config->initdelay = pConfig->initdelay;
else
config->initdelay = defConfig.initdelay;
#if HAVE_OPENSSL
if (optConf->sslrequired != FLAGUNKNOWN)
@ -1461,14 +1512,23 @@ main(argc, argv)
else if (pConfig->sslrequired != FLAGUNKNOWN)
config->sslrequired = pConfig->sslrequired;
else
config->sslrequired = FLAGTRUE;
config->sslrequired = defConfig.sslrequired;
if (optConf->sslcredentials != (char *)0)
config->sslcredentials = optConf->sslcredentials;
config->sslcredentials = StrDup(optConf->sslcredentials);
else if (pConfig->sslcredentials != (char *)0)
config->sslcredentials = pConfig->sslcredentials;
config->sslcredentials = StrDup(pConfig->sslcredentials);
else
config->sslcredentials = (char *)0;
config->sslcredentials = StrDup(defConfig.sslcredentials);
#endif
#if HAVE_SETPROCTITLE
if (optConf->setproctitle != FLAGUNKNOWN)
config->setproctitle = optConf->setproctitle;
else if (pConfig->setproctitle != FLAGUNKNOWN)
config->setproctitle = pConfig->setproctitle;
else
config->setproctitle = defConfig.setproctitle;
#endif
#if HAVE_DMALLOC && DMALLOC_MARK_MAIN
@ -1477,15 +1537,23 @@ main(argc, argv)
if (pGroups == (GRPENT *)0 && pRCList == (REMOTE *)0) {
Error("no consoles found in configuration file");
} else if (!fSyntaxOnly) {
} else if (fSyntaxOnly) {
/* short-circuit */
#if USE_UNIX_DOMAIN_SOCKETS
} else if (VerifyEmptyDirectory(interface) == -1) {
Error("Master(): %s: unusable socket directory", interface);
#endif
} else {
#if HAVE_OPENSSL
/* Prep the SSL layer */
SetupSSL();
#endif
if (fDaemon)
if (config->daemonmode == FLAGTRUE)
Daemonize();
ReopenUnifiedlog();
/* if no one can use us we need to come up with a default
*/
if (pACList == (ACCESS *)0)
@ -1497,12 +1565,30 @@ main(argc, argv)
if (pGE->imembers == 0)
continue;
Spawn(pGE);
Spawn(pGE, -1);
Verbose("group #%d pid %lu on port %hu", pGE->id,
(unsigned long)pGE->pid, pGE->port);
}
#if HAVE_SETPROCTITLE
if (config->setproctitle == FLAGTRUE) {
REMOTE *pRC;
GRPENT *pGE;
int local = 0, remote = 0;
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext)
local += pGE->imembers;
for (pRC = pRCList; (REMOTE *)0 != pRC; pRC = pRC->pRCnext)
remote++;
# if USE_UNIX_DOMAIN_SOCKETS
setproctitle("master: port 0, %d local, %d remote", local,
remote);
#else
setproctitle("master: port %hu, %d local, %d remote", bindPort,
local, remote);
#endif
}
#endif
if (fVerbose) {
ACCESS *pACtmp;
for (pACtmp = pACList; pACtmp != (ACCESS *)0;
@ -1533,6 +1619,9 @@ main(argc, argv)
SignalKids(SIGTERM);
}
if (unifiedlog != (CONSFILE *)0)
FileClose(&unifiedlog);
DumpDataStructures();
Msg("terminated");

View File

@ -1,5 +1,5 @@
/*
* $Id: main.h,v 5.49 2003-06-15 19:50:28-07 bryan Exp $
* $Id: main.h,v 5.53 2004/05/21 04:15:17 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -44,11 +44,16 @@ extern unsigned short bindPort, bindBasePort;
extern char *pcConfig;
extern int cMaxMemb;
extern struct sockaddr_in in_port;
extern int isMaster;
extern CONFIG *optConf;
extern CONFIG *config;
extern CONFIG defConfig;
extern CONSFILE *unifiedlog;
#if USE_UNIX_DOMAIN_SOCKETS
extern char *interface;
#endif
#if HAVE_OPENSSL
extern SSL_CTX *ctx;
#endif
extern void ReopenLogfile PARAMS((void));
extern void ReopenUnifiedlog PARAMS((void));
extern void DumpDataStructures PARAMS((void));

View File

@ -1,5 +1,5 @@
/*
* $Id: master.c,v 5.117 2003-10-03 07:23:37-07 bryan Exp $
* $Id: master.c,v 5.132 2005/09/05 22:22:53 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -29,7 +29,7 @@
#include <compat.h>
#include <util.h>
#include <cutil.h>
#include <consent.h>
#include <client.h>
#include <group.h>
@ -68,9 +68,10 @@ FlagSawCHLD(sig)
*/
static void
#if PROTOTYPES
FixKids()
FixKids(int msfd)
#else
FixKids()
FixKids(msfd)
int msfd;
#endif
{
pid_t pid;
@ -124,7 +125,7 @@ FixKids()
/* this kid kid is dead, start another
*/
Spawn(pGE);
Spawn(pGE, msfd);
Verbose("group #%d pid %lu on port %hu", pGE->id,
(unsigned long)pGE->pid, pGE->port);
}
@ -231,6 +232,28 @@ SignalKids(arg)
}
}
REMOTE *
#if PROTOTYPES
FindRemoteConsole(char *args)
#else
FindRemoteConsole(args)
char *args;
#endif
{
REMOTE *pRC;
NAMES *name;
for (pRC = pRCList; (REMOTE *)0 != pRC; pRC = pRC->pRCnext) {
if (strcasecmp(args, pRC->rserver) == 0)
return pRC;
for (name = pRC->aliases; name != (NAMES *)0; name = name->next) {
if (strcasecmp(args, name->name) == 0)
return pRC;
}
}
return pRC;
}
void
#if PROTOTYPES
CommandCall(CONSCLIENT *pCL, char *args)
@ -263,16 +286,15 @@ CommandCall(pCL, args)
}
if (config->redirect == FLAGTRUE ||
(config->redirect != FLAGTRUE && found == 0)) {
for (pRC = pRCList; (REMOTE *)0 != pRC; pRC = pRC->pRCnext) {
if (strcasecmp(args, pRC->rserver) != 0)
continue;
if ((pRC = FindRemoteConsole(args)) != (REMOTE *)0) {
ambiguous = BuildTmpString(pRC->rserver);
ambiguous = BuildTmpString(", ");
++found;
pRCFound = pRC;
}
}
if (found == 0) { /* Then look for substring matches */
if (found == 0 && config->autocomplete == FLAGTRUE) {
/* Then look for substring matches */
NAMES *name = (NAMES *)0;
int foundOne = 0;
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext) {
@ -413,7 +435,7 @@ DoNormalRead(pCLServing)
{
char *pcCmd;
char *pcArgs;
int nr, i;
int nr, i, l;
unsigned char acIn[BUFSIZ];
/* read connection */
@ -422,212 +444,267 @@ DoNormalRead(pCLServing)
return;
}
for (i = 0; i < nr; ++i) {
if ('\n' != acIn[i]) {
BuildStringChar(acIn[i], pCLServing->accmd);
while ((l = ParseIACBuf(pCLServing->fd, acIn, &nr)) >= 0) {
if (l == 0) /* we ignore special OB_IAC stuff */
continue;
}
if ((pCLServing->accmd->used > 1) &&
('\r' ==
pCLServing->accmd->string[pCLServing->accmd->used - 2])) {
pCLServing->accmd->string[pCLServing->accmd->used - 2] =
'\000';
pCLServing->accmd->used--;
}
for (i = 0; i < l; ++i) {
if ('\n' != acIn[i]) {
BuildStringChar(acIn[i], pCLServing->accmd);
continue;
}
if ((pCLServing->accmd->used > 1) &&
('\r' ==
pCLServing->accmd->string[pCLServing->accmd->used - 2])) {
pCLServing->accmd->string[pCLServing->accmd->used - 2] =
'\000';
pCLServing->accmd->used--;
}
/* process password here...before we corrupt accmd */
if (pCLServing->iState == S_PASSWD) {
if (CheckPasswd(pCLServing, pCLServing->accmd->string) !=
AUTH_SUCCESS) {
FileWrite(pCLServing->fd, FLAGFALSE,
"invalid password\r\n", -1);
/* process password here...before we corrupt accmd */
if (pCLServing->iState == S_PASSWD) {
if (CheckPasswd(pCLServing, pCLServing->accmd->string) !=
AUTH_SUCCESS) {
FileWrite(pCLServing->fd, FLAGFALSE,
"invalid password\r\n", -1);
BuildString((char *)0, pCLServing->accmd);
DropMasterClient(pCLServing, FLAGFALSE);
return;
}
Verbose("<master> login %s", pCLServing->acid->string);
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", 4);
pCLServing->iState = S_NORMAL;
BuildString((char *)0, pCLServing->accmd);
DropMasterClient(pCLServing, FLAGFALSE);
return;
continue;
}
Verbose("<master> login %s", pCLServing->acid->string);
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", -1);
pCLServing->iState = S_NORMAL;
BuildString((char *)0, pCLServing->accmd);
continue;
}
if ((char *)0 != (pcArgs = strchr(pCLServing->accmd->string, ':'))) {
*pcArgs++ = '\000';
} else if ((char *)0 !=
(pcArgs = strchr(pCLServing->accmd->string, ' '))) {
*pcArgs++ = '\000';
}
if (pcArgs != (char *)0)
pcArgs = PruneSpace(pcArgs);
pcCmd = PruneSpace(pCLServing->accmd->string);
if (strcmp(pcCmd, "help") == 0) {
static char *apcHelp1[] = {
"exit disconnect\r\n",
"help this help message\r\n",
"login log in\r\n",
#if HAVE_OPENSSL
"ssl start ssl session\r\n",
#endif
(char *)0
};
static char *apcHelp2[] = {
"call provide port for given console\r\n",
"exit disconnect\r\n",
"groups provide ports for group leaders\r\n",
"help this help message\r\n",
"master provide a list of master servers\r\n",
"pid provide pid of master process\r\n",
"quit* terminate conserver (SIGTERM)\r\n",
"restart* restart conserver (SIGHUP)\r\n",
"version provide version info for server\r\n",
"* = requires admin privileges\r\n",
(char *)0
};
char **ppc;
for (ppc =
(pCLServing->iState == S_IDENT ? apcHelp1 : apcHelp2);
(char *)0 != *ppc; ++ppc) {
FileWrite(pCLServing->fd, FLAGTRUE, *ppc, -1);
if ((char *)0 !=
(pcArgs = strchr(pCLServing->accmd->string, ':'))) {
*pcArgs++ = '\000';
} else if ((char *)0 !=
(pcArgs = strchr(pCLServing->accmd->string, ' '))) {
*pcArgs++ = '\000';
}
FileWrite(pCLServing->fd, FLAGFALSE, (char *)0, 0);
} else if (strcmp(pcCmd, "exit") == 0) {
FileWrite(pCLServing->fd, FLAGFALSE, "goodbye\r\n", -1);
DropMasterClient(pCLServing, FLAGFALSE);
return;
if (pcArgs != (char *)0)
pcArgs = PruneSpace(pcArgs);
pcCmd = PruneSpace(pCLServing->accmd->string);
if (strcmp(pcCmd, "help") == 0) {
static char *apcHelp1[] = {
"exit disconnect\r\n",
"help this help message\r\n",
"login log in\r\n",
#if HAVE_OPENSSL
} else if (pCLServing->iState == S_IDENT &&
strcmp(pcCmd, "ssl") == 0) {
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", -1);
if (!AttemptSSL(pCLServing)) {
"ssl start ssl session\r\n",
#endif
(char *)0
};
static char *apcHelp2[] = {
"call provide port for given console\r\n",
"exit disconnect\r\n",
"groups provide ports for group leaders\r\n",
"help this help message\r\n",
"master provide a list of master servers\r\n",
"newlogs* close and open all logfiles (SIGUSR2)\r\n",
"pid provide pid of master process\r\n",
"quit* terminate conserver (SIGTERM)\r\n",
"restart* restart conserver (SIGHUP) - deprecated\r\n",
"reconfig* reread config file (SIGHUP)\r\n",
"version provide version info for server\r\n",
"up* bring up all downed consoles (SIGUSR1)\r\n",
"* = requires admin privileges\r\n",
(char *)0
};
char **ppc;
for (ppc =
(pCLServing->iState == S_IDENT ? apcHelp1 : apcHelp2);
(char *)0 != *ppc; ++ppc) {
FileWrite(pCLServing->fd, FLAGTRUE, *ppc, -1);
}
FileWrite(pCLServing->fd, FLAGFALSE, (char *)0, 0);
} else if (strcmp(pcCmd, "exit") == 0) {
FileWrite(pCLServing->fd, FLAGFALSE, "goodbye\r\n", -1);
DropMasterClient(pCLServing, FLAGFALSE);
return;
}
#endif
} else if (pCLServing->iState == S_IDENT &&
strcmp(pcCmd, "login") == 0) {
#if HAVE_OPENSSL
if (config->sslrequired == FLAGTRUE &&
FileGetType(pCLServing->fd) != SSLSocket) {
FileWrite(pCLServing->fd, FLAGFALSE,
"encryption required\r\n", -1);
} else {
} else if (pCLServing->iState == S_IDENT &&
strcmp(pcCmd, "ssl") == 0) {
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", -1);
if (!AttemptSSL(pCLServing)) {
DropMasterClient(pCLServing, FLAGFALSE);
return;
}
#endif
if (pcArgs == (char *)0) {
} else if (pCLServing->iState == S_IDENT &&
strcmp(pcCmd, "login") == 0) {
#if HAVE_OPENSSL
if (config->sslrequired == FLAGTRUE &&
FileGetType(pCLServing->fd) != SSLSocket) {
FileWrite(pCLServing->fd, FLAGFALSE,
"login requires argument\r\n", -1);
"encryption required\r\n", -1);
} else {
BuildString((char *)0, pCLServing->username);
BuildString((char *)0, pCLServing->acid);
BuildString(pcArgs, pCLServing->username);
BuildString(pcArgs, pCLServing->acid);
BuildStringChar('@', pCLServing->acid);
BuildString(pCLServing->peername->string,
pCLServing->acid);
if (pCLServing->caccess == 't' ||
CheckPasswd(pCLServing, "") == AUTH_SUCCESS) {
pCLServing->iState = S_NORMAL;
Verbose("<master> login %s",
pCLServing->acid->string);
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", -1);
} else {
FilePrint(pCLServing->fd, FLAGFALSE,
"passwd? %s\r\n", myHostname);
pCLServing->iState = S_PASSWD;
}
}
#if HAVE_OPENSSL
}
#endif
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "master") == 0) {
int iSep = 1;
if ((GRPENT *)0 != pGroups) {
struct sockaddr_in lcl;
socklen_t so = sizeof(lcl);
if (-1 ==
getsockname(FileFDNum(pCLServing->fd),
(struct sockaddr *)&lcl, &so)) {
FileWrite(pCLServing->fd, FLAGFALSE,
"getsockname failed, try again later\r\n",
-1);
Error("Master(): getsockname(%u): %s",
FileFDNum(pCLServing->fd), strerror(errno));
Bye(EX_OSERR);
if (pcArgs == (char *)0) {
FileWrite(pCLServing->fd, FLAGFALSE,
"login requires argument\r\n", -1);
} else {
BuildString((char *)0, pCLServing->username);
BuildString((char *)0, pCLServing->acid);
BuildString(pcArgs, pCLServing->username);
BuildString(pcArgs, pCLServing->acid);
BuildStringChar('@', pCLServing->acid);
BuildString(pCLServing->peername->string,
pCLServing->acid);
if (pCLServing->caccess == 't' ||
CheckPasswd(pCLServing, "") == AUTH_SUCCESS) {
pCLServing->iState = S_NORMAL;
Verbose("<master> login %s",
pCLServing->acid->string);
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n",
4);
} else {
FilePrint(pCLServing->fd, FLAGFALSE,
"passwd? %s\r\n", myHostname);
pCLServing->iState = S_PASSWD;
}
}
#if HAVE_OPENSSL
}
FilePrint(pCLServing->fd, FLAGTRUE, "@%s",
inet_ntoa(lcl.sin_addr));
iSep = 0;
}
if (config->redirect == FLAGTRUE) {
REMOTE *pRC;
for (pRC = pRCUniq; (REMOTE *)0 != pRC; pRC = pRC->pRCuniq) {
FilePrint(pCLServing->fd, FLAGTRUE, ":@%s" + iSep,
pRC->rhost);
#endif
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "master") == 0) {
int iSep = 1;
if ((GRPENT *)0 != pGroups) {
#if USE_UNIX_DOMAIN_SOCKETS
FilePrint(pCLServing->fd, FLAGTRUE, "@0");
iSep = 0;
#else
struct sockaddr_in lcl;
socklen_t so = sizeof(lcl);
if (-1 ==
getsockname(FileFDNum(pCLServing->fd),
(struct sockaddr *)&lcl, &so)) {
FileWrite(pCLServing->fd, FLAGFALSE,
"getsockname failed, try again later\r\n",
-1);
Error("Master(): getsockname(%u): %s",
FileFDNum(pCLServing->fd), strerror(errno));
iSep = -1;
} else {
FilePrint(pCLServing->fd, FLAGTRUE, "@%s",
inet_ntoa(lcl.sin_addr));
iSep = 0;
}
#endif
}
if (iSep >= 0) {
if (config->redirect == FLAGTRUE) {
REMOTE *pRC;
for (pRC = pRCUniq; (REMOTE *)0 != pRC;
pRC = pRC->pRCuniq) {
FilePrint(pCLServing->fd, FLAGTRUE,
":@%s" + iSep, pRC->rhost);
iSep = 0;
}
}
FileWrite(pCLServing->fd, FLAGFALSE, "\r\n", -1);
}
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "pid") == 0) {
FilePrint(pCLServing->fd, FLAGFALSE, "%lu\r\n",
(unsigned long)thepid);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "version") == 0) {
FilePrint(pCLServing->fd, FLAGFALSE, "version `%s'\r\n",
THIS_VERSION);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "quit") == 0) {
if (ConsentUserOk(pADList, pCLServing->username->string) ==
1) {
Verbose("quit command by %s",
pCLServing->acid->string);
FileWrite(pCLServing->fd, FLAGFALSE,
"ok -- terminated\r\n", -1);
DropMasterClient(pCLServing, FLAGFALSE);
kill(thepid, SIGTERM);
return;
} else
FileWrite(pCLServing->fd, FLAGFALSE,
"unauthorized command\r\n", -1);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "restart") == 0) {
if (ConsentUserOk(pADList, pCLServing->username->string) ==
1) {
FileWrite(pCLServing->fd, FLAGFALSE,
"ok -- restarting\r\n", -1);
Verbose("restart command by %s",
pCLServing->acid->string);
kill(thepid, SIGHUP);
} else
FileWrite(pCLServing->fd, FLAGFALSE,
"unauthorized command\r\n", -1);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "reconfig") == 0) {
if (ConsentUserOk(pADList, pCLServing->username->string) ==
1) {
FileWrite(pCLServing->fd, FLAGFALSE,
"ok -- reconfiguring\r\n", -1);
Verbose("reconfig command by %s",
pCLServing->acid->string);
kill(thepid, SIGHUP);
} else
FileWrite(pCLServing->fd, FLAGFALSE,
"unauthorized command\r\n", -1);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "up") == 0) {
if (ConsentUserOk(pADList, pCLServing->username->string) ==
1) {
FileWrite(pCLServing->fd, FLAGFALSE,
"ok -- bringing up consoles\r\n", -1);
Verbose("up command by %s", pCLServing->acid->string);
kill(thepid, SIGUSR1);
} else
FileWrite(pCLServing->fd, FLAGFALSE,
"unauthorized command\r\n", -1);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "newlogs") == 0) {
if (ConsentUserOk(pADList, pCLServing->username->string) ==
1) {
FileWrite(pCLServing->fd, FLAGFALSE,
"ok -- opening new logfiles\r\n", -1);
Verbose("newlogs command by %s",
pCLServing->acid->string);
kill(thepid, SIGUSR2);
} else
FileWrite(pCLServing->fd, FLAGFALSE,
"unauthorized command\r\n", -1);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "groups") == 0) {
int iSep = 1;
GRPENT *pGE;
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext) {
if (0 == pGE->imembers)
continue;
FilePrint(pCLServing->fd, FLAGTRUE, ":%hu" + iSep,
pGE->port);
iSep = 0;
}
FileWrite(pCLServing->fd, FLAGFALSE, "\r\n", 2);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "call") == 0) {
if (pcArgs == (char *)0)
FileWrite(pCLServing->fd, FLAGFALSE,
"call requires argument\r\n", -1);
else
CommandCall(pCLServing, pcArgs);
} else {
FileWrite(pCLServing->fd, FLAGFALSE, "unknown command\r\n",
-1);
}
FileWrite(pCLServing->fd, FLAGFALSE, "\r\n", -1);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "pid") == 0) {
FilePrint(pCLServing->fd, FLAGFALSE, "%lu\r\n",
(unsigned long)thepid);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "version") == 0) {
FilePrint(pCLServing->fd, FLAGFALSE, "version `%s'\r\n",
THIS_VERSION);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "quit") == 0) {
if (ConsentFindUser(pADList, pCLServing->username->string) !=
(CONSENTUSERS *)0 ||
ConsentFindUser(pADList, "*") != (CONSENTUSERS *)0) {
Verbose("quit command by %s", pCLServing->acid->string);
FileWrite(pCLServing->fd, FLAGFALSE,
"ok -- terminated\r\n", -1);
DropMasterClient(pCLServing, FLAGFALSE);
kill(thepid, SIGTERM);
return;
} else
FileWrite(pCLServing->fd, FLAGFALSE,
"unauthorized command\r\n", -1);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "restart") == 0) {
if (ConsentFindUser(pADList, pCLServing->username->string) !=
(CONSENTUSERS *)0 ||
ConsentFindUser(pADList, "*") != (CONSENTUSERS *)0) {
FileWrite(pCLServing->fd, FLAGFALSE,
"ok -- restarting\r\n", -1);
Verbose("restart command by %s", pCLServing->acid->string);
kill(thepid, SIGHUP);
} else
FileWrite(pCLServing->fd, FLAGFALSE,
"unauthorized command\r\n", -1);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "groups") == 0) {
int iSep = 1;
GRPENT *pGE;
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext) {
if (0 == pGE->imembers)
continue;
FilePrint(pCLServing->fd, FLAGTRUE, ":%hu" + iSep,
pGE->port);
iSep = 0;
}
FileWrite(pCLServing->fd, FLAGFALSE, "\r\n", -1);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "call") == 0) {
if (pcArgs == (char *)0)
FileWrite(pCLServing->fd, FLAGFALSE,
"call requires argument\r\n", -1);
else
CommandCall(pCLServing, pcArgs);
} else {
FileWrite(pCLServing->fd, FLAGFALSE, "unknown command\r\n",
-1);
BuildString((char *)0, pCLServing->accmd);
}
BuildString((char *)0, pCLServing->accmd);
nr -= l;
MemMove(acIn, acIn + l, nr);
}
}
@ -644,8 +721,15 @@ Master()
int msfd;
socklen_t so;
fd_set rmask, wmask;
#if USE_UNIX_DOMAIN_SOCKETS
struct sockaddr_un master_port;
static STRING *portPath = (STRING *)0;
#else
struct sockaddr_in master_port;
# if HAVE_SETSOCKOPT
int true = 1;
# endif
#endif
FILE *fp;
CONSCLIENT *pCLServing = (CONSCLIENT *)0;
CONSCLIENT *pCL = (CONSCLIENT *)0;
@ -662,6 +746,9 @@ Master()
#endif
#if defined(SIGPOLL)
SimpleSignal(SIGPOLL, SIG_IGN);
#endif
#if defined(SIGXFSZ)
SimpleSignal(SIGXFSZ, SIG_IGN);
#endif
SimpleSignal(SIGCHLD, FlagSawCHLD);
SimpleSignal(SIGTERM, FlagQuitIt);
@ -686,6 +773,40 @@ Master()
#else
bzero((char *)&master_port, sizeof(master_port));
#endif
#if USE_UNIX_DOMAIN_SOCKETS
master_port.sun_family = AF_UNIX;
if (portPath == (STRING *)0)
portPath = AllocString();
BuildStringPrint(portPath, "%s/0", interface);
if (portPath->used > sizeof(master_port.sun_path)) {
Error("Master(): path to socket too long: %s", portPath->string);
return;
}
strcpy(master_port.sun_path, portPath->string);
if ((msfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
Error("Master(): socket(AF_UNIX,SOCK_STREAM): %s",
strerror(errno));
return;
}
if (!SetFlags(msfd, O_NONBLOCK, 0))
return;
if (bind(msfd, (struct sockaddr *)&master_port, sizeof(master_port)) <
0) {
Error("Master(): bind(%s): %s", master_port.sun_path,
strerror(errno));
return;
}
if (listen(msfd, SOMAXCONN) < 0) {
Error("Master(): listen(%s): %s", master_port.sun_path,
strerror(errno));
return;
}
#else
master_port.sin_family = AF_INET;
master_port.sin_addr.s_addr = bindAddr;
master_port.sin_port = htons(bindPort);
@ -695,7 +816,7 @@ Master()
strerror(errno));
return;
}
#if HAVE_SETSOCKOPT
# if HAVE_SETSOCKOPT
if (setsockopt
(msfd, SOL_SOCKET, SO_REUSEADDR, (char *)&true,
sizeof(true)) < 0) {
@ -703,7 +824,7 @@ Master()
strerror(errno));
return;
}
#endif
# endif
if (!SetFlags(msfd, O_NONBLOCK, 0))
return;
@ -719,6 +840,7 @@ Master()
strerror(errno));
return;
}
#endif
fp = fopen(PIDFILE, "w");
if (fp) {
@ -736,14 +858,15 @@ Master()
for (fSawQuit = 0; !fSawQuit; /* can't close here :-( */ ) {
if (fSawCHLD) {
fSawCHLD = 0;
FixKids();
FixKids(msfd);
}
if (fSawHUP) {
fSawHUP = 0;
Msg("processing SIGHUP");
ReopenLogfile();
ReopenUnifiedlog();
SignalKids(SIGHUP);
ReReadCfg(msfd);
ReReadCfg(msfd, msfd);
/* fix up the client descriptors since ReReadCfg() doesn't
* see them like it can in the child processes */
for (pCL = pCLmall; pCL != (CONSCLIENT *)0; pCL = pCL->pCLscan) {
@ -763,6 +886,7 @@ Master()
fSawUSR2 = 0;
Msg("processing SIGUSR2");
ReopenLogfile();
ReopenUnifiedlog();
SignalKids(SIGUSR2);
}
if (fSawQuit) { /* Something above set the quit flag */
@ -854,9 +978,10 @@ Master()
}
/* set to non-blocking and wrap in a File object */
if (SetFlags(cfd, O_NONBLOCK, 0))
if (SetFlags(cfd, O_NONBLOCK, 0)) {
pCLmfree->fd = FileOpenFD(cfd, simpleSocket);
else
FileSetQuoteIAC(pCLmfree->fd, FLAGTRUE);
} else
pCLmfree->fd = (CONSFILE *)0;
if ((CONSFILE *)0 == pCLmfree->fd) {
@ -905,11 +1030,16 @@ Master()
if (ClientAccessOk(pCL)) {
pCL->ioState = ISNORMAL;
/* say hi to start */
FileWrite(pCL->fd, FLAGFALSE, "ok\r\n", -1);
FileWrite(pCL->fd, FLAGFALSE, "ok\r\n", 4);
} else
DropMasterClient(pCL, FLAGFALSE);
}
close(msfd);
#if USE_UNIX_DOMAIN_SOCKETS
unlink(master_port.sun_path);
#endif
/* clean up the free list */
while (pCLmfree != (CONSCLIENT *)0) {
pCL = pCLmfree->pCLnext;

View File

@ -1,5 +1,5 @@
/*
* $Id: master.h,v 5.17 2003-10-03 07:23:37-07 bryan Exp $
* $Id: master.h,v 5.17 2003/10/03 14:23:37 bryan Exp $
*
* Copyright conserver.com, 2000
*

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,30 @@
/*
* $Id: readcfg.h,v 5.33 2003-10-02 18:53:48-07 bryan Exp $
* $Id: readcfg.h,v 5.45 2005/06/07 19:55:51 bryan Exp $
*
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*/
#define BREAKDELAYDEFAULT 250
typedef struct config {
STRING *name;
FLAG autocomplete;
char defaultaccess;
FLAG daemonmode;
char *logfile;
char *initcmd;
char *motd;
char *passwdfile;
char *primaryport;
FLAG redirect;
FLAG loghostnames;
int reinitcheck;
char *secondaryport;
char *unifiedlog;
int initdelay;
#if HAVE_SETPROCTITLE
FLAG setproctitle;
#endif
#if HAVE_OPENSSL
char *sslcredentials;
FLAG sslrequired;
@ -35,11 +42,13 @@ extern REMOTE *pRCList; /* list of remote consoles we know about */
extern REMOTE *pRCUniq; /* list of uniq console servers */
extern ACCESS *pACList; /* `who do you love' (or trust) */
extern CONSENTUSERS *pADList; /* list of admin users */
extern CONSENTUSERS *pLUList; /* list of limited users */
extern BREAKS breakList[9]; /* list of break sequences */
extern CONFIG *pConfig; /* settings seen by config parser */
extern SUBST *substData; /* substitution function data */
extern void ReadCfg PARAMS((char *, FILE *));
extern void ReReadCfg PARAMS((int));
extern void ReReadCfg PARAMS((int, int));
extern void DestroyBreakList PARAMS((void));
extern void DestroyUserList PARAMS((void));
extern void DestroyConfig PARAMS((CONFIG *));

View File

@ -1,5 +1,5 @@
/*
* $Id: version.h,v 1.48 2003-10-05 17:04:09-07 bryan Exp $
* $Id: version.h,v 1.72 2006/01/15 17:10:44 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -14,4 +14,4 @@
@(#) Copyright 2000 conserver.com.\n\
All rights reserved.\n"
#define THIS_VERSION "conserver.com version 8.0.2"
#define THIS_VERSION "conserver.com version 8.1.13"

View File

@ -15,7 +15,7 @@ MKDIR = @MKDIR@
### Compiler and link options
CC = @CC@
CFLAGS = @CFLAGS@ # -DPUCC -DSUN5
CFLAGS = @CFLAGS@
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\"
CPPFLAGS = -I.. -I$(top_srcdir) -I$(srcdir) -I$(top_srcdir)/conserver $(DEFS) @CPPFLAGS@
LDFLAGS = @LDFLAGS@
@ -25,18 +25,23 @@ LIBS = @LIBS@
### Makefile rules - no user-servicable parts below
CONSOLE_OBJS = console.o getpassword.o ../conserver/util.o
CONSOLE_HDRS = ../config.h $(top_srcdir)/compat.h $(top_srcdir)/conserver/port.h
CONSOLE_OBJS = console.o getpassword.o readconf.o ../conserver/cutil.o
CONSOLE_HDRS = ../config.h $(top_srcdir)/compat.h \
$(top_srcdir)/conserver/cutil.h \
$(top_srcdir)/conserver/version.h \
$(srcdir)/getpassword.h $(srcdir)/readconf.h
ALL = console
all: $(ALL)
$(CONSOLE_OBJS): $(CONSOLE_HDRS)
console: $(CONSOLE_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o console $(CONSOLE_OBJS) $(LIBS)
../conserver/util.o:
( cd ../conserver && $(MAKE) $(MAKE_FLAGS) util.o ) || exit 1;
../conserver/cutil.o:
( cd ../conserver && $(MAKE) $(MAKE_FLAGS) cutil.o ) || exit 1;
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<

File diff suppressed because it is too large Load Diff

View File

@ -1,45 +1,45 @@
.\" $Id: console.man,v 1.37 2003-10-02 19:00:45-07 bryan Exp $
.TH CONSOLE 1 "2003-10-02" "conserver-8.0.2" "conserver"
.\" $Id: console.man,v 1.58 2005/09/05 22:17:33 bryan Exp $
.TH CONSOLE 1 "2005/09/05" "conserver-8.1.13" "conserver"
.SH NAME
console \- console server client program
.SH SYNOPSIS
.B console
.RB [ \-aAEfFsS ]
.RB [ \-7Dv ]
.RB [ \-c
.IR cred ]
.BR [ \-M
.IR mach ]
.BR [ \-p
.IR port ]
.RI [ generic-args ]
.RB [ \-aAfFsS ]
.BR [ \-e
.IR esc ]
.BR [ \-l
.IR user ]
.I console
.br
.B console
.RB [ \-hiIPrRuVwWx ]
.RB [ \-7Dv ]
.RB [ \-M
.IR mach ]
.RB [ \-p
.IR port ]
.RB [ \-d
.RI [ user ][\fB@\fP console ]]
.RB [ \- [ bB ]
.IR message ]
.RB [ \-t
.RI [ user ][\fB@\fP console ]
.IR message ]
.RI [ generic-args ]
.RB [ \-iIuwWx ]
.RI [ console ]
.br
.B console
.RB [ \-qQ ]
.RB [ \-7Dv ]
.RB [ \-M
.IR mach ]
.RB [ \-p
.RI [ generic-args ]
.RB [ \-hPqQrRV ]
.RB [ \- [ bB ]
.IR message ]
.RB [ \-d
.RI [ user ][\f3@\fP console ]]
.RB [ \-t
.RI [ user ][\f3@\fP console ]
.IR message ]
.RB [ \- [ zZ ]
.IR cmd ]
.PP
.IR generic-args :
.RB [ \-7DEnUv ]
.RB [ \-c
.IR cred ]
.RB [ \-C
.IR config ]
.BR [ \-M
.IR master ]
.BR [ \-p
.IR port ]
.BR [ \-l
.IR user ]
.SH DESCRIPTION
.B Console
is used to manipulate console terminals remotely or to poll running
@ -51,7 +51,8 @@ In the first form above,
asks the user's password before
granting interactive access to a console (on a non-trusted system),
since such a session may provide single-user access.
Only as much of the console name as is required to
If the server's autocompletion feature is enabled,
only as much of the console name as is required to
identify it uniquely to the server is required.
.PP
For non-interactive options,
@ -116,6 +117,10 @@ to users on the primary server.
Load an SSL certificate and key from the PEM encoded file
.IR cred .
.TP
.BI \-C config
Use the per-user configuration file
.IR config .
.TP
.B \-d
Disconnect the users specified by
.IR user @ console .
@ -150,9 +155,13 @@ The default value is
.B \-E
If encryption has been built into the code
.RB ( --with-openssl ),
encrypted client connections are a requirement.
This option allows the client to connect to a console
over a non-encrypted connection.
encrypted client connections are, by default, a requirement.
This option disables any attempt at creating an
encrypted connection.
If you'd like to use encrypted connections when your server
supports it, but fallback to non-encrypted otherwise, the
.B \-U
option is what you want.
.TP
.B \-f
Same as
@ -163,7 +172,7 @@ except it will force any existing connection into spy mode.
Display a brief help message.
.TP
.B \-i
Display information in a machine-parseable format (see below for the details).
Display status information in a machine-parseable format (see below for the details).
.TP
.B \-I
Same as
@ -179,19 +188,34 @@ uses $USER if its uid matches the user's real uid,
or $LOGNAME if its uid matches the user's real uid,
or else the name associated with the user's real uid.
.TP
.BI \-M mach
.BI \-M master
The
.B console
client program polls
.I mach
.I master
as the primary server,
rather than the default set at compile time (typically
.RB `` console '').
The default
.I mach
.I master
may be changed at compile time using the
.B --with-master
option.
If
.B --with-uds
is used to enable Unix domain sockets, however, this option points
.B console
to the directory which holds those sockets.
The default
.I master
directory
.RB (`` /tmp/conserver '')
may be changed at compile time using the
.B --with-uds
option.
.TP
.BI \-n
Do not read the system-wide configuration file.
.TP
.BI \-p port
Set the port to connect to.
@ -203,6 +227,9 @@ may be changed at compile time
using the
.B --with-port
option.
If the
.B --with-uds
option was used, this option is ignored.
.TP
.B \-P
Display the pid of the master daemon process on each server.
@ -264,6 +291,18 @@ and attached users
.RI ( user @ host
if attached read-write, `<spies>' if only users in spy mode, or `<none>').
.TP
.B \-U
If encryption has been built into the code
.RB ( --with-openssl ),
encrypted client connections are, by default, a requirement.
This option allows the client to attempt an encrypted connection
but fall back to a non-encrypted connection if the server doesn't
support encryption.
If the encryption handshake is failing, disabling encryption on the
client with the
.B \-E
option is probably what you want.
.TP
.B \-v
Be more verbose when building the connection(s).
Use this option in combination with any of `show' options (below)
@ -289,6 +328,72 @@ but just acts on the primary server.
.TP
.B \-x
Show a list of consoles and devices.
.TP
.BI \-z cmd
Sends a command
.RI ( cmd )
to each server and displays the result.
The valid commands are:
.RS
.sp
.PD 0
.TP 12
.B bringup
Try to connect all consoles marked as down (this is equivalent
to sending the server a SIGUSR1)
.TP
.B SIGUSR1
Same as
.B bringup
.TP
.B help
Displays the help message
.TP
.B pid
Returns the pid of the server (this is equivalent to
.BR \-P )
.TP
.B quit
Instructs the server to shut down (this is equivalent to
.B \-q
or sending the server a SIGTERM)
.TP
.B SIGTERM
Same as
.B quit
.TP
.B reconfig
Instructs the server to reload the configuration file, then
perform the actions of
.B reopen
(this is equivalent to sending the server a SIGHUP)
.TP
.B SIGHUP
Same as
.B reconfig
.TP
.B reopen
Instructs the server to reopen all logfiles, then
perform the actions of
.B bringup
(this is equivalent to sending the server a SIGUSR2)
.TP
.B SIGUSR2
Same as
.B reopen
.TP
.B version
Returns the version of the server (this is equivalent to
.BR \-V )
.PD
.RE
.TP
.BI \-Z cmd
Same as
.B \-z
but just sends
.I cmd
to the primary server.
.PP
The
.BR \-A ,
@ -297,12 +402,19 @@ The
options have the same effect as their lower-case variants.
In addition, they each request the last 20 lines of the console output after
making the connection (as if
.RB ` ^Ecr '
.RB `` ^Ecr ''
were typed).
.PP
The
.BR \-i ,
.BR \-u ,
.BR \-w ", and"
.B \-x
options can be given a console name, which will limit their output to that console.
.PP
The
.B \-i
option outputs information regarding each console in 13 colon-separated fields.
option outputs status information regarding each console in 15 colon-separated fields.
.TP
.I name
The name of the console.
@ -318,22 +430,22 @@ a command, or `!' for a remote port.
.TP
.I console-details
The details regarding the console.
The values here (all comma seperated) depend on the type of the console.
Local devices will have values of the device file, baud rate, and
The values here (all comma-separated) depend on the type of the console.
Local devices will have values of the device file, baud rate/parity, and
file descriptor for the device.
Commands will have values of the command, the command's pid, the
pseudo-tty, and file descriptor for the pseudo-tty.
Remote ports will have values of the remote hostname, remote port number,
and file descriptor for the socket connection.
``raw'' or ``telnet'' protocol, and file descriptor for the socket connection.
.TP
.I users-list
The details of each user connected to the console.
The details for each
user are an `@' seperated list of `w', `r', or `s' (for read-write, read-only,
user are an `@' separated list of `w', `r', or `s' (for read-write, read-only,
or suspended), username, hostname the user is on, the user's idle time,
and (for `r' and `s' users only) ``rw'' or ``ro'' (if the user wants
read-write mode or not).
Each user bundle is seperated by commas.
Each user bundle is separated by commas.
.TP
.I state
The state of the console.
@ -347,9 +459,9 @@ that the server can open the file for read, but not write.
.TP
.I logfile-details
The details regarding the logging for the console.
The comma seperated
The comma-separated
values will be the logfile, ``log'' or ``nolog'' (if logging is on
or not - toggled via ^EcL), ``act'' or ``noact'' (if activity logging is
or not - toggled via ``^EcL''), ``act'' or ``noact'' (if activity logging is
enabled or not - the `a' timestamp option), the timestamp interval, and
the file descriptor of the logfile.
.TP
@ -362,13 +474,300 @@ is at work, it will have the value of ``autoup'', otherwise it
will be ``noautoup''.
.TP
.I aliases
The console aliases are presented in a comma seperated list.
The console aliases are presented in a comma-separated list.
.TP
.I options
The active options for the console are presented in a comma seperated list.
The active options for the console are presented in a comma-separated list.
.TP
.I initcmd
The initcmd configuration option for the console.
.TP
.I idletimeout
The idletimeout configuration option for the console.
.TP
.I idlestring
The idlestring configuration option for the console.
.SH CONFIGURATION
.B Console
reads configuration information from the system-wide configuration file
.RB ( console.cf ),
then the per-user configuration file
.RB ( .consolerc ),
and then applies command-line arguments.
Each configuration location can override the previous.
The same happens when parsing an individual file - the later entries
always override the earlier entries.
Because of that, you should put ``global'' defaults first and
more specific defaults second.
.PP
The configuration file is read using the same parser as
.BR conserver.cf (5),
and you should check that manpage for parser details.
.B Console
recognizes the following configuration blocks.
.TP
\f3config\fP \f2hostname\fP|\f2ipaddr\fP
.br
Define a configuration block for the client host named
.I hostname
or using the address
.IR ipaddr .
If the value of ``*'' is used, the configuration block will be applied to
all client hosts.
.RS
.TP
\f3escape\fP \f2esc\fP
.br
Set the escape sequence (see the
.B \-e
command-line flag).
.TP
\f3master\fP \f2master\fP
.br
Set the default master to
.I master
(see the
.B \-M
command-line flag).
.TP
\f3port\fP \f2port\fP
.br
Set the default port to
.I port
(see the
.B \-p
command-line flag).
.TP
\f3sslcredentials\fP \f2filename\fP
.br
Set the
.SM SSL
credentials file location (see the
.B \-c
command-line flag).
.TP
\f3sslenabled\fP \f3yes\fP|\f3true\fP|\f3on\fP|\f3no\fP|\f3false\fP|\f3off\fP
.br
Set whether or not encryption is attempted when talking to servers (see the
.B \-E
command-line flag).
.TP
\f3sslrequired\fP \f3yes\fP|\f3true\fP|\f3on\fP|\f3no\fP|\f3false\fP|\f3off\fP
.br
Set whether or not encryption is required when talking to servers (see the
.B \-U
command-line flag).
.TP
\f3striphigh\fP \f3yes\fP|\f3true\fP|\f3on\fP|\f3no\fP|\f3false\fP|\f3off\fP
.br
Set whether or not to strip the high bit off all data received
(see the
.B \-7
command-line flag).
.TP
\f3username\fP \f2user\fP
.br
Set the username passed to the server to
.I user
(see the
.B \-l
command-line flag).
.RE
.TP
\f3terminal\fP \f2type\fP
.br
Define a configuration block when using a terminal of type
.IR type .
If the value of ``*'' is used, the configuration block will be applied to
all terminal types.
.RS
.TP
\f3attach\fP \f2string\fP|\f3""\fP
.br
Set a
.I string
to print when successfully attached to a console.
Character substitions will be performed based on the
.B attachsubst
value and occur
.I before
interpretation of the special characters below.
If the null string (``\f3""\fP'') is used, no string will be printed.
.I string
is a simple character string with the exception of `\e'
and `^':
.RS
.RS
.sp
.PD 0
.TP 6
.B \ea
alert
.TP
.B \eb
backspace
.TP
.B \ef
form-feed
.TP
.B \en
newline
.TP
.B \er
carriage-return
.TP
.B \et
tab
.TP
.B \ev
vertical-tab
.TP
.B \e\e
backslash
.TP
.B \e^
circumflex
.TP
.BI \e ooo
octal representation of a character (where
.I ooo
is one to three octal digits)
.TP
.BI \e c
character
.I c
.TP
.B ^?
delete
.TP
.BI ^ c
control character
.RI ( c
is ``and''ed with 0x1f)
.PD
.RE
.RE
.IP
An interesting use of
.B attach
and
.B attachsubst
would be:
.RS
.IP
.ft CR
.nf
terminal xterm {
attach "^[]0;conserver: U@C^G";
attachsubst U=us,C=cs;
}
.fi
.ft
.RE
.TP
\f3attachsubst\fP \f2c\fP\f3=\fP\f2t\fP[\f2n\fP]\f2f\fP[\f3,\fP...]|\f3""\fP
.br
Perform character substitutions on the
.B attach
value.
A series of replacements can be defined by specifying a
comma-separated list of
\f2c\fP\f3=\fP\f2t\fP[\f2n\fP]\f2f\fP
sequences where
.I c
is any printable character,
.I t
specifies the replacement value,
.I n
is a field length (optional),
and
.I f
is the format string.
.I t
can be one of the characters below, catagorized as a string replacement
or a numeric replacement, which dictates the use of the
.I n
and
.I f
fields.
.RS
.RS
.sp
.PD 0
.TP
String Replacement
.TP
.B u
username
.TP
.B c
console name
.sp
.PP
Numeric Replacement
.TP
none available (yet)
.PD
.RE
.RE
.IP
For string replacements, if the replacement isn't at least
.I n
characters, it will be padded with space characters on the left.
.I f
must be `s'.
For numeric replacements, the value will be formatted to at least
.I n
characters, padded with 0s if
.I n
begins with a 0, and space characters otherwise.
.I f
must be either `d', `x' or `X', specifying a decimal, lower-case
hexadecimal, or an uppercase hexadecimal conversion.
If the null string (``\f3""\fP'') is used, no replacements will be done.
.TP
\f3detach\fP \f2string\fP|\f3""\fP
.br
Set a
.I string
to print once detached from a console.
Character substitions will be performed based on the
.B detachsubst
value.
See the
.B attach
option for an explanation of
.IR string .
If the null string (``\f3""\fP'') is used, no string will be printed.
.TP
\f3detachsubst\fP \f2c\fP\f3=\fP\f2t\fP[\f2n\fP]\f2f\fP[\f3,\fP...]|\f3""\fP
.br
Perform character substitutions on the
.B detach
value.
See the
.B attachsubst
option for an explanation of the format string.
.RE
.PP
A simple configuration to set a new default escape sequence and override
the master location would be:
.IP
.ft CR
.nf
# override options for all hosts
config * {
master localhost;
escape ^Ee;
}
# set things more specific to host1
# note: if the entries were reversed, host1
# would also use localhost.
config host1 {
master console1;
}
.fi
.ft
.SH "ESCAPE SEQUENCES"
The connection can be controlled by a two-character escape sequence, followed
by a command.
@ -381,6 +780,12 @@ Commands are:
.sp
.PD 0
.TP 13
.B \.
disconnect
.TP
.B ;
move to another console
.TP
.B a
attach read-write if nobody already is
.TP
@ -402,6 +807,9 @@ forcibly attach read-write
.B g
group info
.TP
.B i
information dump
.TP
.B L
toggle logging on/off
.TP
@ -445,6 +853,9 @@ examine this group's devices and modes
.B z
suspend this connection
.TP
.B |
attach a local command to the console
.TP
.B ?
display list of commands
.TP
@ -458,14 +869,12 @@ replay the last line only
send character having octal code
.IR ooo " (must"
specify three octal digits)
.IP \.
disconnect
.PD
.PP
If any other character is hit after the escape sequence, all three characters
will be discarded.
Note that a line break or a down command
can only be sent from a full two-way attachment.
can only be sent from a read-write connection.
To send the escape sequence through the connection one must redefine
the outer escape sequence, or use
.BI ^Ec\e ooo
@ -476,13 +885,17 @@ In the
.B \-u
output, the login ``<none>'' indicates no one is
viewing that console, and the login ``<spies>'' indicates that
no one has a full two-way attachment.
When no one is attached to
a console its output is cloned to the stdout of the server process if
.B conserver
was started with the
.B \-u
option.
no one has a read-write connection (only read-only).
.PP
When running a local command via
.RB `` ^Ec| '',
you can type
.RB ` ^C '
to send the command a SIGHUP,
.RB ` ^\e '
to send the command a SIGKILL, and
.RB ` o '
to toggle the display of the console data.
.SH EXAMPLES
.TP 15
console \-u
@ -534,6 +947,22 @@ or number of days is displayed.
console \-e "^[1" lv426
Requests a connection to the host ``lv426'' with the escape characters
set to ``escape one''.
.SH FILES
.PP
The following default file locations may be overridden
at compile time or by the command-line options described above.
Run
.B console \-V
to see the defaults set at compile time.
.PP
.PD 0
.TP 25
.B /etc/console.cf
system-wide configuration file
.TP
.B \s-1$HOME\s0/.consolerc
per-user configuration file
.PD
.SH BUGS
It is possible to create a loop of console connections, with ugly results.
Never run

View File

@ -1,5 +1,5 @@
/*
* $Id: getpassword.c,v 1.7 2003-09-28 12:29:17-07 bryan Exp $
* $Id: getpassword.c,v 1.8 2003/11/20 13:56:41 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -12,7 +12,7 @@
#include <pwd.h>
#include <util.h>
#include <cutil.h>
#include <version.h>

View File

@ -1,5 +1,5 @@
/*
* $Id: getpassword.h,v 1.3 2003-09-11 02:10:58-07 bryan Exp $
* $Id: getpassword.h,v 1.3 2003/09/11 09:10:58 bryan Exp $
*
* Copyright conserver.com, 2000
*

719
console/readconf.c Normal file
View File

@ -0,0 +1,719 @@
/*
* $Id: readconf.c,v 5.3 2005/06/11 02:32:21 bryan Exp $
*
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*/
#include <compat.h>
#include <cutil.h>
#include <readconf.h>
CONFIG *parserConfigTemp = (CONFIG *)0;
CONFIG *parserConfigDefault = (CONFIG *)0;
CONFIG *pConfig = (CONFIG *)0;
TERM *parserTermTemp = (TERM *)0;
TERM *parserTermDefault = (TERM *)0;
TERM *pTerm = (TERM *)0;
void
#if PROTOTYPES
DestroyConfig(CONFIG *c)
#else
DestroyConfig(c)
CONFIG *c;
#endif
{
if (c == (CONFIG *)0)
return;
if (c->username != (char *)0)
free(c->username);
if (c->master != (char *)0)
free(c->master);
if (c->port != (char *)0)
free(c->port);
if (c->escape != (char *)0)
free(c->escape);
#if HAVE_OPENSSL
if (c->sslcredentials != (char *)0)
free(c->sslcredentials);
#endif
free(c);
}
void
#if PROTOTYPES
ApplyConfigDefault(CONFIG *c)
#else
ApplyConfigDefault(c)
CONFIG *c;
#endif
{
if (parserConfigDefault == (CONFIG *)0)
return;
if (parserConfigDefault->username != (char *)0) {
if (c->username != (char *)0)
free(c->username);
if ((c->username =
StrDup(parserConfigDefault->username)) == (char *)0)
OutOfMem();
}
if (parserConfigDefault->master != (char *)0) {
if (c->master != (char *)0)
free(c->master);
if ((c->master = StrDup(parserConfigDefault->master)) == (char *)0)
OutOfMem();
}
if (parserConfigDefault->port != (char *)0) {
if (c->port != (char *)0)
free(c->port);
if ((c->port = StrDup(parserConfigDefault->port)) == (char *)0)
OutOfMem();
}
if (parserConfigDefault->escape != (char *)0) {
if (c->escape != (char *)0)
free(c->escape);
if ((c->escape = StrDup(parserConfigDefault->escape)) == (char *)0)
OutOfMem();
}
if (parserConfigDefault->striphigh != FLAGUNKNOWN)
c->striphigh = parserConfigDefault->striphigh;
#if HAVE_OPENSSL
if (parserConfigDefault->sslcredentials != (char *)0) {
if (c->sslcredentials != (char *)0)
free(c->sslcredentials);
if ((c->sslcredentials =
StrDup(parserConfigDefault->sslcredentials)) == (char *)0)
OutOfMem();
}
if (parserConfigDefault->sslrequired != FLAGUNKNOWN)
c->sslrequired = parserConfigDefault->sslrequired;
if (parserConfigDefault->sslenabled != FLAGUNKNOWN)
c->sslenabled = parserConfigDefault->sslenabled;
#endif
}
void
#if PROTOTYPES
ConfigBegin(char *id)
#else
ConfigBegin(id)
char *id;
#endif
{
CONDDEBUG((1, "ConfigBegin(%s) [%s:%d]", id, file, line));
if (id == (char *)0 || id[0] == '\000') {
Error("empty config name [%s:%d]", file, line);
return;
}
if (parserConfigTemp != (CONFIG *)0)
DestroyConfig(parserConfigTemp);
if ((parserConfigTemp = (CONFIG *)calloc(1, sizeof(CONFIG)))
== (CONFIG *)0)
OutOfMem();
ApplyConfigDefault(parserConfigTemp);
parserConfigTemp->name = AllocString();
BuildString(id, parserConfigTemp->name);
}
void
#if PROTOTYPES
ConfigEnd(void)
#else
ConfigEnd()
#endif
{
CONDDEBUG((1, "ConfigEnd() [%s:%d]", file, line));
if (parserConfigTemp == (CONFIG *)0)
return;
if (parserConfigTemp->name->used > 1) {
if ((parserConfigTemp->name->string[0] == '*' &&
parserConfigTemp->name->string[1] == '\000') ||
IsMe(parserConfigTemp->name->string)) {
DestroyConfig(parserConfigDefault);
parserConfigDefault = parserConfigTemp;
parserConfigTemp = (CONFIG *)0;
}
}
DestroyConfig(parserConfigTemp);
parserConfigTemp = (CONFIG *)0;
}
void
#if PROTOTYPES
ConfigAbort(void)
#else
ConfigAbort()
#endif
{
CONDDEBUG((1, "ConfigAbort() [%s:%d]", file, line));
if (parserConfigTemp == (CONFIG *)0)
return;
DestroyConfig(parserConfigTemp);
parserConfigTemp = (CONFIG *)0;
}
void
#if PROTOTYPES
ConfigDestroy(void)
#else
ConfigDestroy()
#endif
{
CONDDEBUG((1, "ConfigDestroy() [%s:%d]", file, line));
if (parserConfigTemp != (CONFIG *)0) {
DestroyConfig(parserConfigTemp);
parserConfigTemp = (CONFIG *)0;
}
if (parserConfigDefault != (CONFIG *)0) {
DestroyConfig(pConfig);
pConfig = parserConfigDefault;
parserConfigDefault = (CONFIG *)0;
}
}
void
#if PROTOTYPES
DestroyTerminal(TERM *t)
#else
DestroyTerminal(t)
TERM *t;
#endif
{
if (t == (TERM *)0)
return;
if (t->attach != (char *)0)
free(t->attach);
if (t->attachsubst != (char *)0)
free(t->attachsubst);
if (t->detach != (char *)0)
free(t->detach);
if (t->detachsubst != (char *)0)
free(t->detachsubst);
free(t);
}
void
#if PROTOTYPES
ApplyTermDefault(TERM *t)
#else
ApplyTermDefault(t)
TERM *t;
#endif
{
if (parserTermDefault == (TERM *)0)
return;
if (parserTermDefault->attach != (char *)0) {
if (t->attach != (char *)0)
free(t->attach);
if ((t->attach = StrDup(parserTermDefault->attach)) == (char *)0)
OutOfMem();
}
if (parserTermDefault->attachsubst != (char *)0) {
if (t->attachsubst != (char *)0)
free(t->attachsubst);
if ((t->attachsubst =
StrDup(parserTermDefault->attachsubst)) == (char *)0)
OutOfMem();
}
if (parserTermDefault->detach != (char *)0) {
if (t->detach != (char *)0)
free(t->detach);
if ((t->detach = StrDup(parserTermDefault->detach)) == (char *)0)
OutOfMem();
}
if (parserTermDefault->detachsubst != (char *)0) {
if (t->detachsubst != (char *)0)
free(t->detachsubst);
if ((t->detachsubst =
StrDup(parserTermDefault->detachsubst)) == (char *)0)
OutOfMem();
}
}
void
#if PROTOTYPES
TerminalBegin(char *id)
#else
TerminalBegin(id)
char *id;
#endif
{
CONDDEBUG((1, "TerminalBegin(%s) [%s:%d]", id, file, line));
if (id == (char *)0 || id[0] == '\000') {
Error("empty terminal name [%s:%d]", file, line);
return;
}
if (parserTermTemp != (TERM *)0)
DestroyTerminal(parserTermTemp);
if ((parserTermTemp = (TERM *)calloc(1, sizeof(TERM)))
== (TERM *)0)
OutOfMem();
ApplyTermDefault(parserTermTemp);
parserTermTemp->name = AllocString();
BuildString(id, parserTermTemp->name);
}
void
#if PROTOTYPES
TerminalEnd(void)
#else
TerminalEnd()
#endif
{
static char *term = (char *)0;
CONDDEBUG((1, "TerminalEnd() [%s:%d]", file, line));
if (parserTermTemp == (TERM *)0)
return;
if (term == (char *)0) {
if ((term = getenv("TERM")) == (char *)0) {
term = "";
}
}
if (parserTermTemp->name->used > 1) {
if ((parserTermTemp->name->string[0] == '*' &&
parserTermTemp->name->string[1] == '\000') ||
strcmp(parserTermTemp->name->string, term) == 0) {
DestroyTerminal(parserTermDefault);
parserTermDefault = parserTermTemp;
parserTermTemp = (TERM *)0;
}
}
DestroyTerminal(parserTermTemp);
parserTermTemp = (TERM *)0;
}
void
#if PROTOTYPES
TerminalAbort(void)
#else
TerminalAbort()
#endif
{
CONDDEBUG((1, "TerminalAbort() [%s:%d]", file, line));
if (parserTermTemp == (TERM *)0)
return;
DestroyTerminal(parserTermTemp);
parserTermTemp = (TERM *)0;
}
void
#if PROTOTYPES
TerminalDestroy(void)
#else
TerminalDestroy()
#endif
{
CONDDEBUG((1, "TerminalDestroy() [%s:%d]", file, line));
if (parserTermTemp != (TERM *)0) {
DestroyTerminal(parserTermTemp);
parserTermTemp = (TERM *)0;
}
if (parserTermDefault != (TERM *)0) {
DestroyTerminal(pTerm);
pTerm = parserTermDefault;
parserTermDefault = (TERM *)0;
}
}
void
#if PROTOTYPES
ProcessYesNo(char *id, FLAG *flag)
#else
ProcessYesNo(id, flag)
char *id;
FLAG *flag;
#endif
{
if (id == (char *)0 || id[0] == '\000')
*flag = FLAGFALSE;
else if (strcasecmp("yes", id) == 0 || strcasecmp("true", id) == 0 ||
strcasecmp("on", id) == 0)
*flag = FLAGTRUE;
else if (strcasecmp("no", id) == 0 || strcasecmp("false", id) == 0 ||
strcasecmp("off", id) == 0)
*flag = FLAGFALSE;
}
void
#if PROTOTYPES
ConfigItemEscape(char *id)
#else
ConfigItemEscape(id)
char *id;
#endif
{
CONDDEBUG((1, "ConfigItemEscape(%s) [%s:%d]", id, file, line));
if (parserConfigTemp->escape != (char *)0)
free(parserConfigTemp->escape);
if ((id == (char *)0) || (*id == '\000')) {
parserConfigTemp->escape = (char *)0;
return;
}
if ((parserConfigTemp->escape = StrDup(id)) == (char *)0)
OutOfMem();
}
void
#if PROTOTYPES
ConfigItemMaster(char *id)
#else
ConfigItemMaster(id)
char *id;
#endif
{
CONDDEBUG((1, "ConfigItemMaster(%s) [%s:%d]", id, file, line));
if (parserConfigTemp->master != (char *)0)
free(parserConfigTemp->master);
if ((id == (char *)0) || (*id == '\000')) {
parserConfigTemp->master = (char *)0;
return;
}
if ((parserConfigTemp->master = StrDup(id)) == (char *)0)
OutOfMem();
}
void
#if PROTOTYPES
ConfigItemPort(char *id)
#else
ConfigItemPort(id)
char *id;
#endif
{
CONDDEBUG((1, "ConfigItemPort(%s) [%s:%d]", id, file, line));
if (parserConfigTemp->port != (char *)0)
free(parserConfigTemp->port);
if ((id == (char *)0) || (*id == '\000')) {
parserConfigTemp->port = (char *)0;
return;
}
if ((parserConfigTemp->port = StrDup(id)) == (char *)0)
OutOfMem();
}
void
#if PROTOTYPES
ConfigItemSslcredentials(char *id)
#else
ConfigItemSslcredentials(id)
char *id;
#endif
{
CONDDEBUG((1, "ConfigItemSslcredentials(%s) [%s:%d]", id, file, line));
#if HAVE_OPENSSL
if (parserConfigTemp->sslcredentials != (char *)0)
free(parserConfigTemp->sslcredentials);
if ((id == (char *)0) || (*id == '\000')) {
parserConfigTemp->sslcredentials = (char *)0;
return;
}
if ((parserConfigTemp->sslcredentials = StrDup(id)) == (char *)0)
OutOfMem();
#else
Error
("sslcredentials ignored - encryption not compiled into code [%s:%d]",
file, line);
#endif
}
void
#if PROTOTYPES
ConfigItemSslrequired(char *id)
#else
ConfigItemSslrequired(id)
char *id;
#endif
{
CONDDEBUG((1, "ConfigItemSslrequired(%s) [%s:%d]", id, file, line));
#if HAVE_OPENSSL
ProcessYesNo(id, &(parserConfigTemp->sslrequired));
#else
Error
("sslrequired ignored - encryption not compiled into code [%s:%d]",
file, line);
#endif
}
void
#if PROTOTYPES
ConfigItemSslenabled(char *id)
#else
ConfigItemSslenabled(id)
char *id;
#endif
{
CONDDEBUG((1, "ConfigItemSslenabled(%s) [%s:%d]", id, file, line));
#if HAVE_OPENSSL
ProcessYesNo(id, &(parserConfigTemp->sslenabled));
#else
Error("sslenabled ignored - encryption not compiled into code [%s:%d]",
file, line);
#endif
}
void
#if PROTOTYPES
ConfigItemStriphigh(char *id)
#else
ConfigItemStriphigh(id)
char *id;
#endif
{
CONDDEBUG((1, "ConfigItemStriphigh(%s) [%s:%d]", id, file, line));
ProcessYesNo(id, &(parserConfigTemp->striphigh));
}
void
#if PROTOTYPES
ConfigItemUsername(char *id)
#else
ConfigItemUsername(id)
char *id;
#endif
{
CONDDEBUG((1, "ConfigItemUsername(%s) [%s:%d]", id, file, line));
if (parserConfigTemp->username != (char *)0)
free(parserConfigTemp->username);
if ((id == (char *)0) || (*id == '\000')) {
parserConfigTemp->username = (char *)0;
return;
}
if ((parserConfigTemp->username = StrDup(id)) == (char *)0)
OutOfMem();
}
SUBST *substData = (SUBST *)0;
int
#if PROTOTYPES
SubstCallback(char c, char **s, int *i)
#else
SubstCallback(c, s, i)
char c;
char **s;
int *i;
#endif
{
int retval = 0;
if (substData == (SUBST *)0) {
if ((substData = (SUBST *)calloc(1, sizeof(SUBST))) == (SUBST *)0)
OutOfMem();
substData->callback = &SubstCallback;
substData->tokens['u'] = ISSTRING;
substData->tokens['c'] = ISSTRING;
}
if (s != (char **)0) {
CONFIG *pc;
if (substData->data == (void *)0)
return 0;
pc = (CONFIG *)(substData->data);
if (c == 'u') {
(*s) = pc->username;
retval = 1;
} else if (c == 'c') {
(*s) = pc->console;
retval = 1;
}
}
return retval;
}
void
#if PROTOTYPES
TerminalItemAttach(char *id)
#else
TerminalItemAttach(id)
char *id;
#endif
{
CONDDEBUG((1, "TerminalItemAttach(%s) [%s:%d]", id, file, line));
if (parserTermTemp->attach != (char *)0)
free(parserTermTemp->attach);
if ((id == (char *)0) || (*id == '\000')) {
parserTermTemp->attach = (char *)0;
return;
}
if ((parserTermTemp->attach = StrDup(id)) == (char *)0)
OutOfMem();
}
void
#if PROTOTYPES
TerminalItemAttachsubst(char *id)
#else
TerminalItemAttachsubst(id)
char *id;
#endif
{
CONDDEBUG((1, "TerminalItemAttachsubst(%s) [%s:%d]", id, file, line));
ProcessSubst(substData, (char **)0, &(parserTermTemp->attachsubst),
"attachsubst", id);
}
void
#if PROTOTYPES
TerminalItemDetach(char *id)
#else
TerminalItemDetach(id)
char *id;
#endif
{
CONDDEBUG((1, "TerminalItemDetach(%s) [%s:%d]", id, file, line));
if (parserTermTemp->detach != (char *)0)
free(parserTermTemp->detach);
if ((id == (char *)0) || (*id == '\000')) {
parserTermTemp->detach = (char *)0;
return;
}
if ((parserTermTemp->detach = StrDup(id)) == (char *)0)
OutOfMem();
}
void
#if PROTOTYPES
TerminalItemDetachsubst(char *id)
#else
TerminalItemDetachsubst(id)
char *id;
#endif
{
CONDDEBUG((1, "TerminalItemDetachsubst(%s) [%s:%d]", id, file, line));
ProcessSubst(substData, (char **)0, &(parserTermTemp->detachsubst),
"detachsubst", id);
}
ITEM keyConfig[] = {
{"escape", ConfigItemEscape},
{"master", ConfigItemMaster},
{"port", ConfigItemPort},
{"sslcredentials", ConfigItemSslcredentials},
{"sslrequired", ConfigItemSslrequired},
{"sslenabled", ConfigItemSslenabled},
{"striphigh", ConfigItemStriphigh},
{"username", ConfigItemUsername},
{(char *)0, (void *)0}
};
ITEM keyTerminal[] = {
{"attach", TerminalItemAttach},
{"attachsubst", TerminalItemAttachsubst},
{"detach", TerminalItemDetach},
{"detachsubst", TerminalItemDetachsubst},
{(char *)0, (void *)0}
};
SECTION sections[] = {
{"config", ConfigBegin, ConfigEnd, ConfigAbort, ConfigDestroy,
keyConfig},
{"terminal", TerminalBegin, TerminalEnd, TerminalAbort,
TerminalDestroy, keyTerminal},
{(char *)0, (void *)0, (void *)0, (void *)0, (void *)0}
};
void
#if PROTOTYPES
ReadConf(char *filename, FLAG verbose)
#else
ReadConf(filename, verbose)
char *filename;
FLAG verbose;
#endif
{
FILE *fp;
if ((FILE *)0 == (fp = fopen(filename, "r"))) {
if (verbose == FLAGTRUE)
Error("could not open `%s'", filename);
return;
}
/* initialize the substition bits */
SubstCallback('\000', (char **)0, (int *)0);
parserConfigDefault = pConfig;
pConfig = (CONFIG *)0;
parserTermDefault = pTerm;
pTerm = (TERM *)0;
ParseFile(filename, fp, 0);
/* shouldn't really happen, but in case i screw up the stuff
* ParseFile calls...
*/
if (pConfig == (CONFIG *)0) {
if ((pConfig = (CONFIG *)calloc(1, sizeof(CONFIG)))
== (CONFIG *)0)
OutOfMem();
}
if (pTerm == (TERM *)0) {
if ((pTerm = (TERM *)calloc(1, sizeof(TERM)))
== (TERM *)0)
OutOfMem();
}
if (fDebug) {
#define EMPTYSTR(x) x == (char *)0 ? "(null)" : x
#define FLAGSTR(x) x == FLAGTRUE ? "true" : (x == FLAGFALSE ? "false" : "unset")
CONDDEBUG((1, "pConfig->username = %s",
EMPTYSTR(pConfig->username)));
CONDDEBUG((1, "pConfig->master = %s", EMPTYSTR(pConfig->master)));
CONDDEBUG((1, "pConfig->port = %s", EMPTYSTR(pConfig->port)));
CONDDEBUG((1, "pConfig->escape = %s", EMPTYSTR(pConfig->escape)));
CONDDEBUG((1, "pConfig->striphigh = %s",
FLAGSTR(pConfig->striphigh)));
#if HAVE_OPENSSL
CONDDEBUG((1, "pConfig->sslcredentials = %s",
EMPTYSTR(pConfig->sslcredentials)));
CONDDEBUG((1, "pConfig->sslrequired = %s",
FLAGSTR(pConfig->sslrequired)));
CONDDEBUG((1, "pConfig->sslenabled = %s",
FLAGSTR(pConfig->sslenabled)));
#endif
CONDDEBUG((1, "pTerm->attach = %s", EMPTYSTR(pTerm->attach)));
CONDDEBUG((1, "pTerm->attachsubst = %s",
EMPTYSTR(pTerm->attachsubst)));
CONDDEBUG((1, "pTerm->detach = %s", EMPTYSTR(pTerm->detach)));
CONDDEBUG((1, "pTerm->detachsubst = %s",
EMPTYSTR(pTerm->detachsubst)));
}
fclose(fp);
}

38
console/readconf.h Normal file
View File

@ -0,0 +1,38 @@
/*
* $Id: readconf.h,v 5.3 2004/05/25 23:03:25 bryan Exp $
*
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*/
typedef struct config {
STRING *name;
char *console;
char *username;
char *master;
char *port;
char *escape;
FLAG striphigh;
#if HAVE_OPENSSL
char *sslcredentials;
FLAG sslrequired;
FLAG sslenabled;
#endif
} CONFIG;
typedef struct term {
STRING *name;
char *attach;
char *attachsubst;
char *detach;
char *detachsubst;
} TERM;
extern CONFIG *pConfig;
extern TERM *pTerm;
extern SUBST *substData;
extern void ReadConf PARAMS((char *, FLAG));
extern void DestroyConfig PARAMS((CONFIG *));
extern void DestroyTerminal PARAMS((TERM *));

View File

@ -24,5 +24,5 @@ will be helpful.
Bryan Stansell
#
# $Id: README,v 1.4 2003-09-29 07:29:37-07 bryan Exp $
# $Id: README,v 1.4 2003/09/29 14:29:37 bryan Exp $
#

View File

@ -88,15 +88,6 @@
#define const
#endif
#include <sys/cdefs.h>
#ifndef __NetBSD__
#if 1
static const char rcsid[] = "Id: chat.c,v 1.26 1999/12/23 01:39:54 paulus Exp ";
#else
__RCSID("$NetBSD: chat.c,v 1.25 2001/09/24 13:22:38 wiz Exp $");
#endif
#endif
#include <stdio.h>
#include <ctype.h>
#include <time.h>

View File

@ -4,7 +4,7 @@
#
%define pkg conserver
%define ver conserver-8.0.2
%define ver 8.1.13
# define the name of the machine on which the main conserver
# daemon will be running if you don't want to use the default
@ -17,7 +17,7 @@
Summary: Serial console server daemon/client
Name: %{pkg}
Version: %{ver}
Release: 1.%{distver}x
Release: 1.%{distver}
Copyright: distributable
Group: System Environment/Daemons
URL: http://www.conserver.com/
@ -100,4 +100,6 @@ fi
%{prefix}/share/man/man8/conserver.8.gz
%{prefix}/share/man/man5/conserver.cf.5.gz
%{prefix}/share/man/man5/conserver.passwd.5.gz
%{prefix}/share/examples/conserver/conserver.cf
%{prefix}/share/examples/conserver/conserver.passwd
%{prefix}/sbin/conserver

View File

@ -1,7 +1,7 @@
PKG="conserver"
NAME="Console server and client"
CATEGORY="system"
VERSION="conserver-8.0.2"
VERSION="8.1.13"
DESC="Console server and client"
CLASSES=none
ARCH=sparc

View File

@ -14,6 +14,7 @@ cleanup()
[ "$i" != "conserver.log" ] && [ -f "$i" ] && rm -f "$i";
done
[ "$exitval" = 0 ] && rm -f conserver.log
[ -d 127.0.0.1 ] && sleep 1 && rm -rf 127.0.0.1
exit $exitval
}
@ -25,15 +26,15 @@ dotest()
eval "$2" > test.out 2>&1
else
echo "$1" | \
../console/console -M 127.0.0.1 -p 7777 shell > test.out 2>&1
../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 shell > test.out 2>&1
fi
if [ "$record" ]; then
echo "recorded"
mv test.out results/test$testnum
else
if [ -f results/test$testnum ]; then
if diff -i test.out results/test$testnum >test$testnum.diff 2>&1; then
echo "succeded"
if diff -i results/test$testnum >test$testnum.diff test.out 2>&1; then
echo "succeeded"
rm -f test$testnum.diff
else
echo "failed (diffs in test$testnum.diff)"
@ -72,7 +73,7 @@ sleep 3
[ ! -d results ] && mkdir results
dotest EVAL "../console/console -M 127.0.0.1 -p 7777 -u | sed -e 's/[0-9][0-9]*//g' -e 's/[ ][ ]*/ /g'"
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -u | sed -e 's/[0-9][0-9]*//g' -e 's/[ ][ ]*/ /g'"
dotest 'c?c.'
dotest 'cl?c.'
dotest 'cdc.'
@ -84,14 +85,16 @@ cp test2.cf c.cf
kill -1 $pid
sleep 3
dotest EVAL "../console/console -M 127.0.0.1 -p 7777 -u | sed -e 's/[0-9][0-9]*//g' -e 's/[ ][ ]*/ /g'"
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -u | sed -e 's/[0-9][0-9]*//g' -e 's/[ ][ ]*/ /g'"
dotest 'c?c.'
dotest 'cl?c.'
dotest 'cdc.'
dotest 'coc.'
dotest 'cocacoc.'
dotest EVAL "echo 'tu.' | ../console/console -M 127.0.0.1 -p 7777 -e 'tu' shell"
dotest EVAL "../console/console -M 127.0.0.1 -p 7777 -P | sed -e 's/:.*//'"
dotest EVAL "../console/console -M 127.0.0.1 -p 7777 -x | sed -e 's/ on [^ ]* */ on /'"
dotest EVAL "echo 'tu.' | ../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -e 'tu' shell"
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -R | sed -e 's/ [^ ]*$//'"
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -x | sed -e 's/ on [^ ]* */ on /'"
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -x sh | sed -e '1s/^[^:]*//'"
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -x shell | sed -e 's/ on [^ ]* */ on /'"
cleanup

View File

@ -1,4 +1,6 @@
console: shell is down
[`shell' -- console is down]
[Enter `^Ec?' for help]
[up -- attached]
[up]
[ok]
[up]
[disconnect]

View File

@ -1 +1 @@
127.0.0.1
version `conserver.com version

2
test/results/test14 Normal file
View File

@ -0,0 +1,2 @@
: ambiguous console abbreviation, `sh'
choices are shellb, shella, shell

1
test/results/test15 Normal file
View File

@ -0,0 +1 @@
shell on at Local

View File

@ -1,17 +1,18 @@
[Enter `^Ec?' for help]
[help]
. disconnect a attach read/write
b send broadcast message c toggle flow control
d down a console e change escape sequence
f force attach read/write g group info
i information dump L toggle logging on/off
l? break sequence list l0 send break per config file
l1-9 send specific break sequence m display the message of the day
o (re)open the tty and log file p replay the last 60 lines
r replay the last 20 lines s spy read only
u show host status v show version info
w who is on this console x show console baud info
z suspend the connection <cr> ignore/abort command
? print this message ^R replay the last line
. disconnect ; move to another console
a attach read/write b send broadcast message
c toggle flow control d down a console
e change escape sequence f force attach read/write
g group info i information dump
L toggle logging on/off l? break sequence list
l0 send break per config file l1-9 send specific break sequence
m display the message of the day o (re)open the tty and log file
p replay the last 60 lines r replay the last 20 lines
s spy read only u show host status
v show version info w who is on this console
x show console baud info z suspend the connection
| attach local command ? print this message
<cr> ignore/abort command ^R replay the last line
\ooo send character by octal code
[disconnect]

View File

@ -1,4 +1,4 @@
console: shell is down
[`shell' -- console is down]
[Enter `^Ec?' for help]
[up -- attached]
[up]
[disconnect]

View File

@ -1,17 +1,18 @@
[Enter `^Ec?' for help]
[help]
. disconnect a attach read/write
b send broadcast message c toggle flow control
d down a console e change escape sequence
f force attach read/write g group info
i information dump L toggle logging on/off
l? break sequence list l0 send break per config file
l1-9 send specific break sequence m display the message of the day
o (re)open the tty and log file p replay the last 60 lines
r replay the last 20 lines s spy read only
u show host status v show version info
w who is on this console x show console baud info
z suspend the connection <cr> ignore/abort command
? print this message ^R replay the last line
. disconnect ; move to another console
a attach read/write b send broadcast message
c toggle flow control d down a console
e change escape sequence f force attach read/write
g group info i information dump
L toggle logging on/off l? break sequence list
l0 send break per config file l1-9 send specific break sequence
m display the message of the day o (re)open the tty and log file
p replay the last 60 lines r replay the last 20 lines
s spy read only u show host status
v show version info w who is on this console
x show console baud info z suspend the connection
| attach local command ? print this message
<cr> ignore/abort command ^R replay the last line
\ooo send character by octal code
[disconnect]