1 |
diff -Nur --no-dereference smeserver-phplist-0.2.1.old/createlinks smeserver-phplist-0.2.1/createlinks |
2 |
--- smeserver-phplist-0.2.1.old/createlinks 2020-03-18 13:12:54.000000000 -0400 |
3 |
+++ smeserver-phplist-0.2.1/createlinks 2022-08-02 22:02:43.291000000 -0400 |
4 |
@@ -6,7 +6,7 @@ |
5 |
templates2events("/etc/phplist/config.php", qw/webapps-update bootstrap-console-save/); |
6 |
|
7 |
safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/webapps-update/S55phplist-qmail-assign"); |
8 |
-foreach my $event (qw/webapps-update ipasserelle-update bootstrap-ldap-save/){ |
9 |
+foreach my $event (qw/webapps-update bootstrap-ldap-save/){ |
10 |
event_link("phplist-create-pseudo", "$event", "55"); |
11 |
} |
12 |
|
13 |
@@ -15,13 +15,36 @@ |
14 |
|
15 |
safe_symlink("/var/qmail/alias/.qmail-phplistbounces", "root/var/qmail/alias/.qmail-phplistbounces-default"); |
16 |
|
17 |
-safe_symlink("../daemontools" , 'root/etc/rc.d/init.d/supervise/phplist'); |
18 |
-safe_symlink("/var/service/phplist" , 'root/service/phplist'); |
19 |
-safe_touch("root/var/service/phplist/down"); |
20 |
safe_symlink("restart", "root/etc/e-smith/events/webapps-update/services2adjust/phplist"); |
21 |
|
22 |
-service_link_enhanced('phplist', 'S98', '7'); |
23 |
-service_link_enhanced('phplist', 'K12', '6'); |
24 |
-service_link_enhanced('phplist', 'K12', '0'); |
25 |
|
26 |
safe_touch("root/var/lib/phplist/bounces.mbox"); |
27 |
+ |
28 |
+my $event="smeserver-phplist-update"; |
29 |
+event_templates($event, qw( |
30 |
+/etc/httpd/conf/httpd.conf |
31 |
+/etc/opt/remi/php80/php-fpm.d/www.conf |
32 |
+/etc/e-smith/sql/init/phplistdb |
33 |
+/etc/phplist/config.php |
34 |
+/etc/e-smith/sql/init/phplistdb |
35 |
+)); |
36 |
+ |
37 |
+event_services($event, qw( |
38 |
+ php80-php-fpm restart |
39 |
+ httpd-e-smith restart |
40 |
+ phplist restart |
41 |
+ mysql.init restart |
42 |
+)); |
43 |
+safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/$event/S55phplist-qmail-assign"); |
44 |
+ |
45 |
+event_actions($event, qw( |
46 |
+ phplist-create-pseudo 55 |
47 |
+ systemd-default 88 |
48 |
+ systemd-reload 89 |
49 |
+)); |
50 |
+ |
51 |
+use esmith::Build::Backup qw(:all); |
52 |
+backup_includes("smeserver-phplist-udpdate", qw( |
53 |
+/var/lib/phplist |
54 |
+/var/log/phplist |
55 |
+)); |
56 |
diff -Nur --no-dereference smeserver-phplist-0.2.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98phplist smeserver-phplist-0.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98phplist |
57 |
--- smeserver-phplist-0.2.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98phplist 2020-03-18 13:12:54.000000000 -0400 |
58 |
+++ smeserver-phplist-0.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98phplist 2022-08-02 22:03:20.751000000 -0400 |
59 |
@@ -6,11 +6,12 @@ |
60 |
my $alias = $phplist{'AliasOnPrimary'} || 'enabled'; |
61 |
my $ver = $sysconfig{'ReleaseVersion'} || '8.1'; |
62 |
|
63 |
-my $allow = ( $access eq 'public' ) ? 'all' : "$localAccess $externalSSLAccess"; |
64 |
+my $allow = ( $access eq 'public' ) ? 'all granted' : "ip $localAccess $externalSSLAccess"; |
65 |
$alias = ($alias ne 'enabled') ? '' : 'Alias /lists /usr/share/phplist/www/'; |
66 |
$auth = ( $auth eq 'http' ) ? 'AuthName "phplist"' . "\n" . |
67 |
" AuthType Basic\n" . |
68 |
- " AuthExternal pwauth\n" . (($ver =~ m/^9/) ? " AuthBasicProvider external\n":'') . |
69 |
+ " AuthBasicProvider external\n" . |
70 |
+ " AuthExternal pwauth\n" . |
71 |
" require valid-user\n" : ''; |
72 |
|
73 |
if ($status eq 'enabled') { |
74 |
@@ -22,42 +23,30 @@ |
75 |
Options None +FollowSymLinks |
76 |
AllowOverride None |
77 |
DirectoryIndex index.php |
78 |
- AddType application/x-httpd-php .php .php3 |
79 |
- php_admin_value openbase_dir /usr/share/phplist:/var/lib/phplist:/tmp:/etc/phplist |
80 |
- php_admin_flag file_uploads on |
81 |
- php_admin_value upload_max_filesize 5M |
82 |
- php_admin_value post_max_size 6M |
83 |
- php_admin_value memory_limit 128M |
84 |
- php_admin_value session.save_path /var/lib/phplist/tmp |
85 |
- php_admin_value upload_tmp_dir /var/lib/phplist/tmp |
86 |
+ AddType application/x-httpd-php .php |
87 |
<FilesMatch "\\.(php|inc)\$"> |
88 |
- Order allow,deny |
89 |
- deny from all |
90 |
+ Require all denied |
91 |
</FilesMatch> |
92 |
<FilesMatch "(index.php|dl.php|ut.php|lt.php|download.php|connector.php)\$"> |
93 |
- Order allow,deny |
94 |
- allow from all |
95 |
+ Require all granted |
96 |
+ SetHandler "proxy:unix:/var/run/php-fpm/php80-phplist.sock|fcgi://localhost" |
97 |
</FilesMatch> |
98 |
- Order deny,allow |
99 |
- deny from all |
100 |
- allow from $allow |
101 |
+ Require $allow |
102 |
</Directory> |
103 |
|
104 |
# Admin section |
105 |
<Directory /usr/share/phplist/www/admin> |
106 |
SSLRequireSSL on |
107 |
<FilesMatch "\\.(php|inc)\$"> |
108 |
- Order allow,deny |
109 |
- Deny from all |
110 |
+ Require all denied |
111 |
</FilesMatch> |
112 |
<FilesMatch "(index.php|connector.php|upload.php)\$"> |
113 |
- Order allow,deny |
114 |
- allow from all |
115 |
+ Require all granted |
116 |
</FilesMatch> |
117 |
- order deny,allow |
118 |
- deny from all |
119 |
- allow from $allow |
120 |
- $auth |
121 |
+ <RequireAll> |
122 |
+ Require $allow |
123 |
+ $auth |
124 |
+ </RequireAll> |
125 |
</Directory> |
126 |
|
127 |
|
128 |
diff -Nur --no-dereference smeserver-phplist-0.2.1.old/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phplist smeserver-phplist-0.2.1/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phplist |
129 |
--- smeserver-phplist-0.2.1.old/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phplist 1969-12-31 19:00:00.000000000 -0500 |
130 |
+++ smeserver-phplist-0.2.1/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phplist 2022-08-02 21:50:33.405000000 -0400 |
131 |
@@ -0,0 +1,65 @@ |
132 |
+{ |
133 |
+ |
134 |
+if ($PHP_VERSION eq '80'){ |
135 |
+ if (($phplist{'status'} || 'disabled') eq 'enabled'){ |
136 |
+ my $max_upload_size = ($phplist{MaxUploadSize} || '6M'); |
137 |
+ $max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/); |
138 |
+ my $memory_limit = ($phplist{MemoryLimit} || '128M'); |
139 |
+ $memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/); |
140 |
+ my $open_basedir= $phplist{PHPBaseDir} || ''; |
141 |
+ $open_basedir = "/usr/share/phplist:/var/lib/phplist:/tmp:/etc/phplist:$open_basedir"; |
142 |
+ my $id = 'phplist'; |
143 |
+ my $max_children = $phplist{'PHPmaxChildren'} || 20; |
144 |
+ my $min_spare_servers = $phplist{'PHPminServers'} || 4; |
145 |
+ my $start_servers = $phplist{'PHPstartServers'} || 6; |
146 |
+ my $max_spare_servers = $phplist{'PHPmaxServers'} || 8; |
147 |
+ my $max_requests = $phplist{'PHPmaxRequests'} || 1000; |
148 |
+ $min_spare_servers = ( $min_spare_servers > $max_spare_servers ) ? printf("%.0f",$max_spare_servers/2) : $min_spare_servers; |
149 |
+ $start_servers = ( $start_servers > $max_spare_servers ) ? printf("%.0f", $max_spare_servers /2 + $min_spare_servers/2 ) : $start_servers; |
150 |
+ |
151 |
+ $OUT .=<<_EOF; |
152 |
+ |
153 |
+[php$PHP_VERSION-$id] |
154 |
+user = www |
155 |
+group = www |
156 |
+listen.owner = root |
157 |
+listen.group = www |
158 |
+listen.mode = 0660 |
159 |
+listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock |
160 |
+pm = dynamic |
161 |
+pm.max_children = $max_children |
162 |
+pm.start_servers = $start_servers |
163 |
+pm.min_spare_servers = $min_spare_servers |
164 |
+pm.max_spare_servers = $max_spare_servers |
165 |
+pm.max_requests = $max_requests |
166 |
+php_admin_value[session.save_path] = /var/lib/php/$id/session |
167 |
+php_admin_value[session.gc_maxlifetime] = 86400 |
168 |
+php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache |
169 |
+php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp |
170 |
+php_admin_value[error_log] = /var/log/php/$id/error.log |
171 |
+slowlog = /var/log/php/phplist/slow.log |
172 |
+php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName } |
173 |
+php_admin_flag[display_errors] = off |
174 |
+php_admin_flag[log_errors] = on |
175 |
+php_admin_value[error_log] = syslog |
176 |
+php_admin_value[memory_limit] = $memory_limit |
177 |
+php_admin_value[max_execution_time] = 3600 |
178 |
+php_admin_value[post_max_size] = $max_upload_size |
179 |
+php_admin_value[upload_max_filesize] = $max_upload_size |
180 |
+php_admin_value[disable_functions] = system, show_source, symlink, dl, passthru, phpinfo, escapeshellarg, escapeshellcmd |
181 |
+php_admin_value[open_basedir] = $open_basedir |
182 |
+php_admin_flag[allow_url_fopen] = on |
183 |
+php_admin_flag[file_uploads] = on |
184 |
+php_admin_flag[session.cookie_httponly] = on |
185 |
+php_admin_flag[allow_url_include] = off |
186 |
+php_admin_value[session.save_handler] = files |
187 |
+php_admin_flag[output_buffering] = off |
188 |
+ |
189 |
+_EOF |
190 |
+ |
191 |
+ } |
192 |
+ else{ |
193 |
+ $OUT .= '; phplist is disabled'; |
194 |
+ } |
195 |
+} |
196 |
+} |
197 |
diff -Nur --no-dereference smeserver-phplist-0.2.1.old/root/usr/lib/systemd/system/phplist.service smeserver-phplist-0.2.1/root/usr/lib/systemd/system/phplist.service |
198 |
--- smeserver-phplist-0.2.1.old/root/usr/lib/systemd/system/phplist.service 1969-12-31 19:00:00.000000000 -0500 |
199 |
+++ smeserver-phplist-0.2.1/root/usr/lib/systemd/system/phplist.service 2022-08-02 15:34:42.017000000 -0400 |
200 |
@@ -0,0 +1,13 @@ |
201 |
+[Unit] |
202 |
+Description=phplist process queues |
203 |
+After=network-online.target |
204 |
+ |
205 |
+[Service] |
206 |
+ExecStartPre=/sbin/e-smith/service-status phplist |
207 |
+ExecStart=/usr/sbin/e-smith/systemd/phplist |
208 |
+Restart=always |
209 |
+Restartsec=10s |
210 |
+RemainAfterExit=yes |
211 |
+ |
212 |
+[Install] |
213 |
+WantedBy=sme-server.target |
214 |
diff -Nur --no-dereference smeserver-phplist-0.2.1.old/root/usr/sbin/e-smith/systemd/phplist smeserver-phplist-0.2.1/root/usr/sbin/e-smith/systemd/phplist |
215 |
--- smeserver-phplist-0.2.1.old/root/usr/sbin/e-smith/systemd/phplist 1969-12-31 19:00:00.000000000 -0500 |
216 |
+++ smeserver-phplist-0.2.1/root/usr/sbin/e-smith/systemd/phplist 2020-03-18 13:12:54.000000000 -0400 |
217 |
@@ -0,0 +1,10 @@ |
218 |
+#!/bin/sh |
219 |
+ |
220 |
+exec 2>&1 |
221 |
+ |
222 |
+cd /usr/share/phplist/bin |
223 |
+while true; do |
224 |
+ /usr/local/bin/setuidgid www ./phplist -pprocessbounces |
225 |
+ /usr/local/bin/setuidgid www ./phplist -pprocessqueue |
226 |
+ sleep 120 |
227 |
+done |
228 |
diff -Nur --no-dereference smeserver-phplist-0.2.1.old/root/var/service/phplist/run smeserver-phplist-0.2.1/root/var/service/phplist/run |
229 |
--- smeserver-phplist-0.2.1.old/root/var/service/phplist/run 2020-03-18 13:12:54.000000000 -0400 |
230 |
+++ smeserver-phplist-0.2.1/root/var/service/phplist/run 1969-12-31 19:00:00.000000000 -0500 |
231 |
@@ -1,10 +0,0 @@ |
232 |
-#!/bin/sh |
233 |
- |
234 |
-exec 2>&1 |
235 |
- |
236 |
-cd /usr/share/phplist/bin |
237 |
-while true; do |
238 |
- /usr/local/bin/setuidgid www ./phplist -pprocessbounces |
239 |
- /usr/local/bin/setuidgid www ./phplist -pprocessqueue |
240 |
- sleep 120 |
241 |
-done |