View | Details | Raw Unified | Return to bug 15303
Collapse All | Expand All

(-)a/debian/docs/koha-create.xml (+17 lines)
Lines 40-45 Link Here
40
      <arg><option>--enable-sru</option></arg>
40
      <arg><option>--enable-sru</option></arg>
41
      <arg><option>--sru-port</option> port</arg>
41
      <arg><option>--sru-port</option> port</arg>
42
      <arg><option>--upload-path</option> directory</arg>
42
      <arg><option>--upload-path</option> directory</arg>
43
      <arg><option>--force-https</option></arg>
44
      <arg><option>--letsencrypt</option> directory</arg>
43
      <arg><option>--help</option>|<option>-h</option></arg>
45
      <arg><option>--help</option>|<option>-h</option></arg>
44
46
45
      <arg choice="req" rep="norepeat"><replaceable>instancename</replaceable></arg>
47
      <arg choice="req" rep="norepeat"><replaceable>instancename</replaceable></arg>
Lines 177-182 Link Here
177
    </varlistentry>
179
    </varlistentry>
178
180
179
    <varlistentry>
181
    <varlistentry>
182
      <term><option>--force-https</option></term>
183
      <listitem>
184
        <para>Set up a https-only website</para>
185
      </listitem>
186
    </varlistentry>
187
188
    <varlistentry>
189
      <term><option>--letsencrypt</option></term>
190
      <listitem>
191
        <para>Specify the <option>directory</option> where letsencrypt-auto lives
192
              It defaults to <filename>/path/to/letsencrypt</filename>.</para>
193
      </listitem>
194
    </varlistentry>
195
196
    <varlistentry>
180
      <term><option>--help</option>,<option>-h</option></term>
197
      <term><option>--help</option>,<option>-h</option></term>
181
      <listitem>
198
      <listitem>
182
        <para>Print usage information.</para>
199
        <para>Print usage information.</para>
(-)a/debian/scripts/koha-create (-3 / +29 lines)
Lines 71-76 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
75
  --letsencrypt             Path to the letsencrypt folder
74
  --help,-h                 Show this help.
76
  --help,-h                 Show this help.
75
77
76
Note: the instance name cannot be longer that 11 chars.
78
Note: the instance name cannot be longer that 11 chars.
Lines 354-359 END_BIBLIOS_RETRIEVAL_INFO="" Link Here
354
START_AUTHORITIES_RETRIEVAL_INFO=""
356
START_AUTHORITIES_RETRIEVAL_INFO=""
355
END_AUTHORITIES_RETRIEVAL_INFO=""
357
END_AUTHORITIES_RETRIEVAL_INFO=""
356
358
359
APACHE_CONFIGFILE=""
360
LETSENCRYPT_PATH=""
361
357
if [ -e /etc/koha/koha-sites.conf ]
362
if [ -e /etc/koha/koha-sites.conf ]
358
then
363
then
359
    . /etc/koha/koha-sites.conf
364
    . /etc/koha/koha-sites.conf
Lines 361-367 fi Link Here
361
366
362
[ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" )
367
[ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" )
363
368
364
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:, \
369
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:, \
365
     -n "$0" -- "$@"`
370
     -n "$0" -- "$@"`
366
371
367
# Note the quotes around `$TEMP': they are essential!
372
# Note the quotes around `$TEMP': they are essential!
Lines 378-384 CLO_MEMCACHED_SERVERS="" Link Here
378
CLO_MEMCACHED_PREFIX=""
383
CLO_MEMCACHED_PREFIX=""
379
CLO_UPLOAD_PATH=""
384
CLO_UPLOAD_PATH=""
380
385
381
382
while true ; do
386
while true ; do
383
    case "$1" in
387
    case "$1" in
384
        -c|--create-db)
388
        -c|--create-db)
Lines 419-424 while true ; do Link Here
419
            SRU_SERVER_PORT="$2" ; shift 2 ;;
423
            SRU_SERVER_PORT="$2" ; shift 2 ;;
420
        --upload-path)
424
        --upload-path)
421
            CLO_UPLOAD_PATH="$2" ; shift 2 ;;
425
            CLO_UPLOAD_PATH="$2" ; shift 2 ;;
426
        --force-https)
427
            USE_HTTPS="yes" ; shift ;;
428
        --letsencrypt)
429
            LETSENCRYPT_PATH="$2" ; shift 2 ;;
422
        -h|--help)
430
        -h|--help)
423
            usage ; exit 0 ;;
431
            usage ; exit 0 ;;
424
        --)
432
        --)
Lines 598-605 FLUSH PRIVILEGES; Link Here
598
eof
606
eof
599
    fi #`
607
    fi #`
600
608
609
    if [ "$USE_HTTPS" = "yes" ]; then
610
        APACHE_CONFIGFILE="apache-site-https.conf.in"
611
    else
612
        APACHE_CONFIGFILE="apache-site.conf.in"
613
    fi
601
    # Generate and install Apache site-available file and log dir.
614
    # Generate and install Apache site-available file and log dir.
602
    generate_config_file apache-site.conf.in \
615
    generate_config_file $APACHE_CONFIGFILE \
603
        "/etc/apache2/sites-available/$name.conf"
616
        "/etc/apache2/sites-available/$name.conf"
604
    mkdir "/var/log/koha/$name"
617
    mkdir "/var/log/koha/$name"
605
    chown "$username:$username" "/var/log/koha/$name"
618
    chown "$username:$username" "/var/log/koha/$name"
Lines 708-713 then Link Here
708
        # Start Indexer daemon
721
        # Start Indexer daemon
709
        koha-indexer --start "$name"
722
        koha-indexer --start "$name"
710
    fi
723
    fi
724
725
    if [ "$USE_HTTPS" = "yes" ]; then
726
        # Get letsencrypt certificates
727
        # TODO: fix path of letsencrypt
728
        $LETSENCRYPT_PATH/letsencrypt-auto --agree-tos --renew-by-default --webroot --server https://acme-v01.api.letsencrypt.org/directory certonly -w /usr/share/koha/opac/htdocs/ -d $opacdomain -w /usr/share/koha/intranet/htdocs/ -d $intradomain
729
        # enable all ssl settings (apache won't start with these before certs are present)
730
        sed -i "s:^\s*#\(\s*SSL.*\)$:\1:" "/etc/apache2/sites-available/$name.conf"
731
        # change port from 80 to 443. (apache won't start if it is 443 without certs present)
732
        sed -i "s:^\s*\(<VirtualHost \*\:\)80> #ssl$:\1443>:" "/etc/apache2/sites-available/$name.conf"
733
        # TODO: enable forward from 80 to https
734
        # restart apache with working certs
735
        service apache2 restart
736
    fi
711
fi
737
fi
712
738
713
739
(-)a/debian/templates/apache-site-https.conf.in (-1 / +68 lines)
Line 0 Link Here
0
- 
1
# Koha instance __KOHASITE__ Apache config.
2
3
#<VirtualHost *:80> #nohttps
4
#  RewriteEngine On
5
#  RewriteCond %{HTTPS} !=on
6
#  RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
7
#</VirtualHost>
8
9
10
# OPAC
11
<VirtualHost *:80> #https
12
#  SSLEngine on
13
#  SSLProtocol +TLSv1.2 +TLSv1.1 +TLSv1
14
#  SSLCompression off
15
#  SSLHonorCipherOrder on
16
#  SSLCipherSuite "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-SA-AES128-SHA256:ECDHE-RSA-AES256-SHA"
17
#  SSLCertificateKeyFile   /etc/letsencrypt/live/__OPACSERVER__/privkey.pem
18
#  SSLCertificateFile      /etc/letsencrypt/live/__OPACSERVER__/cert.pem
19
#  SSLCertificateChainFile /etc/letsencrypt/live/__OPACSERVER__/chain.pem
20
21
  <IfVersion >= 2.4>
22
   Define instance "__KOHASITE__"
23
  </IfVersion>
24
   Include /etc/koha/apache-shared.conf
25
#  Include /etc/koha/apache-shared-disable.conf
26
#  Include /etc/koha/apache-shared-opac-plack.conf
27
   Include /etc/koha/apache-shared-opac.conf
28
29
   ServerName __OPACSERVER__
30
   SetEnv KOHA_CONF "/etc/koha/sites/__KOHASITE__/koha-conf.xml"
31
   SetEnv MEMCACHED_SERVERS "__MEMCACHED_SERVERS__"
32
   SetEnv MEMCACHED_NAMESPACE "__MEMCACHED_NAMESPACE__"
33
   AssignUserID __UNIXUSER__ __UNIXGROUP__
34
35
   ErrorLog    /var/log/koha/__KOHASITE__/opac-error.log
36
#  TransferLog /var/log/koha/__KOHASITE__/opac-access.log
37
#  RewriteLog  /var/log/koha/__KOHASITE__/opac-rewrite.log
38
</VirtualHost>
39
40
# Intranet
41
<VirtualHost *:80> #https
42
#  SSLEngine on
43
#  SSLProtocol +TLSv1.2 +TLSv1.1 +TLSv1
44
#  SSLCompression off
45
#  SSLHonorCipherOrder on
46
#  SSLCipherSuite "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA"
47
#  SSLCertificateKeyFile   /etc/letsencrypt/live/__OPACSERVER__/privkey.pem
48
#  SSLCertificateFile      /etc/letsencrypt/live/__OPACSERVER__/cert.pem
49
#  SSLCertificateChainFile /etc/letsencrypt/live/__OPACSERVER__/chain.pem
50
51
  <IfVersion >= 2.4>
52
   Define instance "__KOHASITE__"
53
  </IfVersion>
54
   Include /etc/koha/apache-shared.conf
55
#  Include /etc/koha/apache-shared-disable.conf
56
#  Include /etc/koha/apache-shared-intranet-plack.conf
57
   Include /etc/koha/apache-shared-intranet.conf
58
   
59
   ServerName __INTRASERVER__
60
   SetEnv KOHA_CONF "/etc/koha/sites/__KOHASITE__/koha-conf.xml"
61
   SetEnv MEMCACHED_SERVERS "__MEMCACHED_SERVERS__"
62
   SetEnv MEMCACHED_NAMESPACE "__MEMCACHED_NAMESPACE__"
63
   AssignUserID __UNIXUSER__ __UNIXGROUP__
64
65
   ErrorLog    /var/log/koha/__KOHASITE__/intranet-error.log
66
#  TransferLog /var/log/koha/__KOHASITE__/intranet-access.log
67
#  RewriteLog  /var/log/koha/__KOHASITE__/intranet-rewrite.log
68
</VirtualHost>

Return to bug 15303