Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar.sh 1530 2014-12-21 19:59:20Z richard $
|
2 |
# $Id: alcasar.sh 1532 2014-12-21 21:39:52Z richard $
|
3 |
|
3 |
|
4 |
# alcasar.sh
|
4 |
# alcasar.sh
|
5 |
|
5 |
|
6 |
# ALCASAR Install script - CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...]
|
6 |
# ALCASAR Install script - CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...]
|
7 |
# Ce programme est un logiciel libre ; This software is free and open source
|
7 |
# Ce programme est un logiciel libre ; This software is free and open source
|
Line 648... |
Line 648... |
648 |
# Configuration et sécurisation Apache
|
648 |
# Configuration et sécurisation Apache
|
649 |
rm -rf /var/www/cgi-bin/* /var/www/perl/* /var/www/icons/README* /var/www/error/README*
|
649 |
rm -rf /var/www/cgi-bin/* /var/www/perl/* /var/www/icons/README* /var/www/error/README*
|
650 |
[ -e /etc/httpd/conf/httpd.conf.default ] || cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.default
|
650 |
[ -e /etc/httpd/conf/httpd.conf.default ] || cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.default
|
651 |
$SED "s?^#ServerName.*?ServerName $HOSTNAME.$DOMAIN?g" /etc/httpd/conf/httpd.conf
|
651 |
$SED "s?^#ServerName.*?ServerName $HOSTNAME.$DOMAIN?g" /etc/httpd/conf/httpd.conf
|
652 |
$SED "s?^Listen.*?Listen $PRIVATE_IP:80?g" /etc/httpd/conf/httpd.conf
|
652 |
$SED "s?^Listen.*?Listen $PRIVATE_IP:80?g" /etc/httpd/conf/httpd.conf
|
653 |
$SED "s?^ServerTokens.*?ServerTokens Prod?g" /etc/httpd/conf/httpd.conf
|
653 |
$SED "s?Options Indexes.*?Options -Indexes?g" /etc/httpd/conf/httpd.conf
|
- |
|
654 |
echo "ServerTokens Prod" >> /etc/httpd/conf/httpd.conf
|
654 |
$SED "s?^ServerSignature.*?ServerSignature Off?g" /etc/httpd/conf/httpd.conf
|
655 |
echo "ServerSignature Off" >> /etc/httpd/conf/httpd.conf
|
655 |
$SED "s?^#ErrorDocument 404 /missing.html.*?ErrorDocument 404 /index.html?g" /etc/httpd/conf/httpd.conf
|
656 |
[ -e /etc/httpd/conf/modules.d/00_base.conf.default ] || cp /etc/httpd/conf/modules.d/00_base.conf /etc/httpd/conf/modules.d/00_base.conf.default
|
656 |
$SED "s?^LoadModule authn_anon_module.*?#LoadModule authn_anon_module modules/mod_authn_anon.so?g" /etc/httpd/conf/httpd.conf
|
657 |
$SED "s?^LoadModule authn_anon_module.*?#LoadModule authn_anon_module modules/mod_authn_anon.so?g" /etc/httpd/conf/modules.d/00_base.conf
|
657 |
$SED "s?^LoadModule status_module.*?#LoadModule status_module modules/mod_status.so?g" /etc/httpd/conf/httpd.conf
|
658 |
$SED "s?^LoadModule status_module.*?#LoadModule status_module modules/mod_status.so?g" /etc/httpd/conf/modules.d/00_base.conf
|
658 |
$SED "s?^LoadModule autoindex_module.*?#LoadModule autoindex_module modules/mod_autoindex.so?g" /etc/httpd/conf/httpd.conf
|
659 |
$SED "s?^LoadModule autoindex_module.*?#LoadModule autoindex_module modules/mod_autoindex.so?g" /etc/httpd/conf/modules.d/00_base.conf
|
659 |
$SED "s?^LoadModule info_module.*?#LoadModule info_module modules/mod_info.so?g" /etc/httpd/conf/httpd.conf
|
660 |
$SED "s?^LoadModule info_module.*?#LoadModule info_module modules/mod_info.so?g" /etc/httpd/conf/modules.d/00_base.conf
|
660 |
$SED "s?^LoadModule imagemap_module.*?#LoadModule imagemap_module modules/mod_imagemap.so?g" /etc/httpd/conf/httpd.conf
|
661 |
$SED "s?^LoadModule imagemap_module.*?#LoadModule imagemap_module modules/mod_imagemap.so?g" /etc/httpd/conf/modules.d/00_base.conf
|
661 |
$SED "s?^LoadModule rewrite_module.*?#LoadModule rewrite_module modules/mod_rewrite.so?g" /etc/httpd/conf/httpd.conf
|
662 |
$SED "s?^LoadModule rewrite_module.*?#LoadModule rewrite_module modules/mod_rewrite.so?g" /etc/httpd/conf/modules.d/00_base.conf
|
662 |
$SED "s?LoadModule speling_module.*?LoadModule speling_module modules/mod_speling.so?g" /etc/httpd/conf/httpd.conf
|
663 |
$SED "s?^LoadModule speling_module.*?#LoadModule speling_module modules/mod_speling.so?g" /etc/httpd/conf/modules.d/00_base.conf
|
663 |
[ -e /etc/httpd/conf/conf.d/ssl.conf.default ] || cp /etc/httpd/conf/conf.d/ssl.conf /etc/httpd/conf/conf.d/ssl.conf.default
|
664 |
[ -e /etc/httpd/conf/conf.d/ssl.conf.default ] || cp /etc/httpd/conf/conf.d/ssl.conf /etc/httpd/conf/conf.d/ssl.conf.default
|
664 |
$SED "s?^Listen.*?Listen $PRIVATE_IP:443?g" /etc/httpd/conf/conf.d/ssl.conf # Listen only on INTIF
|
665 |
$SED "s?^Listen.*?Listen $PRIVATE_IP:443?g" /etc/httpd/conf/conf.d/ssl.conf # Listen only on INTIF
|
- |
|
666 |
# Error page management
|
- |
|
667 |
FIC_ERROR_DOC=`find /etc/httpd/conf -type f -name multilang-errordoc.conf`
|
- |
|
668 |
[ -e $FIC_ERROR_DOC ] || cp $FIC_ERROR_DOC $FIC_ERROR_DOC.default
|
- |
|
669 |
cat <<EOF > $FIC_ERROR_DOC
|
- |
|
670 |
Alias /error/ "/var/www/html/"
|
- |
|
671 |
<Directory "/usr/share/httpd/error">
|
- |
|
672 |
AllowOverride None
|
- |
|
673 |
Options IncludesNoExec
|
- |
|
674 |
AddOutputFilter Includes html
|
- |
|
675 |
AddHandler type-map var
|
- |
|
676 |
Require all granted
|
- |
|
677 |
LanguagePriority en cs de es fr it ja ko nl pl pt-br ro sv tr
|
- |
|
678 |
ForceLanguagePriority Prefer Fallback
|
- |
|
679 |
</Directory>
|
- |
|
680 |
ErrorDocument 400 /error/error.php?error=400
|
- |
|
681 |
ErrorDocument 401 /error/error.php?error=401
|
- |
|
682 |
ErrorDocument 403 /error/error.php?error=403
|
- |
|
683 |
ErrorDocument 404 /error/error.php?error=404
|
- |
|
684 |
ErrorDocument 405 /error/error.php?error=405
|
- |
|
685 |
ErrorDocument 408 /error/error.php?error=408
|
- |
|
686 |
ErrorDocument 410 /error/error.php?error=410
|
- |
|
687 |
ErrorDocument 411 /error/error.php?error=411
|
- |
|
688 |
ErrorDocument 412 /error/error.php?error=412
|
- |
|
689 |
ErrorDocument 413 /error/error.php?error=413
|
- |
|
690 |
ErrorDocument 414 /error/error.php?error=414
|
- |
|
691 |
ErrorDocument 415 /error/error.php?error=415
|
- |
|
692 |
ErrorDocument 500 /error/error.php?error=500
|
- |
|
693 |
ErrorDocument 501 /error/error.php?error=501
|
- |
|
694 |
ErrorDocument 502 /error/error.php?error=502
|
- |
|
695 |
ErrorDocument 503 /error/error.php?error=503
|
- |
|
696 |
ErrorDocument 506 /error/error.php?error=506
|
- |
|
697 |
EOF
|
665 |
[ -e /usr/share/httpd/error/include/top.html.default ] || cp /usr/share/httpd/error/include/top.html /usr/share/httpd/error/include/top.html.default
|
698 |
[ -e /usr/share/httpd/error/include/top.html.default ] || cp /usr/share/httpd/error/include/top.html /usr/share/httpd/error/include/top.html.default
|
666 |
$SED "s?background-color.*?background-color: #EFEFEF; }?g" /usr/share/httpd/error/include/top.html
|
699 |
$SED "s?background-color.*?background-color: #EFEFEF; }?g" /usr/share/httpd/error/include/top.html
|
667 |
[ -e /usr/share/httpd/error/include/bottom.html.default ] || cp /usr/share/httpd/error/include/bottom.html /usr/share/httpd/error/include/bottom.html.default
|
700 |
[ -e /usr/share/httpd/error/include/bottom.html.default ] || cp /usr/share/httpd/error/include/bottom.html /usr/share/httpd/error/include/bottom.html.default
|
668 |
cat <<EOF > /usr/share/httpd/error/include/bottom.html
|
701 |
cat <<EOF > /usr/share/httpd/error/include/bottom.html
|
669 |
</body>
|
702 |
</body>
|
Line 784... |
Line 817... |
784 |
AuthType digest
|
817 |
AuthType digest
|
785 |
AuthName $HOSTNAME.$DOMAIN
|
818 |
AuthName $HOSTNAME.$DOMAIN
|
786 |
AuthUserFile $DIR_DEST_ETC/digest/key_backup
|
819 |
AuthUserFile $DIR_DEST_ETC/digest/key_backup
|
787 |
ErrorDocument 404 https://$HOSTNAME.$DOMAIN/
|
820 |
ErrorDocument 404 https://$HOSTNAME.$DOMAIN/
|
788 |
</Directory>
|
821 |
</Directory>
|
789 |
<Directory $DIR_ACC/stats>
|
- |
|
790 |
SSLRequireSSL
|
- |
|
791 |
AllowOverride None
|
- |
|
792 |
Order deny,allow
|
- |
|
793 |
Deny from all
|
- |
|
794 |
Allow from 127.0.0.1
|
- |
|
795 |
Allow from $PRIVATE_NETWORK_MASK
|
- |
|
796 |
# Allow from AA.BB.CC.DD/32 # Allow from specific @IP
|
- |
|
797 |
require valid-user
|
- |
|
798 |
AuthType digest
|
- |
|
799 |
AuthName $HOSTNAME.$DOMAIN
|
- |
|
800 |
BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
|
- |
|
801 |
AuthUserFile $DIR_DEST_ETC/digest/key_manager
|
- |
|
802 |
ErrorDocument 404 https://$HOSTNAME.$DOMAIN/
|
- |
|
803 |
</Directory>
|
- |
|
804 |
EOF
|
822 |
EOF
|
805 |
# Launch after coova
|
823 |
# Launch after coova
|
806 |
$SED "s?^After=.*?After=network.target remote-fs.target nss-lookup.target chilli.service?g" /lib/systemd/system/httpd.service
|
824 |
$SED "s?^After=.*?After=network.target remote-fs.target nss-lookup.target chilli.service?g" /lib/systemd/system/httpd.service
|
807 |
# Error page management
|
- |
|
808 |
FIC_ERROR_DOC=`find /etc/httpd/conf -type f -name multilang-errordoc.conf`
|
- |
|
809 |
[ -e $FIC_ERROR_DOC ] || cp $FIC_ERROR_DOC $FIC_ERROR_DOC.default
|
- |
|
810 |
|
- |
|
811 |
cat <<EOF > $FIC_ERROR_DOC
|
- |
|
812 |
Alias /error/ "/var/www/html/"
|
- |
|
813 |
|
- |
|
814 |
<Directory "/usr/share/httpd/error">
|
- |
|
815 |
AllowOverride None
|
- |
|
816 |
Options IncludesNoExec
|
- |
|
817 |
AddOutputFilter Includes html
|
- |
|
818 |
AddHandler type-map var
|
- |
|
819 |
Require all granted
|
- |
|
820 |
LanguagePriority en cs de es fr it ja ko nl pl pt-br ro sv tr
|
- |
|
821 |
ForceLanguagePriority Prefer Fallback
|
- |
|
822 |
</Directory>
|
- |
|
823 |
|
- |
|
824 |
ErrorDocument 400 /error/error.php?error=400
|
- |
|
825 |
ErrorDocument 401 /error/error.php?error=401
|
- |
|
826 |
ErrorDocument 403 /error/error.php?error=403
|
- |
|
827 |
ErrorDocument 404 /error/error.php?error=404
|
- |
|
828 |
ErrorDocument 405 /error/error.php?error=405
|
- |
|
829 |
ErrorDocument 408 /error/error.php?error=408
|
- |
|
830 |
ErrorDocument 410 /error/error.php?error=410
|
- |
|
831 |
ErrorDocument 411 /error/error.php?error=411
|
- |
|
832 |
ErrorDocument 412 /error/error.php?error=412
|
- |
|
833 |
ErrorDocument 413 /error/error.php?error=413
|
- |
|
834 |
ErrorDocument 414 /error/error.php?error=414
|
- |
|
835 |
ErrorDocument 415 /error/error.php?error=415
|
- |
|
836 |
ErrorDocument 500 /error/error.php?error=500
|
- |
|
837 |
ErrorDocument 501 /error/error.php?error=501
|
- |
|
838 |
ErrorDocument 502 /error/error.php?error=502
|
- |
|
839 |
ErrorDocument 503 /error/error.php?error=503
|
- |
|
840 |
ErrorDocument 506 /error/error.php?error=506
|
- |
|
841 |
EOF
|
- |
|
842 |
|
- |
|
843 |
# Initialization of Vnstat
|
825 |
# Initialization of Vnstat
|
844 |
[ -e /etc/vnstat.conf.default ] || cp /etc/vnstat.conf /etc/vnstat.conf.default
|
826 |
[ -e /etc/vnstat.conf.default ] || cp /etc/vnstat.conf /etc/vnstat.conf.default
|
845 |
$SED "s?Interface.*?Interface \"$EXTIF\"?g" /etc/vnstat.conf
|
827 |
$SED "s?Interface.*?Interface \"$EXTIF\"?g" /etc/vnstat.conf
|
846 |
/usr/bin/vnstat -u -i $EXTIF
|
828 |
/usr/bin/vnstat -u -i $EXTIF
|
847 |
|
- |
|
848 |
} # End of ACC ()
|
829 |
} # End of ACC ()
|
849 |
|
830 |
|
850 |
##########################################################################################
|
831 |
##########################################################################################
|
851 |
## Fonction "CA" ##
|
832 |
## Fonction "CA" ##
|
852 |
## - Création d'une Autorité de Certification et du certificat serveur pour apache ##
|
833 |
## - Création d'une Autorité de Certification et du certificat serveur pour apache ##
|
Line 854... |
Line 835... |
854 |
CA ()
|
835 |
CA ()
|
855 |
{
|
836 |
{
|
856 |
$DIR_DEST_BIN/alcasar-CA.sh
|
837 |
$DIR_DEST_BIN/alcasar-CA.sh
|
857 |
FIC_VIRTUAL_SSL=`find /etc/httpd/conf -type f -name *default_ssl_vhost.conf`
|
838 |
FIC_VIRTUAL_SSL=`find /etc/httpd/conf -type f -name *default_ssl_vhost.conf`
|
858 |
[ -e /etc/httpd/conf/vhosts-ssl.default ] || cp $FIC_VIRTUAL_SSL /etc/httpd/conf/vhosts-ssl.default
|
839 |
[ -e /etc/httpd/conf/vhosts-ssl.default ] || cp $FIC_VIRTUAL_SSL /etc/httpd/conf/vhosts-ssl.default
|
859 |
|
- |
|
860 |
#$SED "s?localhost.crt?alcasar.crt?g" $FIC_VIRTUAL_SSL
|
- |
|
861 |
#$SED "s?localhost.key?alcasar.key?g" $FIC_VIRTUAL_SSL
|
- |
|
862 |
#$SED "s?^#SSLCertificateChainFile.*?SSLCertificateChainFile /etc/pki/tls/certs/server-chain.crt?" $FIC_VIRTUAL_SSL
|
- |
|
863 |
|
- |
|
864 |
cat <<EOF > $FIC_VIRTUAL_SSL
|
840 |
cat <<EOF > $FIC_VIRTUAL_SSL
|
865 |
# default SSL virtual host, used for all HTTPS requests that do not
|
841 |
# default SSL virtual host, used for all HTTPS requests that do not
|
866 |
# match a ServerName or ServerAlias in any <VirtualHost> block.
|
842 |
# match a ServerName or ServerAlias in any <VirtualHost> block.
|
867 |
|
843 |
|
868 |
<VirtualHost _default_:443>
|
844 |
<VirtualHost _default_:443>
|