initial commit of file from CVS for smeserver-dl on Sat Sep 7 20:17:57 AEST 2024
This commit is contained in:
parent
801eb52dba
commit
ff1e2ecd0f
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
*.rpm
|
||||||
|
*.log
|
||||||
|
*spec-20*
|
||||||
|
*.tar.gz
|
21
Makefile
Normal file
21
Makefile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Makefile for source rpm: smeserver-dl
|
||||||
|
# $Id: Makefile,v 1.1 2021/04/18 16:21:15 jpp Exp $
|
||||||
|
NAME := smeserver-dl
|
||||||
|
SPECFILE = $(firstword $(wildcard *.spec))
|
||||||
|
|
||||||
|
define find-makefile-common
|
||||||
|
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||||
|
endef
|
||||||
|
|
||||||
|
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||||
|
|
||||||
|
ifeq ($(MAKEFILE_COMMON),)
|
||||||
|
# attept a checkout
|
||||||
|
define checkout-makefile-common
|
||||||
|
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||||
|
endef
|
||||||
|
|
||||||
|
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(MAKEFILE_COMMON)
|
14
README.md
14
README.md
@ -1,3 +1,15 @@
|
|||||||
# smeserver-dl
|
# <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> smeserver-dl
|
||||||
|
|
||||||
SMEServer Koozali developed git repo for smeserver-dl smecontribs
|
SMEServer Koozali developed git repo for smeserver-dl smecontribs
|
||||||
|
|
||||||
|
## Wiki
|
||||||
|
<br />https://wiki.koozali.org/
|
||||||
|
|
||||||
|
## Bugzilla
|
||||||
|
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-dl&product=SME%20Contribs&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
<br />*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
|
||||||
|
*Once it has been checked, then this comment will be deleted*
|
||||||
|
<br />
|
||||||
|
3
additional/.tito/packages/.readme
Normal file
3
additional/.tito/packages/.readme
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
the .tito/packages directory contains metadata files
|
||||||
|
named after their packages. Each file has the latest tagged
|
||||||
|
version and the project's relative directory.
|
1
additional/.tito/packages/smeserver-dl
Normal file
1
additional/.tito/packages/smeserver-dl
Normal file
@ -0,0 +1 @@
|
|||||||
|
0.2.3-1 ./
|
1
additional/.tito/releasers.conf
Symbolic link
1
additional/.tito/releasers.conf
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../tito_libs/releasers.conf
|
6
additional/.tito/tito.props
Normal file
6
additional/.tito/tito.props
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[buildconfig]
|
||||||
|
builder = tito.builder.Builder
|
||||||
|
tagger = tito.tagger.VersionTagger
|
||||||
|
changelog_do_not_remove_cherrypick = 0
|
||||||
|
changelog_format = %s (%ae)
|
||||||
|
lib_dir = ../tito_libs
|
81
additional/smeserver-dl.spec
Normal file
81
additional/smeserver-dl.spec
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
%define phpversion 56
|
||||||
|
|
||||||
|
Summary: sme server integration of dl
|
||||||
|
Name: smeserver-dl
|
||||||
|
Version: 0.2.3
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Epoch: 9
|
||||||
|
License: GNU GPL version 2
|
||||||
|
URL: http://www.thregr.org/~wavexx/software/dl/
|
||||||
|
Group: SMEserver/addon
|
||||||
|
Source: %{name}-%{version}.tar.gz
|
||||||
|
|
||||||
|
BuildArchitectures: noarch
|
||||||
|
BuildRequires: e-smith-devtools
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}
|
||||||
|
Requires: e-smith-base
|
||||||
|
Requires: dl
|
||||||
|
Requires: smeserver-webapps-common
|
||||||
|
|
||||||
|
%description
|
||||||
|
smserver integration of dl
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Sun Jan 21 2018 Daniel Berteaud <daniel@firewall-services.com> 0.2.3-1
|
||||||
|
- Use alt php binary when expiring tickets [SME: 10495] (daniel@firewall-
|
||||||
|
services.com)
|
||||||
|
|
||||||
|
* Sun Nov 19 2017 Daniel Berteaud <daniel@firewall-services.com> 0.2.2-1
|
||||||
|
- Prepare spec file for tito (daniel@firewall-services.com)
|
||||||
|
|
||||||
|
* Wed Jul 26 2017 Daniel Berteaud <daniel@firewall-services.com> 0.2.1-1.sme
|
||||||
|
- Add /var/lib/php/dl to open_basedir for the fpm pool
|
||||||
|
- Assume MB if no unit is specified for max file size
|
||||||
|
- Remove hardcoded PHP version, replaced at build time
|
||||||
|
|
||||||
|
* Thu Jul 13 2017 Daniel Berteaud <daniel@firewall-services.com> 0.2.0-1.sme
|
||||||
|
- Support smeserver-php-fpm
|
||||||
|
|
||||||
|
* Tue May 31 2016 Daniel Berteaud <daniel@firewall-services.com> 0.1.4-1.sme
|
||||||
|
- Fix cron job output [SME: 9116]
|
||||||
|
|
||||||
|
* Wed Apr 23 2014 Daniel Berteaud <daniel@firewall-services.com> 0.1.3-1.sme
|
||||||
|
- Fix basic auth on SME9
|
||||||
|
|
||||||
|
* Tue Feb 4 2014 Daniel Berteaud <daniel@firewall-services.com> 0.1.2-1.sme
|
||||||
|
- Grant admin privileges to the admin user
|
||||||
|
|
||||||
|
* Sun Nov 24 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.1-1.sme
|
||||||
|
- Automatically upgrade the database
|
||||||
|
|
||||||
|
* Fri Nov 22 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.0-1.sme
|
||||||
|
- First release
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q
|
||||||
|
|
||||||
|
%build
|
||||||
|
perl ./createlinks
|
||||||
|
find root/ -type f | xargs grep -l __PHP_VERSION__ | xargs sed -i -e "s/__PHP_VERSION__/%{phpversion}/g"
|
||||||
|
%{__mkdir_p} root/var/log/php/dl
|
||||||
|
%{__mkdir_p} root/var/lib/php/dl/{tmp,opcache,session}
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
|
||||||
|
rm -f %{name}-%{version}-filelist
|
||||||
|
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
|
||||||
|
--dir /var/log/php/dl 'attr(0770,root,www)' \
|
||||||
|
--dir /var/lib/php/dl 'attr(0770,root,www)' \
|
||||||
|
--dir /var/lib/php/dl/tmp 'attr(0770,root,www)' \
|
||||||
|
--dir /var/lib/php/dl/opcache 'attr(0770,root,www)' \
|
||||||
|
--dir /var/lib/php/dl/session 'attr(0770,root,www)' \
|
||||||
|
> %{name}-%{version}-filelist
|
||||||
|
|
||||||
|
%files -f %{name}-%{version}-filelist
|
||||||
|
%defattr(-,root,root)
|
||||||
|
|
||||||
|
%clean
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
%postun
|
1
contriborbase
Normal file
1
contriborbase
Normal file
@ -0,0 +1 @@
|
|||||||
|
contribs10
|
40
createlinks
Normal file
40
createlinks
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
use esmith::Build::CreateLinks qw(:all);
|
||||||
|
# our event specific for updating with yum without reboot
|
||||||
|
$event = 'smeserver-dl-update';
|
||||||
|
#add here the path to your templates needed to expand
|
||||||
|
#see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event
|
||||||
|
|
||||||
|
foreach my $file (qw(
|
||||||
|
/etc/systemd/system-preset/49-koozali.preset
|
||||||
|
/etc/httpd/conf/httpd.conf
|
||||||
|
))
|
||||||
|
{
|
||||||
|
templates2events( $file, $event );
|
||||||
|
}
|
||||||
|
#action needed in case we have a systemd unit
|
||||||
|
event_link('systemd-default', $event, '10');
|
||||||
|
event_link('systemd-reload', $event, '50');
|
||||||
|
#action specific to this package
|
||||||
|
#event_link('action', $event, '30');
|
||||||
|
#services we need to restart
|
||||||
|
safe_symlink('restart',"root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
|
||||||
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.init");;
|
||||||
|
|
||||||
|
#and Server Manager panel link
|
||||||
|
#panel_link('somefunction', 'manager');
|
||||||
|
|
||||||
|
|
||||||
|
# Templates to expand
|
||||||
|
templates2events("/etc/dl.php", qw(smeserver-dl-update bootstrap-console-save webapps-update));
|
||||||
|
templates2events("/etc/e-smith/sql/init/dl", qw(smeserver-dl-update bootstrap-console-save webapps-update));
|
||||||
|
|
||||||
|
# PHP header and footer
|
||||||
|
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/etc/dl.php/template-begin");
|
||||||
|
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/etc/dl.php/template-end");
|
||||||
|
|
||||||
|
#backup contrib
|
||||||
|
use esmith::Build::Backup qw(:all);
|
||||||
|
backup_includes("smeserver-dl", qw(
|
||||||
|
/var/lib/dl/
|
||||||
|
));
|
2
root/etc/cron.daily/dl-expire
Normal file
2
root/etc/cron.daily/dl-expire
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
su -s /bin/bash -c "cd /usr/share/dl/include/scripts && /usr/bin/php__PHP_VERSION__ ./expire.php"
|
1
root/etc/e-smith/db/accounts/defaults/dl/type
Normal file
1
root/etc/e-smith/db/accounts/defaults/dl/type
Normal file
@ -0,0 +1 @@
|
|||||||
|
url
|
1
root/etc/e-smith/db/configuration/defaults/dl/DbName
Normal file
1
root/etc/e-smith/db/configuration/defaults/dl/DbName
Normal file
@ -0,0 +1 @@
|
|||||||
|
dl
|
1
root/etc/e-smith/db/configuration/defaults/dl/DbUser
Normal file
1
root/etc/e-smith/db/configuration/defaults/dl/DbUser
Normal file
@ -0,0 +1 @@
|
|||||||
|
dl
|
1
root/etc/e-smith/db/configuration/defaults/dl/access
Normal file
1
root/etc/e-smith/db/configuration/defaults/dl/access
Normal file
@ -0,0 +1 @@
|
|||||||
|
public
|
1
root/etc/e-smith/db/configuration/defaults/dl/status
Normal file
1
root/etc/e-smith/db/configuration/defaults/dl/status
Normal file
@ -0,0 +1 @@
|
|||||||
|
enabled
|
1
root/etc/e-smith/db/configuration/defaults/dl/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/dl/type
Normal file
@ -0,0 +1 @@
|
|||||||
|
webapp
|
27
root/etc/e-smith/db/configuration/migrate/dl-database
Normal file
27
root/etc/e-smith/db/configuration/migrate/dl-database
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
my $rec = $DB->get('dl')
|
||||||
|
|| $DB->new_record('dl', {type => 'webapp'});
|
||||||
|
my $pw = $rec->prop('DbPassword');
|
||||||
|
if (not $pw or length($pw) < 57){
|
||||||
|
use MIME::Base64 qw(encode_base64);
|
||||||
|
|
||||||
|
$pw = "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, 57 ) != 57 ){
|
||||||
|
warn("Short read from /dev/random: $!");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$pw = encode_base64($buf);
|
||||||
|
chomp $pw;
|
||||||
|
}
|
||||||
|
close RANDOM;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
warn "Could not open /dev/urandom: $!";
|
||||||
|
}
|
||||||
|
$rec->set_prop('DbPassword', $pw);
|
||||||
|
}
|
||||||
|
}
|
3
root/etc/e-smith/templates.metadata/etc/dl.php
Normal file
3
root/etc/e-smith/templates.metadata/etc/dl.php
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
PERMS=0640
|
||||||
|
UID="root"
|
||||||
|
GID="www"
|
@ -0,0 +1 @@
|
|||||||
|
PERMS=0750
|
6
root/etc/e-smith/templates/etc/dl.php/10Url
Normal file
6
root/etc/e-smith/templates/etc/dl.php/10Url
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
my $uri = $dl{'Uri'} || "https://$SystemName.$DomainName/dl";
|
||||||
|
$uri .= '/' if ($uri !~ /\/$/);
|
||||||
|
|
||||||
|
$OUT .= "\$masterPath = '$uri';";
|
||||||
|
}
|
1
root/etc/e-smith/templates/etc/dl.php/15From
Normal file
1
root/etc/e-smith/templates/etc/dl.php/15From
Normal file
@ -0,0 +1 @@
|
|||||||
|
$fromAddr = "{$ldap{'defaultCompany'}} <nobody@{$DomainName}>";
|
1
root/etc/e-smith/templates/etc/dl.php/20Spool
Normal file
1
root/etc/e-smith/templates/etc/dl.php/20Spool
Normal file
@ -0,0 +1 @@
|
|||||||
|
$spoolDir = "/var/lib/dl/";
|
5
root/etc/e-smith/templates/etc/dl.php/25Locale
Normal file
5
root/etc/e-smith/templates/etc/dl.php/25Locale
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
my $locale = $sysconfig{'Language'} || 'en_US';
|
||||||
|
$locale = (-e "/usr/share/dl/include/locale/$locale") ? "$locale":'en_US';
|
||||||
|
$OUT .= "\$defLocale = '$locale';";
|
||||||
|
}
|
4
root/etc/e-smith/templates/etc/dl.php/30Defaults
Normal file
4
root/etc/e-smith/templates/etc/dl.php/30Defaults
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
$defaultTicketTotalDays = 30;
|
||||||
|
$defaultTicketLastDlDays = 7;
|
||||||
|
$defaultTicketMaxDl = 0;
|
||||||
|
$defaultGrantTotalDays = 30;
|
4
root/etc/e-smith/templates/etc/dl.php/35ConfVer
Normal file
4
root/etc/e-smith/templates/etc/dl.php/35ConfVer
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
my $ver = `rpm -q --qf %{version} dl`;
|
||||||
|
$OUT .= "\$cfgVersion = '$ver';";
|
||||||
|
}
|
1
root/etc/e-smith/templates/etc/dl.php/40Logs
Normal file
1
root/etc/e-smith/templates/etc/dl.php/40Logs
Normal file
@ -0,0 +1 @@
|
|||||||
|
$logFile = "/var/log/dl.log";
|
1
root/etc/e-smith/templates/etc/dl.php/45Auth
Normal file
1
root/etc/e-smith/templates/etc/dl.php/45Auth
Normal file
@ -0,0 +1 @@
|
|||||||
|
$authRealm = "dl";
|
10
root/etc/e-smith/templates/etc/dl.php/50Database
Normal file
10
root/etc/e-smith/templates/etc/dl.php/50Database
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
my $dbn = $dl{'DbName'} || 'dl';
|
||||||
|
my $dbu = $dl{'DbUser'} || 'dl';
|
||||||
|
my $dbp = $dl{'DbPassword'} || 'secret';
|
||||||
|
$OUT .=<<"EOF"
|
||||||
|
\$dsn = "mysql:host=localhost;dbname=$dbn";
|
||||||
|
\$dbUser = "$dbu";
|
||||||
|
\$dbPassword = "$dbp";
|
||||||
|
EOF
|
||||||
|
}
|
1
root/etc/e-smith/templates/etc/dl.php/55Expire
Normal file
1
root/etc/e-smith/templates/etc/dl.php/55Expire
Normal file
@ -0,0 +1 @@
|
|||||||
|
$gcInternal = false;
|
22
root/etc/e-smith/templates/etc/dl.php/60ClamScan
Normal file
22
root/etc/e-smith/templates/etc/dl.php/60ClamScan
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
my $clam = $clamd{'status'} || 'disabled';
|
||||||
|
return '' unless ($clam eq 'enabled');
|
||||||
|
my $max = $clamav{StreamMaxLength} || '25M';
|
||||||
|
my $limit = $max;
|
||||||
|
$limit =~ s/[KMG]$//;
|
||||||
|
if ($max =~ m/G$/){
|
||||||
|
$limit = $limit * 1024 * 1024 * 1024;
|
||||||
|
}
|
||||||
|
elsif ($max =~ m/M$/){
|
||||||
|
$limit = $limit * 1024 * 1024;
|
||||||
|
}
|
||||||
|
elsif ($max =~ m/K$/){
|
||||||
|
$limit = $limit * 1024;
|
||||||
|
}
|
||||||
|
# 1MB of margin to be sure we don't go over clamd limit
|
||||||
|
$limit -= 1024 * 1024;
|
||||||
|
$OUT .=<<"EOF";
|
||||||
|
\$clamdSocket = 'unix:///var/run/clamd/clamd.socket';
|
||||||
|
\$scanMax = $limit;
|
||||||
|
EOF
|
||||||
|
}
|
52
root/etc/e-smith/templates/etc/e-smith/sql/init/dl
Normal file
52
root/etc/e-smith/templates/etc/e-smith/sql/init/dl
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
my $db = $dl{'DbName'} || 'dl';
|
||||||
|
my $user = $dl{'DbUser'} || 'dl';
|
||||||
|
my $pass = $dl{'DbPassword'} || 'secret';
|
||||||
|
|
||||||
|
my $dbstruct = `rpm -ql dl | grep mysql.sql`;
|
||||||
|
|
||||||
|
$OUT .= <<"END";
|
||||||
|
#! /bin/sh
|
||||||
|
if [ ! -d /var/lib/mysql/$db ]; then
|
||||||
|
/usr/bin/mysql -e 'create database $db'
|
||||||
|
/usr/bin/mysql $db < $dbstruct
|
||||||
|
else
|
||||||
|
su -s /bin/bash - www -c "cd /usr/share/dl/include/scripts && /usr/bin/php__PHP_VERSION__ ./dbupgrade.php"
|
||||||
|
fi
|
||||||
|
|
||||||
|
/usr/bin/mysql <<EOF
|
||||||
|
USE mysql;
|
||||||
|
|
||||||
|
REPLACE INTO user (
|
||||||
|
host,
|
||||||
|
user,
|
||||||
|
password)
|
||||||
|
VALUES (
|
||||||
|
'localhost',
|
||||||
|
'$user',
|
||||||
|
PASSWORD ('$pass'));
|
||||||
|
|
||||||
|
|
||||||
|
REPLACE INTO db (
|
||||||
|
host,
|
||||||
|
db,
|
||||||
|
user,
|
||||||
|
select_priv, insert_priv, update_priv, delete_priv,
|
||||||
|
create_priv, alter_priv, index_priv, drop_priv, create_tmp_table_priv,
|
||||||
|
grant_priv, lock_tables_priv, references_priv)
|
||||||
|
VALUES (
|
||||||
|
'localhost',
|
||||||
|
'$db',
|
||||||
|
'$user',
|
||||||
|
'Y', 'Y', 'Y', 'Y',
|
||||||
|
'Y', 'Y', 'Y', 'Y', 'Y',
|
||||||
|
'N', 'Y', 'Y');
|
||||||
|
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
|
|
||||||
|
use $db
|
||||||
|
INSERT INTO user (\\`name\\`,\\`role_id\\`) VALUES ('admin', '1') ON DUPLICATE KEY update role_id='1';
|
||||||
|
|
||||||
|
EOF
|
||||||
|
END
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
if ($fastcgi_mod eq 'mod_fastcgi'){
|
||||||
|
$OUT .=<<_EOF;
|
||||||
|
Action phpdl-fastcgi /php-cgi-bin/phpdl-wrapper
|
||||||
|
Alias /php-cgi-bin/phpdl-wrapper /var/www/php-cgi-bin/phpdl-wrapper
|
||||||
|
FastCgiExternalServer /var/www/php-cgi-bin/phpdl-wrapper -socket /var/run/php-fpm/php__PHP_VERSION__-dl.sock -pass-header Authorization -idle-timeout 120
|
||||||
|
_EOF
|
||||||
|
}
|
||||||
|
}
|
78
root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98Dl
Normal file
78
root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98Dl
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
{
|
||||||
|
my $access = $dl{'access'} || 'private';
|
||||||
|
my $allow = ($access eq 'public')?'all granted':"ip $localAccess $externalSSLAccess";
|
||||||
|
my $authtype = $dl{'Authentication'} || 'http';
|
||||||
|
my $alias = (($dl{'AliasOnPrimary'} || 'enabled') eq 'enabled') ?
|
||||||
|
'Alias /dl /usr/share/dl' : '';
|
||||||
|
my $maxupload = $dl{'MaxUploadSize'} || '1024';
|
||||||
|
my $maxpost = $maxupload+1;
|
||||||
|
$maxupload .= 'M';
|
||||||
|
$maxpost .= 'M';
|
||||||
|
my $auth = '';
|
||||||
|
if ($authtype eq 'http'){
|
||||||
|
$auth =<<'EOF';
|
||||||
|
<FilesMatch "^(admin|rest)\.php">
|
||||||
|
SSLRequireSSL on
|
||||||
|
AuthName "dl"
|
||||||
|
AuthType Basic
|
||||||
|
AuthBasicProvider external
|
||||||
|
AuthExternal pwauth
|
||||||
|
Require valid-user
|
||||||
|
</FilesMatch>
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
if ($dl{'status'} eq 'enabled'){
|
||||||
|
|
||||||
|
my $php =<<_EOF;
|
||||||
|
AddType application/x-httpd-php .php
|
||||||
|
|
||||||
|
<FilesMatch .php>
|
||||||
|
SetHandler "proxy:unix:/var/run/php-fpm/php__PHP_VERSION__-dl.sock|fcgi://localhost"
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
#php_admin_flag file_uploads On
|
||||||
|
#php_admin_flag magic_quotes Off
|
||||||
|
#php_admin_flag magic_quotes_gpc Off
|
||||||
|
#php_admin_value upload_max_filesize $maxupload
|
||||||
|
#php_admin_value post_max_size $maxpost
|
||||||
|
#php_admin_value memory_limit 100M
|
||||||
|
#php_admin_flag output_buffering Off
|
||||||
|
#php_admin_value max_execution_time 0
|
||||||
|
#php_admin_value upload_tmp_dir /var/lib/dl/tmp
|
||||||
|
#php_admin_value session.save_path /var/lib/dl/tmp
|
||||||
|
#php_admin_value session.gc_maxlifetime 86400
|
||||||
|
_EOF
|
||||||
|
if ($fastcgi_mod eq 'mod_fastcgi'){
|
||||||
|
$php = " AddHandler phpdl-fastcgi .php\n";
|
||||||
|
}
|
||||||
|
elsif ($fastcgi_mod eq 'mod_proxy_fcgi'){
|
||||||
|
$php =<<'_EOF';
|
||||||
|
<FilesMatch \.php$>
|
||||||
|
SetHandler "proxy:unix:/var/run/php-fpm/php__PHP_VERSION__-dl.sock|fcgi://localhost"
|
||||||
|
</FilesMatch>
|
||||||
|
_EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
$OUT .=<<"END"
|
||||||
|
|
||||||
|
# dl Configuration
|
||||||
|
$alias
|
||||||
|
|
||||||
|
<Directory /usr/share/dl>
|
||||||
|
AllowOverride Limit
|
||||||
|
$php
|
||||||
|
Require $allow
|
||||||
|
$auth
|
||||||
|
</Directory>
|
||||||
|
<Directory /usr/share/dl/include>
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
<Directory /usr/share/dl/style/include>
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
END
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$OUT .= "# dl is disabled\n";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
my $sslport = $modSSL{'TCPPort'} || '443';
|
||||||
|
my $status = $dl{'status'} || 'enabled';
|
||||||
|
my $alias = $dl{'AliasOnPrimary'} || 'enabled';
|
||||||
|
|
||||||
|
if (($port ne $sslport) && ($status eq 'enabled') && ($alias eq 'enabled')){
|
||||||
|
$OUT .= " RewriteEngine on\n";
|
||||||
|
$OUT .= " RewriteRule ^/dl(/.*|\$) https://%{HTTP_HOST}/dl\$1 \[L,R\]\n";
|
||||||
|
}
|
||||||
|
}
|
52
root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15Dl
Normal file
52
root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15Dl
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
if ($PHP_VERSION eq '__PHP_VERSION__'){
|
||||||
|
if (($dl{'status'} || 'disabled') eq 'enabled'){
|
||||||
|
my $max_upload_size = ($dl{MaxUploadSize} || '4096');
|
||||||
|
$max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/);
|
||||||
|
my $id = 'dl';
|
||||||
|
$OUT .=<<_EOF;
|
||||||
|
|
||||||
|
[php$PHP_VERSION-$id]
|
||||||
|
user = www
|
||||||
|
group = www
|
||||||
|
listen.owner = root
|
||||||
|
listen.group = www
|
||||||
|
listen.mode = 0660
|
||||||
|
listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 15
|
||||||
|
pm.start_servers = 3
|
||||||
|
pm.min_spare_servers = 3
|
||||||
|
pm.max_spare_servers = 4
|
||||||
|
pm.max_requests = 1000
|
||||||
|
php_admin_value[session.save_path] = /var/lib/php/$id/session
|
||||||
|
php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache
|
||||||
|
php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp
|
||||||
|
php_admin_value[error_log] = /var/log/php/$id/error.log
|
||||||
|
slowlog = /var/log/php/dl/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_log] = syslog
|
||||||
|
php_admin_value[memory_limit] = 128M
|
||||||
|
php_admin_value[max_execution_time] = 0
|
||||||
|
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, exec, dl, shell_exec, passthru, phpinfo, escapeshellarg, escapeshellcmd
|
||||||
|
php_admin_value[open_basedir] = /usr/share/dl:/etc/dl.php:/var/lib/dl:/var/log/dl.log:/var/lib/php/dl
|
||||||
|
php_admin_flag[allow_url_fopen] = off
|
||||||
|
php_admin_flag[file_upload] = on
|
||||||
|
php_admin_flag[session.cookie_httponly] = on
|
||||||
|
php_admin_flag[allow_url_include] = off
|
||||||
|
php_admin_value[session.save_handler] = files
|
||||||
|
php_admin_flag[output_buffering] = off
|
||||||
|
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$OUT .= '; Dl is disabled';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
119
smeserver-dl.spec
Normal file
119
smeserver-dl.spec
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
%define phpversion 74
|
||||||
|
|
||||||
|
Summary: sme server integration of dl
|
||||||
|
Name: smeserver-dl
|
||||||
|
Version: 0.2.3
|
||||||
|
Release: 9%{?dist}
|
||||||
|
Epoch: 9
|
||||||
|
License: GNU GPL version 2
|
||||||
|
URL: http://www.thregr.org/~wavexx/software/dl/
|
||||||
|
Group: SMEserver/addon
|
||||||
|
Source: %{name}-%{version}.tar.xz
|
||||||
|
|
||||||
|
BuildArchitectures: noarch
|
||||||
|
BuildRequires: e-smith-devtools
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}
|
||||||
|
Requires: e-smith-base
|
||||||
|
Requires: dl
|
||||||
|
Requires: e-smith-apache >= 2.6.0-19
|
||||||
|
Requires: smeserver-php >= 3.0.0-43
|
||||||
|
|
||||||
|
%description
|
||||||
|
smserver integration of dl
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Sat Sep 07 2024 cvs2git.sh aka Brian Read <brianr@koozali.org> 0.2.3-9.sme
|
||||||
|
- Roll up patches and move to git repo [SME: 12338]
|
||||||
|
|
||||||
|
* Sat Sep 07 2024 BogusDateBot
|
||||||
|
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
|
||||||
|
by assuming the date is correct and changing the weekday.
|
||||||
|
|
||||||
|
* Thu Jul 21 2022 Jean-Philippe Pialasse <tests@pialasse.com> 0.2.3-8.sme
|
||||||
|
- use httpd 2.4 syntax [SME: 12042]
|
||||||
|
smeserver-php provides smeserver-webapps-common
|
||||||
|
- backup contrib [SME: 12004]
|
||||||
|
|
||||||
|
* Thu Dec 23 2021 Brian Read <brianr@bjsystems.co.uk> 0.2.3-7.sme
|
||||||
|
- Correct-clam-dir-in-60clamscan [SME: 11820]
|
||||||
|
|
||||||
|
* Fri Dec 03 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.2.3-6.sme
|
||||||
|
- Fix clamd path
|
||||||
|
- Fix typo
|
||||||
|
|
||||||
|
* Wed Nov 03 2021 Brian Read <brianr@bjsystems.co.uk> 0.2.3-5.sme
|
||||||
|
- php74-dl-call-in-httpd-fragment [SME: 11567]
|
||||||
|
|
||||||
|
* Tue Sep 28 2021 Brian Read <brianr@bjsystems.co.uk> 0.2.3-4.sme
|
||||||
|
- fix up update routine to create sql db on install [SME: 11567]
|
||||||
|
- Update php to 74
|
||||||
|
|
||||||
|
* Mon Apr 19 2021 Brian Read <brianr@bjsystems.co.uk> 0.2.3-3.sme
|
||||||
|
- Fix httpd syntax and expand it intially [SME: 11567]
|
||||||
|
|
||||||
|
* Mon Apr 19 2021 Brian Read <brianr@bjsystems.co.uk> 0.2.3-2.sme
|
||||||
|
- Initial import to SME10 tree [SME: 11567]
|
||||||
|
- Add Update event to createlinks
|
||||||
|
|
||||||
|
* Mon Apr 19 2021 BogusDateBot
|
||||||
|
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
|
||||||
|
by assuming the date is correct and changing the weekday.
|
||||||
|
|
||||||
|
* Sun Jan 21 2018 Daniel Berteaud <daniel@firewall-services.com> 0.2.3-1
|
||||||
|
- Use alt php binary when expiring tickets [SME: 10495] (daniel@firewall-
|
||||||
|
services.com)
|
||||||
|
|
||||||
|
* Sun Nov 19 2017 Daniel Berteaud <daniel@firewall-services.com> 0.2.2-1
|
||||||
|
- Prepare spec file for tito (daniel@firewall-services.com)
|
||||||
|
|
||||||
|
* Wed Jul 26 2017 Daniel Berteaud <daniel@firewall-services.com> 0.2.1-1.sme
|
||||||
|
- Add /var/lib/php/dl to open_basedir for the fpm pool
|
||||||
|
- Assume MB if no unit is specified for max file size
|
||||||
|
- Remove hardcoded PHP version, replaced at build time
|
||||||
|
|
||||||
|
* Thu Jul 13 2017 Daniel Berteaud <daniel@firewall-services.com> 0.2.0-1.sme
|
||||||
|
- Support smeserver-php-fpm
|
||||||
|
|
||||||
|
* Tue May 31 2016 Daniel Berteaud <daniel@firewall-services.com> 0.1.4-1.sme
|
||||||
|
- Fix cron job output [SME: 9116]
|
||||||
|
|
||||||
|
* Wed Apr 23 2014 Daniel Berteaud <daniel@firewall-services.com> 0.1.3-1.sme
|
||||||
|
- Fix basic auth on SME9
|
||||||
|
|
||||||
|
* Tue Feb 4 2014 Daniel Berteaud <daniel@firewall-services.com> 0.1.2-1.sme
|
||||||
|
- Grant admin privileges to the admin user
|
||||||
|
|
||||||
|
* Sun Nov 24 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.1-1.sme
|
||||||
|
- Automatically upgrade the database
|
||||||
|
|
||||||
|
* Fri Nov 22 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.0-1.sme
|
||||||
|
- First release
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q
|
||||||
|
|
||||||
|
%build
|
||||||
|
perl ./createlinks
|
||||||
|
find root/ -type f | xargs grep -l __PHP_VERSION__ | xargs sed -i -e "s/__PHP_VERSION__/%{phpversion}/g"
|
||||||
|
%{__mkdir_p} root/var/log/php/dl
|
||||||
|
%{__mkdir_p} root/var/lib/php/dl/{tmp,opcache,session}
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
|
||||||
|
rm -f %{name}-%{version}-filelist
|
||||||
|
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
|
||||||
|
--dir /var/log/php/dl 'attr(0770,root,www)' \
|
||||||
|
--dir /var/lib/php/dl 'attr(0770,root,www)' \
|
||||||
|
--dir /var/lib/php/dl/tmp 'attr(0770,root,www)' \
|
||||||
|
--dir /var/lib/php/dl/opcache 'attr(0770,root,www)' \
|
||||||
|
--dir /var/lib/php/dl/session 'attr(0770,root,www)' \
|
||||||
|
> %{name}-%{version}-filelist
|
||||||
|
|
||||||
|
%files -f %{name}-%{version}-filelist
|
||||||
|
%defattr(-,root,root)
|
||||||
|
|
||||||
|
%clean
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
%postun
|
Loading…
Reference in New Issue
Block a user