-
Notifications
You must be signed in to change notification settings - Fork 11
/
configure
executable file
·67 lines (59 loc) · 2.34 KB
/
configure
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
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env ruby
config_path = File.join(File.dirname(__FILE__), 'build/config')
if File.exists?(config_path)
print 'Overwrite existing iRedMail config file (y/N): '
exit if $stdin.gets.strip.downcase != 'y'
end
print 'Enter dn2dnsname (local): '
dn2dnsname = $stdin.gets.strip
if dn2dnsname.empty?
dn2dnsname = 'local'
end
begin
print 'Enter LDAP root password: '
ldap_root_password = $stdin.gets.strip
end while ldap_root_password.empty?
begin
print 'Enter database root password: '
database_root_password = $stdin.gets.strip
end while database_root_password.empty?
begin
print 'Enter postmaster password: '
postmaster_password = $stdin.gets.strip
end while postmaster_password.empty?
PASSWORD_CHARS = ('A'..'Z').to_a + ('a'..'z').to_a + (0..9).to_a
File.open(config_path, 'w') do |f|
f << <<EOF
# 0.9.6
export STORAGE_BASE_DIR='/var/vmail'
export WEB_SERVER='NGINX'
export BACKEND_ORIG='OPENLDAP'
export BACKEND='OPENLDAP'
export VMAIL_DB_BIND_PASSWD='#{(0...30).map { PASSWORD_CHARS.sample }.join}'
export VMAIL_DB_ADMIN_PASSWD='#{(0...30).map { PASSWORD_CHARS.sample }.join}'
export LDAP_SUFFIX='dc=#{dn2dnsname}'
export LDAP_BINDPW='#{(0...30).map { PASSWORD_CHARS.sample }.join}'
export LDAP_ADMIN_PW='#{(0...30).map { PASSWORD_CHARS.sample }.join}'
export LDAP_ROOTPW='#{ldap_root_password}'
export MYSQL_ROOT_PASSWD='#{database_root_password}'
export DOMAIN_ADMIN_PASSWD_PLAIN='#{postmaster_password}'
export USE_IREDADMIN='YES'
export USE_ROUNDCUBE='YES'
export USE_AWSTATS='NO'
export USE_FAIL2BAN='YES'
export AMAVISD_DB_PASSWD='#{(0...30).map { PASSWORD_CHARS.sample }.join}'
export IREDADMIN_DB_PASSWD='#{(0...30).map { PASSWORD_CHARS.sample }.join}'
export RCM_DB_PASSWD='#{(0...30).map { PASSWORD_CHARS.sample }.join}'
export SOGO_DB_PASSWD='#{(0...30).map { PASSWORD_CHARS.sample }.join}'
export SOGO_SIEVE_MASTER_PASSWD='#{(0...30).map { PASSWORD_CHARS.sample }.join}'
export IREDAPD_DB_PASSWD='#{(0...30).map { PASSWORD_CHARS.sample }.join}'
# phusion/baseimage uses Ubuntu, but replaces rsyslog with syslog-ng
export SYSLOG_DAEMON_USER='root'
export SYSLOG_DAEMON_GROUP='root'
export SYSLOG_CONF='/dev/null' # We add our own openldap syslog configuration
export SYSLOG_CONF_DIR='/etc/syslog-ng/conf.d'
export SYSLOG_POSTROTATE_CMD='sv reload syslog-ng > /dev/null'
export USE_SYSTEMD='NO' # Make sure to install init.d files
#EOF
EOF
end