OpenSMTPDAdmin
Go to file
mischa bb19f9aa23 smaller font-size 2022-09-06 14:01:05 +00:00
VIRTUAL_VACATION remove some LF/CR 2022-08-22 18:51:26 +00:00
admin added script to add the ADMIN_ROLE admin 2022-09-05 21:28:23 +00:00
images Initial commit 2022-08-18 14:01:52 +02:00
languages merge /users 2022-09-06 08:32:25 +00:00
templates stylesheet fix 2022-09-06 13:48:07 +00:00
.gitignore rip and replace.. start 2022-09-02 21:06:08 +00:00
LICENSE.TXT Initial commit 2022-08-18 14:01:52 +02:00
README.md correct comments 2022-09-05 21:58:35 +00:00
add-alias.php remove domain_exists where it makes less sense, fix search 2022-09-06 12:29:52 +00:00
add-mailbox.php remove domain_exists where it makes less sense, fix search 2022-09-06 12:29:52 +00:00
admin.php change check_role() to query 2022-09-06 11:56:05 +00:00
backup.php change check_role() to query 2022-09-06 11:56:05 +00:00
conf.php-sample change table name to role, fix list-admin 2022-09-05 20:24:35 +00:00
delete.php change check_role() to query 2022-09-06 11:56:05 +00:00
domain.php change check_role() to query 2022-09-06 11:56:05 +00:00
edit-alias.php remove domain_exists where it makes less sense, fix search 2022-09-06 12:29:52 +00:00
edit-mailbox.php remove domain_exists where it makes less sense, fix search 2022-09-06 12:29:52 +00:00
functions.inc.php change check_role() to query 2022-09-06 11:56:05 +00:00
index.php merge admin + superadmin 2022-09-05 18:29:41 +00:00
list-admin.php change check_role() to query 2022-09-06 11:56:05 +00:00
list-domain.php change check_role() to query 2022-09-06 11:56:05 +00:00
list-virtual.php change check_role() to query 2022-09-06 11:56:05 +00:00
login.php change check_role() to query 2022-09-06 11:56:05 +00:00
logout.php merge admin + superadmin 2022-09-05 18:29:41 +00:00
password.php change check_role() to query 2022-09-06 11:56:05 +00:00
search.php change check_role() to query 2022-09-06 11:56:05 +00:00
sendmail.php change check_role() to query 2022-09-06 11:56:05 +00:00
setup.php change check frmo config.inc.php to conf.php 2022-09-04 20:35:55 +00:00
stylesheet.css smaller font-size 2022-09-06 14:01:05 +00:00
vacation.php change check_role() to query 2022-09-06 11:56:05 +00:00
viewlog.php remove domain_exists where it makes less sense, fix search 2022-09-06 12:29:52 +00:00

README.md

OpenSMTPD Admin

Fork of Postfix Admin 2.1.0 (released in 2007)

Database needed to use SQL with OpenSMTPD

CREATE DATABASE IF NOT EXISTS `opensmtpd` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `opensmtpd`;

CREATE TABLE `admin` (
  `username` varchar(255) NOT NULL DEFAULT '',
  `password` varchar(255) NOT NULL DEFAULT '',
  `role` varchar(32) DEFAULT NULL,
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`username`),
  KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='OpenSMTPD Admin - Virtual Admins'

CREATE TABLE `alias` (
  `address` varchar(255) NOT NULL DEFAULT '',
  `goto` text NOT NULL,
  `domain` varchar(255) NOT NULL DEFAULT '',
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`address`),
  KEY `address` (`address`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='OpenSMTPD Admin - Virtual Aliases'

CREATE TABLE `domain` (
  `domain` varchar(255) NOT NULL DEFAULT '',
  `description` varchar(255) NOT NULL DEFAULT '',
  `aliases` int(10) NOT NULL DEFAULT 0,
  `mailboxes` int(10) NOT NULL DEFAULT 0,
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`domain`),
  KEY `domain` (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='OpenSMTPD Admin - Virtual Domains'

CREATE TABLE `domain_admins` (
  `username` varchar(255) NOT NULL DEFAULT '',
  `domain` varchar(255) NOT NULL DEFAULT '',
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='OpenSMTPD Admin - Domain Admins'

CREATE TABLE `log` (
  `timestamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `username` varchar(255) NOT NULL DEFAULT '',
  `domain` varchar(255) NOT NULL DEFAULT '',
  `action` varchar(255) NOT NULL DEFAULT '',
  `data` varchar(255) NOT NULL DEFAULT '',
  KEY `timestamp` (`timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='OpenSMTPD Admin - Log'

CREATE TABLE `mailbox` (
  `username` varchar(255) NOT NULL DEFAULT '',
  `password` varchar(255) NOT NULL DEFAULT '',
  `name` varchar(255) NOT NULL DEFAULT '',
  `maildir` varchar(255) NOT NULL DEFAULT '',
  `domain` varchar(255) NOT NULL DEFAULT '',
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`username`),
  KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='OpenSMTPD Admin - Virtual Mailboxes'

CREATE TABLE `vacation` (
  `email` varchar(255) NOT NULL DEFAULT '',
  `subject` varchar(255) NOT NULL DEFAULT '',
  `body` text NOT NULL,
  `cache` text NOT NULL,
  `domain` varchar(255) NOT NULL DEFAULT '',
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`email`),
  KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='OpenSMTPD Admin - Virtual Vacation'

Config for OpenSMTPTD, MySQL/MariaDB example:

# /etc/mail/smtpd.conf
table credentials mysql:/etc/mail/sql.conf
table domains mysql:/etc/mail/sql.conf
table userinfo mysql:/etc/mail/sql.conf
table virtuals mysql:/etc/mail/sql.conf

Connecting the database to smtpd:

# /etc/mail/sql.conf
host            localhost
username        opensmtpd
password        RandomString 
database        opensmtpd

query_alias             SELECT goto FROM alias WHERE address=?;
query_credentials       SELECT username, password FROM mailbox WHERE username=?;
query_domain            SELECT domain FROM domain WHERE domain=?;
query_userinfo          SELECT 501, 501, maildir FROM mailbox WHERE username=?;