https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36026

Lukas Koszyk <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #172822|0                           |1
        is obsolete|                            |

--- Comment #10 from Lukas Koszyk <[email protected]> ---
Created attachment 173381
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173381&action=edit
Bug 36026: Use only configured TLS options for database connection

Database connections with TLS require client private keys
and certificates for authentication but MariaDB also supports
authentication by user and password.
This patch allows omitting the TLS options for certificate based
client authentication.

To test:

1) Apply patch.

2) Run "prove -v t/db_dependent/Koha/Database.t"
to check if the new function generate_dsn returns correct DSNs.

3) Use KTD to verify that the TLS DB connection actually works:

a) Open shell in database container "docker exec -it kohadev-db-1 /bin/bash"

b) Create certificates and keys:
mkdir -p /etc/mysql/ssl/{certs,private}
openssl genrsa 4096 > /etc/mysql/ssl/private/ca-key.pem
openssl req -new -x509 -nodes -days 3650 -key /etc/mysql/ssl/private/ca-key.pem
\
   -out /etc/mysql/ssl/certs/ca-cert.pem \
   -subj "/C=US/ST=State/L=City/O=Organization/OU=Unit/CN=MariaDB_CA"
openssl req -newkey rsa:4096 -days 3650 -nodes -keyout
/etc/mysql/ssl/private/server-key.pem \
   -out /etc/mysql/ssl/certs/server-req.pem \
   -subj "/C=US/ST=State/L=City/O=Organization/OU=Unit/CN=db"
openssl rsa -in /etc/mysql/ssl/private/server-key.pem -out
/etc/mysql/ssl/private/server-key.pem
openssl x509 -req -in /etc/mysql/ssl/certs/server-req.pem -days 3650 \
   -CA /etc/mysql/ssl/certs/ca-cert.pem -CAkey
/etc/mysql/ssl/private/ca-key.pem \
   -set_serial 01 -out /etc/mysql/ssl/certs/server-cert.pem
chown -Rv mysql:root /etc/mysql/ssl/

c) Configure the MariaDB server to require TLS:
echo "
[mariadb]
ssl_ca=/etc/mysql/ssl/certs/ca-cert.pem
ssl_cert=/etc/mysql/ssl/certs/server-cert.pem
ssl_key=/etc/mysql/ssl/private/server-key.pem
require_secure_transport = on
" > /etc/mysql/mariadb.conf.d/50-ssl.cnf

d) Restart MariaDB: kill 1

e) Switch to Koha container: ktd --shell

f) Set "<tls>yes</tls>" in the <config> section in koha-conf.xml.

g) In Koha/Database.pm:
replace ";mysql_ssl=1" by ";mysql_ssl=1;mysql_ssl_optional=1"

4) Run restart_all.

5) Check that Koha's staff interface works.

6) Sign off.

Sponsored-by: Karlsruhe Institute of Technology (KIT)

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to