commit
f05d6b7521
26 changed files with 396 additions and 0 deletions
@ -0,0 +1,12 @@ |
||||
#!/usr/bin/perl -w |
||||
|
||||
use esmith::Build::CreateLinks qw(:all); |
||||
|
||||
# Templates to expand |
||||
templates2events("/etc/e-smith/sql/init/openuploaddb", qw(bootstrap-console-save webapps-update)); |
||||
templates2events("/usr/share/openupload/www/config.inc.php", qw(bootstrap-console-save webapps-update)); |
||||
|
||||
# PHP header and footer |
||||
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/usr/share/openupload/www/config.inc.php/template-begin"); |
||||
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/usr/share/openupload/www/config.inc.php/template-end"); |
||||
|
@ -0,0 +1 @@ |
||||
url |
@ -0,0 +1 @@ |
||||
openuploaddb |
@ -0,0 +1 @@ |
||||
openuploaduser |
@ -0,0 +1 @@ |
||||
100 |
@ -0,0 +1 @@ |
||||
yes |
@ -0,0 +1 @@ |
||||
private |
@ -0,0 +1 @@ |
||||
enabled |
@ -0,0 +1 @@ |
||||
webapp |
@ -0,0 +1,33 @@ |
||||
{ |
||||
my $rec = $DB->get('openupload') |
||||
|| $DB->new_record('openupload', {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); |
||||
} |
||||
} |
||||
|
@ -0,0 +1 @@ |
||||
PERMS=0750 |
@ -0,0 +1,4 @@ |
||||
UID="root" |
||||
GID="www" |
||||
PERMS=0640 |
||||
|
@ -0,0 +1,51 @@ |
||||
{ |
||||
my $db = ${'openupload'}{'DbName'} || 'openuploaddb'; |
||||
my $user = ${'openupload'}{'DbUser'} || 'openuploaduser'; |
||||
my $pass = ${'openupload'}{'DbPassword'} || 'secret'; |
||||
|
||||
my $dbstruct = `rpm -ql openupload | grep mysql | grep structure`; |
||||
my $dbbase = `rpm -ql openupload | grep mysql | grep base`; |
||||
my $dbacl = `rpm -ql openupload | grep mysql | grep private`; |
||||
|
||||
|
||||
$OUT .= <<"END"; |
||||
#! /bin/sh |
||||
if [ ! -d /var/lib/mysql/$db ]; then |
||||
/usr/bin/mysql -e 'create database $db' |
||||
/usr/bin/mysql $db < $dbstruct |
||||
/usr/bin/mysql $db < $dbbase |
||||
/usr/bin/mysql $db < $dbacl |
||||
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; |
||||
EOF |
||||
END |
||||
} |
@ -0,0 +1,49 @@ |
||||
{ |
||||
my $access = $openupload{'access'} || 'private'; |
||||
my $allow = ($access eq 'public')?'all':"$localAccess $externalSSLAccess"; |
||||
my $maxsize = $openupload{'MaxUploadSize'} || '100'; |
||||
$maxsize=$maxsize.'M'; |
||||
|
||||
my $requiressl = (($openupload{'RequireSSL'} || 'yes') eq 'yes') ? |
||||
"SSLRequireSSL on":"# RequireSSL is disabled"; |
||||
|
||||
my $alias = (($openupload{'AliasOnPrimary'} || 'enabled') eq 'enabled') ? |
||||
'Alias /openupload /usr/share/openupload/www' : ''; |
||||
|
||||
if ($openupload{'status'} eq 'enabled'){ |
||||
|
||||
$OUT .=<<"END" |
||||
|
||||
# OpenUpload Configuration |
||||
$alias |
||||
|
||||
<Directory /usr/share/openupload/www> |
||||
AllowOverride None |
||||
$requiressl |
||||
AddType application/x-httpd-php .php |
||||
php_admin_value open_basedir /usr/share/openupload:/var/lib/openupload |
||||
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 $maxsize |
||||
php_admin_value post_max_size $maxsize |
||||
php_admin_value memory_limit $maxsize |
||||
php_admin_value max_execution_time 0 |
||||
php_admin_value upload_tmp_dir /var/lib/openupload/tmp |
||||
php_admin_value session.save_path /var/lib/openupload/tmp |
||||
order deny,allow |
||||
deny from all |
||||
allow from $allow |
||||
Satisfy all |
||||
<FilesMatch "config.inc.php"> |
||||
Order allow,deny |
||||
Deny from all |
||||
</FilesMatch> |
||||
</Directory> |
||||
|
||||
END |
||||
} |
||||
else{ |
||||
$OUT .= "# OpenUpload is disabled\n"; |
||||
} |
||||
} |
@ -0,0 +1,15 @@ |
||||
{ |
||||
my $sslport = $modSSL{'TCPPort'} || '443'; |
||||
my $alias = $openupload{'AliasOnPrimary'} || 'enabled'; |
||||
my $requiressl = $openupload{'RequireSSL'} || 'yes'; |
||||
|
||||
if (($port ne $sslport) && ($requiressl ne 'no') && ($alias ne 'disabled')){ |
||||
|
||||
## Redirect Web Address to Secure Address |
||||
$OUT .= " RewriteEngine on\n"; |
||||
$OUT .= " RewriteCond %{QUERY_STRING} action=login\n" if ($requiressl eq 'login'); |
||||
$OUT .= " RewriteRule ^/openupload(/.*|\$) https://%{HTTP_HOST}/openupload\$1 \[L,R\]\n"; |
||||
|
||||
} |
||||
} |
||||
|
@ -0,0 +1,9 @@ |
||||
|
||||
$CONFIG['WWW_SERVER'] = 'http://{"$SystemName.$DomainName";}'; |
||||
|
||||
$CONFIG['WWW_ROOT'] = '/openupload'; |
||||
|
||||
$CONFIG['INSTALL_ROOT'] = '/usr/share/openupload/'; |
||||
|
||||
$CONFIG['DATA_PATH'] = '/var/lib/openupload'; |
||||
|
@ -0,0 +1,8 @@ |
||||
|
||||
$CONFIG['database']['type'] = 'mysql'; |
||||
$CONFIG['database']['host'] = 'localhost'; |
||||
$CONFIG['database']['user'] = '{"$openupload{'DbUser'}";}'; |
||||
$CONFIG['database']['password'] = '{"$openupload{'DbPassword'}";}'; |
||||
$CONFIG['database']['name'] = '{"$openupload{'DbName'}";}'; |
||||
$CONFIG['database']['prefix'] = ''; |
||||
|
@ -0,0 +1,5 @@ |
||||
|
||||
$CONFIG['registration']['email_confirm'] = 'yes'; |
||||
$CONFIG['register']['nologingroup'] = 'unregistered'; |
||||
$CONFIG['register']['default_group'] = 'registered'; |
||||
|
@ -0,0 +1,7 @@ |
||||
|
||||
$CONFIG['site']['title'] = 'Open Upload'; |
||||
$CONFIG['site']['webmaster'] = 'admin@{"$DomainName";}'; |
||||
$CONFIG['site']['email'] = 'admin@{"$DomainName";}'; |
||||
$CONFIG['site']['footer'] = '<a href="http://openupload.sf.net">Open Upload</a> - Created by Alessandro Briosi © 2009'; |
||||
$CONFIG['site']['template'] = 'default'; |
||||
|
@ -0,0 +1,17 @@ |
||||
|
||||
$CONFIG['max_upload_size'] = '{"$openupload{'MaxUploadSize'}";}'; |
||||
|
||||
$CONFIG['use_short_links'] = 'yes'; |
||||
|
||||
$CONFIG['id_max_length'] = '10'; |
||||
|
||||
$CONFIG['id_use_alpha'] = 'yes'; |
||||
|
||||
$CONFIG['max_download_time'] = '0'; |
||||
|
||||
$CONFIG['multiupload'] = '{"$openupload{'MaxUpload'}";}'; |
||||
|
||||
$CONFIG['allow_unprotected_removal'] = ''; |
||||
|
||||
$CONFIG['progress'] = 'none'; |
||||
|
@ -0,0 +1,5 @@ |
||||
|
||||
$CONFIG['translator'] = 'phparray'; |
||||
|
||||
$CONFIG['defaultlang'] = 'en'; |
||||
|
@ -0,0 +1,5 @@ |
||||
|
||||
$CONFIG['logging']['enabled'] = 'yes'; |
||||
$CONFIG['logging']['db_level'] = '4'; |
||||
$CONFIG['logging']['syslog_level'] = '0'; |
||||
|
@ -0,0 +1,9 @@ |
||||
|
||||
$CONFIG['plugins']['0'] = 'captcha'; |
||||
$CONFIG['plugins']['1'] = 'compress'; |
||||
$CONFIG['plugins']['2'] = 'email'; |
||||
$CONFIG['plugins']['3'] = 'expire'; |
||||
$CONFIG['plugins']['4'] = 'filesize'; |
||||
$CONFIG['plugins']['5'] = 'mimetypes'; |
||||
$CONFIG['plugins']['6'] = 'password'; |
||||
|
@ -0,0 +1,49 @@ |
||||
{ |
||||
|
||||
my $auth = $openupload{'Authentication'} || 'ldap'; |
||||
my $ldapbase = esmith::util::ldapBase($DomainName); |
||||
|
||||
if ($auth eq 'imap'){ |
||||
$OUT .=<<"EOF"; |
||||
|
||||
\$CONFIG['auth'] = 'imap'; |
||||
\$CONFIG['imap']['server'] = "\{localhost/imap/notls\}"; |
||||
\$CONFIG['imap']['domain'] = "$DomainName"; |
||||
\$CONFIG['imap']['default_group'] = 'registered'; |
||||
|
||||
EOF |
||||
} |
||||
elsif ($auth eq 'database' or $auth eq 'internal'){ |
||||
$OUT .=<<"EOF"; |
||||
|
||||
\$CONFIG['auth'] = 'default'; |
||||
|
||||
EOF |
||||
} |
||||
elsif ($auth eq 'ldap' or $auth eq 'LemonLDAP'){ |
||||
|
||||
if ($auth eq 'ldap'){ |
||||
$OUT .= "\$CONFIG['auth'] = 'ldap';\n"; |
||||
} |
||||
elsif ($auth eq 'LemonLDAP'){ |
||||
$OUT .= "\$CONFIG['auth'] = 'httpldap';\n"; |
||||
$OUT .= "\$CONFIG['httpldap']['login'] = 'HTTP_AUTH_USER';\n"; |
||||
} |
||||
$OUT .=<<"EOF"; |
||||
|
||||
\$CONFIG['ldap']['host'] = '127.0.0.1'; |
||||
\$CONFIG['ldap']['basedn'] = "$ldapbase"; |
||||
\$CONFIG['ldap']['userdn'] = 'ou=Users,$ldapbase'; |
||||
\$CONFIG['ldap']['userclass'] = 'inetOrgPerson'; |
||||
\$CONFIG['ldap']['uid'] = 'uid'; |
||||
\$CONFIG['ldap']['userfields'] = array ( 'uid' => 'login', 'cn' => 'name', 'gidnumber' => 'group_id', 'mail' => 'email'); |
||||
\$CONFIG['ldap']['groupdn'] = 'ou=Groups,$ldapbase'; |
||||
\$CONFIG['ldap']['groupclass'] = 'mailboxRelatedObject'; |
||||
\$CONFIG['ldap']['gid'] = 'gidNumber'; |
||||
\$CONFIG['ldap']['sgid'] = 'memberUid'; |
||||
\$CONFIG['ldap']['groupfields'] = array ( 'cn' => 'name', 'description' => 'description' ); |
||||
\$CONFIG['ldap']['sgroupfields'] = array ( 'cn' => 'name', 'description' => 'description' ); |
||||
|
||||
EOF |
||||
} |
||||
} |
@ -0,0 +1,108 @@ |
||||
# Authority: vip-ire |
||||
# Name: Daniel Berteaud |
||||
|
||||
%define name smeserver-openupload |
||||
%define version 0.1 |
||||
%define release 11 |
||||
Summary: sme server integration of openupload |
||||
Name: %{name} |
||||
Version: %{version} |
||||
Release: %{release}%{?dist} |
||||
License: GNU GPL version 2 |
||||
URL: http://openupload.sourceforge.net/ |
||||
Group: SMEserver/addon |
||||
Source: %{name}-%{version}.tar.gz |
||||
Patch1: smeserver-openupload-0.1-session_save_path.patch |
||||
Patch2: smeserver-openupload-0.1-prop_alias_on_primary.patch |
||||
Patch3: smeserver-openupload-0.1-support_lemonldap_auth.patch |
||||
Patch4: smeserver-openupload-0.1-fix_ldap_auth_config.patch |
||||
Patch5: smeserver-openupload-0.1-make_ldap_the_default_auth.patch |
||||
Patch6: smeserver-openupload-0.1-dont_rewrite_if_alias_is_disabled.patch |
||||
Patch7: smeserver-openupload-0.1-add_login_field.patch |
||||
Patch8: smeserver-openupload-0.1-fix_defaults_db.patch |
||||
Patch9: smeserver-openupload-0.1-remove_default_auth.patch |
||||
Patch10: smeserver-openupload-0.1-fix_public_access.patch |
||||
|
||||
BuildArchitectures: noarch |
||||
BuildRequires: e-smith-devtools |
||||
BuildRoot: /var/tmp/%{name}-%{version} |
||||
Requires: e-smith-base >= 5.2.0-56 |
||||
Requires: openupload |
||||
Requires: smeserver-webapps-common |
||||
AutoReqProv: no |
||||
|
||||
%description |
||||
smserver integration of openupload. |
||||
OpenUpload is an open source application to share files over |
||||
the internet (like MegaUpload or RapidShare for example) |
||||
|
||||
%changelog |
||||
* Wed Oct 19 2011 Daniel Berteaud <daniel@firewall-services.com> 0.1-11.sme |
||||
- Fix public access property handling |
||||
|
||||
* Thu Jul 21 2011 Daniel Berteaud <daniel@firewall-services.com> 0.1-10.sme |
||||
- Remove DB fragment for authentication |
||||
|
||||
* Mon Jul 11 2011 Daniel Berteaud <daniel@firrewall-services.com> 0.1-9 |
||||
- Fix accounts defaults fragments location |
||||
|
||||
* Wed May 04 2011 Daniel B. <daniel@firewall-services.com> 0.1-8 |
||||
- Requires e-smith-base >= 5.2.0-56 |
||||
|
||||
* Thu Feb 17 2011 Daniel B. <daniel@firewall-services.com> 0.1-7 |
||||
- Add default login field for httpldap auth |
||||
|
||||
* Mon Jan 31 2011 Daniel B. <daniel@firewall-services.com> 0.1-6 |
||||
- Fix templates for LDAP auth |
||||
- LDAP is now the default auth |
||||
- Don't add useless rewriterules in apache if alias is disabled |
||||
- Stop disabling openupload on rpm removal |
||||
|
||||
* Wed Jan 05 2011 Daniel B. <daniel@firewall-services.com> 0.1-5 |
||||
- Add AliasOnPrimary prop |
||||
- Support LemonLDAP auth |
||||
|
||||
* Tue Dec 14 2010 Daniel B. <daniel@firewall-services.com> 0.1-4 |
||||
- Revert previous change |
||||
|
||||
* Tue Nov 23 2010 Daniel B. <daniel@firewall-services.com> 0.1-3 |
||||
- Change owner and group from apache to www |
||||
|
||||
* Thu Mar 11 2010 Daniel B. <daniel@firewall-services.com> 0.1-2 |
||||
- put session files in /var/lib/openupload/tmp to prevent conflicts |
||||
|
||||
* Tue Mar 09 2010 Daniel B. <daniel@firewall-services.com> 0.1-1 |
||||
- initial release |
||||
|
||||
%prep |
||||
%setup |
||||
%patch1 -p1 |
||||
%patch2 -p1 |
||||
%patch3 -p1 |
||||
%patch4 -p1 |
||||
%patch5 -p1 |
||||
%patch6 -p1 |
||||
%patch7 -p1 |
||||
%patch8 -p1 |
||||
%patch9 -p1 |
||||
%patch10 -p1 |
||||
|
||||
%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 |
||||
|
Loading…
Reference in new issue