Robotframework-Database-Library icon indicating copy to clipboard operation
Robotframework-Database-Library copied to clipboard

Support for SSL connections

Open restagner opened this issue 2 years ago • 3 comments

We are actively using the database-library across multiple projects within our company. It's been working flawlessly. We recently had one project's DB switch over to using SSL/TSL encryption. Does the custom connection supported within the library support to connecting to a DB that uses SSL?

restagner avatar Apr 13 '23 18:04 restagner

SSL/TLS is now a must have for all serious projects and not allowing TLS within the library will become more and more unbearable.

It looks like the current version might allow for TLS connections, but the dbConfigFile format is not documented, so it's hard to tell.

However, from what I read in https://github.com/PyMySQL/PyMySQL/blob/main/pymysql/connections.py (for example), it looks like the SSL-related params are supported by connect() and hence could be used by DatabaseLibrary. Let's wait for author response.

As a fallback, I suggest rpaframework-database with the following db.cfg file : [default] module_name = pymysql host = localhost port = 3306 username = user1 password = passwd1 database = dbname1 ssl_ca = /opt/robotframework/resources/ca-cert.pem client_flags = SSL,FOUND_ROWS

trz-scoulibaly avatar May 03 '23 12:05 trz-scoulibaly

@trz-scoulibaly,

Thanks for the suggestion!!!

restagner avatar May 05 '23 17:05 restagner

HI @restagner! The Connect To Database Using Custom Params keyword just passed all the params to the DB python module - like pymysql, so it should work. I've just made a quick test with the following example:

    ${Params}=    Catenate
    ...    database='${DB_NAME}',
    ...    user='${DB_USER}',
    ...    password='${DB_PASS}',
    ...    host='${DB_HOST}',
    ...    port=${DB_PORT},
    ...    ssl_key='something',
    ...    ssl_cert='some_cert',
    ...    ssl_ca='some_cert.pem'

    Connect To Database Using Custom Params
    ...    pymysql
    ...    ${Params}

pymysql returned an error "file not found", which means it was able to get the params passed. I don't have an appropriate DB setup right now to do a proper test. Could you please try it this way?

I'm currently working in the DEV branch and there have been quite some fixes - so please use it. The release is coming :)

amochin avatar Jul 13 '23 16:07 amochin