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

(-)a/C4/Installer.pm (-1 / +11 lines)
Lines 69-76 sub new { Link Here
69
    $self->{'port'}     = C4::Context->config("port");
69
    $self->{'port'}     = C4::Context->config("port");
70
    $self->{'user'}     = C4::Context->config("user");
70
    $self->{'user'}     = C4::Context->config("user");
71
    $self->{'password'} = C4::Context->config("pass");
71
    $self->{'password'} = C4::Context->config("pass");
72
    $self->{'tls'} = C4::Context->config("tls");
73
    if ($self->{'tls'} eq 'yes'){
74
        $self->{'ca'} = C4::Context->config('ca');
75
        $self->{'cert'} = C4::Context->config('cert');
76
        $self->{'key'} = C4::Context->config('key');
77
        $self->{'tlsoptions'} = ";mysql_ssl=1;mysql_ssl_client_key=".$self->{key}.";mysql_ssl_client_cert=".$self->{cert}.";mysql_ssl_ca_file=".$self->{ca}; 
78
        $self->{'tlscmdline'} =  " --ssl-cert ". $self->{cert} . " --ssl-key " . $self->{key} . " --ssl-ca ".$self->{ca}." "
79
    }
72
    $self->{'dbh'} = DBI->connect("DBI:$self->{dbms}:dbname=$self->{dbname};host=$self->{hostname}" .
80
    $self->{'dbh'} = DBI->connect("DBI:$self->{dbms}:dbname=$self->{dbname};host=$self->{hostname}" .
73
                                  ( $self->{port} ? ";port=$self->{port}" : "" ),
81
                                  ( $self->{port} ? ";port=$self->{port}" : "" ).
82
                                  ( $self->{tlsoptions} ? $self->{tlsoptions} : ""),
74
                                  $self->{'user'}, $self->{'password'});
83
                                  $self->{'user'}, $self->{'password'});
75
    $self->{'language'} = undef;
84
    $self->{'language'} = undef;
76
    $self->{'marcflavour'} = undef;
85
    $self->{'marcflavour'} = undef;
Lines 446-451 sub load_sql { Link Here
446
            . ( $self->{port}     ? " -P $self->{port} "     : "" )
455
            . ( $self->{port}     ? " -P $self->{port} "     : "" )
447
            . ( $self->{user}     ? " -u $self->{user} "     : "" )
456
            . ( $self->{user}     ? " -u $self->{user} "     : "" )
448
            . ( $self->{password} ? " -p'$self->{password}'"   : "" )
457
            . ( $self->{password} ? " -p'$self->{password}'"   : "" )
458
            . ( $self->{tlscmdline} ? $self->{tlscmdline} : "" )
449
            . " $self->{dbname} ";
459
            . " $self->{dbname} ";
450
        $error = qx($strcmd --default-character-set=utf8 <$filename 2>&1 1>/dev/null);
460
        $error = qx($strcmd --default-character-set=utf8 <$filename 2>&1 1>/dev/null);
451
    } elsif ( $self->{dbms} eq 'Pg' ) {
461
    } elsif ( $self->{dbms} eq 'Pg' ) {
(-)a/Koha/Database.pm (-1 / +11 lines)
Lines 58-63 sub _new_schema { Link Here
58
    my $db_port   = $context->config("port") || '';
58
    my $db_port   = $context->config("port") || '';
59
    my $db_user   = $context->config("user");
59
    my $db_user   = $context->config("user");
60
    my $db_passwd = $context->config("pass");
60
    my $db_passwd = $context->config("pass");
61
    my $tls = $context->config("tls");
62
    my $tls_options;
63
    if ($tls eq 'yes'){
64
        my $ca = $context->config('ca');
65
        my $cert = $context->config('cert');
66
        my $key = $context->config('key');
67
        $tls_options = ";mysql_ssl=1;mysql_ssl_client_key=".$key.";mysql_ssl_client_cert=".$cert.";mysql_ssl_ca_file=".$ca;
68
    }
69
70
61
71
62
    my ( %encoding_attr, $encoding_query, $tz_query );
72
    my ( %encoding_attr, $encoding_query, $tz_query );
63
    my $tz = $ENV{TZ};
73
    my $tz = $ENV{TZ};
Lines 72-78 sub _new_schema { Link Here
72
    }
82
    }
73
    my $schema = Koha::Schema->connect(
83
    my $schema = Koha::Schema->connect(
74
        {
84
        {
75
            dsn => "dbi:$db_driver:database=$db_name;host=$db_host;port=$db_port",
85
            dsn => "dbi:$db_driver:database=$db_name;host=$db_host;port=$db_port".($tls_options? $tls_options : ""),
76
            user => $db_user,
86
            user => $db_user,
77
            password => $db_passwd,
87
            password => $db_passwd,
78
            %encoding_attr,
88
            %encoding_attr,
(-)a/Makefile.PL (+26 lines)
Lines 420-425 my %config_defaults = ( Link Here
420
  'DB_NAME'           => 'koha',
420
  'DB_NAME'           => 'koha',
421
  'DB_USER'           => 'kohaadmin',
421
  'DB_USER'           => 'kohaadmin',
422
  'DB_PASS'           => 'katikoan',
422
  'DB_PASS'           => 'katikoan',
423
  'DB_USE_TLS'	      => 'no',
424
  'DB_TLS_CA_CERTIFICATE'  => '/etc/mysql-ssl/server-ca.pem',
425
  'DB_TLS_CLIENT_CERTIFICATE'  => '/etc/mysql-ssl/client-cert.pem',
426
  'DB_TLS_CLIENT_KEY' => '/etc/mysql-ssl/client-key.pem',
423
  'INSTALL_SRU'       => 'yes',
427
  'INSTALL_SRU'       => 'yes',
424
  'INSTALL_PAZPAR2'   => 'no',
428
  'INSTALL_PAZPAR2'   => 'no',
425
  'AUTH_INDEX_MODE'   => 'dom',
429
  'AUTH_INDEX_MODE'   => 'dom',
Lines 465-470 else { Link Here
465
my %valid_config_values = (
469
my %valid_config_values = (
466
  'INSTALL_MODE'  => { 'standard' => 1, 'single' => 1, 'dev' => 1 },
470
  'INSTALL_MODE'  => { 'standard' => 1, 'single' => 1, 'dev' => 1 },
467
  'DB_TYPE' => { 'mysql' => 1, 'Pg' => 1 },
471
  'DB_TYPE' => { 'mysql' => 1, 'Pg' => 1 },
472
  'DB_USE_TLS' => {'yes', 'no'},
468
  'INSTALL_SRU' => { 'yes' => 1, 'no' => 1 },
473
  'INSTALL_SRU' => { 'yes' => 1, 'no' => 1 },
469
  'AUTH_INDEX_MODE' => { 'grs1' => 1, 'dom' => 1 },
474
  'AUTH_INDEX_MODE' => { 'grs1' => 1, 'dom' => 1 },
470
  'BIB_INDEX_MODE'  => { 'grs1' => 1, 'dom' => 1 },
475
  'BIB_INDEX_MODE'  => { 'grs1' => 1, 'dom' => 1 },
Lines 900-905 DMBS); Link Here
900
Please specify the name of the database to be
905
Please specify the name of the database to be
901
used by Koha);
906
used by Koha);
902
    $config{'DB_NAME'} = _get_value('DB_NAME', $msg, $defaults->{'DB_NAME'}, $valid_values, $install_log_values);
907
    $config{'DB_NAME'} = _get_value('DB_NAME', $msg, $defaults->{'DB_NAME'}, $valid_values, $install_log_values);
908
    if ($config{'DB_TYPE'} eq 'mysql'){
909
        $msg = q(
910
Please specify whether the connection to MySQL will use TLS 
911
        );
912
        $config{'DB_USE_TLS'} = _get_value('DB_USE_TLS', $msg, $defaults->{'DB_USE_TLS'}, $valid_values, $install_log_values);
913
    }
914
    if ($config{'DB_USE_TLS'} eq 'yes'){
915
        $msg = q(
916
Please enter the path to the CA certificate for TLS
917
        );
918
        $config{'DB_TLS_CA_CERTIFICATE'} = _get_value('DB_TLS_CA_CERTIFICATE', $msg, $defaults->{'DB_TLS_CA_CERTIFICATE'}, $valid_values, $install_log_values);
919
920
        $msg = q(
921
Please enter the path to the client certificate for TLS
922
        );
923
        $config{'DB_TLS_CLIENT_CERTIFICATE'} = _get_value('DB_TLS_CLIENT_CERTIFICATE', $msg, $defaults->{'DB_TLS_CLIENT_CERTIFICATE'}, $valid_values, $install_log_values);
924
        $msg = q(
925
Please enter the path to the client key for TLS
926
        );
927
        $config{'DB_TLS_CLIENT_KEY'} = _get_value('DB_TLS_CLIENT_KEY', $msg, $defaults->{'DB_TLS_CLIENT_KEY'}, $valid_values, $install_log_values);
928
    }
903
929
904
    $msg = q(
930
    $msg = q(
905
Please specify the user that owns the database to be
931
Please specify the user that owns the database to be
(-)a/etc/koha-conf.xml (+4 lines)
Lines 82-87 __PAZPAR2_TOGGLE_XML_POST__ Link Here
82
 <port>__DB_PORT__</port>
82
 <port>__DB_PORT__</port>
83
 <user>__DB_USER__</user>
83
 <user>__DB_USER__</user>
84
 <pass>__DB_PASS__</pass>
84
 <pass>__DB_PASS__</pass>
85
 <tls>__DB_USE_TLS__</tls>
86
 <ca>__DB_TLS_CA_CERTIFICATE__</ca>
87
 <cert>__DB_TLS_CLIENT_CERTIFICATE__</cert>
88
 <key>__DB_TLS_CLIENT_KEY__</key>
85
 <biblioserver>biblios</biblioserver>
89
 <biblioserver>biblios</biblioserver>
86
 <biblioservershadow>1</biblioservershadow>
90
 <biblioservershadow>1</biblioservershadow>
87
 <authorityserver>authorities</authorityserver>
91
 <authorityserver>authorities</authorityserver>
(-)a/installer/install.pl (-2 / +13 lines)
Lines 48-56 $info{'hostname'} = C4::Context->config("hostname"); Link Here
48
$info{'port'}     = C4::Context->config("port");
48
$info{'port'}     = C4::Context->config("port");
49
$info{'user'}     = C4::Context->config("user");
49
$info{'user'}     = C4::Context->config("user");
50
$info{'password'} = C4::Context->config("pass");
50
$info{'password'} = C4::Context->config("pass");
51
$info{'tls'} = C4::Context->config("tls");
52
    if ($info{'tls'} eq 'yes'){
53
        $info{'ca'} = C4::Context->config('ca');
54
        $info{'cert'} = C4::Context->config('cert');
55
        $info{'key'} = C4::Context->config('key');
56
        $info{'tlsoptions'} = ";mysql_ssl=1;mysql_ssl_client_key=".$info{key}.";mysql_ssl_client_cert=".$info{cert}.";mysql_ssl_ca_file=".$info{ca};
57
        $info{'tlscmdline'} =  " --ssl-cert ". $info{cert} . " --ssl-key " . $info{key} . " --ssl-ca ".$info{ca}." "
58
    }
59
51
my $dbh = DBI->connect(
60
my $dbh = DBI->connect(
52
    "DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}"
61
    "DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}"
53
      . ( $info{port} ? ";port=$info{port}" : "" ),
62
      . ( $info{port} ? ";port=$info{port}" : "" )
63
      . ( $info{tlsoptions} ? $info{tlsoptions} : "" ),
54
    $info{'user'}, $info{'password'}
64
    $info{'user'}, $info{'password'}
55
);
65
);
56
66
Lines 368-374 elsif ( $step && $step == 3 ) { Link Here
368
        #I put it there because it implied a data import if condition was not satisfied.
378
        #I put it there because it implied a data import if condition was not satisfied.
369
        my $dbh = DBI->connect(
379
        my $dbh = DBI->connect(
370
    		"DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}"
380
    		"DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}"
371
      		. ( $info{port} ? ";port=$info{port}" : "" ),
381
      		. ( $info{port} ? ";port=$info{port}" : "" )
382
                . ( $info{tlsoptions} ? $info{tlsoptions} : "" ),
372
            	$info{'user'}, $info{'password'}
383
            	$info{'user'}, $info{'password'}
373
        );
384
        );
374
	my $rq;
385
	my $rq;
(-)a/rewrite-config.PL (-2 / +5 lines)
Lines 44-50 The following configuration keywords are available: Link Here
44
44
45
PREFIX,
45
PREFIX,
46
BASE_DIR, CGI_DIR, LOG_DIR, PLUGINS_DIR, INSTALL_BASE,
46
BASE_DIR, CGI_DIR, LOG_DIR, PLUGINS_DIR, INSTALL_BASE,
47
DB_TYPE, DB_HOST, DB_PORT, DB_NAME, DB_PASS, DB_USER, WEBMASTER_EMAIL, WEBSERVER_DOMAIN,
47
DB_TYPE, DB_HOST, DB_PORT, DB_NAME, DB_PASS, DB_USER, DB_USE_TLS, DB_TLS_CA_CERT, DB_TLS_CLIENT_KEY, DB_TLS_CLIENT_CERT, WEBMASTER_EMAIL, WEBSERVER_DOMAIN,
48
WEBSERVER_HOST, WEBSERVER_IP, WEBSERVER_PORT, WEBSERVER_PORT_LIBRARIAN, ZEBRA_PASS, ZEBRA_USER
48
WEBSERVER_HOST, WEBSERVER_IP, WEBSERVER_PORT, WEBSERVER_PORT_LIBRARIAN, ZEBRA_PASS, ZEBRA_USER
49
49
50
=head1 EXAMPLES
50
=head1 EXAMPLES
Lines 89-94 $prefix = $ENV{'INSTALL_BASE'} || "/usr"; Link Here
89
  "__DB_PORT__" => "3306",
89
  "__DB_PORT__" => "3306",
90
  "__DB_USER__" => "kohaadmin",
90
  "__DB_USER__" => "kohaadmin",
91
  "__DB_PASS__" => "katikoan",
91
  "__DB_PASS__" => "katikoan",
92
  "__DB_USE_TLS__" => "no",
93
  "__DB_TLS_CA_CERTIFICATE__" => "",
94
  "__DB_TLS_CLIENT_CERTIFICATE__" => "",
95
  "__DB_TLS_CLIENT_KEY__"=>"",
92
  "__WEBMASTER_EMAIL__" => 'webmaster@'.$mydomain,
96
  "__WEBMASTER_EMAIL__" => 'webmaster@'.$mydomain,
93
  "__WEBSERVER_DOMAIN__" => $mydomain,
97
  "__WEBSERVER_DOMAIN__" => $mydomain,
94
  "__WEBSERVER_HOST__" => $myhost,
98
  "__WEBSERVER_HOST__" => $myhost,
95
- 

Return to bug 15427