postfix_admin 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a83f945f0f977fc80b8715b899af26d908b3d6b1169d27fae9cf92089bac5082
4
- data.tar.gz: f8f63116ece1064079b99f986fc26778c4f4affc28ae8dbd3beca3496a595186
3
+ metadata.gz: 70bd18f454fd77684ab652949e36829f6d9e3e8e275e475819b60b025b3fea6e
4
+ data.tar.gz: 477da494d685bcaeb45f090d92edbfb1abc6af811e04172a4e4f1865b51eac46
5
5
  SHA512:
6
- metadata.gz: 22f7cc6d351d3a7e63ba95e653ac21f4b1eeebaebb5a717810477ab0d700dbb3199eeee042ca34909aee1c959bb7d27fe705d1c332895e7bb38ae0cc1f3e9120
7
- data.tar.gz: 821bb8bac75277e3faf303f1db8292256cc9bbcf40cb2de6f63f9c3c38e40f84c5739849edc159ddec8bf262d9fa9e5ea8f9bac15e8dce37f2691f0a017e2772
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
@@ -1,3 +1,7 @@
1
+ ## 0.2.1
2
+ * Supported `superadmin` column of `admin` table
3
+ * Added `passwordhash_prefix` keyword in the configuration format for backward compatibility
4
+
1
5
  ## 0.2.0
2
6
  * Switched its object-relational mapper from DataMapper to ActiveRecord
3
7
  * Stored password hash includes scheme prefix: like `{CRAM-MD5}`, `{PLAIN}`
@@ -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
+ [client]
2
+ user = postfix
3
+ password = password
4
+ host = db
5
+ database = postfix
@@ -2,21 +2,43 @@ version: '3.8'
2
2
 
3
3
  services:
4
4
  app:
5
- build: .
5
+ build:
6
+ context: .
7
+ dockerfile: docker-app/Dockerfile
6
8
  tty: true
7
- ports:
8
- - '7080:80'
9
9
  volumes:
10
10
  - .:/app
11
- - /sys/fs/cgroup:/sys/fs/cgroup:ro
12
- tmpfs:
13
- - /tmp
14
- - /run
15
- stop_signal: SIGRTMIN+3
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
16
36
  db:
17
37
  image: mariadb:10
18
38
  volumes:
19
- - ./spec/postfix.v1841.sql:/docker-entrypoint-initdb.d/postfix.sql
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
20
42
  environment:
21
43
  - MYSQL_RANDOM_ROOT_PASSWORD=yes
22
44
  - MYSQL_USER=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 */;
@@ -0,0 +1,223 @@
1
+ -- phpMyAdmin SQL Dump
2
+ -- version 3.4.7
3
+ -- http://www.phpmyadmin.net
4
+ --
5
+ -- ホスト: localhost
6
+ -- 生成時間: 2012 年 9 月 25 日 23:12
7
+ -- サーバのバージョン: 5.5.15
8
+ -- PHP のバージョン: 5.3.15
9
+
10
+ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
11
+ SET time_zone = "+00:00";
12
+
13
+
14
+ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
15
+ /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
16
+ /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
17
+ /*!40101 SET NAMES utf8 */;
18
+
19
+ --
20
+ -- データベース: `postfix_test`
21
+ --
22
+
23
+ -- --------------------------------------------------------
24
+
25
+ --
26
+ -- テーブルの構造 `admin`
27
+ --
28
+
29
+ CREATE TABLE IF NOT EXISTS `admin` (
30
+ `username` varchar(255) NOT NULL DEFAULT '',
31
+ `password` varchar(255) NOT NULL DEFAULT '',
32
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
33
+ `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
34
+ `active` tinyint(1) NOT NULL DEFAULT '1',
35
+ PRIMARY KEY (`username`)
36
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Admins';
37
+
38
+ -- --------------------------------------------------------
39
+
40
+ --
41
+ -- テーブルの構造 `alias`
42
+ --
43
+
44
+ CREATE TABLE IF NOT EXISTS `alias` (
45
+ `address` varchar(255) NOT NULL DEFAULT '',
46
+ `goto` text NOT NULL,
47
+ `domain` varchar(255) NOT NULL DEFAULT '',
48
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
49
+ `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
50
+ `active` tinyint(1) NOT NULL DEFAULT '1',
51
+ PRIMARY KEY (`address`)
52
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Aliases';
53
+
54
+ --
55
+ -- テーブルのデータをダンプしています `alias`
56
+ --
57
+
58
+ -- --------------------------------------------------------
59
+
60
+ --
61
+ -- テーブルの構造 `config`
62
+ --
63
+
64
+ CREATE TABLE IF NOT EXISTS `config` (
65
+ `id` int(11) NOT NULL AUTO_INCREMENT,
66
+ `name` varchar(20) CHARACTER SET latin1 NOT NULL DEFAULT '',
67
+ `value` varchar(20) CHARACTER SET latin1 NOT NULL DEFAULT '',
68
+ PRIMARY KEY (`id`),
69
+ UNIQUE KEY `name` (`name`)
70
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='PostfixAdmin settings' AUTO_INCREMENT=2 ;
71
+
72
+ --
73
+ -- テーブルのデータをダンプしています `config`
74
+ --
75
+
76
+ INSERT INTO `config` (`id`, `name`, `value`) VALUES
77
+ (1, 'version', '352');
78
+
79
+ -- --------------------------------------------------------
80
+
81
+ --
82
+ -- テーブルの構造 `domain`
83
+ --
84
+
85
+ CREATE TABLE IF NOT EXISTS `domain` (
86
+ `domain` varchar(255) NOT NULL DEFAULT '',
87
+ `description` varchar(255) NOT NULL DEFAULT '',
88
+ `aliases` int(10) NOT NULL DEFAULT '0',
89
+ `mailboxes` int(10) NOT NULL DEFAULT '0',
90
+ `maxquota` bigint(20) NOT NULL DEFAULT '0',
91
+ `quota` bigint(20) NOT NULL DEFAULT '0',
92
+ `transport` varchar(255) DEFAULT NULL,
93
+ `backupmx` tinyint(1) NOT NULL DEFAULT '0',
94
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
95
+ `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
96
+ `active` tinyint(1) NOT NULL DEFAULT '1',
97
+ PRIMARY KEY (`domain`)
98
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Domains';
99
+
100
+ --
101
+ -- テーブルのデータをダンプしています `domain`
102
+ --
103
+
104
+ INSERT INTO `domain` (`domain`, `description`, `aliases`, `mailboxes`, `maxquota`, `quota`, `transport`, `backupmx`, `created`, `modified`, `active`) VALUES
105
+ ('ALL', '', 0, 0, 0, 0, NULL, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1);
106
+
107
+ -- --------------------------------------------------------
108
+
109
+ --
110
+ -- テーブルの構造 `domain_admins`
111
+ --
112
+
113
+ CREATE TABLE IF NOT EXISTS `domain_admins` (
114
+ `username` varchar(255) NOT NULL DEFAULT '',
115
+ `domain` varchar(255) NOT NULL DEFAULT '',
116
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
117
+ `active` tinyint(1) NOT NULL DEFAULT '1',
118
+ KEY `username` (`username`)
119
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Domain Admins';
120
+
121
+ -- --------------------------------------------------------
122
+
123
+ --
124
+ -- テーブルの構造 `fetchmail`
125
+ --
126
+
127
+ CREATE TABLE IF NOT EXISTS `fetchmail` (
128
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
129
+ `mailbox` varchar(255) NOT NULL DEFAULT '',
130
+ `src_server` varchar(255) NOT NULL DEFAULT '',
131
+ `src_auth` enum('password','kerberos_v5','kerberos','kerberos_v4','gssapi','cram-md5','otp','ntlm','msn','ssh','any') DEFAULT NULL,
132
+ `src_user` varchar(255) NOT NULL DEFAULT '',
133
+ `src_password` varchar(255) NOT NULL DEFAULT '',
134
+ `src_folder` varchar(255) NOT NULL DEFAULT '',
135
+ `poll_time` int(11) unsigned NOT NULL DEFAULT '10',
136
+ `fetchall` tinyint(1) unsigned NOT NULL DEFAULT '0',
137
+ `keep` tinyint(1) unsigned NOT NULL DEFAULT '0',
138
+ `protocol` enum('POP3','IMAP','POP2','ETRN','AUTO') DEFAULT NULL,
139
+ `extra_options` text,
140
+ `returned_text` text,
141
+ `mda` varchar(255) NOT NULL DEFAULT '',
142
+ `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
143
+ PRIMARY KEY (`id`)
144
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
145
+
146
+ -- --------------------------------------------------------
147
+
148
+ --
149
+ -- テーブルの構造 `log`
150
+ --
151
+
152
+ CREATE TABLE IF NOT EXISTS `log` (
153
+ `timestamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
154
+ `username` varchar(255) NOT NULL DEFAULT '',
155
+ `domain` varchar(255) NOT NULL DEFAULT '',
156
+ `action` varchar(255) NOT NULL DEFAULT '',
157
+ `data` varchar(255) NOT NULL DEFAULT '',
158
+ KEY `timestamp` (`timestamp`)
159
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Log';
160
+
161
+ -- --------------------------------------------------------
162
+
163
+ --
164
+ -- テーブルの構造 `mailbox`
165
+ --
166
+
167
+ CREATE TABLE IF NOT EXISTS `mailbox` (
168
+ `username` varchar(255) NOT NULL DEFAULT '',
169
+ `password` varchar(255) NOT NULL DEFAULT '',
170
+ `name` varchar(255) NOT NULL DEFAULT '',
171
+ `maildir` varchar(255) NOT NULL DEFAULT '',
172
+ `quota` bigint(20) NOT NULL DEFAULT '0',
173
+ `domain` varchar(255) NOT NULL DEFAULT '',
174
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
175
+ `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
176
+ `active` tinyint(1) NOT NULL DEFAULT '1',
177
+ PRIMARY KEY (`username`)
178
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Mailboxes';
179
+
180
+ -- --------------------------------------------------------
181
+
182
+ --
183
+ -- テーブルの構造 `vacation`
184
+ --
185
+
186
+ CREATE TABLE IF NOT EXISTS `vacation` (
187
+ `email` varchar(255) NOT NULL,
188
+ `subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
189
+ `body` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
190
+ `cache` text NOT NULL,
191
+ `domain` varchar(255) NOT NULL,
192
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
193
+ `active` tinyint(1) NOT NULL DEFAULT '1',
194
+ PRIMARY KEY (`email`),
195
+ KEY `email` (`email`)
196
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Postfix Admin - Virtual Vacation';
197
+
198
+ -- --------------------------------------------------------
199
+
200
+ --
201
+ -- テーブルの構造 `vacation_notification`
202
+ --
203
+
204
+ CREATE TABLE IF NOT EXISTS `vacation_notification` (
205
+ `on_vacation` varchar(255) NOT NULL,
206
+ `notified` varchar(255) NOT NULL,
207
+ `notified_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
208
+ PRIMARY KEY (`on_vacation`,`notified`)
209
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Postfix Admin - Virtual Vacation Notifications';
210
+
211
+ --
212
+ -- ダンプしたテーブルの制約
213
+ --
214
+
215
+ --
216
+ -- テーブルの制約 `vacation_notification`
217
+ --
218
+ ALTER TABLE `vacation_notification`
219
+ ADD CONSTRAINT `vacation_notification_pkey` FOREIGN KEY (`on_vacation`) REFERENCES `vacation` (`email`) ON DELETE CASCADE;
220
+
221
+ /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
222
+ /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
223
+ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
@@ -0,0 +1,269 @@
1
+
2
+ -- phpMyAdmin SQL Dump
3
+ -- version 3.5.7
4
+ -- http://www.phpmyadmin.net
5
+ --
6
+ -- ホスト: localhost
7
+ -- 生成日時: 2013 年 5 月 09 日 08:25
8
+ -- サーバのバージョン: 5.5.29
9
+ -- PHP のバージョン: 5.3.20
10
+
11
+ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
12
+ SET time_zone = "+00:00";
13
+
14
+
15
+ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
16
+ /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
17
+ /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
18
+ /*!40101 SET NAMES utf8 */;
19
+
20
+ --
21
+ -- データベース: `postfix`
22
+ --
23
+
24
+ -- --------------------------------------------------------
25
+
26
+ --
27
+ -- テーブルの構造 `admin`
28
+ --
29
+
30
+ CREATE TABLE IF NOT EXISTS `admin` (
31
+ `username` varchar(255) NOT NULL,
32
+ `password` varchar(255) NOT NULL,
33
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
34
+ `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
35
+ `active` tinyint(1) NOT NULL DEFAULT '1',
36
+ PRIMARY KEY (`username`)
37
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Admins';
38
+
39
+ -- --------------------------------------------------------
40
+
41
+ --
42
+ -- テーブルの構造 `alias`
43
+ --
44
+
45
+ CREATE TABLE IF NOT EXISTS `alias` (
46
+ `address` varchar(255) NOT NULL,
47
+ `goto` text NOT NULL,
48
+ `domain` varchar(255) NOT NULL,
49
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
50
+ `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
51
+ `active` tinyint(1) NOT NULL DEFAULT '1',
52
+ PRIMARY KEY (`address`),
53
+ KEY `domain` (`domain`)
54
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Aliases';
55
+
56
+ -- --------------------------------------------------------
57
+
58
+ --
59
+ -- テーブルの構造 `alias_domain`
60
+ --
61
+
62
+ CREATE TABLE IF NOT EXISTS `alias_domain` (
63
+ `alias_domain` varchar(255) NOT NULL,
64
+ `target_domain` varchar(255) NOT NULL,
65
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
66
+ `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
67
+ `active` tinyint(1) NOT NULL DEFAULT '1',
68
+ PRIMARY KEY (`alias_domain`),
69
+ KEY `active` (`active`),
70
+ KEY `target_domain` (`target_domain`)
71
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Domain Aliases';
72
+
73
+ -- --------------------------------------------------------
74
+
75
+ --
76
+ -- テーブルの構造 `config`
77
+ --
78
+
79
+ CREATE TABLE IF NOT EXISTS `config` (
80
+ `id` int(11) NOT NULL AUTO_INCREMENT,
81
+ `name` varchar(20) CHARACTER SET utf8 NOT NULL DEFAULT '',
82
+ `value` varchar(20) CHARACTER SET utf8 NOT NULL DEFAULT '',
83
+ PRIMARY KEY (`id`),
84
+ UNIQUE KEY `name` (`name`)
85
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='PostfixAdmin settings' AUTO_INCREMENT=2 ;
86
+
87
+ --
88
+ -- テーブルのデータのダンプ `config`
89
+ --
90
+
91
+ INSERT INTO `config` (`id`, `name`, `value`) VALUES
92
+ (1, 'version', '740');
93
+
94
+ -- --------------------------------------------------------
95
+
96
+ --
97
+ -- テーブルの構造 `domain`
98
+ --
99
+
100
+ CREATE TABLE IF NOT EXISTS `domain` (
101
+ `domain` varchar(255) NOT NULL,
102
+ `description` varchar(255) CHARACTER SET utf8 NOT NULL,
103
+ `aliases` int(10) NOT NULL DEFAULT '0',
104
+ `mailboxes` int(10) NOT NULL DEFAULT '0',
105
+ `maxquota` bigint(20) NOT NULL DEFAULT '0',
106
+ `quota` bigint(20) NOT NULL DEFAULT '0',
107
+ `transport` varchar(255) NOT NULL,
108
+ `backupmx` tinyint(1) NOT NULL DEFAULT '0',
109
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
110
+ `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
111
+ `active` tinyint(1) NOT NULL DEFAULT '1',
112
+ PRIMARY KEY (`domain`)
113
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Domains';
114
+
115
+ --
116
+ -- テーブルのデータのダンプ `domain`
117
+ --
118
+
119
+ INSERT INTO `domain` (`domain`, `description`, `aliases`, `mailboxes`, `maxquota`, `quota`, `transport`, `backupmx`, `created`, `modified`, `active`) VALUES
120
+ ('ALL', '', 0, 0, 0, 0, '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1);
121
+
122
+ -- --------------------------------------------------------
123
+
124
+ --
125
+ -- テーブルの構造 `domain_admins`
126
+ --
127
+
128
+ CREATE TABLE IF NOT EXISTS `domain_admins` (
129
+ `username` varchar(255) NOT NULL,
130
+ `domain` varchar(255) NOT NULL,
131
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
132
+ `active` tinyint(1) NOT NULL DEFAULT '1',
133
+ KEY `username` (`username`)
134
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Domain Admins';
135
+
136
+ -- --------------------------------------------------------
137
+
138
+ --
139
+ -- テーブルの構造 `fetchmail`
140
+ --
141
+
142
+ CREATE TABLE IF NOT EXISTS `fetchmail` (
143
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
144
+ `mailbox` varchar(255) NOT NULL,
145
+ `src_server` varchar(255) NOT NULL,
146
+ `src_auth` enum('password','kerberos_v5','kerberos','kerberos_v4','gssapi','cram-md5','otp','ntlm','msn','ssh','any') CHARACTER SET utf8 DEFAULT NULL,
147
+ `src_user` varchar(255) NOT NULL,
148
+ `src_password` varchar(255) NOT NULL,
149
+ `src_folder` varchar(255) NOT NULL,
150
+ `poll_time` int(11) unsigned NOT NULL DEFAULT '10',
151
+ `fetchall` tinyint(1) unsigned NOT NULL DEFAULT '0',
152
+ `keep` tinyint(1) unsigned NOT NULL DEFAULT '0',
153
+ `protocol` enum('POP3','IMAP','POP2','ETRN','AUTO') CHARACTER SET utf8 DEFAULT NULL,
154
+ `usessl` tinyint(1) unsigned NOT NULL DEFAULT '0',
155
+ `extra_options` text,
156
+ `returned_text` text,
157
+ `mda` varchar(255) NOT NULL,
158
+ `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
159
+ PRIMARY KEY (`id`)
160
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
161
+
162
+ -- --------------------------------------------------------
163
+
164
+ --
165
+ -- テーブルの構造 `log`
166
+ --
167
+
168
+ CREATE TABLE IF NOT EXISTS `log` (
169
+ `timestamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
170
+ `username` varchar(255) NOT NULL,
171
+ `domain` varchar(255) NOT NULL,
172
+ `action` varchar(255) NOT NULL,
173
+ `data` text NOT NULL,
174
+ KEY `timestamp` (`timestamp`)
175
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Log';
176
+
177
+
178
+ -- --------------------------------------------------------
179
+
180
+ --
181
+ -- テーブルの構造 `mailbox`
182
+ --
183
+
184
+ CREATE TABLE IF NOT EXISTS `mailbox` (
185
+ `username` varchar(255) NOT NULL,
186
+ `password` varchar(255) NOT NULL,
187
+ `name` varchar(255) CHARACTER SET utf8 NOT NULL,
188
+ `maildir` varchar(255) NOT NULL,
189
+ `quota` bigint(20) NOT NULL DEFAULT '0',
190
+ `local_part` varchar(255) NOT NULL,
191
+ `domain` varchar(255) NOT NULL,
192
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
193
+ `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
194
+ `active` tinyint(1) NOT NULL DEFAULT '1',
195
+ PRIMARY KEY (`username`),
196
+ KEY `domain` (`domain`)
197
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Mailboxes';
198
+
199
+
200
+ -- --------------------------------------------------------
201
+
202
+ --
203
+ -- テーブルの構造 `quota`
204
+ --
205
+
206
+ CREATE TABLE IF NOT EXISTS `quota` (
207
+ `username` varchar(255) CHARACTER SET utf8 NOT NULL,
208
+ `path` varchar(100) CHARACTER SET utf8 NOT NULL,
209
+ `current` bigint(20) DEFAULT NULL,
210
+ PRIMARY KEY (`username`,`path`)
211
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8;
212
+
213
+ -- --------------------------------------------------------
214
+
215
+ --
216
+ -- テーブルの構造 `quota2`
217
+ --
218
+
219
+ CREATE TABLE IF NOT EXISTS `quota2` (
220
+ `username` varchar(100) CHARACTER SET utf8 NOT NULL,
221
+ `bytes` bigint(20) NOT NULL DEFAULT '0',
222
+ `messages` int(11) NOT NULL DEFAULT '0',
223
+ PRIMARY KEY (`username`)
224
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8;
225
+
226
+ -- --------------------------------------------------------
227
+
228
+ --
229
+ -- テーブルの構造 `vacation`
230
+ --
231
+
232
+ CREATE TABLE IF NOT EXISTS `vacation` (
233
+ `email` varchar(255) NOT NULL,
234
+ `subject` varchar(255) CHARACTER SET utf8 NOT NULL,
235
+ `body` text CHARACTER SET utf8 NOT NULL,
236
+ `cache` text NOT NULL,
237
+ `domain` varchar(255) NOT NULL,
238
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
239
+ `active` tinyint(1) NOT NULL DEFAULT '1',
240
+ PRIMARY KEY (`email`),
241
+ KEY `email` (`email`)
242
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Vacation';
243
+
244
+ -- --------------------------------------------------------
245
+
246
+ --
247
+ -- テーブルの構造 `vacation_notification`
248
+ --
249
+
250
+ CREATE TABLE IF NOT EXISTS `vacation_notification` (
251
+ `on_vacation` varchar(150) CHARACTER SET utf8 NOT NULL,
252
+ `notified` varchar(150) NOT NULL,
253
+ `notified_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
254
+ PRIMARY KEY (`on_vacation`,`notified`)
255
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Postfix Admin - Virtual Vacation Notifications';
256
+
257
+ --
258
+ -- ダンプしたテーブルの制約
259
+ --
260
+
261
+ --
262
+ -- テーブルの制約 `vacation_notification`
263
+ --
264
+ ALTER TABLE `vacation_notification`
265
+ ADD CONSTRAINT `vacation_notification_pkey` FOREIGN KEY (`on_vacation`) REFERENCES `vacation` (`email`) ON DELETE CASCADE;
266
+
267
+ /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
268
+ /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
269
+ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
@@ -24,7 +24,11 @@ module PostfixAdmin
24
24
 
25
25
  def super_admin?
26
26
  if @super_admin.nil?
27
- @super_admin = rel_domains.exists?("ALL")
27
+ @super_admin = if has_superadmin_column?
28
+ self.superadmin && rel_domains.exists?("ALL")
29
+ else
30
+ rel_domains.exists?("ALL")
31
+ end
28
32
  else
29
33
  @super_admin
30
34
  end
@@ -35,10 +39,16 @@ module PostfixAdmin
35
39
  domain_ids = self.rel_domain_ids.dup
36
40
  domain_ids << "ALL"
37
41
  self.rel_domain_ids = domain_ids
38
- save!
42
+ self.superadmin = true if has_superadmin_column?
39
43
  else
40
44
  domain_admins.where(domain: "ALL").delete_all
45
+ self.superadmin = false if has_superadmin_column?
41
46
  end
47
+ save!
48
+ end
49
+
50
+ def has_superadmin_column?
51
+ has_attribute?(:superadmin)
42
52
  end
43
53
 
44
54
  def has_admin?(admin)
@@ -13,6 +13,7 @@ module PostfixAdmin
13
13
  'mailboxes' => 30,
14
14
  'maxquota' => 100,
15
15
  'scheme' => 'CRAM-MD5',
16
+ 'passwordhash_prefix' => true
16
17
  }
17
18
 
18
19
  def initialize(config)
@@ -22,6 +23,11 @@ module PostfixAdmin
22
23
  @config[:mailboxes] = config['mailboxes'] || 30
23
24
  @config[:maxquota] = config['maxquota'] || 100
24
25
  @config[:scheme] = config['scheme'] || 'CRAM-MD5'
26
+ @config[:passwordhash_prefix] = if config['passwordhash_prefix'].nil?
27
+ true
28
+ else
29
+ config['passwordhash_prefix']
30
+ end
25
31
  end
26
32
 
27
33
  def db_setup
@@ -4,7 +4,8 @@ require 'postfix_admin/doveadm'
4
4
 
5
5
  module PostfixAdmin
6
6
  class CLI
7
- @config_file = '~/.postfix_admin.conf'
7
+ DEFAULT_CONFIG_PATH = '~/.postfix_admin.conf'
8
+ @config_file = DEFAULT_CONFIG_PATH
8
9
  MIN_NUM_PASSWORD_CHARACTER = 5
9
10
 
10
11
  def initialize
@@ -482,9 +483,10 @@ module PostfixAdmin
482
483
  private
483
484
 
484
485
  def hashed_password(password, in_scheme = nil)
486
+ prefix = @base.config[:passwordhash_prefix]
485
487
  scheme = in_scheme || @base.config[:scheme]
486
488
  puts "scheme: #{scheme}"
487
- PostfixAdmin::Doveadm.password(password, scheme)
489
+ PostfixAdmin::Doveadm.password(password, scheme, prefix)
488
490
  end
489
491
  end
490
492
  end
@@ -9,14 +9,19 @@ module PostfixAdmin
9
9
  result.split
10
10
  end
11
11
 
12
- def self.password(in_password, in_scheme)
12
+ def self.password(in_password, in_scheme, prefix)
13
13
  password = Shellwords.escape(in_password)
14
14
  scheme = Shellwords.escape(in_scheme)
15
15
  stdin, stdout, stderr = Open3.popen3("#{self.command_name} -s #{scheme} -p #{password}")
16
16
  if stderr.readlines.to_s =~ /Fatal:/
17
17
  raise Error, stderr.readlines
18
18
  else
19
- stdout.readlines.first.chomp
19
+ res = stdout.readlines.first.chomp
20
+ if prefix
21
+ res
22
+ else
23
+ res.gsub("{#{scheme}}", "")
24
+ end
20
25
  end
21
26
  end
22
27
 
@@ -1,3 +1,3 @@
1
1
  module PostfixAdmin
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -10,6 +10,8 @@ Gem::Specification.new do |gem|
10
10
  gem.description = %q{Command Line Tools for Postfix Admin}
11
11
  gem.homepage = "https://github.com/krhitoshi/postfix_admin"
12
12
 
13
+ gem.required_ruby_version = ">= 2.5.0"
14
+
13
15
  gem.add_dependency 'thor', '~> 1.0.1'
14
16
  gem.add_dependency 'activerecord', '~> 6.0.3'
15
17
  gem.add_dependency 'mysql2', '>= 0.5.3'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postfix_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hitoshi Kurokawa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-15 00:00:00.000000000 Z
11
+ date: 2020-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -116,18 +116,26 @@ executables:
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
+ - ".github/workflows/ruby.yml"
119
120
  - ".gitignore"
120
121
  - ".rubocop.yml"
121
122
  - CHANGELOG.md
122
- - Dockerfile
123
123
  - Gemfile
124
124
  - LICENSE
125
125
  - README.md
126
126
  - Rakefile
127
127
  - Thorfile
128
128
  - bin/console
129
+ - docker-admin/Dockerfile
130
+ - docker-admin/config.local.php
131
+ - docker-app-2.5/Dockerfile
132
+ - docker-app/Dockerfile
133
+ - docker-app/docker-entrypoint.sh
134
+ - docker-app/my.cnf
129
135
  - docker-compose.yml
130
- - docker-entrypoint.sh
136
+ - docker-db/postfix.v1841.sql
137
+ - docker-db/postfix.v352.sql
138
+ - docker-db/postfix.v740.sql
131
139
  - exe/postfix_admin
132
140
  - lib/postfix_admin.rb
133
141
  - lib/postfix_admin/admin.rb
@@ -161,7 +169,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
169
  requirements:
162
170
  - - ">="
163
171
  - !ruby/object:Gem::Version
164
- version: '0'
172
+ version: 2.5.0
165
173
  required_rubygems_version: !ruby/object:Gem::Requirement
166
174
  requirements:
167
175
  - - ">="
data/Dockerfile DELETED
@@ -1,24 +0,0 @@
1
- FROM centos:8
2
-
3
- RUN dnf -y module enable ruby:2.6 \
4
- && dnf -y install \
5
- ruby ruby-devel mariadb-devel sqlite-devel gcc make redhat-rpm-config \
6
- mariadb dovecot git \
7
- && dnf clean all
8
-
9
- WORKDIR /app
10
-
11
- COPY Gemfile postfix_admin.gemspec ./
12
- COPY ./lib/postfix_admin/version.rb ./lib/postfix_admin/version.rb
13
-
14
- RUN gem install bundler && bundle install
15
-
16
- COPY spec/postfix_admin.conf /root/.postfix_admin.conf
17
-
18
- COPY docker-entrypoint.sh /docker-entrypoint.sh
19
- RUN chmod +x /docker-entrypoint.sh
20
- ENTRYPOINT ["/docker-entrypoint.sh"]
21
-
22
- EXPOSE 80
23
-
24
- CMD ["/sbin/init"]