initial commit of file from CVS for smeserver-dokuwiki on Sat Sep 7 20:19:56 AEST 2024

This commit is contained in:
Trevor Batley 2024-09-07 20:19:56 +10:00
parent 591af675cf
commit c17236d1fb
17 changed files with 547 additions and 2 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.rpm
*.log
*spec-20*
*.tar.gz

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
# Makefile for source rpm: smeserver-dokuwiki
# $Id: Makefile,v 1.1 2021/10/04 14:57:25 jcrisp Exp $
NAME := smeserver-dokuwiki
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)

View File

@ -1,3 +1,16 @@
# smeserver-dokuwiki # <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> smeserver-dokuwiki
SMEServer Koozali developed git repo for smeserver-dokuwiki smecontribs SMEServer Koozali developed git repo for smeserver-dokuwiki smecontribs
## Wiki
<br />https://wiki.koozali.org/Dokuwiki
<br />https://wiki.koozali.org/Dokuwiki/fr
## Bugzilla
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-dokuwiki&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 />

1
contriborbase Normal file
View File

@ -0,0 +1 @@
contribs10

67
createlinks Normal file
View File

@ -0,0 +1,67 @@
#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/etc/dokuwiki/local.protected.php/template-begin");
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/etc/dokuwiki/local.protected.php/template-end");
templates2events("/etc/dokuwiki/local.protected.php", qw(webapps-update bootstrap-console-save smeserver-dokuwiki-update));
use esmith::Build::Backup qw(:all);
backup_includes("smeserver-dokuwiki", qw(
/etc/dokuwiki/acl.auth.php
/etc/dokuwiki/acronyms.conf
/etc/dokuwiki/entities.conf
/etc/dokuwiki/interwiki.conf
/etc/dokuwiki/local.php
/etc/dokuwiki/plugins.local.php
/etc/dokuwiki/scheme.conf
/var/lib/dokuwiki/data
/usr/share/dokuwiki/lib/plugins
));
# data temp dir, plugins from rpm dokuwiki-plugins and dokuwiki
backup_excludes("smeserver-dokuwiki", qw(
/var/lib/dokuwiki/data/cache
/var/lib/dokuwiki/data/locks
/var/lib/dokuwiki/data/tmp
/usr/share/dokuwiki/lib/plugins/acl
/usr/share/dokuwiki/lib/plugins/action.php
/usr/share/dokuwiki/lib/plugins/admin.php
/usr/share/dokuwiki/lib/plugins/authad
/usr/share/dokuwiki/lib/plugins/authhttpldap
/usr/share/dokuwiki/lib/plugins/authldap
/usr/share/dokuwiki/lib/plugins/authpdo
/usr/share/dokuwiki/lib/plugins/auth.php
/usr/share/dokuwiki/lib/plugins/authplain
/usr/share/dokuwiki/lib/plugins/cli.php
/usr/share/dokuwiki/lib/plugins/config
/usr/share/dokuwiki/lib/plugins/extension
/usr/share/dokuwiki/lib/plugins/index.html
/usr/share/dokuwiki/lib/plugins/info
/usr/share/dokuwiki/lib/plugins/popularity
/usr/share/dokuwiki/lib/plugins/remote.php
/usr/share/dokuwiki/lib/plugins/revert
/usr/share/dokuwiki/lib/plugins/safefnrecode
/usr/share/dokuwiki/lib/plugins/styling
/usr/share/dokuwiki/lib/plugins/syntax.php
/usr/share/dokuwiki/lib/plugins/usermanager
/usr/share/dokuwiki/lib/plugins/changes
/usr/share/dokuwiki/lib/plugins/ckgedit
/usr/share/dokuwiki/lib/plugins/color
/usr/share/dokuwiki/lib/plugins/dw2pdf
/usr/share/dokuwiki/lib/plugins/edittable
/usr/share/dokuwiki/lib/plugins/encryptedpasswords
/usr/share/dokuwiki/lib/plugins/hidden
/usr/share/dokuwiki/lib/plugins/howhard
/usr/share/dokuwiki/lib/plugins/loglog
/usr/share/dokuwiki/lib/plugins/note
/usr/share/dokuwiki/lib/plugins/nspages
/usr/share/dokuwiki/lib/plugins/odt
/usr/share/dokuwiki/lib/plugins/pagelist
/usr/share/dokuwiki/lib/plugins/pagemove
/usr/share/dokuwiki/lib/plugins/sortablejs
/usr/share/dokuwiki/lib/plugins/tag
/usr/share/dokuwiki/lib/plugins/todo
));
#

View File

@ -0,0 +1 @@
url

View File

@ -0,0 +1 @@
enabled

View File

@ -0,0 +1 @@
webapp

View File

@ -0,0 +1,49 @@
{
use esmith::util;
my $base = esmith::util::ldapBase($DomainName);
my $auth = $dokuwiki{'Authentication'} || 'ldap';
my $ldapPort = $ldap{'TCPPort'} || '389';
if ($auth eq 'internal'){
$OUT .=<<"EOF";
\$conf['authtype'] = 'authplain';
EOF
}
elsif ($auth eq 'ldap'){
$OUT .=<<"EOF";
\$conf['authtype'] = 'authldap';
EOF
}
elsif ($auth eq 'LemonLDAP'){
$OUT .=<<"EOF";
\$conf['authtype'] = 'authhttpldap';
EOF
}
if ($auth eq 'LemonLDAP' or $auth eq 'ldap'){
$OUT .=<<"EOF";
\$conf['plugin'][\$conf['authtype']]['server'] = "ldap://localhost:$ldapPort";
\$conf['plugin'][\$conf['authtype']]['version'] = '3';
\$conf['plugin'][\$conf['authtype']]['usertree'] = 'ou=Users,$base';
\$conf['plugin'][\$conf['authtype']]['grouptree'] = 'ou=Groups,$base';
\$conf['plugin'][\$conf['authtype']]['userfilter'] = '(&(uid=%{user})(objectClass=inetOrgPerson))';
\$conf['plugin'][\$conf['authtype']]['groupfilter'] = '(&(objectClass=mailboxRelatedObject)(memberUid=%{user}))';
\$conf['plugin'][\$conf['authtype']]['groupkey'] = 'cn';
EOF
}
}

View File

@ -0,0 +1,11 @@
$conf['useacl'] = 1;
{
if (system('egrep -q "^[^#/].*\[\'superuser\'\]" /etc/dokuwiki/local.php') != 0){
$OUT .= '$conf[\'superuser\'] = \'admin\';';
}
}

View File

@ -0,0 +1,9 @@
{
if ($fastcgi_mod eq 'mod_fastcgi'){
$OUT .=<<_EOF;
Action phpdokuwiki-fastcgi /php-cgi-bin/phpdokuwiki-wrapper
Alias /php-cgi-bin/phpdokuwiki-wrapper /var/www/php-cgi-bin/phpdokuwiki-wrapper
FastCgiExternalServer /var/www/php-cgi-bin/phpdokuwiki-wrapper -socket /var/run/php-fpm/php__PHP_VERSION__-dokuwiki.sock -pass-header Authorization -idle-timeout 120
_EOF
}
}

View File

@ -0,0 +1,103 @@
{
if (($dokuwiki{'status'} || 'disabled') eq 'enabled'){
my $alias = (($dokuwiki{'AliasOnPrimary'} || 'enabled') eq 'enabled' ) ? 'Alias /dokuwiki /usr/share/dokuwiki':'';
my $allow = (($dokuwiki{'access'} || 'private') eq 'public') ? 'all granted':"ip $localAccess $externalSSLAccess";
my $auth = (($dokuwiki{'Authentication'} || 'internal') eq 'http') ? "AuthName \"Dokuwiki\"\n" .
" AuthType Basic\n" .
" AuthBasicProvider external\n" .
" AuthExternal pwauth\n" : '';
my $ssl = (($dokuwiki{'RequireSSL'} || 'enabled') =~ m/^(enabled|yes|on)$/i) ?
'SSLRequireSSL on':'# SSL is not enforced';
my $maxsize = $dokuwiki{'MaxUploadSize'} || '200';
$maxsize .= 'M' unless ($maxsize =~ m/M$/);
my $php =<<_EOF;
AddType application/x-httpd-php .php
php_admin_value open_basedir /usr/share/dokuwiki:/var/lib/dokuwiki:/etc/dokuwiki:/dev/urandom
php_admin_value memory_limit 128M
php_admin_value upload_max_filesize $maxsize
php_admin_value post_max_size $maxsize
php_admin_value upload_tmp_dir /var/lib/dokuwiki/data/tmp
php_admin_value session.save_path /var/lib/dokuwiki/data/tmp
_EOF
if ($fastcgi_mod eq 'mod_fastcgi'){
$php = "AddHandler phpdokuwiki-fastcgi .php\n";
}
elsif ($fastcgi_mod eq 'mod_proxy_fcgi'){
$php =<<_EOF;
<FilesMatch \\.php\$>
SetHandler "proxy:unix:/var/run/php-fpm/php74-dokuwiki.sock|fcgi://localhost"
</FilesMatch>
_EOF
}
$OUT .=<<_EOF;
$alias
<Directory /usr/share/dokuwiki>
AllowOverride None
Options +FollowSymlinks
$ssl
_EOF
if ( $auth ) {
$OUT .= " $auth\n" .
" <RequireAll>\n" .
" Require $allow\n" .
" Require valid-user\n" .
" </RequireAll>\n";
} else {
$OUT .= "Require $allow\n";
}
$OUT .=<<_EOF;
$php
</Directory>
<Directory /usr/share/dokuwiki/inc>
Require all denied
</Directory>
<Directory /usr/share/dokuwiki/inc/lang>
Require all denied
</Directory>
<Directory /usr/share/dokuwiki/lib/_fla>
## no access to the fla directory
Require all denied
</Directory>
## no access to the conf directory
<Directory /etc/dokuwiki>
Require all denied
</Directory>
<Directory /usr/share/dokuwiki/conf>
Require all denied
</Directory>
## no access to the data directory
<Directory /usr/share/dokuwiki/data>
Require all denied
</Directory>
<Directory /var/lib/dokuwiki>
Require all denied
</Directory>
_EOF
} else {
$OUT .=<<'EOF';
# Dokuwiki is disabled
# You can enable it with
# db configuration setprop dokuwiki status enabled
# signal-event webapps-update
EOF
}
}

View File

@ -0,0 +1,15 @@
{
my $sslport = $modSSL{'TCPPort'} || '443';
my $alias = $dokuwiki{'AliasOnPrimary'} || 'enabled';
my $requiressl = $dokuwiki{'RequireSSL'} || 'yes';
if (($port ne $sslport) && ($requiressl =~ m/^(enabled|yes|on|1|login)$/i) && ($alias ne 'disabled')){
## Redirect Web Address to Secure Address
$OUT .= " RewriteEngine on\n";
$OUT .= " RewriteCond %{QUERY_STRING} do=login\n" if ($requiressl eq 'login');
$OUT .= " RewriteRule ^/dokuwiki(/.*|\$) https://%{HTTP_HOST}/dokuwiki\$1 \[L,R\]\n";
}
}

View File

@ -0,0 +1,50 @@
{
if ($PHP_VERSION eq '__PHP_VERSION__'){
if (($dokuwiki{'status'} || 'disabled') eq 'enabled'){
my $max_upload_size = ($dokuwiki{MaxUploadSize} || '20') . 'M';
my $id = 'dokuwiki';
$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] = 60
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/dokuwiki:/var/lib/dokuwiki:/etc/dokuwiki:/dev/urandom
php_admin_flag[allow_url_fopen] = on
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
_EOF
}
else{
$OUT .= '; Dl is disabled';
}
}
}

View File

@ -0,0 +1,71 @@
<?php
if(!defined('DOKU_INC')) die();
/**
* HTTP/LDAP authentication backend
* HTTP (your web server) handle the authentication
* LDAP handle user informations, and group membership
* This plugin have been written to work with LemonLDAP::NG WebSSO
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Daniel Berteaud <daniel@firewall-services.com>
*/
require(DOKU_PLUGIN."authldap/auth.php");
class auth_plugin_authhttpldap extends auth_plugin_authldap {
/**
* Constructor
*/
public function __construct() {
parent::__construct();
// ldap extension is needed
if(!function_exists('ldap_connect')) {
$this->_debug("LDAP err: PHP LDAP extension not found.", -1, __LINE__, __FILE__);
$this->success = false;
return;
}
$this->cando = array (
'addUser' => false, // can Users be created?
'delUser' => false, // can Users be deleted?
'modLogin' => false, // can login names be changed?
'modPass' => false, // can passwords be changed?
'modName' => false, // can real names be changed?
'modMail' => false, // can emails be changed?
'modGroups' => false, // can groups be changed?
'getUsers' => true, // can a (filtered) list of users be retrieved?
'getUserCount'=> false, // can the number of users be retrieved?
'getGroups' => true, // can a list of available groups be retrieved?
'external' => true, // does the module do external auth checking?
'logout' => true, // can the user logout again? (eg. not possible with HTTP auth)
);
}
/**
* Check if REMOTE_USER is set
*/
function trustExternal($user,$pass,$sticky=false){
global $USERINFO;
$success = false;
if (isset($_SERVER['REMOTE_USER'])){
$username = $_SERVER['REMOTE_USER'];
}
elseif (isset($_SERVER['REDIRECT_REMOTE_USER'])){
$username = $_SERVER['REDIRECT_REMOTE_USER'];
$_SERVER['REMOTE_USER'] = $username;
}
else{
return false;
}
$this->_debug('LemonLDAP::NG Login Name: '.htmlspecialchars($username),0,__LINE__,__FILE__);
if (!empty($username)){
$USERINFO = $this->getUserData($username,true);
if ($USERINFO !== false){
$success = true;
$_SESSION[DOKU_COOKIE]['auth']['user'] = $username;
$_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO;
}
}
return $success;
}
}

View File

@ -0,0 +1,7 @@
base authhttpldap
author Daniel Berteaud
email daniel@firewall-services.com
date 2017-07-17
name HTTP+LDAP auth plugin
desc This plugin uses a basic HTTP authentication, but LDAP to get info and authorization
url https://www.firewall-services.com

121
smeserver-dokuwiki.spec Normal file
View File

@ -0,0 +1,121 @@
%define phpversion 74
Summary: sme server integration of dokuwiki
Name: smeserver-dokuwiki
Version: 0.3.0
Release: 6%{?dist}
License: GNU GPL
URL: http://www.splitbrain.org/projects/dokuwiki
Group: SMEserver/addon
Source: %{name}-%{version}.tar.xz
BuildArchitectures: noarch
BuildRequires: e-smith-devtools
BuildRoot: /var/tmp/%{name}-%{version}
Requires: e-smith-base >= 5.8.0
Requires: dokuwiki
Requires: smeserver-webapps-common
Requires: e-smith-apache >= 2.6.0-19
Requires: smeserver-php >= 3.0.0-43
AutoReqProv: no
%description
smserver integration of dokuwiki
DokuWiki is a simple to use Wiki aimed at the documentation needs of a small company
%changelog
* Sat Sep 07 2024 cvs2git.sh aka Brian Read <brianr@koozali.org> 0.3.0-6.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.
* Fri Jun 24 2022 Michel Begue <mab974@misouk.com> 0.3.0-5.sme
- update to httpd 2.4 syntax [SME: 12043]
- add dokuwiki to backup list [SME: 12005]
* Sat Oct 16 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.3.0-4.sme
- Fix spec file patch issue
* Thu Oct 14 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.3.0-3.sme
- remove directory permissions for plugin directory [SME: 11703]
- Fix httpd FilesMatch
* Tue Oct 05 2021 Brian Read <brianr@bjsystems.co.uk> 0.3.0-2.sme
- Add update event [SME: 11703]
* Mon Oct 04 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 0.3.0-1
- First import to SME Contribs [SME: 11703]
- Update to PHP 74
* Mon Jan 22 2018 Daniel Berteaud <daniel@firewall-services.com> 0.2.2-1
- Fix permissions on plugin dir (daniel@firewall-services.com)
* Sun Nov 19 2017 Daniel Berteaud <daniel@firewall-services.com> 0.2.1-1
- new package built with tito
* Fri Jul 14 2017 Daniel Berteaud <daniel@firewall-services.com> 0.2.0-1
- Switch to php 71 using FastCGI and FPM is available
* Wed Mar 15 2017 Daniel Berteaud <daniel@firewall-services.com> 0.1.7-1
- Add /dev/urandom to open_basedir, needed since 2017-02-19
* Wed Oct 29 2014 Daniel B. <daniel@firewall-services.com> 0.1.6-1
- Fix SSL redirection
* Sat Jul 5 2014 Daniel B. <daniel@firewall-services.com> 0.1.5-1
- Small fixes in authhttpldap plugin
* Tue May 6 2014 Daniel B. <daniel@firewall-services.com> 0.1.4-1
- Add missing plugin.info.txt file for the authhttpldap plugin
* Thu Dec 5 2013 Daniel B. <daniel@firewall-services.com> 0.1.3-1
- Push php memory limit to 128M
* Fri Nov 22 2013 Daniel B. <daniel@firewall-services.com> 0.1.2-1
- Fix a typo which prevent transparent SSL redirection
* Wed May 15 2013 Daniel B. <daniel@firewall-services.com> 0.1.1-1
- Use the new auth plugins to be compatible with dokuwiki 2013-05-10
* Wed May 15 2013 Daniel B. <daniel@firewall-services.com> 0.1.0-1
- Import in GIT
* Mon Dec 19 2011 Daniel B. <daniel@firewall-services.com> 0.1-2
- Follow symlinks so fck media browser works
* Fri Jul 08 2011 Daniel B. <daniel@firewall-services.com> 0.1-1
- initial release
%prep
%setup
%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/dokuwiki
%{__mkdir_p} root/var/lib/php/dokuwiki/{tmp,session,opcache}
%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/dokuwiki 'attr(0770,root,www)' \
--dir /var/lib/php/dokuwiki 'attr(0770,root,www)' \
--dir /var/lib/php/dokuwiki/tmp 'attr(0770,root,www)' \
--dir /var/lib/php/dokuwiki/opcache 'attr(0770,root,www)' \
--dir /var/lib/php/dokuwiki/session 'attr(0770,root,www)' \
--ignoredir /usr/share/dokuwiki/lib/plugins \
> %{name}-%{version}-filelist
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)
%clean
rm -rf $RPM_BUILD_ROOT
%postun