This is an authentication module for the Squid proxy server to authenticate users on an NT domain.
It originates from the Samba and SMB packages by Andrew Tridgell and Richard Sharpe. This version is sourced from the Pike authentication module by William Welliver (hwellive@intersil.com).
Usage is simple. It accepts a username and password on standard input and will return OK if the username/password is valid for the domain, or ERR if there was some problem. Check syslog messages for reported problems.
Msntauth is released under the GNU General Public License and
is available from http://stellarx.tripod.com.
Make any changes to the source code you need.
Type 'make', then 'make install', then 'make clean'.
To avoid using the makefile, it may compile with
gcc -O2 -s -o msntauth *.c
'Make install' will put 'msntauth' into
/usr/local/squid/bin by default.
Hopefully nobody has problems compiling msntauth.
In the future I plan to use GNU automake.
The Makefile uses the GCC compiler, and assumes that it is in the current PATH.
Msntauth is known to compile properly on Redhat Linux 6, and FreeBSD 3.1
without problems. Other operating systems are untested,
but use a recent copy of the GNU C compiler.
Smbencrypt.c has the '#include
When compiling under Solaris, the socket libraries must be linked to.
In the Makefile, hash the default CFLAGS line, and unhash the Solaris
CFLAGS line. It always helps to have /usr/ccs/bin in your path
prior to compiling.
Msntauth uses a configuration file which is a break from previous
releases. The file is /usr/local/squid/etc/msntauth.conf.
If this needs to be changed, it is defined in confload.h.
An example configuration file is provided. It looks like
All comments start with '#'.
NT servers are used to query user accounts. The 'server' lines
are used for this, with the PDC, BDC, and NT domain as parameters.
Up to 5 servers/domains can be queried. If this is not enough
modify the MAXSERVERS define in confload.h.
At least one server must be specified, or msntauth will not
run.
When a user provides a username/password, each of these
servers will be queried to authenticate the username.
It stops after a user has been successfully authenticated,
so it makes sense to specify the most commonly queried
server first. Make sure the servers can be reached and
are active, or else msntauth will start failing user accounts!
The 'denyusers' and 'allowusers' lines give the absolute path
to files of user accounts. They can be used to deny or allow
access to the proxy. Do not use these directives if you
do not need these features.
Users who are not allowed to access the web proxy can be added to
the denied user list. This list is read around every minute, or when
the msntauth process receives a SIGHUP signal.
The denied user file is set using the 'denyusers' directive
in msntauth.h. The denied user file
contains a list of usernames in no particular structure or form.
If the file does not exist, no users are denied.
The file must be readable by the web proxy user.
Msntauth will send syslog messages if a user was denied,
at LOG_USER facility.
Similar to denying users, you can allow users to access the proxy
by username. This is useful if only a number of people are
allowed supposed to be accessing a proxy.
The allowed user file is set using the 'allowusers' directive
in msntauth.h.
If the file does not exist or if empty, all users are allowed.
You could make use of the SHOWMBRS tool in Microsoft Technet.
This gives you a list of users which are in a particular
NT Domain Group. This list can be made into the allowed users
file.
Some other rules -
Hopefully this wasn't too confusing.
Refer to Squid documentation for the required changes to squid.conf.
You will need to set the following lines to enable authentication for
your access list -
You will also need to review the following directives -
I strongly urge that Msntauth is tested prior to being used in a
production environment. It may behave differently on different platforms.
To test it, run it from the command line. Enter username and password
pairs separated by a space.
It should behave in the following way -
If the above didn't work as expected, you may need to modify the main()
function in msntauth.c. Inform the maintainer of any problems.
To contact the maintainer of this package, email Antonino Iannella
at antonino@usa.net, antonino.iannella@usa.net, or
antonino.iannella@camtech.com.au.
The latest version may be found on http://members.tripod.com/stellarx.
It is also distributed as part of Squid.
For an unknown username, Msntauth returns OK.
This is because the PDC returns guest access for unknown users,
even if guest access is disabled.
This problem was reported by Mr Vadim Popov (vap@iilsr.minsk.by).
I am not able to replicate this.
The tested environment consisted of PDC on Windows NT 4, SP 6.
Squid 2.3 and Msntauth was tested on SuSe, RedHat, and Debian Linux.
A fix was provided in case you have this problem.
Apply the provided patch before compiling, using
Usernames are checked if they are allowed or denied. If a username
is found as a substring of a different username in these files,
the user will be affected somehow. For example, if 'jpeterman' has
been explicitly denied in the denyusers file, then 'jpeter' who
is trying to use the proxy, will be denied. If this causes anyone
any problems, then I'll fix it.
Installation
Other compiling issues
Configuration file
# Sample MSNT authenticator configuration file
# Antonino Iannella, Stellar-X Pty Ltd
# Tue Sep 26 17:26:59 CST 2000
server my_PDC my_BDC my_NTdomain
server other_PDC other_BDC otherdomain
denyusers /usr/local/squid/etc/denyusers
allowusers /usr/local/squid/etc/allowusers
Denying users
Allowing users
Squid.conf changes
acl
proxy_auth_realm enterprise web gateway
authenticate_program /usr/local/squid/bin/msntauth
authenticate_ttl 5
authenticate_children 20
Testing
- Press ENTER to get an OK or ERR message.
- Make sure pressing CTRL-D behaves the same as a carriage return.
- Make sure pressing CTRL-C aborts the program.
- Test that entering no details does not result in an OK or ERR message.
- Test that entering an invalid username and password results in
an ERR message. Note that if NT guest user access is allowed on
the PDC, an OK message may be returned instead of ERR.
- Test that entering an valid username and password results in an OK message.
Try usernames which are and aren't in the denied/allowed user files,
if they're in use.
- Test that entering a guest username and password returns the correct response.
Contact details
Reported problem
patch smblib.c < smblib.c.patch
Known limitation