OpenSMTPD Admin - Administrative webshell for OpenSMTPD
Go to file
2022-08-22 21:18:20 +02:00
admin Update admin: include session hardening 2022-08-22 21:16:52 +02:00
images Initial commit 2022-08-18 14:01:52 +02:00
languages Initial commit 2022-08-18 14:01:52 +02:00
templates Initial commit 2022-08-18 14:01:52 +02:00
users Initial commit 2022-08-18 14:01:52 +02:00
VIRTUAL_VACATION Update vacation.pl: rework SQL, ht martijn@, added parsing of the sql config file 2022-08-22 18:22:27 +02:00
.gitignore Initial commit 2022-08-18 14:01:52 +02:00
config.inc.php.sample Add the debug toggle in config.inc.php.sample 2022-08-21 12:27:20 +02:00
create-alias.php Rename to session.inc.php and include it 2022-08-22 21:11:15 +02:00
create-mailbox.php Rename to session.inc.php and include it 2022-08-22 21:11:15 +02:00
delete.php Rename to session.inc.php and include it 2022-08-22 21:11:15 +02:00
edit-active.php Rename to session.inc.php and include it 2022-08-22 21:11:15 +02:00
edit-alias.php Rename to session.inc.php and include it 2022-08-22 21:11:15 +02:00
edit-mailbox.php Rename to session.inc.php and include it 2022-08-22 21:11:15 +02:00
functions.inc.php Update functions: Check the debug mode after the direct access check 2022-08-21 12:54:56 +02:00
index.php Rework the logic of index.php 2022-08-21 12:19:11 +02:00
LICENSE.TXT Initial commit 2022-08-18 14:01:52 +02:00
login.php Rename to session.inc.php and include it 2022-08-22 21:11:15 +02:00
logout.php Rename to session.inc.php and include it 2022-08-22 21:11:15 +02:00
main.php Rename to session.inc.php and include it 2022-08-22 21:11:15 +02:00
overview.php Rename to session.inc.php and include it 2022-08-22 21:11:15 +02:00
password.php Rename to session.inc.php and include it 2022-08-22 21:11:15 +02:00
README.md Update README.md: Add tagline 2022-08-22 18:23:30 +02:00
search.php Rename to session.inc.php and include it 2022-08-22 21:11:15 +02:00
sendmail.php Rename to session.inc.php and include it 2022-08-22 21:11:15 +02:00
session.inc.php Update session.inc.php: This ain't the setup ;) 2022-08-22 21:18:20 +02:00
setup.php Update setup.php (OCD the comments) and session.php (session hardening) 2022-08-22 21:06:35 +02:00
stylesheet.css Initial commit 2022-08-18 14:01:52 +02:00
variables.inc.php Initial commit 2022-08-18 14:01:52 +02:00
viewlog.php Rename to session.inc.php and include it 2022-08-22 21:11:15 +02:00

OpenSMTPD Admin - Administrative webshell for OpenSMTPD

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 '',
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `active` tinyint(1) NOT NULL DEFAULT 1
) 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',
  `active` tinyint(1) NOT NULL DEFAULT 1
) 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,
  `maxquota` int(10) NOT NULL DEFAULT 0,
  `transport` varchar(255) DEFAULT NULL,
  `backupmx` tinyint(1) 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',
  `active` tinyint(1) NOT NULL DEFAULT 1
) 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',
  `active` tinyint(1) NOT NULL DEFAULT 1
) 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 ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='OpenSMTPD Admin - Log';

Config for OpenSMTPTD, MySQL/MariaDB example:

# cat /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:

# cat /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=? AND active='1';
query_domain            SELECT domain FROM domain WHERE domain=? AND active='1';
query_userinfo          SELECT 501, 501, maildir FROM mailbox WHERE username=? AND active='1';