smartmachine 1.2.3 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smart_machine/apps/app.rb +1 -0
  3. data/lib/smart_machine/buildpackers/buildpacker.rb +2 -2
  4. data/lib/smart_machine/commands/grid.rb +8 -0
  5. data/lib/smart_machine/commands/grid_commands/emailer.rb +107 -0
  6. data/lib/smart_machine/commands/grid_commands/roundcube.rb +107 -0
  7. data/lib/smart_machine/configuration.rb +35 -2
  8. data/lib/smart_machine/credentials.rb +10 -0
  9. data/lib/smart_machine/engine.rb +7 -1
  10. data/lib/smart_machine/grids/adminer.rb +1 -0
  11. data/lib/smart_machine/grids/certbot.rb +1 -0
  12. data/lib/smart_machine/grids/emailer/imapsync.rb +7 -0
  13. data/lib/smart_machine/grids/emailer.rb +188 -0
  14. data/lib/smart_machine/grids/haproxy.rb +1 -0
  15. data/lib/smart_machine/grids/mariadb.rb +1 -0
  16. data/lib/smart_machine/grids/postgresql.rb +1 -0
  17. data/lib/smart_machine/grids/roundcube/.keep +0 -0
  18. data/lib/smart_machine/grids/roundcube.rb +184 -0
  19. data/lib/smart_machine/machine.rb +7 -0
  20. data/lib/smart_machine/syncer.rb +10 -0
  21. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/docker/command.rb +50 -0
  22. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/docker/entrypoint.rb +196 -0
  23. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/docker/logtailer.rb +75 -0
  24. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/10-auth.conf +132 -0
  25. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/10-mail.conf +427 -0
  26. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/10-master.conf +153 -0
  27. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/10-ssl.conf +87 -0
  28. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/15-mailboxes.conf +94 -0
  29. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/20-imap.conf +102 -0
  30. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/20-lmtp.conf +43 -0
  31. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/90-quota.conf +114 -0
  32. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/90-sieve.conf +229 -0
  33. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/dovecot-sql.conf.ext +163 -0
  34. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve/learn-ham.sh +2 -0
  35. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve/learn-ham.sieve +5 -0
  36. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve/learn-spam.sh +2 -0
  37. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve/learn-spam.sieve +2 -0
  38. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve-after/spam-to-folder.sieve +6 -0
  39. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/haproxy/haproxy.cfg +58 -0
  40. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/monit/conf.d/services.cfg +70 -0
  41. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/monit/monitrc +344 -0
  42. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/opendkim.conf +71 -0
  43. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/main.cf +128 -0
  44. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/master.cf +149 -0
  45. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-sender-login-maps.cf +7 -0
  46. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-domains.cf +7 -0
  47. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-maps-domains.cf +7 -0
  48. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-maps-masters.cf +7 -0
  49. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-maps-users.cf +7 -0
  50. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-maps-userstothemselves.cf +7 -0
  51. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-mailbox-domains.cf +7 -0
  52. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-mailbox-maps.cf +7 -0
  53. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix-policyd-spf-python/policyd-spf.conf +12 -0
  54. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/spamassassin/local.cf +124 -0
  55. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/usr/local/bin/quota-warning.sh +22 -0
  56. data/lib/smart_machine/templates/dotsmartmachine/config/emailer.yml +37 -0
  57. data/lib/smart_machine/templates/dotsmartmachine/config/engine.yml +2 -0
  58. data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/docker/custom-docker-entrypoint.sh +185 -0
  59. data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/docker/entrypoint.rb +58 -0
  60. data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/etc/apache2/sites-available/000-default.conf +36 -0
  61. data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/usr/local/etc/php/conf.d/zzz_roundcube-custom.ini +4 -0
  62. data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/var/roundcube/config/config.custom.inc.php +25 -0
  63. data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/var/www/html/plugins/password/config.inc.php +523 -0
  64. data/lib/smart_machine/templates/dotsmartmachine/config/roundcube.yml +49 -0
  65. data/lib/smart_machine/templates/dotsmartmachine/config/users.yml +1 -1
  66. data/lib/smart_machine/version.rb +2 -2
  67. data/lib/smart_machine.rb +2 -0
  68. metadata +89 -8
@@ -0,0 +1,149 @@
1
+ #
2
+ # Postfix master process configuration file. For details on the format
3
+ # of the file, see the master(5) manual page (command: "man 5 master" or
4
+ # on-line: http://www.postfix.org/master.5.html).
5
+ #
6
+ # Do not forget to execute "postfix reload" after editing this file.
7
+ #
8
+ # ==========================================================================
9
+ # service type private unpriv chroot wakeup maxproc command + args
10
+ # (yes) (yes) (no) (never) (100)
11
+ # ==========================================================================
12
+ ##### SmartMachine Begin.
13
+ #smtp inet n - y - - smtpd
14
+ smtp inet n - y - - smtpd
15
+ -o content_filter=spamassassin
16
+ ##### SmartMachine Close.
17
+ #smtp inet n - y - 1 postscreen
18
+ #smtpd pass - - y - - smtpd
19
+ #dnsblog unix - - y - 0 dnsblog
20
+ #tlsproxy unix - - y - 0 tlsproxy
21
+ #submission inet n - y - - smtpd
22
+ # -o syslog_name=postfix/submission
23
+ # -o smtpd_tls_security_level=encrypt
24
+ # -o smtpd_sasl_auth_enable=yes
25
+ # -o smtpd_tls_auth_only=yes
26
+ # -o smtpd_reject_unlisted_recipient=no
27
+ # -o smtpd_client_restrictions=$mua_client_restrictions
28
+ # -o smtpd_helo_restrictions=$mua_helo_restrictions
29
+ # -o smtpd_sender_restrictions=$mua_sender_restrictions
30
+ # -o smtpd_recipient_restrictions=
31
+ # -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
32
+ # -o milter_macro_daemon_name=ORIGINATING
33
+ ##### SmartMachine Begin.
34
+ submission inet n - y - - smtpd
35
+ -o syslog_name=postfix/submission
36
+ -o smtpd_tls_security_level=encrypt
37
+ # -o smtpd_sasl_auth_enable=yes
38
+ # -o smtpd_tls_auth_only=yes
39
+ -o smtpd_reject_unlisted_recipient=no
40
+ -o smtpd_client_restrictions=permit_sasl_authenticated,reject
41
+ # -o smtpd_helo_restrictions=$mua_helo_restrictions
42
+ # -o smtpd_sender_restrictions=$mua_sender_restrictions
43
+ # -o smtpd_recipient_restrictions=
44
+ # -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
45
+ -o milter_macro_daemon_name=ORIGINATING
46
+ ##### SmartMachine Close.
47
+ #smtps inet n - y - - smtpd
48
+ # -o syslog_name=postfix/smtps
49
+ # -o smtpd_tls_wrappermode=yes
50
+ # -o smtpd_sasl_auth_enable=yes
51
+ # -o smtpd_reject_unlisted_recipient=no
52
+ # -o smtpd_client_restrictions=$mua_client_restrictions
53
+ # -o smtpd_helo_restrictions=$mua_helo_restrictions
54
+ # -o smtpd_sender_restrictions=$mua_sender_restrictions
55
+ # -o smtpd_recipient_restrictions=
56
+ # -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
57
+ # -o milter_macro_daemon_name=ORIGINATING
58
+ #628 inet n - y - - qmqpd
59
+ pickup unix n - y 60 1 pickup
60
+ cleanup unix n - y - 0 cleanup
61
+ qmgr unix n - n 300 1 qmgr
62
+ #qmgr unix n - n 300 1 oqmgr
63
+ tlsmgr unix - - y 1000? 1 tlsmgr
64
+ rewrite unix - - y - - trivial-rewrite
65
+ bounce unix - - y - 0 bounce
66
+ defer unix - - y - 0 bounce
67
+ trace unix - - y - 0 bounce
68
+ verify unix - - y - 1 verify
69
+ flush unix n - y 1000? 0 flush
70
+ proxymap unix - - n - - proxymap
71
+ proxywrite unix - - n - 1 proxymap
72
+ smtp unix - - y - - smtp
73
+ relay unix - - y - - smtp
74
+ -o syslog_name=postfix/$service_name
75
+ # -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
76
+ showq unix n - y - - showq
77
+ error unix - - y - - error
78
+ retry unix - - y - - error
79
+ discard unix - - y - - discard
80
+ local unix - n n - - local
81
+ virtual unix - n n - - virtual
82
+ lmtp unix - - y - - lmtp
83
+ anvil unix - - y - 1 anvil
84
+ scache unix - - y - 1 scache
85
+ postlog unix-dgram n - n - 1 postlogd
86
+ #
87
+ # ====================================================================
88
+ # Interfaces to non-Postfix software. Be sure to examine the manual
89
+ # pages of the non-Postfix software to find out what options it wants.
90
+ #
91
+ # Many of the following services use the Postfix pipe(8) delivery
92
+ # agent. See the pipe(8) man page for information about ${recipient}
93
+ # and other message envelope options.
94
+ # ====================================================================
95
+ #
96
+ # maildrop. See the Postfix MAILDROP_README file for details.
97
+ # Also specify in main.cf: maildrop_destination_recipient_limit=1
98
+ #
99
+ maildrop unix - n n - - pipe
100
+ flags=DRXhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
101
+ #
102
+ # ====================================================================
103
+ #
104
+ # Recent Cyrus versions can use the existing "lmtp" master.cf entry.
105
+ #
106
+ # Specify in cyrus.conf:
107
+ # lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
108
+ #
109
+ # Specify in main.cf one or more of the following:
110
+ # mailbox_transport = lmtp:inet:localhost
111
+ # virtual_transport = lmtp:inet:localhost
112
+ #
113
+ # ====================================================================
114
+ #
115
+ # Cyrus 2.1.5 (Amos Gouaux)
116
+ # Also specify in main.cf: cyrus_destination_recipient_limit=1
117
+ #
118
+ #cyrus unix - n n - - pipe
119
+ # flags=DRX user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
120
+ #
121
+ # ====================================================================
122
+ # Old example of delivery via Cyrus.
123
+ #
124
+ #old-cyrus unix - n n - - pipe
125
+ # flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
126
+ #
127
+ # ====================================================================
128
+ #
129
+ # See the Postfix UUCP_README file for configuration details.
130
+ #
131
+ uucp unix - n n - - pipe
132
+ flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
133
+ #
134
+ # Other external delivery methods.
135
+ #
136
+ ifmail unix - n n - - pipe
137
+ flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
138
+ bsmtp unix - n n - - pipe
139
+ flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
140
+ scalemail-backend unix - n n - 2 pipe
141
+ flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
142
+ mailman unix - n n - - pipe
143
+ flags=FRX user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}
144
+ ##### SmartMachine Begin.
145
+ spamassassin unix - n n - - pipe
146
+ user=spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
147
+ policyd-spf unix - n n - 0 spawn
148
+ user=policyd-spf argv=/usr/bin/policyd-spf
149
+ ##### SmartMachine Close.
@@ -0,0 +1,7 @@
1
+ ##### SmartMachine Begin.
2
+ user = %<mysql_user>s
3
+ password = %<mysql_password>s
4
+ hosts = %<mysql_host>s:%<mysql_port>s
5
+ dbname = %<mysql_database_name>s
6
+ query = SELECT email FROM virtual_users WHERE email IN ('%s', (SELECT CONCAT('%u', '@', destination_name) FROM virtual_domains WHERE name='%d' AND destination_name IS NOT NULL)) UNION SELECT destination FROM virtual_aliases WHERE source IN ('%s', (SELECT CONCAT('%u', '@', destination_name) FROM virtual_domains WHERE name='%d' AND destination_name IS NOT NULL))
7
+ ##### SmartMachine Close.
@@ -0,0 +1,7 @@
1
+ ##### SmartMachine Begin.
2
+ user = %<mysql_user>s
3
+ password = %<mysql_password>s
4
+ hosts = %<mysql_host>s:%<mysql_port>s
5
+ dbname = %<mysql_database_name>s
6
+ query = SELECT 1 FROM virtual_domains WHERE name='%s' AND destination_name IS NOT NULL
7
+ ##### SmartMachine Close.
@@ -0,0 +1,7 @@
1
+ ##### SmartMachine Begin.
2
+ user = %<mysql_user>s
3
+ password = %<mysql_password>s
4
+ hosts = %<mysql_host>s:%<mysql_port>s
5
+ dbname = %<mysql_database_name>s
6
+ query = SELECT concat('@', destination_name) FROM virtual_domains WHERE CONCAT('@', name)='%s' AND destination_name IS NOT NULL
7
+ ##### SmartMachine Close.
@@ -0,0 +1,7 @@
1
+ ##### SmartMachine Begin.
2
+ user = %<mysql_user>s
3
+ password = %<mysql_password>s
4
+ hosts = %<mysql_host>s:%<mysql_port>s
5
+ dbname = %<mysql_database_name>s
6
+ query = SELECT email FROM virtual_users WHERE email='%<sysadmin_email>s' AND ('%u'='postmaster' OR '%u'='abuse' OR '%u'='hostmaster' OR '%u'='webmaster')
7
+ ##### SmartMachine Close.
@@ -0,0 +1,7 @@
1
+ ##### SmartMachine Begin.
2
+ user = %<mysql_user>s
3
+ password = %<mysql_password>s
4
+ hosts = %<mysql_host>s:%<mysql_port>s
5
+ dbname = %<mysql_database_name>s
6
+ query = SELECT destination FROM virtual_aliases WHERE source='%s'
7
+ ##### SmartMachine Close.
@@ -0,0 +1,7 @@
1
+ ##### SmartMachine Begin.
2
+ user = %<mysql_user>s
3
+ password = %<mysql_password>s
4
+ hosts = %<mysql_host>s:%<mysql_port>s
5
+ dbname = %<mysql_database_name>s
6
+ query = SELECT email FROM virtual_users WHERE email='%s'
7
+ ##### SmartMachine Close.
@@ -0,0 +1,7 @@
1
+ ##### SmartMachine Begin.
2
+ user = %<mysql_user>s
3
+ password = %<mysql_password>s
4
+ hosts = %<mysql_host>s:%<mysql_port>s
5
+ dbname = %<mysql_database_name>s
6
+ query = SELECT 1 FROM virtual_domains WHERE name='%s' AND destination_name IS NULL
7
+ ##### SmartMachine Close.
@@ -0,0 +1,7 @@
1
+ ##### SmartMachine Begin.
2
+ user = %<mysql_user>s
3
+ password = %<mysql_password>s
4
+ hosts = %<mysql_host>s:%<mysql_port>s
5
+ dbname = %<mysql_database_name>s
6
+ query = SELECT 1 FROM virtual_users WHERE email='%s'
7
+ ##### SmartMachine Close.
@@ -0,0 +1,12 @@
1
+ # For a fully commented sample config file see policyd-spf.conf.commented
2
+
3
+ debugLevel = 1
4
+ TestOnly = 1
5
+
6
+ HELO_reject = Fail
7
+ Mail_From_reject = Fail
8
+
9
+ PermError_reject = False
10
+ TempError_Defer = False
11
+
12
+ skip_addresses = 127.0.0.0/8,::ffff:127.0.0.0/104,::1
@@ -0,0 +1,124 @@
1
+ # This is the right place to customize your installation of SpamAssassin.
2
+ #
3
+ # See 'perldoc Mail::SpamAssassin::Conf' for details of what can be
4
+ # tweaked.
5
+ #
6
+ # Only a small subset of options are listed below
7
+ #
8
+ ###########################################################################
9
+
10
+ # A 'contact address' users should contact for more info. (replaces
11
+ # _CONTACTADDRESS_ in the report template)
12
+ # report_contact youremailaddress@domain.tld
13
+
14
+
15
+ # Add *****SPAM***** to the Subject header of spam e-mails
16
+ #
17
+ # rewrite_header Subject *****SPAM*****
18
+
19
+
20
+ # Save spam messages as a message/rfc822 MIME attachment instead of
21
+ # modifying the original message (0: off, 2: use text/plain instead)
22
+ #
23
+ # report_safe 1
24
+
25
+
26
+ # Set which networks or hosts are considered 'trusted' by your mail
27
+ # server (i.e. not spammers)
28
+ #
29
+ # trusted_networks 212.17.35.
30
+
31
+
32
+ # Set file-locking method (flock is not safe over NFS, but is faster)
33
+ #
34
+ # lock_method flock
35
+
36
+
37
+ # Set the threshold at which a message is considered spam (default: 5.0)
38
+ #
39
+ # required_score 5.0
40
+
41
+
42
+ # Use Bayesian classifier (default: 1)
43
+ #
44
+ # use_bayes 1
45
+
46
+
47
+ # Bayesian classifier auto-learning (default: 1)
48
+ #
49
+ # bayes_auto_learn 1
50
+
51
+
52
+ # Set headers which may provide inappropriate cues to the Bayesian
53
+ # classifier
54
+ #
55
+ # bayes_ignore_header X-Bogosity
56
+ # bayes_ignore_header X-Spam-Flag
57
+ # bayes_ignore_header X-Spam-Status
58
+
59
+
60
+ # Whether to decode non- UTF-8 and non-ASCII textual parts and recode
61
+ # them to UTF-8 before the text is given over to rules processing.
62
+ #
63
+ # normalize_charset 1
64
+
65
+ # Textual body scan limit (default: 50000)
66
+ #
67
+ # Amount of data per email text/* mimepart, that will be run through body
68
+ # rules. This enables safer and faster scanning of large messages,
69
+ # perhaps having very large textual attachments. There should be no need
70
+ # to change this well tested default.
71
+ #
72
+ # body_part_scan_size 50000
73
+
74
+ # Textual rawbody data scan limit (default: 500000)
75
+ #
76
+ # Amount of data per email text/* mimepart, that will be run through
77
+ # rawbody rules.
78
+ #
79
+ # rawbody_part_scan_size 500000
80
+
81
+ # Some shortcircuiting, if the plugin is enabled
82
+ #
83
+ ifplugin Mail::SpamAssassin::Plugin::Shortcircuit
84
+ #
85
+ # default: strongly-whitelisted mails are *really* whitelisted now, if the
86
+ # shortcircuiting plugin is active, causing early exit to save CPU load.
87
+ # Uncomment to turn this on
88
+ #
89
+ # SpamAssassin tries hard not to launch DNS queries before priority -100.
90
+ # If you want to shortcircuit without launching unneeded queries, make
91
+ # sure such rule priority is below -100. These examples are already:
92
+ #
93
+ # shortcircuit USER_IN_WHITELIST on
94
+ # shortcircuit USER_IN_DEF_WHITELIST on
95
+ # shortcircuit USER_IN_ALL_SPAM_TO on
96
+ # shortcircuit SUBJECT_IN_WHITELIST on
97
+
98
+ # the opposite; blacklisted mails can also save CPU
99
+ #
100
+ # shortcircuit USER_IN_BLACKLIST on
101
+ # shortcircuit USER_IN_BLACKLIST_TO on
102
+ # shortcircuit SUBJECT_IN_BLACKLIST on
103
+
104
+ # if you have taken the time to correctly specify your "trusted_networks",
105
+ # this is another good way to save CPU
106
+ #
107
+ # shortcircuit ALL_TRUSTED on
108
+
109
+ # and a well-trained bayes DB can save running rules, too
110
+ #
111
+ # shortcircuit BAYES_99 spam
112
+ # shortcircuit BAYES_00 ham
113
+
114
+ endif # Mail::SpamAssassin::Plugin::Shortcircuit
115
+
116
+ ##### SmartMachine Begin.
117
+ loadplugin Mail::SpamAssassin::Plugin::DCC
118
+
119
+ report_safe 0
120
+ required_score 10.0
121
+ use_razor2 0
122
+ use_dcc 0
123
+ use_pyzor 0
124
+ ##### SmartMachine Close.
@@ -0,0 +1,22 @@
1
+ #!/bin/sh
2
+ PERCENT=$1
3
+ USER=$2
4
+ cat << EOF | /usr/lib/dovecot/dovecot-lda -d $USER -o "plugin/quota=maildir:User quota:noenforcing"
5
+ From: Email Postmaster <postmaster@%<mailname>s>
6
+ Subject: Your mailbox is $PERCENT% full.
7
+
8
+ Hello there,
9
+
10
+ Your mailbox can store a limited amount of emails. Currently it is $PERCENT% full. New emails will not be stored if you reach 100%.
11
+
12
+ To get more space in your mailbox you can:
13
+ 1. Contact your email provider and upgrade your plan.
14
+ 2. Delete emails from your mailbox.
15
+
16
+ If using option 2, please ensure you have emptied your Trash folder to free up the space.
17
+
18
+ Thanks for reading. Hope this was helpful.
19
+
20
+ Regards,
21
+ Your Email Postmaster
22
+ EOF
@@ -0,0 +1,37 @@
1
+ emailerone:
2
+ fqdn: "youremailerone.yourdomain.com"
3
+ mailname: "yourdomain.com"
4
+ sysadmin_email: "adminname@yourdomain.com"
5
+ networks: ["mysqlone-network"]
6
+ mysql_host: mysqlone
7
+ mysql_port: 3306
8
+ mysql_user: <%= SmartMachine.credentials.dig(:emailerone, :mysql_user) %>
9
+ mysql_password: <%= SmartMachine.credentials.dig(:emailerone, :mysql_password) %>
10
+ mysql_database_name: <%= SmartMachine.credentials.dig(:emailerone, :mysql_database_name) %>
11
+ monit_smtp_email_name: "Your Emailer One"
12
+ monit_smtp_email_address: "yourmachineemailerone@yourdomain.com"
13
+ monit_smtp_host: "youremailerone.yourdomain.com"
14
+ monit_smtp_port: 587
15
+ monit_smtp_username: <%= SmartMachine.credentials.dig(:emailerone, :monit_smtp_username) %>
16
+ monit_smtp_password: <%= SmartMachine.credentials.dig(:emailerone, :monit_smtp_password) %>
17
+ oracle_ips_allowed: []
18
+ oracle_deflect_url: "https://yourdomain.com"
19
+
20
+ # emailertwo:
21
+ # fqdn: "youremailertwo.yourdomain.com"
22
+ # mailname: "yourdomain.com"
23
+ # sysadmin_email: "adminname@yourdomain.com"
24
+ # networks: ["mysqlone-network"]
25
+ # mysql_host: mysqlone
26
+ # mysql_port: 3306
27
+ # mysql_user: <%= SmartMachine.credentials.dig(:emailertwo, :mysql_user) %>
28
+ # mysql_password: <%= SmartMachine.credentials.dig(:emailertwo, :mysql_password) %>
29
+ # mysql_database_name: <%= SmartMachine.credentials.dig(:emailertwo, :mysql_database_name) %>
30
+ # monit_smtp_email_name: "Your Emailer Two"
31
+ # monit_smtp_email_address: "yourmachineemailertwo@yourdomain.com"
32
+ # monit_smtp_host: "youremailertwo.yourdomain.com"
33
+ # monit_smtp_port: 587
34
+ # monit_smtp_username: <%= SmartMachine.credentials.dig(:emailertwo, :monit_smtp_username) %>
35
+ # monit_smtp_password: <%= SmartMachine.credentials.dig(:emailertwo, :monit_smtp_password) %>
36
+ # oracle_ips_allowed: []
37
+ # oracle_deflect_url: "https://yourdomain.com"
@@ -0,0 +1,2 @@
1
+ engineone:
2
+ timezone: "Etc/UTC"
@@ -0,0 +1,185 @@
1
+ #!/bin/bash
2
+ # set -ex
3
+
4
+ # PWD=`pwd`
5
+
6
+ if [[ "$1" == apache2* || "$1" == php-fpm || "$1" == bin* ]]; then
7
+ INSTALLDIR=`pwd`
8
+ # docroot is empty
9
+ if ! [ -e index.php -a -e bin/installto.sh ]; then
10
+ echo >&2 "roundcubemail not found in $PWD - copying now..."
11
+ if [ "$(ls -A)" ]; then
12
+ echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
13
+ ( set -x; ls -A; sleep 10 )
14
+ fi
15
+ tar cf - --one-file-system -C /usr/src/roundcubemail . | tar xf -
16
+ echo >&2 "Complete! ROUNDCUBEMAIL has been successfully copied to $INSTALLDIR"
17
+ # update Roundcube in docroot
18
+ else
19
+ echo >&2 "roundcubemail found in $INSTALLDIR - installing update..."
20
+ (cd /usr/src/roundcubemail && bin/installto.sh -y $INSTALLDIR)
21
+ # Re-install composer modules (including plugins)
22
+ composer \
23
+ --working-dir=${INSTALLDIR} \
24
+ --prefer-dist \
25
+ --no-dev \
26
+ --no-interaction \
27
+ --optimize-autoloader \
28
+ install
29
+ fi
30
+
31
+ if [ -f /run/secrets/roundcube_db_user ]; then
32
+ ROUNDCUBEMAIL_DB_USER=`cat /run/secrets/roundcube_db_user`
33
+ fi
34
+ if [ -f /run/secrets/roundcube_db_password ]; then
35
+ ROUNDCUBEMAIL_DB_PASSWORD=`cat /run/secrets/roundcube_db_password`
36
+ fi
37
+ if [ -f /run/secrets/roundcube_oauth_client_secret ]; then
38
+ ROUNDCUBEMAIL_OAUTH_CLIENT_SECRET=`cat /run/secrets/roundcube_oauth_client_secret`
39
+ fi
40
+
41
+ if [ ! -z "${!POSTGRES_ENV_POSTGRES_*}" ] || [ "$ROUNDCUBEMAIL_DB_TYPE" == "pgsql" ]; then
42
+ : "${ROUNDCUBEMAIL_DB_TYPE:=pgsql}"
43
+ : "${ROUNDCUBEMAIL_DB_HOST:=postgres}"
44
+ : "${ROUNDCUBEMAIL_DB_PORT:=5432}"
45
+ : "${ROUNDCUBEMAIL_DB_USER:=${POSTGRES_ENV_POSTGRES_USER}}"
46
+ : "${ROUNDCUBEMAIL_DB_PASSWORD:=${POSTGRES_ENV_POSTGRES_PASSWORD}}"
47
+ : "${ROUNDCUBEMAIL_DB_NAME:=${POSTGRES_ENV_POSTGRES_DB:-roundcubemail}}"
48
+ : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}://${ROUNDCUBEMAIL_DB_USER}:${ROUNDCUBEMAIL_DB_PASSWORD}@${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT}/${ROUNDCUBEMAIL_DB_NAME}}"
49
+
50
+ /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT} -t 30
51
+ elif [ ! -z "${!MYSQL_ENV_MYSQL_*}" ] || [ "$ROUNDCUBEMAIL_DB_TYPE" == "mysql" ]; then
52
+ : "${ROUNDCUBEMAIL_DB_TYPE:=mysql}"
53
+ : "${ROUNDCUBEMAIL_DB_HOST:=mysql}"
54
+ : "${ROUNDCUBEMAIL_DB_PORT:=3306}"
55
+ : "${ROUNDCUBEMAIL_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}"
56
+ if [ "$ROUNDCUBEMAIL_DB_USER" = 'root' ]; then
57
+ : "${ROUNDCUBEMAIL_DB_PASSWORD:=${MYSQL_ENV_MYSQL_ROOT_PASSWORD}}"
58
+ else
59
+ : "${ROUNDCUBEMAIL_DB_PASSWORD:=${MYSQL_ENV_MYSQL_PASSWORD}}"
60
+ fi
61
+ : "${ROUNDCUBEMAIL_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-roundcubemail}}"
62
+ : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}://${ROUNDCUBEMAIL_DB_USER}:${ROUNDCUBEMAIL_DB_PASSWORD}@${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT}/${ROUNDCUBEMAIL_DB_NAME}}"
63
+
64
+ /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT} -t 30
65
+ else
66
+ # use local SQLite DB in /var/roundcube/db
67
+ : "${ROUNDCUBEMAIL_DB_TYPE:=sqlite}"
68
+ : "${ROUNDCUBEMAIL_DB_DIR:=/var/roundcube/db}"
69
+ : "${ROUNDCUBEMAIL_DB_NAME:=sqlite}"
70
+ : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}:///$ROUNDCUBEMAIL_DB_DIR/${ROUNDCUBEMAIL_DB_NAME}.db?mode=0646}"
71
+
72
+ mkdir -p $ROUNDCUBEMAIL_DB_DIR
73
+ chown www-data:www-data $ROUNDCUBEMAIL_DB_DIR
74
+ fi
75
+
76
+ : "${ROUNDCUBEMAIL_DEFAULT_HOST:=localhost}"
77
+ : "${ROUNDCUBEMAIL_DEFAULT_PORT:=143}"
78
+ : "${ROUNDCUBEMAIL_SMTP_SERVER:=localhost}"
79
+ : "${ROUNDCUBEMAIL_SMTP_PORT:=587}"
80
+ : "${ROUNDCUBEMAIL_PLUGINS:=archive,zipdownload}"
81
+ : "${ROUNDCUBEMAIL_SKIN:=elastic}"
82
+ : "${ROUNDCUBEMAIL_TEMP_DIR:=/tmp/roundcube-temp}"
83
+ : "${ROUNDCUBEMAIL_REQUEST_PATH:=/}"
84
+ : "${ROUNDCUBEMAIL_COMPOSER_PLUGINS_FOLDER:=$INSTALLDIR}"
85
+
86
+ if [ ! -z "${ROUNDCUBEMAIL_COMPOSER_PLUGINS}" ]; then
87
+ echo "Installing plugins from the list"
88
+ echo "Plugins: ${ROUNDCUBEMAIL_COMPOSER_PLUGINS}"
89
+
90
+ # Change ',' into a space
91
+ ROUNDCUBEMAIL_COMPOSER_PLUGINS_SH=`echo "${ROUNDCUBEMAIL_COMPOSER_PLUGINS}" | tr ',' ' '`
92
+
93
+ composer \
94
+ --working-dir=${ROUNDCUBEMAIL_COMPOSER_PLUGINS_FOLDER} \
95
+ --prefer-dist \
96
+ --prefer-stable \
97
+ --update-no-dev \
98
+ --no-interaction \
99
+ --optimize-autoloader \
100
+ require \
101
+ -- \
102
+ ${ROUNDCUBEMAIL_COMPOSER_PLUGINS_SH};
103
+ fi
104
+
105
+ if [ ! -e config/config.inc.php ]; then
106
+ GENERATED_DES_KEY=`head /dev/urandom | base64 | head -c 24`
107
+ touch config/config.inc.php
108
+
109
+ echo "Write root config to $PWD/config/config.inc.php"
110
+ echo "<?php
111
+ \$config['plugins'] = [];
112
+ \$config['log_driver'] = 'stdout';
113
+ \$config['zipdownload_selection'] = true;
114
+ \$config['des_key'] = '${GENERATED_DES_KEY}';
115
+ \$config['enable_spellcheck'] = true;
116
+ \$config['spellcheck_engine'] = 'pspell';
117
+ include(__DIR__ . '/config.docker.inc.php');
118
+ " > config/config.inc.php
119
+
120
+ elif ! grep -q "config.docker.inc.php" config/config.inc.php; then
121
+ echo "include(__DIR__ . '/config.docker.inc.php');" >> config/config.inc.php
122
+ fi
123
+
124
+ ROUNDCUBEMAIL_PLUGINS_PHP=`echo "${ROUNDCUBEMAIL_PLUGINS}" | sed -E "s/[, ]+/', '/g"`
125
+ echo "Write Docker config to $PWD/config/config.docker.inc.php"
126
+ echo "<?php
127
+ \$config['db_dsnw'] = '${ROUNDCUBEMAIL_DSNW}';
128
+ \$config['db_dsnr'] = '${ROUNDCUBEMAIL_DSNR}';
129
+ \$config['imap_host'] = '${ROUNDCUBEMAIL_DEFAULT_HOST}:${ROUNDCUBEMAIL_DEFAULT_PORT}';
130
+ \$config['smtp_host'] = '${ROUNDCUBEMAIL_SMTP_SERVER}:${ROUNDCUBEMAIL_SMTP_PORT}';
131
+ \$config['username_domain'] = '${ROUNDCUBEMAIL_USERNAME_DOMAIN}';
132
+ \$config['temp_dir'] = '${ROUNDCUBEMAIL_TEMP_DIR}';
133
+ \$config['skin'] = '${ROUNDCUBEMAIL_SKIN}';
134
+ \$config['request_path'] = '${ROUNDCUBEMAIL_REQUEST_PATH}';
135
+ \$config['plugins'] = array_filter(array_unique(array_merge(\$config['plugins'], ['${ROUNDCUBEMAIL_PLUGINS_PHP}'])));
136
+ " > config/config.docker.inc.php
137
+
138
+ if [ -e /run/secrets/roundcube_des_key ]; then
139
+ echo "\$config['des_key'] = file_get_contents('/run/secrets/roundcube_des_key');" >> config/config.docker.inc.php
140
+ elif [ ! -z "${ROUNDCUBEMAIL_DES_KEY}" ]; then
141
+ echo "\$config['des_key'] = getenv('ROUNDCUBEMAIL_DES_KEY');" >> config/config.docker.inc.php
142
+ fi
143
+
144
+ if [ ! -z "${ROUNDCUBEMAIL_OAUTH_CLIENT_SECRET}" ]; then
145
+ echo "\$config['oauth_client_secret'] = '${ROUNDCUBEMAIL_OAUTH_CLIENT_SECRET}';" >> config/config.docker.inc.php
146
+ fi
147
+
148
+ if [ ! -z "${ROUNDCUBEMAIL_SPELLCHECK_URI}"]; then
149
+ echo "\$config['spellcheck_engine'] = 'googie';" >> config/config.docker.inc.php
150
+ echo "\$config['spellcheck_uri'] = '${ROUNDCUBEMAIL_SPELLCHECK_URI}';" >> config/config.docker.inc.php
151
+ fi
152
+
153
+ # include custom config files
154
+ for fn in `ls /var/roundcube/config/*.php 2>/dev/null || true`; do
155
+ echo "include('$fn');" >> config/config.docker.inc.php
156
+ done
157
+
158
+ # initialize or update DB
159
+ bin/initdb.sh --dir=$PWD/SQL --update || echo "Failed to initialize/update the database. Please start with an empty database and restart the container."
160
+
161
+ if [ ! -z "${ROUNDCUBEMAIL_TEMP_DIR}" ]; then
162
+ mkdir -p ${ROUNDCUBEMAIL_TEMP_DIR} && chown www-data ${ROUNDCUBEMAIL_TEMP_DIR}
163
+ fi
164
+
165
+ if [ ! -z "${ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE}" ]; then
166
+ echo "upload_max_filesize=${ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE}" >> /usr/local/etc/php/conf.d/roundcube-override.ini
167
+ echo "post_max_size=${ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE}" >> /usr/local/etc/php/conf.d/roundcube-override.ini
168
+ fi
169
+
170
+ : "${ROUNDCUBEMAIL_LOCALE:=en_US.UTF-8 UTF-8}"
171
+
172
+ if [ -e /usr/sbin/locale-gen ] && [ ! -z "${ROUNDCUBEMAIL_LOCALE}" ]; then
173
+ echo "${ROUNDCUBEMAIL_LOCALE}" > /etc/locale.gen
174
+ /usr/sbin/locale-gen
175
+ fi
176
+
177
+ if [ ! -z "${ROUNDCUBEMAIL_ASPELL_DICTS}" ]; then
178
+ ASPELL_PACKAGES=`echo -n "aspell-${ROUNDCUBEMAIL_ASPELL_DICTS}" | sed -E "s/[, ]+/ aspell-/g"`
179
+ which apt-get && apt-get install -y $ASPELL_PACKAGES
180
+ which apk && apk add --no-cache $ASPELL_PACKAGES
181
+ fi
182
+
183
+ fi
184
+
185
+ exec ruby /smartmachine/config/roundcube/docker/entrypoint.rb "$@"
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'fileutils'
5
+ require 'logger'
6
+ require 'cgi'
7
+
8
+ logger = Logger.new(STDOUT)
9
+ STDOUT.sync = true
10
+
11
+ def update_envkeys_in(filepaths, envkeys)
12
+ filepaths.each do |filepath|
13
+ str = File.read(filepath)
14
+ str = str.gsub(/%(?!<)/, '%%')
15
+ str = format(str, envkeys)
16
+ File.open(filepath, "w") { |file| file << str }
17
+ end
18
+ end
19
+
20
+ # initial setup
21
+ unless File.exist?('/run/initial_container_start')
22
+ FileUtils.touch('/run/initial_container_start')
23
+
24
+ # EnvKeys
25
+ envkeys = {
26
+ container_name: ENV.delete('CONTAINER_NAME'),
27
+ fqdn: ENV.delete('FQDN'),
28
+ timezone: `cat /etc/timezone`.chomp,
29
+ roundcubemail_request_path: ENV.delete('ROUNDCUBEMAIL_REQUEST_PATH'),
30
+ roundcubemail_plugins_password_database_type: ENV.delete('ROUNDCUBEMAIL_PLUGINS_PASSWORD_DATABASE_TYPE'),
31
+ roundcubemail_plugins_password_database_host: ENV.delete('ROUNDCUBEMAIL_PLUGINS_PASSWORD_DATABASE_HOST'),
32
+ roundcubemail_plugins_password_database_user: CGI.escape(ENV.delete('ROUNDCUBEMAIL_PLUGINS_PASSWORD_DATABASE_USER')),
33
+ roundcubemail_plugins_password_database_pass: CGI.escape(ENV.delete('ROUNDCUBEMAIL_PLUGINS_PASSWORD_DATABASE_PASS')),
34
+ roundcubemail_plugins_password_database_name: ENV.delete('ROUNDCUBEMAIL_PLUGINS_PASSWORD_DATABASE_NAME')
35
+ }
36
+
37
+ # Config
38
+ FileUtils.cp '/smartmachine/config/roundcube/etc/apache2/sites-available/000-default.conf', '/etc/apache2/sites-available/000-default.conf'
39
+ FileUtils.cp '/smartmachine/config/roundcube/usr/local/etc/php/conf.d/zzz_roundcube-custom.ini', '/usr/local/etc/php/conf.d/zzz_roundcube-custom.ini'
40
+ FileUtils.cp '/smartmachine/config/roundcube/var/roundcube/config/config.custom.inc.php', '/var/roundcube/config/config.custom.inc.php'
41
+ filepaths = [
42
+ '/etc/apache2/sites-available/000-default.conf'
43
+ ]
44
+ update_envkeys_in(filepaths, envkeys)
45
+
46
+ # Plugins
47
+ FileUtils.cp '/smartmachine/config/roundcube/var/www/html/plugins/password/config.inc.php', '/var/www/html/plugins/password/config.inc.php'
48
+ filepaths = [
49
+ '/var/www/html/plugins/password/config.inc.php'
50
+ ]
51
+ update_envkeys_in(filepaths, envkeys)
52
+ system("chown root:www-data /var/www/html/plugins/password/config.inc.php")
53
+ system("chmod u=rw,g=r,o= /var/www/html/plugins/password/config.inc.php")
54
+
55
+ logger.info "Initial setup completed for #{envkeys[:container_name]}."
56
+ end
57
+
58
+ exec(*ARGV)