postfix_admin 0.1.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ruby.yml +37 -0
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +2 -0
  5. data/CHANGELOG.md +22 -0
  6. data/README.md +47 -32
  7. data/Rakefile +6 -0
  8. data/bin/console +18 -0
  9. data/docker-admin/Dockerfile +6 -0
  10. data/docker-admin/config.local.php +21 -0
  11. data/docker-app-2.5/Dockerfile +15 -0
  12. data/docker-app/Dockerfile +25 -0
  13. data/docker-app/docker-entrypoint.sh +5 -0
  14. data/docker-app/my.cnf +5 -0
  15. data/docker-compose.yml +46 -0
  16. data/docker-db/postfix.v1841.sql +383 -0
  17. data/{spec/postfix_test.sql → docker-db/postfix.v352.sql} +1 -28
  18. data/docker-db/postfix.v740.sql +269 -0
  19. data/{bin → exe}/postfix_admin +1 -0
  20. data/lib/postfix_admin.rb +1 -1
  21. data/lib/postfix_admin/admin.rb +62 -0
  22. data/lib/postfix_admin/alias.rb +65 -0
  23. data/lib/postfix_admin/application_record.rb +44 -0
  24. data/lib/postfix_admin/base.rb +120 -75
  25. data/lib/postfix_admin/cli.rb +173 -58
  26. data/lib/postfix_admin/concerns/.keep +0 -0
  27. data/lib/postfix_admin/concerns/dovecot_cram_md5_password.rb +30 -0
  28. data/lib/postfix_admin/concerns/existing_timestamp.rb +18 -0
  29. data/lib/postfix_admin/domain.rb +98 -0
  30. data/lib/postfix_admin/domain_admin.rb +8 -0
  31. data/lib/postfix_admin/doveadm.rb +37 -0
  32. data/lib/postfix_admin/log.rb +5 -0
  33. data/lib/postfix_admin/mail_domain.rb +9 -0
  34. data/lib/postfix_admin/mailbox.rb +89 -0
  35. data/lib/postfix_admin/models.rb +10 -170
  36. data/lib/postfix_admin/quota.rb +6 -0
  37. data/lib/postfix_admin/runner.rb +108 -36
  38. data/lib/postfix_admin/version.rb +1 -1
  39. data/postfix_admin.gemspec +22 -12
  40. metadata +80 -55
  41. data/spec/base_spec.rb +0 -235
  42. data/spec/cli_spec.rb +0 -286
  43. data/spec/models_spec.rb +0 -146
  44. data/spec/postfix_admin.conf +0 -5
  45. data/spec/runner_spec.rb +0 -194
  46. data/spec/spec_helper.rb +0 -159
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 03fe6501c97e53bf66c3fa2f783e8b2e40cc18da
4
- data.tar.gz: 0a7c400bee5d1f953ea9f2d03475b8c1e182653f
2
+ SHA256:
3
+ metadata.gz: 70bd18f454fd77684ab652949e36829f6d9e3e8e275e475819b60b025b3fea6e
4
+ data.tar.gz: 477da494d685bcaeb45f090d92edbfb1abc6af811e04172a4e4f1865b51eac46
5
5
  SHA512:
6
- metadata.gz: b976ae17e338b7bd8154a092bb1d9ed91274b3cb1f008fc1d98e0b55b045dd28966e1d912cd35315bd75ce3005d2bad2e286d29d869967038e461c6867ad31e2
7
- data.tar.gz: 56b944669124660d726addfcd2258543845b61170ea68cae3189d7ff87b45e4d2809ba2a0bfbea274d8338ada8e10e64408e672713531043614c28dd6bc07275
6
+ metadata.gz: a7b8c5f69e4f15589ca5c10250e88d9dfb76e623bed02548161e24c29fca02e74e97b154bf5f876936922e7b7d134f4fb6f46ab2e85765198fbaf5c7dddb1c32
7
+ data.tar.gz: 777b1af93896c8df8a4eab31af493af872a694502cab871c0ea99bcf7e8a82ce014228e82b117c37a3c9953ec86bd54648a01954c2bcae72c373fca94d1c18dc
@@ -0,0 +1,37 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Set up Ruby
24
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
25
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
26
+ # uses: ruby/setup-ruby@v1
27
+ uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
28
+ with:
29
+ ruby-version: 2.6
30
+ - name: docker-compose up
31
+ run: docker-compose up -d
32
+ - name: Run tests for Ruby 2.6
33
+ run: docker-compose exec -T app /wait-for-it.sh db:3306 -- rake
34
+ - name: Remove Gemfile.lock
35
+ run: rm -f Gemfile.lock
36
+ - name: Run tests for Ruby 2.5.0
37
+ run: docker-compose exec -T app2.5 rake
data/.gitignore CHANGED
@@ -15,3 +15,5 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .idea
19
+ .vagrant
@@ -0,0 +1,2 @@
1
+ Style/StringLiterals:
2
+ Enabled: false
@@ -0,0 +1,22 @@
1
+ ## 0.2.1
2
+ * Supported `superadmin` column of `admin` table
3
+ * Added `passwordhash_prefix` keyword in the configuration format for backward compatibility
4
+
5
+ ## 0.2.0
6
+ * Switched its object-relational mapper from DataMapper to ActiveRecord
7
+ * Stored password hash includes scheme prefix: like `{CRAM-MD5}`, `{PLAIN}`
8
+
9
+ ## 0.1.4
10
+ * Added "log" subcommand
11
+
12
+ ## 0.1.3
13
+ * Support for activation and deactivation of domain, admin and account
14
+ * Added "edit_admin" subcommand
15
+
16
+ ## 0.1.2
17
+ * Support password hash by doveadm (external subcommand)
18
+ * Show active status
19
+ * Don't show passwords using list format
20
+
21
+ ## 0.1.1, release 2013-05-10
22
+ * Fixed string length of password
data/README.md CHANGED
@@ -1,17 +1,20 @@
1
- # PostfixAdmin
1
+ [![Gem Version](https://badge.fury.io/rb/postfix_admin.png)](https://rubygems.org/gems/postfix_admin)
2
2
 
3
- Command Line Tools of Postfix Admin
3
+ # postfix_admin
4
+
5
+ Command Line Tools for Postfix Admin
4
6
 
5
7
  ## Description
6
8
 
7
- Postfix Admin Web Site http://postfixadmin.sourceforge.net/
9
+ * Postfix Admin (Original Web-based Application)
10
+ + Web Site http://postfixadmin.sourceforge.net/
11
+ + GitHub https://github.com/postfixadmin/postfixadmin
8
12
 
9
- Sourceforge page http://sourceforge.net/projects/postfixadmin/
13
+ * Postfix Admin 3.2 is supported.
10
14
 
11
- This software supports only MySQL as database for Postfix Admin.
12
- PostgreSQL is not supported.
15
+ * MySQL/MariaDB is supported.
13
16
 
14
- Postfix Admin 2.2.0 is supported.
17
+ * Other database engines are not supported.
15
18
 
16
19
  ## Installation
17
20
 
@@ -19,6 +22,18 @@ Install postfix_admin as:
19
22
 
20
23
  $ gem install postfix_admin
21
24
 
25
+ Just execute `postfix_admin` command to generate your config file: `~/.postfix_admin.conf`
26
+
27
+ $ postfix_admin
28
+
29
+ Edit the file for your environment:
30
+
31
+ $ vi ~/.postfix_admin.conf
32
+
33
+ You can see domains on your host if the `database` parameter is set properly:
34
+
35
+ $ postfix_admin show
36
+
22
37
  ## Usage
23
38
 
24
39
  List the postfix_admin subcommands as:
@@ -26,29 +41,29 @@ List the postfix_admin subcommands as:
26
41
  $ postfix_admin
27
42
 
28
43
  ```
29
- postfix_admin account_passwd user@example.com new_password # Change password of account
30
- postfix_admin add_account user@example.com password # Add an account
31
- postfix_admin add_admin admin@example.com password # Add an admin user
32
- postfix_admin add_admin_domain admin@example.com example.com # Add admin_domain
33
- postfix_admin add_alias alias@example.com goto@example.net # Add an alias
34
- postfix_admin add_domain example.com # Add a domain
35
- postfix_admin admin_passwd admin@example.com new_password # Change password of admin
36
- postfix_admin delete_account user@example.com # Delete an account
37
- postfix_admin delete_admin admin@example.com # Delete an admin
38
- postfix_admin delete_alias alias@example.com # Delete an alias
39
- postfix_admin delete_domain example.com # Delete a domain
40
- postfix_admin help [TASK] # Describe available tasks or one specific task
41
- postfix_admin setup example.com password # Setup a domain
42
- postfix_admin show # List of domains
43
- postfix_admin summary [example.com] # Summarize the usage of PostfixAdmin
44
- postfix_admin super_admin admin@example.com # Enable super admin flag of an admin
45
- postfix_admin version # Show postfix_admin version
44
+ Commands:
45
+ postfix_admin account_passwd user@example.com new_password # Change password of account
46
+ postfix_admin add_account user@example.com password # Add an account
47
+ postfix_admin add_admin admin@example.com password # Add an admin user
48
+ postfix_admin add_admin_domain admin@example.com example.com # Add admin_domain
49
+ postfix_admin add_alias alias@example.com goto@example.net # Add an alias
50
+ postfix_admin add_domain example.com # Add a domain
51
+ postfix_admin admin_passwd admin@example.com new_password # Change password of admin
52
+ postfix_admin delete_account user@example.com # Delete an account
53
+ postfix_admin delete_admin admin@example.com # Delete an admin
54
+ postfix_admin delete_admin_domain admin@example.com example.com # Delete admin_domain
55
+ postfix_admin delete_alias alias@example.com # Delete an alias
56
+ postfix_admin delete_domain example.com # Delete a domain
57
+ postfix_admin dump # Dump all data
58
+ postfix_admin edit_account user@example.com # Edit an account
59
+ postfix_admin edit_admin admin@example.com # Edit an admin user
60
+ postfix_admin edit_alias alias@example.com # Edit an alias
61
+ postfix_admin edit_domain example.com # Edit a domain limitation
62
+ postfix_admin help [COMMAND] # Describe available commands or one specific command
63
+ postfix_admin log # Show action logs
64
+ postfix_admin schemes # List all supported password schemes
65
+ postfix_admin setup example.com password # Setup a domain
66
+ postfix_admin show [example.com | admin@example.com | user@example.com] # Show domains or admins or mailboxes
67
+ postfix_admin summary [example.com] # Summarize the usage of PostfixAdmin
68
+ postfix_admin version # Show postfix_admin version
46
69
  ```
47
-
48
- ## Contributing
49
-
50
- 1. Fork it
51
- 2. Create your feature branch (`git checkout -b my-new-feature`)
52
- 3. Commit your changes (`git commit -am 'Added some feature'`)
53
- 4. Push to the branch (`git push origin my-new-feature`)
54
- 5. Create new Pull Request
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "postfix_admin"
5
+ require "postfix_admin/cli"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ cli = PostfixAdmin::CLI.new
11
+ cli.db_setup
12
+ include PostfixAdmin
13
+
14
+ require "pry"
15
+ Pry.start
16
+
17
+ # require "irb"
18
+ # IRB.start(__FILE__)
@@ -0,0 +1,6 @@
1
+ FROM postfixadmin:3.2.4-apache
2
+
3
+ RUN apt-get update && \
4
+ apt-get install -y dovecot-core iproute2 mariadb-client && \
5
+ rm -rf /var/lib/apt/lists/*
6
+
@@ -0,0 +1,21 @@
1
+ <?php
2
+ $CONF['configured'] = true;
3
+
4
+ $CONF['database_type'] = 'mysqli';
5
+ $CONF['database_user'] = 'postfix';
6
+ $CONF['database_password'] = 'password';
7
+ $CONF['database_name'] = 'postfix';
8
+ $CONF['database_host'] = 'db';
9
+
10
+ $CONF['password_validation'] = array(
11
+ # '/regular expression/' => '$PALANG key (optional: + parameter)',
12
+ '/.{5}/' => 'password_too_short 5', # minimum length 5 characters
13
+ '/([a-zA-Z].*){3}/' => 'password_no_characters 3', # must contain at least 3 characters
14
+ // '/([0-9].*){2}/' => 'password_no_digits 2', # must contain at least 2 digits
15
+ );
16
+
17
+ $CONF['encrypt'] = 'dovecot:CRAM-MD5';
18
+
19
+ // setup_password: 'password'
20
+ $CONF['setup_password'] = '87745eb0269b2f42813b23601be3231a:6e41880f73d97321f2f0b25a5ee30f57f5ab3be8';
21
+ ?>
@@ -0,0 +1,15 @@
1
+ FROM ruby:2.5.0
2
+
3
+ RUN apt-get update && \
4
+ apt-get install -y dovecot-core iproute2 mariadb-client && \
5
+ rm -rf /var/lib/apt/lists/*
6
+
7
+ WORKDIR /app
8
+
9
+ COPY Gemfile postfix_admin.gemspec ./
10
+ COPY ./lib/postfix_admin/version.rb ./lib/postfix_admin/version.rb
11
+
12
+ RUN gem install bundler && bundle install
13
+
14
+ COPY spec/postfix_admin.conf /root/.postfix_admin.conf
15
+ COPY docker-app/my.cnf /root/.my.cnf
@@ -0,0 +1,25 @@
1
+ FROM ruby:2.6
2
+
3
+ RUN apt-get update && \
4
+ apt-get install -y dovecot-core iproute2 mariadb-client && \
5
+ rm -rf /var/lib/apt/lists/*
6
+
7
+ WORKDIR /app
8
+
9
+ COPY Gemfile postfix_admin.gemspec ./
10
+ COPY ./lib/postfix_admin/version.rb ./lib/postfix_admin/version.rb
11
+
12
+ RUN gem install bundler && bundle install
13
+
14
+ COPY spec/postfix_admin.conf /root/.postfix_admin.conf
15
+ COPY docker-app/my.cnf /root/.my.cnf
16
+
17
+ # for GitHub Actions
18
+ RUN curl https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -so /wait-for-it.sh && \
19
+ chmod 755 /wait-for-it.sh
20
+
21
+ COPY docker-app/docker-entrypoint.sh /docker-entrypoint.sh
22
+ RUN chmod +x /docker-entrypoint.sh
23
+ ENTRYPOINT ["/docker-entrypoint.sh"]
24
+
25
+ CMD ["irb"]
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ set -eu
4
+
5
+ exec "$@"
@@ -0,0 +1,5 @@
1
+ [client]
2
+ user = postfix
3
+ password = password
4
+ host = db
5
+ database = postfix
@@ -0,0 +1,46 @@
1
+ version: '3.8'
2
+
3
+ services:
4
+ app:
5
+ build:
6
+ context: .
7
+ dockerfile: docker-app/Dockerfile
8
+ tty: true
9
+ volumes:
10
+ - .:/app
11
+ depends_on:
12
+ - db
13
+ app2.5:
14
+ tty: true
15
+ build:
16
+ context: .
17
+ dockerfile: docker-app-2.5/Dockerfile
18
+ volumes:
19
+ - .:/app
20
+ depends_on:
21
+ - db
22
+ admin:
23
+ build: docker-admin
24
+ ports:
25
+ - '8080:80'
26
+ volumes:
27
+ - ./docker-admin/config.local.php:/var/www/html/config.local.php
28
+ depends_on:
29
+ - db
30
+ # environment:
31
+ # - POSTFIXADMIN_DB_TYPE=mysqli
32
+ # - POSTFIXADMIN_DB_HOST=db
33
+ # - POSTFIXADMIN_DB_USER=postfix
34
+ # - POSTFIXADMIN_DB_PASSWORD=password
35
+ # - POSTFIXADMIN_DB_NAME=postfix
36
+ db:
37
+ image: mariadb:10
38
+ volumes:
39
+ - ./docker-db/postfix.v1841.sql:/docker-entrypoint-initdb.d/postfix.sql
40
+ # - ./docker-db/postfix.v740.sql:/docker-entrypoint-initdb.d/postfix.sql
41
+ # - ./docker-db/postfix.v352.sql:/docker-entrypoint-initdb.d/postfix.sql
42
+ environment:
43
+ - MYSQL_RANDOM_ROOT_PASSWORD=yes
44
+ - MYSQL_USER=postfix
45
+ - MYSQL_PASSWORD=password
46
+ - MYSQL_DATABASE=postfix
@@ -0,0 +1,383 @@
1
+ -- phpMyAdmin SQL Dump
2
+ -- version 4.9.1
3
+ -- https://www.phpmyadmin.net/
4
+ --
5
+ -- Host: localhost
6
+ -- Generation Time: May 30, 2020 at 04:28 PM
7
+ -- Server version: 10.3.17-MariaDB-log
8
+ -- PHP Version: 7.2.11
9
+
10
+ SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11
+ SET AUTOCOMMIT = 0;
12
+ START TRANSACTION;
13
+ SET time_zone = "+00:00";
14
+
15
+
16
+ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
17
+ /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
18
+ /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
19
+ /*!40101 SET NAMES utf8mb4 */;
20
+
21
+ --
22
+ -- Database: `postfix`
23
+ --
24
+
25
+ -- --------------------------------------------------------
26
+
27
+ --
28
+ -- Table structure for table `admin`
29
+ --
30
+
31
+ CREATE TABLE `admin` (
32
+ `username` varchar(255) NOT NULL,
33
+ `password` varchar(255) NOT NULL,
34
+ `created` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
35
+ `modified` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
36
+ `active` tinyint(1) NOT NULL DEFAULT 1,
37
+ `superadmin` tinyint(1) NOT NULL DEFAULT 0,
38
+ `phone` varchar(30) NOT NULL DEFAULT '',
39
+ `email_other` varchar(255) NOT NULL DEFAULT '',
40
+ `token` varchar(255) NOT NULL DEFAULT '',
41
+ `token_validity` datetime NOT NULL DEFAULT '2000-01-01 00:00:00'
42
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Admins';
43
+
44
+ -- --------------------------------------------------------
45
+
46
+ --
47
+ -- Table structure for table `alias`
48
+ --
49
+
50
+ CREATE TABLE `alias` (
51
+ `address` varchar(255) NOT NULL,
52
+ `goto` text NOT NULL,
53
+ `domain` varchar(255) NOT NULL,
54
+ `created` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
55
+ `modified` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
56
+ `active` tinyint(1) NOT NULL DEFAULT 1
57
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Aliases';
58
+
59
+ -- --------------------------------------------------------
60
+
61
+ --
62
+ -- Table structure for table `alias_domain`
63
+ --
64
+
65
+ CREATE TABLE `alias_domain` (
66
+ `alias_domain` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT '',
67
+ `target_domain` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT '',
68
+ `created` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
69
+ `modified` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
70
+ `active` tinyint(1) NOT NULL DEFAULT 1
71
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Domain Aliases';
72
+
73
+ -- --------------------------------------------------------
74
+
75
+ --
76
+ -- Table structure for table `config`
77
+ --
78
+
79
+ CREATE TABLE `config` (
80
+ `id` int(11) NOT NULL,
81
+ `name` varchar(20) NOT NULL DEFAULT '',
82
+ `value` varchar(20) NOT NULL DEFAULT ''
83
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='PostfixAdmin settings';
84
+
85
+ --
86
+ -- Dumping data for table `config`
87
+ --
88
+
89
+ INSERT INTO `config` (`id`, `name`, `value`) VALUES
90
+ (1, 'version', '1841');
91
+
92
+ -- --------------------------------------------------------
93
+
94
+ --
95
+ -- Table structure for table `domain`
96
+ --
97
+
98
+ CREATE TABLE `domain` (
99
+ `domain` varchar(255) NOT NULL,
100
+ `description` varchar(255) NOT NULL,
101
+ `aliases` int(10) NOT NULL DEFAULT 0,
102
+ `mailboxes` int(10) NOT NULL DEFAULT 0,
103
+ `maxquota` bigint(20) NOT NULL DEFAULT 0,
104
+ `quota` bigint(20) NOT NULL DEFAULT 0,
105
+ `transport` varchar(255) NOT NULL,
106
+ `backupmx` tinyint(1) NOT NULL DEFAULT 0,
107
+ `created` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
108
+ `modified` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
109
+ `active` tinyint(1) NOT NULL DEFAULT 1
110
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Domains';
111
+
112
+ --
113
+ -- Dumping data for table `domain`
114
+ --
115
+
116
+ INSERT INTO `domain` (`domain`, `description`, `aliases`, `mailboxes`, `maxquota`, `quota`, `transport`, `backupmx`, `created`, `modified`, `active`) VALUES
117
+ ('ALL', '', 0, 0, 0, 0, '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1);
118
+
119
+ -- --------------------------------------------------------
120
+
121
+ --
122
+ -- Table structure for table `domain_admins`
123
+ --
124
+
125
+ CREATE TABLE `domain_admins` (
126
+ `username` varchar(255) NOT NULL,
127
+ `domain` varchar(255) NOT NULL,
128
+ `created` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
129
+ `active` tinyint(1) NOT NULL DEFAULT 1
130
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Domain Admins';
131
+
132
+ -- --------------------------------------------------------
133
+
134
+ --
135
+ -- Table structure for table `fetchmail`
136
+ --
137
+
138
+ CREATE TABLE `fetchmail` (
139
+ `id` int(11) UNSIGNED NOT NULL,
140
+ `mailbox` varchar(255) NOT NULL,
141
+ `src_server` varchar(255) NOT NULL,
142
+ `src_auth` enum('password','kerberos_v5','kerberos','kerberos_v4','gssapi','cram-md5','otp','ntlm','msn','ssh','any') DEFAULT NULL,
143
+ `src_user` varchar(255) NOT NULL,
144
+ `src_password` varchar(255) NOT NULL,
145
+ `src_folder` varchar(255) NOT NULL,
146
+ `poll_time` int(11) UNSIGNED NOT NULL DEFAULT 10,
147
+ `fetchall` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
148
+ `keep` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
149
+ `protocol` enum('POP3','IMAP','POP2','ETRN','AUTO') DEFAULT NULL,
150
+ `usessl` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
151
+ `extra_options` text DEFAULT NULL,
152
+ `returned_text` text DEFAULT NULL,
153
+ `mda` varchar(255) NOT NULL,
154
+ `date` timestamp NOT NULL DEFAULT '1999-12-31 15:00:00',
155
+ `sslcertck` tinyint(1) NOT NULL DEFAULT 0,
156
+ `sslcertpath` varchar(255) DEFAULT '',
157
+ `sslfingerprint` varchar(255) CHARACTER SET latin1 DEFAULT '',
158
+ `domain` varchar(255) CHARACTER SET latin1 DEFAULT '',
159
+ `active` tinyint(1) NOT NULL DEFAULT 0,
160
+ `created` timestamp NOT NULL DEFAULT '1999-12-31 15:00:00',
161
+ `modified` timestamp NOT NULL DEFAULT current_timestamp()
162
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
163
+
164
+ -- --------------------------------------------------------
165
+
166
+ --
167
+ -- Table structure for table `log`
168
+ --
169
+
170
+ CREATE TABLE `log` (
171
+ `timestamp` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
172
+ `username` varchar(255) NOT NULL,
173
+ `domain` varchar(255) NOT NULL,
174
+ `action` varchar(255) NOT NULL,
175
+ `data` text NOT NULL,
176
+ `id` int(11) NOT NULL
177
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Log';
178
+
179
+ -- --------------------------------------------------------
180
+
181
+ --
182
+ -- Table structure for table `mailbox`
183
+ --
184
+
185
+ CREATE TABLE `mailbox` (
186
+ `username` varchar(255) NOT NULL,
187
+ `password` varchar(255) NOT NULL,
188
+ `name` varchar(255) NOT NULL,
189
+ `maildir` varchar(255) NOT NULL,
190
+ `quota` bigint(20) NOT NULL DEFAULT 0,
191
+ `local_part` varchar(255) NOT NULL,
192
+ `domain` varchar(255) NOT NULL,
193
+ `created` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
194
+ `modified` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
195
+ `active` tinyint(1) NOT NULL DEFAULT 1,
196
+ `phone` varchar(30) NOT NULL DEFAULT '',
197
+ `email_other` varchar(255) NOT NULL DEFAULT '',
198
+ `token` varchar(255) NOT NULL DEFAULT '',
199
+ `token_validity` datetime NOT NULL DEFAULT '2000-01-01 00:00:00'
200
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Mailboxes';
201
+
202
+ -- --------------------------------------------------------
203
+
204
+ --
205
+ -- Table structure for table `quota`
206
+ --
207
+
208
+ CREATE TABLE `quota` (
209
+ `username` varchar(255) NOT NULL,
210
+ `path` varchar(100) NOT NULL,
211
+ `current` bigint(20) DEFAULT NULL
212
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
213
+
214
+ -- --------------------------------------------------------
215
+
216
+ --
217
+ -- Table structure for table `quota2`
218
+ --
219
+
220
+ CREATE TABLE `quota2` (
221
+ `username` varchar(100) NOT NULL,
222
+ `bytes` bigint(20) NOT NULL DEFAULT 0,
223
+ `messages` int(11) NOT NULL DEFAULT 0
224
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
225
+
226
+ -- --------------------------------------------------------
227
+
228
+ --
229
+ -- Table structure for table `vacation`
230
+ --
231
+
232
+ CREATE TABLE `vacation` (
233
+ `email` varchar(255) NOT NULL,
234
+ `subject` varchar(255) NOT NULL,
235
+ `body` text NOT NULL,
236
+ `cache` text NOT NULL,
237
+ `domain` varchar(255) NOT NULL,
238
+ `created` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
239
+ `active` tinyint(1) NOT NULL DEFAULT 1,
240
+ `modified` timestamp NOT NULL DEFAULT current_timestamp(),
241
+ `activefrom` timestamp NOT NULL DEFAULT '1999-12-31 15:00:00',
242
+ `activeuntil` timestamp NOT NULL DEFAULT '2038-01-17 15:00:00',
243
+ `interval_time` int(11) NOT NULL DEFAULT 0
244
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Vacation';
245
+
246
+ -- --------------------------------------------------------
247
+
248
+ --
249
+ -- Table structure for table `vacation_notification`
250
+ --
251
+
252
+ CREATE TABLE `vacation_notification` (
253
+ `on_vacation` varchar(150) NOT NULL,
254
+ `notified` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT '',
255
+ `notified_at` timestamp NOT NULL DEFAULT current_timestamp()
256
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Vacation Notifications';
257
+
258
+ --
259
+ -- Indexes for dumped tables
260
+ --
261
+
262
+ --
263
+ -- Indexes for table `admin`
264
+ --
265
+ ALTER TABLE `admin`
266
+ ADD PRIMARY KEY (`username`);
267
+
268
+ --
269
+ -- Indexes for table `alias`
270
+ --
271
+ ALTER TABLE `alias`
272
+ ADD PRIMARY KEY (`address`),
273
+ ADD KEY `domain` (`domain`);
274
+
275
+ --
276
+ -- Indexes for table `alias_domain`
277
+ --
278
+ ALTER TABLE `alias_domain`
279
+ ADD PRIMARY KEY (`alias_domain`),
280
+ ADD KEY `active` (`active`),
281
+ ADD KEY `target_domain` (`target_domain`);
282
+
283
+ --
284
+ -- Indexes for table `config`
285
+ --
286
+ ALTER TABLE `config`
287
+ ADD PRIMARY KEY (`id`),
288
+ ADD UNIQUE KEY `name` (`name`);
289
+
290
+ --
291
+ -- Indexes for table `domain`
292
+ --
293
+ ALTER TABLE `domain`
294
+ ADD PRIMARY KEY (`domain`);
295
+
296
+ --
297
+ -- Indexes for table `domain_admins`
298
+ --
299
+ ALTER TABLE `domain_admins`
300
+ ADD KEY `username` (`username`);
301
+
302
+ --
303
+ -- Indexes for table `fetchmail`
304
+ --
305
+ ALTER TABLE `fetchmail`
306
+ ADD PRIMARY KEY (`id`);
307
+
308
+ --
309
+ -- Indexes for table `log`
310
+ --
311
+ ALTER TABLE `log`
312
+ ADD PRIMARY KEY (`id`),
313
+ ADD KEY `timestamp` (`timestamp`),
314
+ ADD KEY `domain_timestamp` (`domain`,`timestamp`);
315
+
316
+ --
317
+ -- Indexes for table `mailbox`
318
+ --
319
+ ALTER TABLE `mailbox`
320
+ ADD PRIMARY KEY (`username`),
321
+ ADD KEY `domain` (`domain`);
322
+
323
+ --
324
+ -- Indexes for table `quota`
325
+ --
326
+ ALTER TABLE `quota`
327
+ ADD PRIMARY KEY (`username`,`path`);
328
+
329
+ --
330
+ -- Indexes for table `quota2`
331
+ --
332
+ ALTER TABLE `quota2`
333
+ ADD PRIMARY KEY (`username`);
334
+
335
+ --
336
+ -- Indexes for table `vacation`
337
+ --
338
+ ALTER TABLE `vacation`
339
+ ADD PRIMARY KEY (`email`),
340
+ ADD KEY `email` (`email`);
341
+
342
+ --
343
+ -- Indexes for table `vacation_notification`
344
+ --
345
+ ALTER TABLE `vacation_notification`
346
+ ADD PRIMARY KEY (`on_vacation`,`notified`);
347
+
348
+ --
349
+ -- AUTO_INCREMENT for dumped tables
350
+ --
351
+
352
+ --
353
+ -- AUTO_INCREMENT for table `config`
354
+ --
355
+ ALTER TABLE `config`
356
+ MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
357
+
358
+ --
359
+ -- AUTO_INCREMENT for table `fetchmail`
360
+ --
361
+ ALTER TABLE `fetchmail`
362
+ MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
363
+
364
+ --
365
+ -- AUTO_INCREMENT for table `log`
366
+ --
367
+ ALTER TABLE `log`
368
+ MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
369
+
370
+ --
371
+ -- Constraints for dumped tables
372
+ --
373
+
374
+ --
375
+ -- Constraints for table `vacation_notification`
376
+ --
377
+ ALTER TABLE `vacation_notification`
378
+ ADD CONSTRAINT `vacation_notification_pkey` FOREIGN KEY (`on_vacation`) REFERENCES `vacation` (`email`) ON DELETE CASCADE;
379
+ COMMIT;
380
+
381
+ /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
382
+ /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
383
+ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;