How to connect HESK to Azure MySQL Database over SSL

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
cjanuzi
Posts: 2
Joined: Wed Feb 19, 2020 11:56 pm

How to connect HESK to Azure MySQL Database over SSL

Post by cjanuzi »

Script URL:
Version of script:
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:
MYSQLI_CLIENT_SSL, mysqli_connect, SSL, Azure
Write your message below:

Hi everyone, I found this forum but unfortunately I couldn't find the solution to my problem. I would like to share with you if anyone knows how to solve, please share it!

My HESK is published on Azure.
My environment is a Linux WebApp with PHP7.2.
And my database is a MySQL Database from Azure.
To meet some security requirements, we had to enable SSL-ENFORCED in the MySQL Azure Database and include the ips of the WebApp in the db access permissions, as well as determine the best practices. My problem is in the connection string between HESK and the database, when accessing the page it returns the following message: (9002) SSL connection is required. Please specify SSL options and retry.
I don't know how to proceed with this configuration in the db connection string.

File: database_mysqli.inc.php
Code:
function hesk_dbConnect()
{
global $hesk_settings;
global $hesk_db_link;
global $hesklang;

// Do we have an existing active link?
if ($hesk_db_link)
{
return $hesk_db_link;
}

// Is mysqli supported?
if ( ! function_exists('mysqli_connect') )
{
die($hesklang['emp']);
}

// Do we need a special port? Check and connect to the database
if ( strpos($hesk_settings['db_host'], ':') )
{
list($hesk_settings['db_host_no_port'], $hesk_settings['db_port']) = explode(':', $hesk_settings['db_host']);
$hesk_db_link = @mysqli_connect($hesk_settings['db_host_no_port'], $hesk_settings['db_user'], $hesk_settings['db_pass'], $hesk_settings['db_name'], intval($hesk_settings['db_port']) );
}
else
{
$hesk_db_link = @mysqli_connect($hesk_settings['db_host'], $hesk_settings['db_user'], $hesk_settings['db_pass'], $hesk_settings['db_name']);
}

// Errors?
if ( ! $hesk_db_link)
{
if ($hesk_settings['debug_mode'])
{
hesk_error("$hesklang[cant_connect_db]</p><p>$hesklang[mysql_said]:<br />(".mysqli_connect_errno().") ".mysqli_connect_error()."</p>");
}
else
{
hesk_error("$hesklang[cant_connect_db]</p><p>$hesklang[contact_webmsater] <a href=\"mailto:$hesk_settings[webmaster_mail]\">$hesk_settings[webmaster_mail]</a></p>");
}
}

// Check MySQL/PHP version and set encoding to utf8
hesk_dbSetNames();

// Set the correct timezone
hesk_dbSetTimezone();

return $hesk_db_link;

} // END hesk_dbConnect()
I tried several searches on Google, but they always say to set up certificates for the database, which is not my case, I just need to inform the system that I should force the use of SSL.
Does anyone have an example or solution?
Thanks!
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: How to connect HESK to Azure MySQL Database over SSL

Post by Klemen »

Are you able to create a test database at Azure and send me the login information (via private message) so I can test this?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
cjanuzi
Posts: 2
Joined: Wed Feb 19, 2020 11:56 pm

Re: How to connect HESK to Azure MySQL Database over SSL

Post by cjanuzi »

Hi Klemen, thanks for your help.
I sent you an email containing the access and what I need to release the firewall on Azure MySQL DB, ok.
sabya1986
Posts: 1
Joined: Sun Jun 12, 2022 9:44 pm

Re: How to connect HESK to Azure MySQL Database over SSL

Post by sabya1986 »

Hi, can you please post the solution to this. I am facing the similar challenge where Hesk is not able to connect to Azure MySQL DB during installation.
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: How to connect HESK to Azure MySQL Database over SSL

Post by Klemen »

What is the exact error message you get?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: How to connect HESK to Azure MySQL Database over SSL

Post by Klemen »

Thanks for sharing what worked for you.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply