Difference between revisions of "OwnCloud"
(→Felhasználói kézikönyv=) |
(→Apache beállítások) |
||
Line 72: | Line 72: | ||
==Apache beállítások== | ==Apache beállítások== | ||
+ | |||
+ | ===Virtuális hoszt=== | ||
+ | |||
+ | <source> | ||
+ | <VirtualHost *:443> | ||
+ | ServerAdmin adam@proarcok.com | ||
+ | ServerName owncloud.berki2.org:443 | ||
+ | ServerAlias owncloud.berki2.org:443 | ||
+ | ErrorLog logs/owncloud.berki2.org-error_log | ||
+ | CustomLog logs/owncloud.berki2.org-access_log common | ||
+ | |||
+ | ##Fel evre garantaljuk, hogy HTTPS-en maradunk | ||
+ | Header always set Strict-Transport-Security "max-age=15768000; includeSubdomains;" | ||
+ | |||
+ | |||
+ | ########################## | ||
+ | # SSL beállítások | ||
+ | ########################## | ||
+ | |||
+ | # SSL parameterek | ||
+ | ########################## | ||
+ | SSLEngine on | ||
+ | |||
+ | # Here, I am allowing only "high" and "medium" security key lengths. | ||
+ | SSLCipherSuite HIGH:MEDIUM | ||
+ | |||
+ | # Here I am allowing SSLv3 and TLSv1, I am NOT allowing the old SSLv2. | ||
+ | SSLProtocol all -SSLv2 | ||
+ | |||
+ | |||
+ | # Szerver kulcsok | ||
+ | ########################## | ||
+ | |||
+ | # Server Certificate: | ||
+ | SSLCertificateFile /etc/httpd/ssl/owncloud.berki2.org-server.cer | ||
+ | |||
+ | # Server Private Key: | ||
+ | SSLCertificateKeyFile /etc/httpd/ssl/owncloud.berki2.org-server.key | ||
+ | |||
+ | ############################ | ||
+ | |||
+ | DocumentRoot "/var/www/html/owncloud/" | ||
+ | |||
+ | #Alias /owncloud "/var/www/html/owncloud/" | ||
+ | <Directory "/var/www/html/owncloud"> | ||
+ | Options +FollowSymLinks | ||
+ | AllowOverride All | ||
+ | |||
+ | <IfModule mod_dav.c> | ||
+ | Dav off | ||
+ | </IfModule> | ||
+ | |||
+ | SetEnv HOME /var/www/html/owncloud | ||
+ | SetEnv HTTP_HOME /var/www/html/owncloud | ||
+ | </Directory> | ||
+ | |||
+ | <Directory "/var/www/html/owncloud/data/"> | ||
+ | # just in case if .htaccess gets disabled | ||
+ | Require all denied | ||
+ | </Directory> | ||
+ | |||
+ | |||
+ | </VirtualHost> | ||
+ | |||
+ | |||
+ | <source> | ||
+ | |||
===HSTS=== | ===HSTS=== |
Revision as of 13:41, 15 October 2016
Contents
PHP frissítése
Az OwnCloud 9.x használatához legalább PHP 5.6 ra van szükség. Ehhez fel kell telepíteni a "remi" repozitorikat:
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
Kapcsoljuk be az alap "remi" repo használatát valamint a php56 repot:
/etc/yum.repos.d/remi.repo
[remi] name=Les RPM de remi pour Enterprise Linux 6 - $basearch #baseurl=http://rpms.famillecollet.com/enterprise/6/remi/$basearch/ mirrorlist=http://rpms.famillecollet.com/enterprise/6/remi/mirror enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi ... [remi-php56] name=Les RPM de remi de PHP 5.6 pour Enterprise Linux 6 - $basearch #baseurl=http://rpms.famillecollet.com/enterprise/6/php56/$basearch/ mirrorlist=http://rpms.famillecollet.com/enterprise/6/php56/mirror # WARNING: If you enable this repository, you must also enable "remi" enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Majd frissítsük a PHP-t.
yum update php*
Ellenőrizzük az php verziót:
# php -v PHP 5.6.26 (cli) (built: Sep 15 2016 14:57:05) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
Telepítés és beállítások
ownCloud repos: http://download.owncloud.org/download/repositories/9.1/owncloud/
Csináltam egy új virtualhosztot.
user: adam/liteon
dataFolder: /var/www/html/owncloud/data
cp foo.crt /etc/pki/ca-trust/source/anchors/
Use command:
update-ca-trust extract
{'password': <'liteon'>}
https://www.happyassassin.net/cgit/user_http_external/tree/README.md
Apache beállítások
Virtuális hoszt
<source> <VirtualHost *:443> ServerAdmin adam@proarcok.com ServerName owncloud.berki2.org:443
ServerAlias owncloud.berki2.org:443 ErrorLog logs/owncloud.berki2.org-error_log CustomLog logs/owncloud.berki2.org-access_log common
##Fel evre garantaljuk, hogy HTTPS-en maradunk Header always set Strict-Transport-Security "max-age=15768000; includeSubdomains;"
########################## # SSL beállítások ##########################
# SSL parameterek ########################## SSLEngine on
# Here, I am allowing only "high" and "medium" security key lengths. SSLCipherSuite HIGH:MEDIUM
# Here I am allowing SSLv3 and TLSv1, I am NOT allowing the old SSLv2. SSLProtocol all -SSLv2
# Szerver kulcsok
##########################
# Server Certificate: SSLCertificateFile /etc/httpd/ssl/owncloud.berki2.org-server.cer
# Server Private Key: SSLCertificateKeyFile /etc/httpd/ssl/owncloud.berki2.org-server.key
############################
DocumentRoot "/var/www/html/owncloud/"
#Alias /owncloud "/var/www/html/owncloud/" <Directory "/var/www/html/owncloud">
Options +FollowSymLinks AllowOverride All
<IfModule mod_dav.c> Dav off </IfModule>
SetEnv HOME /var/www/html/owncloud SetEnv HTTP_HOME /var/www/html/owncloud
</Directory>
<Directory "/var/www/html/owncloud/data/">
# just in case if .htaccess gets disabled Require all denied
</Directory>
</VirtualHost>
<source>
HSTS
(HTTP Strict Transport Security)
A HSTS egy biztonsági kiegészítése a https protokollnak, amit az RFC 6797 ír le: (https://tools.ietf.org/html/rfc6797 ). Ha a HSTS az apache szerveren be van kapcsolva egy HTTPS alatt kommunikáló virtuális hoszton, akkor a szerver a válaszba elhelyez egy HTST header-t is, amiben egy vállalást tesz arra, hogy legalább az itt megadott ideig (általában fél év) az adott hosztot kizárólag HTTPS alatt fogja futtatni. Ha a kliens (böngésző vagy más mobilos alkalmazás) HSTS képes, akkor el fogja menteni ezt az információt az adott hoszt névhez. Ha bármilyen módon megpróbálná később egy támadó a HTTPS kommunikációt HTTP-re terelni (akár egy hamis oldalon keresztül) a böngésző nem lesz hajlandó kommunikálni HTTP felett amíg a vállalás le nem jár. Sikeres kapcsolat esetén a vállalás ideje mindig újraindul.
A httpd.conf-ban töltsük be a htst modult.
/etc/httpd/conf/httpd.conf
... LoadModule headers_module modules/mod_headers.so ...
Ezután a HTTPS-es (443) virtuális hoszt konfigurációjába be kell kapcsolni a HSTS header használatát, és meg kell adni a vállalási időt is.
/etc/httpd/vhosts.d/owncloud.berki.org.443.conf
... Header always set Strict-Transport-Security "max-age=15768000; includeSubdomains;" ...
A max-age paramétert másodpercben kell megadni, mi fél évet állítunk be.
Indítsuk újra az apache-ot.
# service httpd restart
Majd nyissuk meg megint a https://owncloud.berki2.org oldalt. Nézzük meg a fogadott fejléceket a Firefox fejlesztői eszközben.
A Firefox a HSTS információkat a iteSecurityServiceState.txt fájlban tárolja:
$ cat /home/adam/.mozilla/firefox/61og30yv.default/SiteSecurityServiceState.txt | grep berki2 owncloud.berki2.org:HSTS 0 17089 1492295509620,1,1
Memória cache bekapcsolása
# yum install php-pecl-zendopcache
Cron job beállítása
Állítsjuk be, hogy az owncloud system cront-t használjon:
Majd hozzuk létre a cron fájlt
/etc/cron.d/owncloud
*/15 * * * * apache /usr/bin/php -f /var/www/html/owncloud/cron.php
És adjunk rá megfelelő jogot:
# chmod 644 ownlcoud
Kiegészítők
Vírus szűrés
Kapcsoljuk be a " Antivirus App for files " kiegészítőt.
Majd konfiguráljuk. A ClamAV-t a socket-en keresztül kell hívja: /var/run/clamav/clamd.sock
SELinux
Ahhoz hogy a HTTP (owncloud) hozzáférjen a ClamAV sockethez (/var/run/clamav/clamd.sock) szükség van egy új SELinux szabályra.
Hozzuk létre a owncloudSELinux.te fájlt.
module mypol 1.0; require { type httpd_t; type antivirus_var_run_t; class sock_file write; } #============= httpd_t ============== allow httpd_t antivirus_var_run_t:sock_file write;
Majd fordítsuk le és töltsük be:
# checkmodule -M -m -o owncloudSELinux.mod owncloudSELinux.te # semodule_package -o owncloudSELinux.pp -m owncloudSELinux.mod # semodule -i owncloudSELinux.pp
Tesztelés
Töltsünk le innen egy teszt vírust:
A webes felületen keresztül töltsük fel. A képernyőn megjelenik a figyelmeztetés:
A /var/log/messages fájlban láthatjuk hogy a ClamAV vírusnak titulálta a fájlt:
Oct 15 13:38:08 centostest clamd[1182]: instream(local): Eicar-Test-Signature FOUND