initial commit

This commit is contained in:
Daniel Berteaud 2013-11-07 17:01:52 +01:00
commit 1fafc84198
9 changed files with 157 additions and 0 deletions

View File

@ -0,0 +1 @@
url

View File

@ -0,0 +1 @@
limesurvey

View File

@ -0,0 +1 @@
limesurvey

View File

@ -0,0 +1 @@
enabled

View File

@ -0,0 +1 @@
webapp

View File

@ -0,0 +1,27 @@
{
my $rec = $DB->get('limesurvey')
|| $DB->new_record('limesurvey', {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);
}
}

View File

@ -0,0 +1,64 @@
{
my $access = $limesurvey{'access'} || 'private';
my $allow = ($access eq 'public')?'all':"$localAccess $externalSSLAccess";
my $alias = (($limesurvey{'AliasOnPrimary'} || 'enabled') eq 'enabled') ?
'':"Alias /limesurvey/tmp /var/lib/limesurvey/tmp\n" .
"Alias /limesurvey/upload /var/lib/limesurvey/upload\n" .
"Alias /limesurvey /usr/share/limesurvey";
if ($limesurvey{'status'} eq 'enabled'){
$OUT .=<<"END"
# LimeSurvey Configuration
$alias
<Directory /usr/share/limesurvey>
AllowOverride None
SSLRequireSSL on
AddType application/x-httpd-php .php
php_admin_value open_basedir /usr/share/limesurvey:/var/lib/limesurvey
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 10M
php_admin_value post_max_size 12M
php_admin_value memory_limit 100M
php_admin_value max_execution_time 120
php_admin_value upload_tmp_dir /var/lib/limesurvey/tmp
php_admin_value session.save_path /var/lib/limesurvey/sessions
order deny,allow
deny from all
allow from $allow
Satisfy all
</Directory>
<DirectoryMatch "/var/lib/limesurvey/(tmp|upload)">
AllowOverride None
SSLRequireSSL on
AddType application/x-httpd-php .php
php_admin_value open_basedir /usr/share/limesurvey:/var/lib/limesurvey
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 10M
php_admin_value post_max_size 12M
php_admin_value memory_limit 100M
php_admin_value max_execution_time 120
php_admin_value upload_tmp_dir /var/lib/limesurvey/tmp
php_admin_value session.save_path /var/lib/limesurvey/sessions
order deny,allow
deny from all
allow from $allow
Satisfy all
</Directory>
<DirectoryMatch "/usr/share/limesurvey/(framework|console|installer/sql|locale)">
Deny from all
</Directory>
END
}
else{
$OUT .= "# LimeSurvey is disabled\n";
}
}

View File

@ -0,0 +1,12 @@
{
my $sslport = $modSSL{'TCPPort'} || '443';
my $status = $limesurvey{'status'} || 'enabled';
my $alias = $limesurvey{'AliasOnPrimary'} || 'enabled';
if (($port ne $sslport) && ($status eq 'enabled') && ($alias eq 'enabled')){
## Redirect Web Address to Secure Address
$OUT .= " RewriteRule ^/limesurvey(/.*|\$) https://%{HTTP_HOST}/limesurvey\$1 \[L,R\]\n";
}
}

49
smeserver-limesurvey.spec Normal file
View File

@ -0,0 +1,49 @@
%define name smeserver-limesurvey
%define version 0.1.0
%define release 1.beta0
Summary: SME server integration of limesurvey
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
License: GNU GPL version 2
URL: http://www.limesurvey.org
Group: SMEserver/addon
Source: %{name}-%{version}.tar.gz
BuildArchitectures: noarch
BuildRequires: e-smith-devtools
BuildRoot: /var/tmp/%{name}-%{version}
Requires: e-smith-base
Requires: limesurvey
Requires: smeserver-webapps-common
AutoReqProv: no
%description
Integration of LimeSUrvey on SME Server
%changelog
* Thu Nov 7 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.0-1.sme
- First release
%prep
%setup
%build
#perl ./createlinks
%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 \
> %{name}-%{version}-filelist
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)
%clean
rm -rf $RPM_BUILD_ROOT
%postun