* Sun Sep 01 2024 Jean-Philippe Pialasse <jpp@koozali.org> 1.6-1.sme

- initial version for SME11 [SME: ]
- build and require rpm for plugins and skins
- TODO: allow custom server IMAP/SMTP
- TODO: Install deps without symphony
This commit is contained in:
2024-09-13 15:20:51 -04:00
parent a503b95af0
commit 8ccd50e523
16 changed files with 465 additions and 127 deletions

View File

@@ -1 +1 @@
globaladdressbook,contextmenu,markasjunk,vcard_attachments,newmail_notifier,emoticons,managesieve,nextcloud_attachments
globaladdressbook,contextmenu,markasjunk,vcard_attachments,newmail_notifier,emoticons,managesieve,nextcloud_attachments,html5_notifier,fail2ban,message_highlight,thunderbird_labels

View File

@@ -1,17 +0,0 @@
{
# If you set the server dns resolver to external
# (for the main domain) you can not login in roundcube
# with the imap authentication
use esmith::DomainsDB;
my $d = esmith::DomainsDB->open_ro;
my $domainname = $DB->get_value('DomainName') or
die ("Unable to retrieve the domain name: $!");
my $dns = $d->get_prop("$domainname",'Nameservers') or
die ("Unable to retrieve the Name Servers: $!");
if ($dns ne 'localhost') {
$DB->set_prop('imaps','access','public');
}
}

View File

@@ -4,54 +4,37 @@
##Added for version smeserver-roundcube-1.1-4
my $plugins = $cdb->get_prop('roundcube','PluginsList') || '';
return unless ($plugins ne '');
# force add plugin we use
for my $plug (qw(nextcloud_attachments html5_notifier fail2ban message_highlight thunderbird_labels) )
{
next unless ($plugins !~ "$plug");
$plugins = $plugins. (($plugins eq "")? "":",") . $plug;
$cdb->set_prop('roundcube','PluginsList',"$plugins");
}
#nextcloud_attachements is used
if ($plugins !~ 'nextcloud_attachments')
{
$plugins = $plugins.',nextcloud_attachments';
$cdb->set_prop('roundcube','PluginsList',"$plugins");
}
#sieverule is now used instead of
if ($plugins !~ 'managesieve')
{
$plugins = $plugins.',managesieve';
$cdb->set_prop('roundcube','PluginsList',"$plugins");
}
# sieverule deprecated
if ($plugins =~ 'sieverule')
{
$plugins =~ s/,sieverule//g;
$cdb->set_prop('roundcube','PluginsList',"$plugins");
}
# markasjunk2 deprecated
if ($plugins =~ 'markasjunk')
{
$plugins =~ s/markasjunk2/markasjunk/g;
$cdb->set_prop('roundcube','PluginsList',"$plugins");
}
#Carddav is a really bad plugin, when available it will become usefull
if ($plugins =~ 'carddav')
{
$plugins =~ s/,carddav//g;
$cdb->set_prop('roundcube','PluginsList',"$plugins");
}
#remove calendar
if ($plugins =~ 'calendar')
{
$plugins =~ s/,calendar//g;
$cdb->set_prop('roundcube','PluginsList',"$plugins");
}
#remove libcalendaring
if ($plugins =~ 'libcalendaring')
{
$plugins =~ s/,libcalendaring//g;
$cdb->set_prop('roundcube','PluginsList',"$plugins");
}
#remove tasklist
if ($plugins =~ 'tasklist')
{
$plugins =~ s/,tasklist//g;
$cdb->set_prop('roundcube','PluginsList',"$plugins");
}
# list of outdated, depreacted or dangerous plugins
#sieverule is now used instead of
if ($plugins !~ 'managesieve')
{
$plugins = $plugins.',managesieve';
$cdb->set_prop('roundcube','PluginsList',"$plugins");
}
# sieverule deprecated
if ($plugins =~ 'sieverule')
{
$plugins =~ s/,sieverule//g;
$cdb->set_prop('roundcube','PluginsList',"$plugins");
}
# markasjunk2 deprecated
if ($plugins =~ 'markasjunk')
{
$plugins =~ s/markasjunk2/markasjunk/g;
$cdb->set_prop('roundcube','PluginsList',"$plugins");
}
#remove tasklist
if ($plugins =~ 'tasklist')
{
$plugins =~ s/,tasklist//g;
$cdb->set_prop('roundcube','PluginsList',"$plugins");
}
}

View File

@@ -1,2 +1,5 @@
#!/bin/bash
# prevents setting error_reporting in 1.6; removed in newer versions
/usr/bin/sed -i -e 's/^.*error_reporting.*$/ \/\/rem/' /usr/share/roundcubemail/program/lib/Roundcube/bootstrap.php
# update composer
/usr/bin/rcplugin_update.sh

View File

@@ -5,7 +5,7 @@
$OUT .= <<END
#! /bin/sh
if [ -d /var/lib/mysql/$db ]; then
#these plugins are no more in the core
#if you need to add plugins:
# /usr/bin/mysql $db < /usr/share/roundcubemail/plugins/calendar/drivers/database/SQL/mysql.initial.sql
# /usr/bin/mysql $db < /usr/share/roundcubemail/plugins/calendar/drivers/kolab/SQL/mysql.initial.sql
# /usr/bin/mysql $db < /usr/share/roundcubemail/plugins/tasklist/drivers/database/SQL/mysql.initial.sql
@@ -21,9 +21,5 @@
flush privileges;
EOF
#these plugins are no more in the core
# /usr/bin/mysql $db < /usr/share/roundcubemail/plugins/calendar/drivers/database/SQL/mysql.initial.sql
# /usr/bin/mysql $db < /usr/share/roundcubemail/plugins/calendar/drivers/kolab/SQL/mysql.initial.sql
# /usr/bin/mysql $db < /usr/share/roundcubemail/plugins/tasklist/drivers/database/SQL/mysql.initial.sql
END
}

View File

@@ -1,25 +0,0 @@
{
my $status = $roundcube{'status'} || "disabled";
return " # roundcube-status is disabled."
unless $status eq 'enabled';
my $domain = $roundcube{'domain'} || "disabled";
return " # no hostname or domain for roundcube defined"
if $domain eq 'disabled';
my $DocRoot = "/usr/share/roundcubemail";
$OUT = "";
$OUT .= "\n";
$OUT .= "# Redirect an existing hostname or domain to $DocRoot.\n";
$OUT .= "<VirtualHost 0.0.0.0:80>\n";
$OUT .= " ServerName $roundcube{'domain'}\n";
$OUT .= " DocumentRoot $DocRoot\n";
$OUT .= "</VirtualHost>\n";
$OUT .= "<VirtualHost 0.0.0.0:443>\n";
$OUT .= " ServerName $roundcube{'domain'}\n";
$OUT .= " DocumentRoot $DocRoot\n";
$OUT .= " SSLEngine on\n";
$OUT .= "</VirtualHost>\n";
}

View File

@@ -26,9 +26,6 @@
{ $OUT .= "Alias /$roundcube{'URL'} /usr/share/roundcubemail\n"; }
}
$OUT .= "Alias /roundcube /usr/share/roundcubemail\n";
$OUT .= "Alias /roundcubemail /usr/share/roundcubemail\n";
$OUT .= "\n";
$OUT .= "<Directory /usr/share/roundcubemail>\n";
$OUT .= " Require $allow\n";

View File

@@ -0,0 +1,11 @@
{
use esmith::DomainsDB;
# Convert the passed hash for the domain object back into an object.
$domain = bless \%domain, 'esmith::DB::db::Record';
# Make scalars from some of the properties of the domain
$virtualHost = $domain->key;
$virtualHostContent = $domain->prop('Content');
$OUT = "";
}

View File

@@ -0,0 +1,40 @@
{
my $status = $roundcube{'status'} || "disabled";
if (($port eq "80") ){
$OUT = <<"_EOL";
# PORT FORWARD FROM 80 TO: 443
ServerName $virtualHost
_EOL
$OUT .= <<_EOL;
ServerAlias
SSLProxyEngine On
RewriteEngine on
RewriteCond %\{REQUEST_URI\} !^/.well-known/acme-challenge [NC]
RewriteCond %\{HTTPS\} off
RewriteRule ^/(.*) https://%\{HTTP_HOST\}/$1 [NC,R,L]
_EOL
}
else {
use esmith::DomainsDB;
my $domains = esmith::DomainsDB->open_ro;
my $ssl_file_crt = $domains->get_prop($virtualHost, "DomainSSLCertificateFile") || "disabled";
my $ssl_file_key = $domains->get_prop($virtualHost, "DomainSSLCertificateKeyFile") || "disabled";
my $ssl_file_chain = $domains->get_prop($virtualHost, "DomainSSLCertificateChainFile") || "disabled";
my $DocRoot = "/usr/share/roundcubemail";
$OUT = <<"_EOL";
ServerName $VirtualHost
DocumentRoot $DocRoot
SSLEngine On
SSLCompression off
_EOL
$OUT .= " SSLCertificateFile $ssl_file_crt\n" unless $ssl_file_crt eq 'disabled';
$OUT .= " SSLCertificateChainFile $ssl_file_chain\n" unless $ssl_file_chain eq 'disabled';
$OUT .= " SSLCertificateKeyFile $ssl_file_key\n" unless ( $ssl_file_key eq 'disabled' || ! -e $ssl_file_chain );
}

View File

@@ -0,0 +1,25 @@
{
$haveSSL = (exists ${modSSL}{status} and ${modSSL}{status} eq "enabled") ? 'yes' : 'no';
my $webmailStatus = $roundcube{'status'} || "disabled";
my $dirs;
$dirs{horde} = '/usr/share/roundcubemail';
$dirs{webmail} = "$dirs{roundcubemail}";
my @places=('webmail','horde','roundcubemail','roundcube');
push(@places,$roundcube{'URL'}) if ((exists $roundcube{'URL'}) && ($roundcube{'URL'} ne ''));
return " # webmail is disabled in this VirtualHost"
unless $webmailStatus eq 'enabled';
foreach $place (@places)
{
if (($port eq "$httpPort") && ($haveSSL eq 'yes') )
{
my $portspec = ($httpsPort eq 443) ? "" : ":$httpsPort";
$OUT .= " RewriteRule ^/$place(/.*|\$) https://%{HTTP_HOST}${portspec}/$place\$1 [L,R]\n";
} else {
$OUT .= " Alias /$place $dirs{$place}\n";
}
}
}

View File

@@ -1,23 +0,0 @@
{
my $status = $roundcube{'status'} || "disabled";
return " # roundcube is disabled in this VirtualHost"
unless $status eq 'enabled';
{
if ($port ne "443")
{
$OUT .= <<'HERE';
## Redirect roundcubeWeb Address to Secure Address
RewriteEngine on
RewriteRule ^/roundcube https://%{HTTP_HOST}/roundcube
RewriteRule ^/roundcubemail https://%{HTTP_HOST}/roundcubemail
## End Of Redirect
HERE
if ((exists $roundcube{'URL'}) && ($roundcube{'URL'} ne '')) {
$OUT .= "RewriteRule ^/$roundcube{'URL'} https://%{HTTP_HOST}/$roundcube{'URL'}\n";
}
}
}
}

View File

@@ -8,7 +8,10 @@ if ($PHP_VERSION eq $phpversion){
my $memory_limit = ($roundcube{MemoryLimit} || '512M');
$memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/);
my $open_basedir= $roundcube{PHPBaseDir} || '';
$open_basedir = "/usr/share/roundcubemail:/etc/roundcubemail/:/var/log/roundcubemail:/var/lib/roundcubemail:/var/log/roundcube.log:/var/lib/php/roundcube:/home/e-smith/files/roundcube:/dev/urandom:/proc/meminfo:/usr/share/GeoIP/GeoLite2-Country.mmdb:/proc/cpuinfo:$open_basedir";
my $include_path = ".:/usr/share/pear-addons:/usr/share/pear:/usr/share/pear-data/:/usr/share/php".
":/opt/remi/php81/root/usr/share/pear:/opt/remi/php81/root/usr/share/php".
":/opt/remi/php81/root/usr/share/pear-data/:/opt/remi/php82/root/usr/share/pear-data/: /opt/remi/php83/root/usr/share/pear-data/";
$open_basedir = "/usr/share/roundcubemail:/etc/roundcubemail/:/var/log/roundcubemail:/var/lib/roundcubemail:/var/log/roundcube.log:/var/lib/php/roundcube:/home/e-smith/files/roundcube:/dev/urandom:/proc/meminfo:/usr/share/GeoIP/GeoLite2-Country.mmdb:/proc/cpuinfo:$open_basedir:$include_path";
my $id = 'roundcube';
my $max_children = $roundcube{'PHPmaxChildren'} || 20;
my $min_spare_servers = $roundcube{'PHPminServers'} || 4;
@@ -42,12 +45,14 @@ slowlog = /var/log/php/roundcube/slow.log
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName }
php_admin_flag[display_errors] = off
php_admin_flag[log_errors] = on
php_admin_value[error_reporting] = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
php_admin_value[error_log] = syslog
php_admin_value[memory_limit] = $memory_limit
php_admin_value[max_execution_time] = 3600
php_admin_value[post_max_size] = $max_upload_size
php_admin_value[upload_max_filesize] = $max_upload_size
php_admin_value[disable_functions] = system, show_source, symlink, dl, passthru
php_admin_value[disable_functions] = system, show_source, symlink, dl, passthru
php_value[include_path] = $include_path
php_admin_value[open_basedir] = $open_basedir
php_admin_flag[allow_url_fopen] = on
php_admin_flag[file_upload] = on

View File

@@ -14,7 +14,7 @@
// For example %n = mail.domain.tld, %t = domain.tld
// WARNING: After hostname change update of mail_host column in users table is
// required to match old user data records with the new host.
{$OUT .= " \$config['imap_host'] = 'ssl://$DomainName:$imaps{TCPPort}';\n";}
{$OUT .= " \$config['imap_host'] = 'ssl://localhost:$imaps{TCPPort}';\n";}
// TCP port used for IMAP connections
//{$OUT .= " \$config['default_port'] = $imaps{TCPPort};\n";}

View File

@@ -147,7 +147,7 @@ $config['username_domain_forced'] = false;
// %d - domain (http hostname without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %t = domain.tld
$config['mail_domain'] = '';
$config['mail_domain'] = '{$DomainName}';
// Password charset.
// Use it if your authentication backend doesn't support UTF-8.