How to detect if I am connected to my DB by SSH or not?
Posted: Mon 11 Jan 2021 16:05
I use the following to connect to a remote MySQL database via SSH
TMyConnection ---> TMySSHIOhandler ---> TScSSHclient ----> TScFileStorage
This seems to work as Wireshark shows encrypted packets.
Sometimes I don't want to use SSH so I delete the connection between TMyConnection and TMySSHIOhandler (this seems to work to stop a SSH connection,, even if its not the correct way to do it)
I have a number of questions
1)
My Delphi application logs all the user connections to the database in a table in the database.
Is there some property or method in any of the above components that will tell me if I am connected via SSH or not so I can log that fact as well? (this is very important as I need to use this in another area to do with IP address manipulation)
2) Is there a better way to 'turn on' and 'turn off' at runtime whether the connection uses SSH or not so I can decide whether or not to use it at runtime?
3)
I think I notice that if TScSSHclient,connected = false at design time and I then run the application, set TScSSHclient,connected := truem connect and then shut down the application, then at design time TScSSHclient,connected remains showing connected = true even though I last left it as false in design the last time. Am I just getting muddled here or is it really happening. If so why?
TMyConnection ---> TMySSHIOhandler ---> TScSSHclient ----> TScFileStorage
This seems to work as Wireshark shows encrypted packets.
Sometimes I don't want to use SSH so I delete the connection between TMyConnection and TMySSHIOhandler (this seems to work to stop a SSH connection,, even if its not the correct way to do it)
I have a number of questions
1)
My Delphi application logs all the user connections to the database in a table in the database.
Is there some property or method in any of the above components that will tell me if I am connected via SSH or not so I can log that fact as well? (this is very important as I need to use this in another area to do with IP address manipulation)
2) Is there a better way to 'turn on' and 'turn off' at runtime whether the connection uses SSH or not so I can decide whether or not to use it at runtime?
3)
I think I notice that if TScSSHclient,connected = false at design time and I then run the application, set TScSSHclient,connected := truem connect and then shut down the application, then at design time TScSSHclient,connected remains showing connected = true even though I last left it as false in design the last time. Am I just getting muddled here or is it really happening. If so why?