--- rpms/smeserver-phplist/contribs10/smeserver-phplist-0.2.1-sme10.patch 2022/08/03 02:04:29 1.3
+++ rpms/smeserver-phplist/contribs10/smeserver-phplist-0.2.1-sme10.patch 2022/08/03 04:07:49 1.4
@@ -1,6 +1,6 @@
diff -Nur --no-dereference smeserver-phplist-0.2.1.old/createlinks smeserver-phplist-0.2.1/createlinks
--- smeserver-phplist-0.2.1.old/createlinks 2020-03-18 13:12:54.000000000 -0400
-+++ smeserver-phplist-0.2.1/createlinks 2022-08-02 22:02:43.291000000 -0400
++++ smeserver-phplist-0.2.1/createlinks 2022-08-02 22:34:17.079000000 -0400
@@ -6,7 +6,7 @@
templates2events("/etc/phplist/config.php", qw/webapps-update bootstrap-console-save/);
@@ -10,7 +10,7 @@ diff -Nur --no-dereference smeserver-php
event_link("phplist-create-pseudo", "$event", "55");
}
-@@ -15,13 +15,36 @@
+@@ -15,13 +15,37 @@
safe_symlink("/var/qmail/alias/.qmail-phplistbounces", "root/var/qmail/alias/.qmail-phplistbounces-default");
@@ -40,10 +40,11 @@ diff -Nur --no-dereference smeserver-php
+ phplist restart
+ mysql.init restart
+));
-+safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/$event/S55phplist-qmail-assign");
++safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/$event/S93phplist-qmail-assign");
+
+event_actions($event, qw(
-+ phplist-create-pseudo 55
++ phplist-initialise 92
++ phplist-create-pseudo 93
+ systemd-default 88
+ systemd-reload 89
+));
@@ -53,9 +54,58 @@ diff -Nur --no-dereference smeserver-php
+/var/lib/phplist
+/var/log/phplist
+));
+diff -Nur --no-dereference smeserver-phplist-0.2.1.old/root/etc/e-smith/db/configuration/defaults/phplist/type smeserver-phplist-0.2.1/root/etc/e-smith/db/configuration/defaults/phplist/type
+--- smeserver-phplist-0.2.1.old/root/etc/e-smith/db/configuration/defaults/phplist/type 2020-03-18 13:12:54.000000000 -0400
++++ smeserver-phplist-0.2.1/root/etc/e-smith/db/configuration/defaults/phplist/type 2022-08-02 22:37:07.129000000 -0400
+@@ -1 +1 @@
+-webapp
++service
+diff -Nur --no-dereference smeserver-phplist-0.2.1.old/root/etc/e-smith/db/configuration/migrate/phplist-database smeserver-phplist-0.2.1/root/etc/e-smith/db/configuration/migrate/phplist-database
+--- smeserver-phplist-0.2.1.old/root/etc/e-smith/db/configuration/migrate/phplist-database 2020-03-18 13:12:54.000000000 -0400
++++ smeserver-phplist-0.2.1/root/etc/e-smith/db/configuration/migrate/phplist-database 2022-08-03 00:07:05.132000000 -0400
+@@ -24,4 +24,29 @@
+ }
+ $rec->set_prop('DbPassword', $pw);
+ }
++ my $apw = $rec->prop('AdminPass');
++ if (not $apw or length($apw) < 20){
++ use MIME::Base64 qw(encode_base64);
++ $apw = "not set due to error";
++ if ( open( RANDOM, "/dev/urandom" ) ){
++ my $buf;
++ # 57 bytes is a full line of Base64 coding, and contains
++ # 456 bits of randomness - given a perfectly random /dev/random
++ if ( read( RANDOM, $buf, 20 ) != 20 ){
++ warn("Short read from /dev/random: $!");
++ }
++ else{
++ $apw = encode_base64($buf);
++ chomp $apw;
++ }
++ close RANDOM;
++ }
++ else{
++ warn "Could not open /dev/urandom: $!";
++ }
++ $rec->set_prop('AdminPass', $apw);
++ }
++ my $type = $rec->prop("type");
++ $rec->set_prop("type","service") unless ($type eq "service");
++
+ }
+diff -Nur --no-dereference smeserver-phplist-0.2.1.old/root/etc/e-smith/events/actions/phplist-initialise smeserver-phplist-0.2.1/root/etc/e-smith/events/actions/phplist-initialise
+--- smeserver-phplist-0.2.1.old/root/etc/e-smith/events/actions/phplist-initialise 1969-12-31 19:00:00.000000000 -0500
++++ smeserver-phplist-0.2.1/root/etc/e-smith/events/actions/phplist-initialise 2022-08-03 00:07:04.884000000 -0400
+@@ -0,0 +1,6 @@
++#!/bin/bash
++password=$(config getprop phplist AdminPass)
++domain=$(config get DomainName)
++ADMIN_PASSWORD=$password ADMIN_EMAIL=admin@$domain phplist -pinitialise
++phplist -pdbcheck
++phplist -pupgrade
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
--- 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
-+++ smeserver-phplist-0.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98phplist 2022-08-02 22:03:20.751000000 -0400
++++ smeserver-phplist-0.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98phplist 2022-08-03 00:07:05.662000000 -0400
@@ -6,11 +6,12 @@
my $alias = $phplist{'AliasOnPrimary'} || 'enabled';
my $ver = $sysconfig{'ReleaseVersion'} || '8.1';
@@ -66,12 +116,12 @@ diff -Nur --no-dereference smeserver-php
$auth = ( $auth eq 'http' ) ? 'AuthName "phplist"' . "\n" .
" AuthType Basic\n" .
- " AuthExternal pwauth\n" . (($ver =~ m/^9/) ? " AuthBasicProvider external\n":'') .
-+ " AuthBasicProvider external\n" .
-+ " AuthExternal pwauth\n" .
++ " AuthBasicProvider external\n".
++ " AuthExternal pwauth\n".
" require valid-user\n" : '';
if ($status eq 'enabled') {
-@@ -22,42 +23,30 @@
+@@ -22,42 +23,33 @@
Options None +FollowSymLinks
AllowOverride None
DirectoryIndex index.php
@@ -98,6 +148,7 @@ diff -Nur --no-dereference smeserver-php
- Order deny,allow
- deny from all
- allow from $allow
++ SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
+ Require $allow
@@ -112,12 +163,14 @@ diff -Nur --no-dereference smeserver-php
- Order allow,deny
- allow from all
++ SetHandler "proxy:unix:/var/run/php-fpm/php80-phplist.sock|fcgi://localhost"
+ Require all granted
- order deny,allow
- deny from all
- allow from $allow
- $auth
++ SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
+
+ Require $allow
+ $auth
@@ -127,8 +180,8 @@ diff -Nur --no-dereference smeserver-php
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
--- 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
-+++ 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
-@@ -0,0 +1,65 @@
++++ smeserver-phplist-0.2.1/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phplist 2022-08-03 00:07:05.910000000 -0400
+@@ -0,0 +1,66 @@
+{
+
+if ($PHP_VERSION eq '80'){
@@ -138,7 +191,7 @@ diff -Nur --no-dereference smeserver-php
+ my $memory_limit = ($phplist{MemoryLimit} || '128M');
+ $memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/);
+ my $open_basedir= $phplist{PHPBaseDir} || '';
-+ $open_basedir = "/usr/share/phplist:/var/lib/phplist:/tmp:/etc/phplist:$open_basedir";
++ $open_basedir = "/usr/share/phplist:/var/lib/phplist:/tmp:/etc/phplist:/var/log/phplist:/usr/share/php/auth_translation.php:$open_basedir";
+ my $id = 'phplist';
+ my $max_children = $phplist{'PHPmaxChildren'} || 20;
+ my $min_spare_servers = $phplist{'PHPminServers'} || 4;
@@ -163,6 +216,7 @@ diff -Nur --no-dereference smeserver-php
+pm.min_spare_servers = $min_spare_servers
+pm.max_spare_servers = $max_spare_servers
+pm.max_requests = $max_requests
++php_admin_value[auto_prepend_file] = /usr/share/php/auth_translation.php
+php_admin_value[session.save_path] = /var/lib/php/$id/session
+php_admin_value[session.gc_maxlifetime] = 86400
+php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache
@@ -196,14 +250,14 @@ diff -Nur --no-dereference smeserver-php
+}
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
--- smeserver-phplist-0.2.1.old/root/usr/lib/systemd/system/phplist.service 1969-12-31 19:00:00.000000000 -0500
-+++ smeserver-phplist-0.2.1/root/usr/lib/systemd/system/phplist.service 2022-08-02 15:34:42.017000000 -0400
++++ smeserver-phplist-0.2.1/root/usr/lib/systemd/system/phplist.service 2022-08-02 22:37:29.174000000 -0400
@@ -0,0 +1,13 @@
+[Unit]
+Description=phplist process queues
+After=network-online.target
+
+[Service]
-+ExecStartPre=/sbin/e-smith/service-status phplist
++ExecStartPre=-/sbin/e-smith/service-status phplist
+ExecStart=/usr/sbin/e-smith/systemd/phplist
+Restart=always
+Restartsec=10s
@@ -211,15 +265,21 @@ diff -Nur --no-dereference smeserver-php
+
+[Install]
+WantedBy=sme-server.target
+diff -Nur --no-dereference smeserver-phplist-0.2.1.old/root/usr/local/bin/phplist smeserver-phplist-0.2.1/root/usr/local/bin/phplist
+--- smeserver-phplist-0.2.1.old/root/usr/local/bin/phplist 1969-12-31 19:00:00.000000000 -0500
++++ smeserver-phplist-0.2.1/root/usr/local/bin/phplist 2022-08-03 00:07:04.607000000 -0400
+@@ -0,0 +1,2 @@
++#!/bin/bash
++/usr/bin/php80 /usr/share/phplist/www/admin/index.php -c /etc/phplist/config.php $*
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
--- smeserver-phplist-0.2.1.old/root/usr/sbin/e-smith/systemd/phplist 1969-12-31 19:00:00.000000000 -0500
-+++ smeserver-phplist-0.2.1/root/usr/sbin/e-smith/systemd/phplist 2020-03-18 13:12:54.000000000 -0400
++++ smeserver-phplist-0.2.1/root/usr/sbin/e-smith/systemd/phplist 2022-08-03 00:07:05.427000000 -0400
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+exec 2>&1
+
-+cd /usr/share/phplist/bin
++cd /usr/local/bin/
+while true; do
+ /usr/local/bin/setuidgid www ./phplist -pprocessbounces
+ /usr/local/bin/setuidgid www ./phplist -pprocessqueue