Readme.mysql 3.01 KB
Author: Jim Hull (8-24-2001)
imaginos@imaginos.net

Mysql support for mailutils ....

This addition to mailutils allows you to have complete email support
without actually having the users on the systems. This would allow you to
have complete web based account management for users while still
maintaining system security as the users can not access the box directly.
The setup is designed to work with the same table definitions as ProFtpd
thus granting you the ability to grant complete web/ftp/email based system
all authenticated by a database running in mysql. A current running system
for this exists at http://www.linuxrocket.net/freeweb.cgi.


Setup:

Mysql:
       create database mail;
       grant all privileges on mail.* to user@localhost identified by
'foobar';

       create table users (username VARCHAR(20) UNIQUE NOT NULL,
                       uid INT(5) NOT NULL DEFAULT 99,
                       gid INT(5) NOT NULL DEFAULT 99,
                       password VARCHAR(15) NOT NULL,
                       homedir VARCHAR(128) NOT NULL,
                       shell VARCHAR(64) NOT NULL,
                       comment TEXT);


When you are done, it should look like ....

+----------+--------------+------+-----+---------+-------+
| Field    | Type         | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| username | varchar(20)  |      | PRI |         |       |
| uid      | int(5)       |      |     | 99      |       |
| gid      | int(5)       |      |     | 99      |       |
| password | varchar(15)  |      |     |         |       |
| homedir  | varchar(128) |      |     |         |       |
| shell    | varchar(64)  |      |     |         |       |
| comment  | text         | YES  |     | NULL    |       |
+----------+--------------+------+-----+---------+-------+

System Setup:

After modifying MySql/MySql.h with your appropriate defines, compile and
install.

Add a user with no possibility of a pass, with its own gid, shell should
be /bin/false and dir should be /dev/null. Something like ...

monly:x:3002:805:Mail Only:/dev/null:/bin/false
monly:x:805:

When you enter new users into your table, you want to be sure they all
have the same uid/gid in the table as that one user on the system. If you
use the mailer thats in examples/mail.MysqlMailer.c then you will be all
ready to go. It explains in the source for its setup and installation.

an example entry would be ...
+----------+------+------+---------------+-------------------------+------------+----------+
| username | uid  | gid  | password      | homedir                 | shell | comment  |
+----------+------+------+---------------+-------------------------+------------+----------+
| foobar   | 3002 |  805 | JahUAjwjhAJha | /home/foobar   | /bin/false |  F. Bar  |
+----------+------+------+---------------+-------------------------+------------+----------+

1) make sure /var/spool/foobar is uid '3002', gid 'mail' and 0660
2) make sure /home/foobar is uid '3002', gid '805' so when you set up
   proftpd it works in unison