Skip to content

Instantly share code, notes, and snippets.

@ThomasLeister
Created June 9, 2018 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThomasLeister/a69b4ca184684344064d20c9e348df55 to your computer and use it in GitHub Desktop.
Save ThomasLeister/a69b4ca184684344064d20c9e348df55 to your computer and use it in GitHub Desktop.
/* Create queries for https://thomas-leister.de/mailserver-debian-stretch/ */
create table domains (
id serial not null,
domain char (255) unique not null,
PRIMARY KEY (id)
);
create table accounts (
id serial not null,
username char(64) not null,
domain char(255) not null,
password char(255) not null,
quota integer default 0,
enabled boolean default false,
sendonly boolean default false,
PRIMARY KEY (id),
UNIQUE (username, domain),
FOREIGN KEY (domain) references domains (domain)
);
CREATE TABLE aliases (
id serial not null,
source_username char(64) not null,
source_domain char(255) not null,
destination_username char(64) not null,
destination_domain char(255) not null,
enabled boolean default false,
PRIMARY KEY (id),
UNIQUE (source_username, source_domain, destination_username, destination_domain),
FOREIGN KEY (source_domain) REFERENCES domains (domain)
);
CREATE TYPE policy AS ENUM('none', 'may', 'encrypt', 'dane', 'dane-only', 'fingerprint', 'verify', 'secure');
CREATE TABLE tlspolicies (
id serial not null,
domain char(255) not null,
policy policy not null,
params varchar(255),
PRIMARY KEY (id),
UNIQUE (domain)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment