--- rpms/smeserver-phplist/contribs10/smeserver-phplist-0.2.1-sme10.patch 2022/08/02 19:54:45 1.2
+++ rpms/smeserver-phplist/contribs10/smeserver-phplist-0.2.1-sme10.patch 2022/08/03 05:54:06 1.6
@@ -1,7 +1,16 @@
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 15:51:25.684000000 -0400
-@@ -15,13 +15,34 @@
++++ 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/);
+
+ safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/webapps-update/S55phplist-qmail-assign");
+-foreach my $event (qw/webapps-update ipasserelle-update bootstrap-ldap-save/){
++foreach my $event (qw/webapps-update bootstrap-ldap-save/){
+ event_link("phplist-create-pseudo", "$event", "55");
+ }
+
+@@ -15,13 +15,37 @@
safe_symlink("/var/qmail/alias/.qmail-phplistbounces", "root/var/qmail/alias/.qmail-phplistbounces-default");
@@ -16,23 +25,26 @@ diff -Nur --no-dereference smeserver-php
safe_touch("root/var/lib/phplist/bounces.mbox");
+
-+my $event="smeserver-phplist-udpdate";
++my $event="smeserver-phplist-update";
+event_templates($event, qw(
+/etc/httpd/conf/httpd.conf
+/etc/opt/remi/php80/php-fpm.d/www.conf
+/etc/e-smith/sql/init/phplistdb
+/etc/phplist/config.php
-+
++/etc/e-smith/sql/init/phplistdb
+));
+
+event_services($event, qw(
+ php80-php-fpm restart
+ httpd-e-smith restart
+ phplist restart
++ mysql.init restart
+));
++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
+));
@@ -42,10 +54,59 @@ 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 01:53:26.239000000 -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 01:53:25.976000000 -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 15:53:59.215000000 -0400
-@@ -6,7 +6,7 @@
++++ smeserver-phplist-0.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98phplist 2022-08-03 01:53:26.722000000 -0400
+@@ -6,11 +6,12 @@
my $alias = $phplist{'AliasOnPrimary'} || 'enabled';
my $ver = $sysconfig{'ReleaseVersion'} || '8.1';
@@ -54,7 +115,13 @@ diff -Nur --no-dereference smeserver-php
$alias = ($alias ne 'enabled') ? '' : 'Alias /lists /usr/share/phplist/www/';
$auth = ( $auth eq 'http' ) ? 'AuthName "phplist"' . "\n" .
" AuthType Basic\n" .
-@@ -22,42 +22,30 @@
+- " AuthExternal pwauth\n" . (($ver =~ m/^9/) ? " AuthBasicProvider external\n":'') .
++ " AuthBasicProvider external\n".
++ " AuthExternal pwauth\n".
+ " require valid-user\n" : '';
+
+ if ($status eq 'enabled') {
+@@ -22,44 +23,45 @@
Options None +FollowSymLinks
AllowOverride None
DirectoryIndex index.php
@@ -95,23 +162,38 @@ 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
+
++
++
++ Require $allow
++
++
++
++
++
++ Require $allow
++
++
+ EOF
+ }
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 15:49:11.805000000 -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 01:53:26.983000000 -0400
+@@ -0,0 +1,66 @@
+{
+
+if ($PHP_VERSION eq '80'){
@@ -121,8 +203,8 @@ 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";
-+ my $id = 'cacti';
++ $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;
+ my $start_servers = $phplist{'PHPstartServers'} || 6;
@@ -146,6 +228,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
@@ -179,14 +262,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
@@ -194,15 +277,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 01:53:25.716000000 -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 01:53:26.456000000 -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