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

(-)a/C4/Installer.pm (-2 / +10 lines)
Lines 75-82 sub new { Link Here
75
    $self->{'port'}     = C4::Context->config("port");
75
    $self->{'port'}     = C4::Context->config("port");
76
    $self->{'user'}     = C4::Context->config("user");
76
    $self->{'user'}     = C4::Context->config("user");
77
    $self->{'password'} = C4::Context->config("pass");
77
    $self->{'password'} = C4::Context->config("pass");
78
    $self->{'tls'} = C4::Context->config("tls");
79
    if ($self->{'tls'} eq 'yes'){
80
        $self->{'ca'} = C4::Context->config('ca');
81
        $self->{'cert'} = C4::Context->config('cert');
82
        $self->{'key'} = C4::Context->config('key');
83
        $self->{'tlsoptions'} = ";mysql_ssl=1;mysql_ssl_client_key=".$self->{key}.";mysql_ssl_client_cert=".$self->{cert}.";mysql_ssl_ca_file=".$self->{ca};
84
        $self->{'tlscmdline'} =  " --ssl-cert ". $self->{cert} . " --ssl-key " . $self->{key} . " --ssl-ca ".$self->{ca}." "
85
    }
78
    $self->{'dbh'} = DBI->connect("DBI:$self->{dbms}:dbname=$self->{dbname};host=$self->{hostname}" .
86
    $self->{'dbh'} = DBI->connect("DBI:$self->{dbms}:dbname=$self->{dbname};host=$self->{hostname}" .
79
                                  ( $self->{port} ? ";port=$self->{port}" : "" ),
87
                                  ( $self->{port} ? ";port=$self->{port}" : "" ).
88
                                  ( $self->{tlsoptions} ? $self->{tlsoptions} : ""),
80
                                  $self->{'user'}, $self->{'password'});
89
                                  $self->{'user'}, $self->{'password'});
81
    $self->{'language'} = undef;
90
    $self->{'language'} = undef;
82
    $self->{'marcflavour'} = undef;
91
    $self->{'marcflavour'} = undef;
Lines 454-460 sub load_sql { Link Here
454
    if( $dup_stderr ) {
463
    if( $dup_stderr ) {
455
        warn "C4::Installer::load_sql returned the following errors while attempting to load $filename:\n";
464
        warn "C4::Installer::load_sql returned the following errors while attempting to load $filename:\n";
456
        $error = $dup_stderr;
465
        $error = $dup_stderr;
457
458
    }
466
    }
459
467
460
    return $error;
468
    return $error;
(-)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 456-461 my %config_defaults = ( Link Here
456
  'DB_NAME'           => 'koha',
456
  'DB_NAME'           => 'koha',
457
  'DB_USER'           => 'kohaadmin',
457
  'DB_USER'           => 'kohaadmin',
458
  'DB_PASS'           => 'katikoan',
458
  'DB_PASS'           => 'katikoan',
459
  'DB_USE_TLS'	      => 'no',
460
  'DB_TLS_CA_CERTIFICATE'  => '/etc/mysql-ssl/server-ca.pem',
461
  'DB_TLS_CLIENT_CERTIFICATE'  => '/etc/mysql-ssl/client-cert.pem',
462
  'DB_TLS_CLIENT_KEY' => '/etc/mysql-ssl/client-key.pem',
459
  'INSTALL_SRU'       => 'yes',
463
  'INSTALL_SRU'       => 'yes',
460
  'INSTALL_PAZPAR2'   => 'no',
464
  'INSTALL_PAZPAR2'   => 'no',
461
  'AUTH_INDEX_MODE'   => 'dom',
465
  'AUTH_INDEX_MODE'   => 'dom',
Lines 502-507 else { Link Here
502
my %valid_config_values = (
506
my %valid_config_values = (
503
  'INSTALL_MODE'  => { 'standard' => 1, 'single' => 1, 'dev' => 1 },
507
  'INSTALL_MODE'  => { 'standard' => 1, 'single' => 1, 'dev' => 1 },
504
  'DB_TYPE' => { 'mysql' => 1, 'Pg' => 1 },
508
  'DB_TYPE' => { 'mysql' => 1, 'Pg' => 1 },
509
  'DB_USE_TLS' => {'yes', 'no'},
505
  'INSTALL_SRU' => { 'yes' => 1, 'no' => 1 },
510
  'INSTALL_SRU' => { 'yes' => 1, 'no' => 1 },
506
  'AUTH_INDEX_MODE' => { 'grs1' => 1, 'dom' => 1 },
511
  'AUTH_INDEX_MODE' => { 'grs1' => 1, 'dom' => 1 },
507
  'BIB_INDEX_MODE'  => { 'grs1' => 1, 'dom' => 1 },
512
  'BIB_INDEX_MODE'  => { 'grs1' => 1, 'dom' => 1 },
Lines 1032-1037 DMBS); Link Here
1032
Please specify the name of the database to be
1037
Please specify the name of the database to be
1033
used by Koha);
1038
used by Koha);
1034
    $config{'DB_NAME'} = _get_value('DB_NAME', $msg, $defaults->{'DB_NAME'}, $valid_values, $install_log_values);
1039
    $config{'DB_NAME'} = _get_value('DB_NAME', $msg, $defaults->{'DB_NAME'}, $valid_values, $install_log_values);
1040
    if ($config{'DB_TYPE'} eq 'mysql'){
1041
        $msg = q(
1042
Please specify whether the connection to MySQL will use TLS
1043
        );
1044
        $config{'DB_USE_TLS'} = _get_value('DB_USE_TLS', $msg, $defaults->{'DB_USE_TLS'}, $valid_values, $install_log_values);
1045
    }
1046
    if ($config{'DB_USE_TLS'} eq 'yes'){
1047
        $msg = q(
1048
Please enter the path to the CA certificate for TLS
1049
        );
1050
        $config{'DB_TLS_CA_CERTIFICATE'} = _get_value('DB_TLS_CA_CERTIFICATE', $msg, $defaults->{'DB_TLS_CA_CERTIFICATE'}, $valid_values, $install_log_values);
1051
1052
        $msg = q(
1053
Please enter the path to the client certificate for TLS
1054
        );
1055
        $config{'DB_TLS_CLIENT_CERTIFICATE'} = _get_value('DB_TLS_CLIENT_CERTIFICATE', $msg, $defaults->{'DB_TLS_CLIENT_CERTIFICATE'}, $valid_values, $install_log_values);
1056
        $msg = q(
1057
Please enter the path to the client key for TLS
1058
        );
1059
        $config{'DB_TLS_CLIENT_KEY'} = _get_value('DB_TLS_CLIENT_KEY', $msg, $defaults->{'DB_TLS_CLIENT_KEY'}, $valid_values, $install_log_values);
1060
    }
1035
1061
1036
    $msg = q(
1062
    $msg = q(
1037
Please specify the user that owns the database to be
1063
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 370-376 elsif ( $step && $step == 3 ) { Link Here
370
        #I put it there because it implied a data import if condition was not satisfied.
380
        #I put it there because it implied a data import if condition was not satisfied.
371
        my $dbh = DBI->connect(
381
        my $dbh = DBI->connect(
372
    		"DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}"
382
    		"DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}"
373
      		. ( $info{port} ? ";port=$info{port}" : "" ),
383
		. ( $info{port} ? ";port=$info{port}" : "" )
384
                . ( $info{tlsoptions} ? $info{tlsoptions} : "" ),
374
            	$info{'user'}, $info{'password'}
385
            	$info{'user'}, $info{'password'}
375
        );
386
        );
376
	my $rq;
387
	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