BLIMITD(8)

NAME
blimitd - enforcer of basic user restrictions

SYNOPSIS
blimitd [-d] [-i] [-m monitor_interval]

DESCRIPTION
blimitd is designed to enforce some of the limits found in login.conf(5).

The following options are available:

-d  Don't detach from the terminal. Cause extra log messages to be generated. Send log messages to stderr(4) as well as the usual syslog(3).

-i  Disable enforcement of the idletime capability.

-m monitor_interval
    Set the monitor interval. blimitd spends most of its time asleep and only wakes up every monitor_interval seconds to see if any limit enforcement is required.

blimitd currently reads the utmp(5) database to get a list of logged in users. It iterates through this list, attempting to enforce each configured limit.

Currently implemented capabilities include:

idletime
    This function logs out terminals that have been left idle for longer than allowed, according to the user's class's idletime capability in the login.conf(4) database. It has the ability to send multiple warning message to users as they approach the idletime limit.

Configuration (apart from the above command line options) is currently only possible by changing constants at compile time. Please see the file config.h for these constants. The meaning of most should be clear from their names and the surrounding comments.

blimitd is normally run at boot time from a script in /usr/local/etc/rc.d.

IMPLEMENTATION NOTES
The 4 possible "kill" functions (functions to log out a user) deserve some mention here.

kill_hangup
    This function sets the baud rate of the terminal to 0. This may disconnect modem users but seems to have little effect on network logins. See cfsetspeed(3) for more information.

kill_revoke
    This function passes the user's terminal to revoke(2). This seems to work well except some (buggy) programs get stuck in infinite loops. Old versions of pine(1) has been known to do this.

kill_kvm
    This function sends the hangup signal to the user's shell (see sigaction(2)). The PID of the shell is determined by using the kvm(3) interface so this function may only work under FreeBSD.

    kvm_getprocs(3) is called with op set to KERN_PROC_TTY to fetch a all the processes running on the terminal. We get the session that the first process returned participates in and from there find the PID of the session leader. This is assumed to be the user's shell.

    This function is the default.

kill_ext
    This function only exists to aid in portability to operating systems other than FreeBSD. It runs an external program (specified in config.h) passing the arguments -u username -t tty. This program should exit with a code of 0 on success.

    SECURITY WARNING If users are allowed to write arbitary data to the utmp(3) database then this can lead to a compromise allowing the user to run an arbitary program as the user running blimitd (usually root). If this is a problem on your system then use one of the other methods or rewrite this one to use fork(2) and exec(3).

FILES
/etc/login.conf	login class capability database
/etc/syslog.conf	logging specifications
/usr/local/etc/rc.d/blimitd.sh	usual place to start blimitd from
/usr/local/sbin/logoff_user default program to run to log a user out (if
kill_ext is in use)

DIAGNOSTICS
Errors are logged to syslog(8) using the facility configured in config.h (LOG_AUTH by default).

The use of the -d flag will produce more debugging output.

If a command configured as the KILL_CMD does not exit with a value of 0 then a diagnostic message will be emitted.

SEE ALSO
cfsetspeed(3), kill(2), kvm(3), login.conf(5), revoke(2), syslogd(8)

HISTORY
blimitd was developed under FreeBSD 4.3.

AUTHORS
blimitd was written by Andrew Stevenson <andrew@ugh.net.au>.

BUGS
There are sure to be many. This is untested software. Please report bugs to the author (patches as well if you can manage it).

There are many missing features - most notably the lack of a configuration file and the enforcement of only one capability. Submissions are welcome, prefferably in the form of patches, but feature requests are OK as well.

blimitd requires an accurate utmp(5) database. Some software (most notably screen(1)) can be configured to allow a user to remove themselves from the utmp(5) database without actually logging out.