Search code examples
pythonsqlsql-serverpython-2.7pymssql

Method to Securely Connect to Remote SQL Server DB


I need to connect to a MS SQL DB located on a computer on a remote network and pull data off the DB into my own environment. I want to do this in the most secure way possible, and I'm looking for guidance on how to pull it off.

I'm thinking Python will be the language of choice here, but just doing some initial reading and came across this link describing setting up protocols, opening ports, etc:

https://technet.microsoft.com/en-us/library/ms345343(v=sql.110).aspx

I've also seen this python library, pymssql.

I need to know the following:

What configuration changes would need to be made on the local computer in order to make the DB accessible, again, securely and preferably to me only.

Is the above linked python library going to be the best method for this? If so, what security considerations do I need to ensure I've accounted for?


Solution

  • In order to be the only one able to access the MySQL server, you need to setup the firewall in the remote SQL server to accept ingoing SQL connections only from localhost and from your IP Address.

    I can't help you with the librabry choise beacause I never had a Microsoft SQL server, anyway, the advice I gave you above should be fine for every kind of security problem