(PM) PORTMAN

Richard Stuplich (dick@dw.net)
Fri, 06 Feb 1998 19:41:21 -0600

Below you will find the config file for a program I wrote to manage our
dial-in pools.

I was wondering why we set an Idle time for people, at all, when we have
free modems?

I was wondering why we set a max session length for people, at all, when we
have free modems?

I was wondering why we didn't hack, or get a radius server that would keep
the 2nd from connecting, but then decided that the user would think their
system was screwy and try to fix it and mess everything they have up.

The program that reads this then gathers the connection info from the
PortMaster devices, or TCH because it acts like a PortMaster from the PMWHO
vantage point. It currently uses PMWHO but I would like to have this be an
external program that could gather data from different devices (other than
PM and TCH, but maybe I will drop that because I will only buy PM's from
now on anyway.

It creates a database for that time slice, you can cron it at any interval.
I use 5 min but 1 would be better...

It then looks at each user in the database and develops a profile from the
config file, that was read into a database at program start up.

The profile will use the default values defined in the config file and then
set any specific values from the user config section.

The variables, I have working so far, are as follows:

PortMaster: Define a portmaster or TCH to gather data for, any number of
these can be listed but they will all be in the same pool. You can use a
command line param to develop multiple pools by loading different config
files with the "-f" option.

TotalPorts: The total number of ports that PMWHO could ever see on all
device, including C0 ports that may always be in USERNAME state. I could
ports off hook, not ports ESTABLISHED for the total in use ports.

FreeLow: ZERO-FreeLow will define Low Load. (This can be in the user
section to override the global)

FreeHigh: FreeHigh-TotalPorts will define High Load. (This can be in the
user section to override the global)

Note: between FreeLow and FreeHigh is Medium load.

IdleLimitLow: The IDLE time the user gets in Low Load. I would think this
should be 0 for infinite. -1 would mean no amount of this time would be
acceptable. (This can be in the user section to override the global)

IdleLimitMed: The IDLE time the user gets in Medium Load. 0 for infinite.
-1 for no acceptable amount of time. (This can be in the user section to
override the global)

IdleLimitHig: The IDLE time the user gets in High Load. 0 for infinite. -1
for no acceptable amount of time. (This can be in the user section to
override the global)

MaxTimeLow: The MAX time the user gets in LOW Load. I would think this
should be 0 for infinite. -1 would mean no amount of this time would be
acceptable. (This can be in the user section to override the global)

MaxTimeMed: The MAX time the user gets in Medium Load. 0 for infinite. -1
for no acceptable amount of time. (This can be in the user section to
override the global)

MaxTimeHig: The MAX time the user gets in High Load. 0 for infinite. -1 for
no acceptable amount of time. (This can be in the user section to override
the global)

Sessions: The max session the user gets, there is no Low, Med or Hig
version of this (yet?). Above this amount and ALL sessions in this class
are terminated and (optionally) sent a bitch letter :-) The termination
and mail message are done with an external program shell script, at this
time I do not look again to see if they are till on but a simple addition
to the script would fix that. The external script sends the mail and
creates a web page for our staff to deal with "I get hung p on all the
time" calls. Well, don't use it from 2 places at the same time dumbass, or
pay for another account and we will set your sessions to 1.

Then an 'end$' shows that this is the end of the global section.

Then the users section comes, I wanted this to look and feel like radius
users file but I threw that out for this better grouping method.

Think of this as a switch/case with $end replacing break.

The first user (USERNAME1), in this example, sets the VARA, VARB and VARC
The 2nd user (USERNAME2), in this example, sets only VARB and VARC
USERNAME3 only sets VARD
Any username that doesn't match uses all defaults.
Any user that is listed uses all default that are not overridden by vars in
the user section between where the "user" starts and thenext $end it.

Not all that bad is it?

User USERNAME1 (up to 30 characters)
(VARA from above that says it can be in the user section) <SPACE> (value)
User USERNAME2
(VARB from above that says it can be in the user section) <SPACE> (value)
(VARC from above that says it can be in the user section) <SPACE> (value)
$end

User USERNAME3
(VARD from above that says it can be in the user section) <SPACE> (value)
$end

ETC...

If a condition is exceeded the user gets hung up on, if the violation was
for too many session they get a nasty-gram in email. All terminations are
logged in a web page we use internally and if it was because of multiple
then it shows that separately.

Problem solved, they don't think it is their equipment because they can
connect EVERY time, we can get control back of out modem pools. Everyone
is happy, well other than the people stealing service with multiple logins
all the time, they hate it and will go to another provider and steal from
them, or pay us to get a session of 2.

Here is the config file: Sorry about the line wraps... Figgure it out.
"/etc/portman.conf"

# Global configuration section,
# Must be first section, may be mix of upper and lower case
# Section must end with an "$end" line.

# NOTE: Config pairs and "$end" tags can be seperated by any of the
following:
# SPACE, TAB, COMMA, SEMICOLON or RETURN.

PortMaster term01.dwave.net # PM2 30 ports (Not a user variable)
PortMaster term02.dwave.net # PM2 29 ports (Not a user variable)
PortMaster term02.dwave.net # PM2 10 ports (Not a user variable)
PortMaster term04.dwave.net # PM3 49 ports (Not a user variable)
PortMaster term05.dwave.net # PM3 49 ports (Not a user variable)
PortMaster term06.dwave.net # TCH 48 ports (Not a user variable)

TotalPorts 216 # The total number of ports we have to watch
#(Not a user variable)

# Note: TotalPorts will see all ports that are returned by
# a pmwho on the device, so on PM3's you will get C0 if you use it
# or not. If it alwaus sits in "USERNAME" then it will always be
# counted as a port in use so you have to take that into account
# on TotalPorts. This is true for a TCH too.

# These are the default values to set for all users

FreeLow 30 # TotalPorts-FreeLow is considered Low load
FreeHig 7 # FreeLow-FreeHig is considered Med load
# above FreeHig is considered Hig
IdleLimitLow 0 # Minutes idle time if in Low load
IdleLimitMed 30 # Minutes idle time if in Med load
IdleLimitHig 15 # Minutes idle time if in Hig load

# Note: 0 = no limit, -1 means always match

MaxTimeLow 0 # Max time per connect Low
MaxTimeMed 480 # Max time per connect Med
MaxTimeHig 360 # Max time per connect Hig
Sessions 1 # Max number of concurent sessions

$end # End the global config section (MUST HAVE THIS)

# This is the users config area below, users configs fall through.
# Much like a 'case' in a 'switch' statement in C

# Use this area to deviate from the above globals for individual users,
# or groups of users by omiting the '$end' in a group.

user koskelin
user kat
user jax
user erik
user bjojade
user jjung
user gdziak
user jean
user clarinut
user bkniess
user kyle
user brennan
user leann
user troll
user kylmar
user accounts
user marcu
user busha
MaxTimeHig -1 #Set max minutes online in high to none
$end

user ruder
Sessions 5 #This account can have 5 multiple
$end

user jmaz
user wifc
user wdez
Sessions 3 #These accounts can have 3 multiple
$end

user cclink
user lsmail
user mp
IdleLimitLow 0 #These pay for dedicated dialup
IdleLimitMed 0 #Never throw them off for any reason
IdleLimitHig 0 #in any load condition
MaxTimeLow 0
MaxTimeMed 0
MaxTimeHig 0
$end

"end portman.conf"

I am in testing now for the 3rd day. I believe it would be irresponsible
to let this out right now but I will be ready in less than a week.

Note, this sould run on any UNIX, the wackiest thing it does is a
"system()" call to run the externals to gather the port data with pmwho and
use pmcom to dump the users.

The command line options are as follows for the program so far:

-a announce only, do not dump anyone, just say what you would do. Great
for testing

-d debug mode, dump every bit of info you have from the config file read to
users info to each user profile as it is generated. Output is not for the
faint of heart.

-f read alternate config file, Great for managing multiple pools!
Defaults to /etc/portman.conf

-l specify log file name, Defaults to /var/adm/portman

-t specify a temp directory to store the gathered pmwho output. Note this
WILL show who is on line and for how long so the default isn't that good if
this is on a system that other users have access to. Mine isn't so it
defaults to /tmp/

-u user test mode, Only read the config file and show what the values are
for the defined user.

-v verbose mode, prints a cool table of all the variables and shows the
authors name and the version number, including the total number of compiles
I have done so far.

Comments? Suggestions? Beta testers?

Note: bringing me down by showing the flaw in the plan is encouraged, I
will, however, be disappointed if I was a fool to write this program,
see... it's already done. I'm just testing now.

Richard Stuplich Dick@dw.net
IP Engineer and Unix administrator Dick@Stuplich.net
----------------------------------------------------------------------------
DataWave Technologies, Central Wisconsin's fastest Internet Service Provider
USR x2 now! K56flex now! http://www.dw.net/ (715) 843-7823
Faster, More Experienced, Dedicated only to Internet Service...
----------------------------------------------------------------------------
-
To unsubscribe, email 'majordomo@livingston.com' with
'unsubscribe portmaster-users' in the body of the message.