|
Lines 71-78
Options:
Link Here
|
| 71 |
conjunction with --defaultsql and --populate-db. |
71 |
conjunction with --defaultsql and --populate-db. |
| 72 |
--upload-path dir Set a user defined upload_path. It defaults to |
72 |
--upload-path dir Set a user defined upload_path. It defaults to |
| 73 |
/var/lib/koha/<instance>/uploads |
73 |
/var/lib/koha/<instance>/uploads |
| 74 |
--force-https Set up a https-only site with letsencrypt certificates |
74 |
--letsencrypt Set up a https-only site with letsencrypt certificates |
| 75 |
--letsencrypt Path to the letsencrypt folder |
|
|
| 76 |
--help,-h Show this help. |
75 |
--help,-h Show this help. |
| 77 |
|
76 |
|
| 78 |
Note: the instance name cannot be longer that 11 chars. |
77 |
Note: the instance name cannot be longer that 11 chars. |
|
Lines 195-205
EOM
Link Here
|
| 195 |
fi |
194 |
fi |
| 196 |
|
195 |
|
| 197 |
# Check that mod_ssl is installed and enabled. |
196 |
# Check that mod_ssl is installed and enabled. |
| 198 |
if [ "$USE_HTTPS" = "yes" ]; then |
197 |
if [ "$CLO_LETSENCRYPT" = "yes" ]; then |
| 199 |
if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q 'ssl_module'; then |
198 |
if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q 'ssl_module'; then |
| 200 |
cat 1>&2 <<EOM |
199 |
cat 1>&2 <<EOM |
| 201 |
|
200 |
|
| 202 |
Koha requires mod_ssl to be enabled within Apache in order to run with --force-https. |
201 |
Koha requires mod_ssl to be enabled within Apache in order to run with --letsencrypt. |
| 203 |
Typically this can be enabled with: |
202 |
Typically this can be enabled with: |
| 204 |
|
203 |
|
| 205 |
sudo a2enmod ssl |
204 |
sudo a2enmod ssl |
|
Lines 330-336
enable_sru_server()
Link Here
|
| 330 |
letsencrypt_instance() |
329 |
letsencrypt_instance() |
| 331 |
{ |
330 |
{ |
| 332 |
# Get letsencrypt certificates |
331 |
# Get letsencrypt certificates |
| 333 |
$LETSENCRYPT_PATH/letsencrypt-auto --agree-tos --renew-by-default --webroot --staging certonly \ |
332 |
letsencrypt --agree-tos --renew-by-default --webroot --staging certonly \ |
| 334 |
-w /usr/share/koha/opac/htdocs/ -d $opacdomain -w /usr/share/koha/intranet/htdocs/ -d $intradomain |
333 |
-w /usr/share/koha/opac/htdocs/ -d $opacdomain -w /usr/share/koha/intranet/htdocs/ -d $intradomain |
| 335 |
# enable all ssl settings (apache won't start with these before certs are present) |
334 |
# enable all ssl settings (apache won't start with these before certs are present) |
| 336 |
sed -i "s:^\s*#\(\s*SSL.*\)$:\1:" "/etc/apache2/sites-available/$name.conf" |
335 |
sed -i "s:^\s*#\(\s*SSL.*\)$:\1:" "/etc/apache2/sites-available/$name.conf" |
|
Lines 388-394
START_AUTHORITIES_RETRIEVAL_INFO=""
Link Here
|
| 388 |
END_AUTHORITIES_RETRIEVAL_INFO="" |
387 |
END_AUTHORITIES_RETRIEVAL_INFO="" |
| 389 |
|
388 |
|
| 390 |
APACHE_CONFIGFILE="" |
389 |
APACHE_CONFIGFILE="" |
| 391 |
LETSENCRYPT_PATH="/usr/bin/" |
|
|
| 392 |
|
390 |
|
| 393 |
if [ -e /etc/koha/koha-sites.conf ] |
391 |
if [ -e /etc/koha/koha-sites.conf ] |
| 394 |
then |
392 |
then |
|
Lines 397-403
fi
Link Here
|
| 397 |
|
395 |
|
| 398 |
[ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" ) |
396 |
[ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" ) |
| 399 |
|
397 |
|
| 400 |
TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,use-memcached,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser:,memcached-servers:,memcached-prefix:,upload-path:,force-https,letsencrypt:, \ |
398 |
TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,use-memcached,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser:,memcached-servers:,memcached-prefix:,upload-path:,letsencrypt:, \ |
| 401 |
-n "$0" -- "$@"` |
399 |
-n "$0" -- "$@"` |
| 402 |
|
400 |
|
| 403 |
# Note the quotes around `$TEMP': they are essential! |
401 |
# Note the quotes around `$TEMP': they are essential! |
|
Lines 413-418
CLO_AUTHORITIES_INDEXING_MODE=""
Link Here
|
| 413 |
CLO_MEMCACHED_SERVERS="" |
411 |
CLO_MEMCACHED_SERVERS="" |
| 414 |
CLO_MEMCACHED_PREFIX="" |
412 |
CLO_MEMCACHED_PREFIX="" |
| 415 |
CLO_UPLOAD_PATH="" |
413 |
CLO_UPLOAD_PATH="" |
|
|
414 |
CLO_LETSENCRYPT="" |
| 416 |
|
415 |
|
| 417 |
while true ; do |
416 |
while true ; do |
| 418 |
case "$1" in |
417 |
case "$1" in |
|
Lines 454-463
while true ; do
Link Here
|
| 454 |
SRU_SERVER_PORT="$2" ; shift 2 ;; |
453 |
SRU_SERVER_PORT="$2" ; shift 2 ;; |
| 455 |
--upload-path) |
454 |
--upload-path) |
| 456 |
CLO_UPLOAD_PATH="$2" ; shift 2 ;; |
455 |
CLO_UPLOAD_PATH="$2" ; shift 2 ;; |
| 457 |
--force-https) |
|
|
| 458 |
USE_HTTPS="yes" ; shift ;; |
| 459 |
--letsencrypt) |
456 |
--letsencrypt) |
| 460 |
LETSENCRYPT_PATH="$2" ; shift 2 ;; |
457 |
CLO_LETSENCRYPT="yes" ; shift ;; |
| 461 |
-h|--help) |
458 |
-h|--help) |
| 462 |
usage ; exit 0 ;; |
459 |
usage ; exit 0 ;; |
| 463 |
--) |
460 |
--) |
|
Lines 553-561
check_apache_config
Link Here
|
| 553 |
opacdomain="$OPACPREFIX$name$OPACSUFFIX$DOMAIN" |
550 |
opacdomain="$OPACPREFIX$name$OPACSUFFIX$DOMAIN" |
| 554 |
intradomain="$INTRAPREFIX$name$INTRASUFFIX$DOMAIN" |
551 |
intradomain="$INTRAPREFIX$name$INTRASUFFIX$DOMAIN" |
| 555 |
|
552 |
|
| 556 |
# Check if letsencrypt path is valid, die otherwise |
553 |
# Check if letsencryptis installed, die otherwise |
| 557 |
if [ ! -e "$LETSENCRYPT_PATH/letsencrypt-auto" ]; then |
554 |
if [ $(dpkg-query -W -f='${Status}' letsencrypt 2>/dev/null | grep -c "ok installed") -eq 0 ]; |
| 558 |
die "Cannot find letsencrypt-auto in $LETSENCRYPT_PATH" |
555 |
apt-cache show letsencrypt &>/dev/null |
|
|
556 |
if [ $? -eq 0 ] |
| 557 |
read -r -p "The letsencrypt package is not installed. Do it now? [y/N] " response |
| 558 |
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then |
| 559 |
apt-get install -y letsencrypt |
| 560 |
else |
| 561 |
die "You have to install letsencrypt to use the --letsencrypt parameter." |
| 562 |
fi |
| 563 |
else |
| 564 |
die "No installation candidate available for package letsencrypt." |
| 565 |
fi |
| 559 |
fi |
566 |
fi |
| 560 |
|
567 |
|
| 561 |
if [ -f $PASSWDFILE ] && [ `cat $PASSWDFILE | grep "^$name:"` ] |
568 |
if [ -f $PASSWDFILE ] && [ `cat $PASSWDFILE | grep "^$name:"` ] |
|
Lines 641-647
FLUSH PRIVILEGES;
Link Here
|
| 641 |
eof |
648 |
eof |
| 642 |
fi #` |
649 |
fi #` |
| 643 |
|
650 |
|
| 644 |
if [ "$USE_HTTPS" = "yes" ]; then |
651 |
if [ "$CLO_LETSENCRYPT" = "yes" ]; then |
| 645 |
APACHE_CONFIGFILE="apache-site-https.conf.in" |
652 |
APACHE_CONFIGFILE="apache-site-https.conf.in" |
| 646 |
else |
653 |
else |
| 647 |
APACHE_CONFIGFILE="apache-site.conf.in" |
654 |
APACHE_CONFIGFILE="apache-site.conf.in" |
|
Lines 757-763
then
Link Here
|
| 757 |
koha-indexer --start "$name" |
764 |
koha-indexer --start "$name" |
| 758 |
fi |
765 |
fi |
| 759 |
|
766 |
|
| 760 |
if [ "$USE_HTTPS" = "yes" ]; then |
767 |
if [ "$CLO_LETSENCRYPT" = "yes" ]; then |
| 761 |
# Get letsencrypt certificates |
768 |
# Get letsencrypt certificates |
| 762 |
letsencrypt_instance |
769 |
letsencrypt_instance |
| 763 |
fi |
770 |
fi |