-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtemplate.sh
executable file
·54 lines (50 loc) · 1.01 KB
/
template.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
USER=$1
PASS=$2
NAME=$3
HOST=$4
function template {
case $1 in
virtual)
echo "user=$USER
password=$PASS
dbname=$NAME
table=postfix_virtual
select_field=userid
where_field=address
hosts=$HOST" > $PF_DIR/virtual.cf
;;
transport)
echo "user=$USER
password=$PASS
dbname=$NAME
table=transport
select_field=transport
where_field=domain
hosts=$HOST" > $PF_DIR/transport.cf
;;
mailboxes)
echo "user=$USER
password=$PASS
dbname=$NAME
table=postfix_mailboxes
select_field=mailbox
where_field=userid
hosts=$HOST" > $PF_DIR/mailboxes.cf
;;
dovecot_sql)
echo "driver = pgsql
connect = host=$HOST dbname=$NAME user=$USER password=$PASS
default_pass_scheme = CRYPT
password_query = SELECT userid as user, password FROM users WHERE userid = '%u'
user_query = SELECT home, uid, gid FROM users WHERE userid = '%u'" > $DC_DIR/dovecot-sql.conf.ext
;;
*)
;;
esac
}
template virtual
template transport
template mailboxes
template dovecot_sql
template domain_cnf