How to temporarily open MySQL / MariaDB port on CentOS 7 firewall

Recently, we came across a CentOS 7 that was executing MariaDB (MySQL) server. The Database Administrators needed a way to open to the port and allow connections to the SQL server from outside the machine.
As they did not have a specific IP from which they would connect, we provided the following solution.

To temporarily open port 3306

firewall-cmd --add-port=3306/tcp;

To close the port 3306 (method A)

firewall-cmd --remove-port=3306/tcp;

or reload firewalld which will cause it to loose all changes that are not permanent (method B)

firewall-cmd  --reload;

firewalld (Dynamic Firewall Manager) tool provides a dynamically managed firewall. The tool enables network/firewall zones to define the trust level of network connections and/or interfaces. It has support both for IPv4 and IPv6 firewall settings. Also, it supports Ethernet bridges and allow you to separate between runtime and permanent configuration options. Finally, it supports an interface for services or applications to add firewall rules directly.


Safari: ‘a.getTime’ is undefined

Recently, we were working with Google Charts at which we were presenting data from a timeline with some processing.
Our JavaScript code was formatted as follows to create Date objects:

$value = "2020-03-19 23:45:00";
var dateStrFormat = new Date($value);

The above code worked fine on Firefox and Chrome but it failed on Safari with the error:
a.getTime is not a function. (In 'a.getTime()', 'a.getTime' is undefined)
After some investigation we found that Safari does not support a Date() constructor that contains time as well so we had to change the code to the following block:

var dateStr = "2020-03-19";
var dateStrFormat = new Date(dateStr);
var hourStr = "23";
var minutesStr = "45";
dateStrFormat.setHours(hourStr, minutesStr);

The above works on all browsers!


Micro SD Card Testing with DJI Mavic Mini

Below we will be posting the lists of micro SD cards that we tested with DJI Mavic Mini and the result (which is if they work or not).

Work

  • integral
    • Capacity: SDXC 64GB
    • Speed: UHS-I
    • Speed Class: 10
    • UHS Speed Class: 3
    • Video Speed Class: V30
    • Application Performance Class: A1
  • SanDisk Ultra
    • Capacity: SDHC 32GB
    • Speed: UHS-I
    • Speed Class: 10
    • UHS Speed Class: 1
    • Video Speed Class: ?
    • Application Performance Class: A1
  • Verbatim
    • Capacity: SDHC 16GB
    • Speed: UHS-I
    • Speed Class: 10
    • UHS Speed Class: 1
    • Video Speed Class: ?
    • Application Performance Class: ?
  • SanDisk Extreme
    • Capacity: SDHC 32GB
    • Speed: UHS-I
    • Speed Class: ?
    • UHS Speed Class: 3
    • Video Speed Class: V30
    • Application Performance Class: A1

Do not work (SD Card Unavailable)

  • SanDisk Ultra Plus
    • Capacity: SDXC 64GB
    • Speed: UHS-I
    • Speed Class: ?
    • UHS Speed Class: 1
    • Video Speed Class: ?
    • Application Performance Class: ?
Screen capture from DJI Fly application showing an SD card that cannot be used nor formatted giving out the message “SD card unavailable”.

Hikvision DVR sending email over GMail

Recently, we were trying to setup the email configuration of a Hikvision DVR which even though it was updated to the latest firmware we would get the message Testing Failed when trying to send an email over GMail.

In the GUI of the DVR there was an option to Enable SSL but no option to enable TLS/STARTTLS. So after consulting the GMail official documentation on how to configure an email client for GMail, we set the SMTP Port to 465 and enabled the SSL option. Then we created an application password for the DVR and tried to test the settings. To our disappointment we got the Testing Failed message.

After reading the latest user manual of the DVR, it mentioned an option to Enable SSL/TLS but not Enable SSL which got us curious. It raised the following question to us: “What if they enabled the TLS functionality but they forgot to update the GUI to match it?”. So we changed the port to 587 and hit Test again.

Guess what ?

It worked!!

It appears that Hikvision enabled the TLS/STARTTLS functionality but forgot to make their GUI reflect the change!

Using the settings depicted in this photo, we were able to send test messages from our Hikvision DVR over GMail using TLS/STARTTLS on port 587 of smpt.gmail.com!
The confirmation of the successful email sending operation.
“TESTING SUCCEEDED.”

A very important note

In the password field, we did not use the password of the Gmail account! We used an Application Password! It is crucial that you activate 2-factor authentication and then create an application password, or else you will not succeed in logging in on your Gmail through your HikVision DVR/NVR.