3

The SQL Server OLEDB provider can use SSL encrypted connections to SQL Server with an option in the connection string:

Use Encryption for Data
Specifies whether data should be encrypted before sending it over the network.
The valid values are "true" and "false". The default value is "false".

As Microsoft notes, that has a number of issues:

  • it requires obtaining a valid SSL certificate
  • it requires installing the SSL certificate on the server
  • it requires altering the connection string
  • it's not what i'm asking

IPSec

Fortunately, Microsoft suggests that IPSec can be used as an alternative:

SQL Server data can be encrypted during transmission by using IPSec. IPSec is provided by the client and server operating systems and requires no SQL Server configuration. For information about IPSec, see your Windows or networking documentation.

Because even though both the client and server are on the same Local Area Network:

enter image description here

We don't want anyone with WireShark, a hub, a PC in permiscuious mode, or a switch that can monitor traffic able to see the traffic.

The question is: how do you do it?

Research Effort is Immaterial

On the client machine, we want to configure a policy that requires IPSec connection to an SQL Server (e.g. port 1433). From within Windows Firewall with Advanced Security:

  • Create a new outbound firewall rule

    enter image description here

  • for an IP port:

    enter image description here

  • for destination TCP port 1433

    enter image description here

  • Allow the connection, if it is secure

    enter image description here

  • Finish

    enter image description here

The downside is that the client now cannot connect to the server:

enter image description here

Bonus Reading

Ian Boyd
  • 5,131
  • 14
  • 57
  • 79
  • What have you tried? The QA you linked to has pointers to vendor docs, and a web search for "Windows Server 2012 IPsec" returns *many* results with useful information. – EEAA Sep 16 '16 at 15:42
  • After you require the secure connection you also have to,actually set up a IPSec association. And btw. I doubt it is much less work than tls self signed cert. – eckes Oct 13 '17 at 00:10

2 Answers2

4

You can't use 'allow this connection if it is secure' until you have a connection security rule in place. This needs to be defined on both systems and have matching settings, just like setting up a standard ipsec VPN tunnel.

Here is how to create one for this use case, step by step.

  1. Open Windows Defender Firewall snapin (wf.msc)
  2. Open the "Connection Security Rules" tab
  3. Right Click on the center panel and select "New Rule"
  4. Select the 'Server to Server' template.
  5. Enter the local computer IP address in endpoint 1
  6. Enter the remote computer IP address in endpoint 2.
  7. As a general rule set the connection security rule to require authentication in both directions.
  8. Select a method to authenticate this connection.
    • If both of your systems have access to a shared internal CA / kerberos that is usually the best option.
    • Failing that - especially true for DMZ to internal machines - a preshared key is the next best option. This is set under the advanced authentication settings.
    • Anything other then computer certificates is in the advanced dialog.
    • You probably only need to use the "first authentication" method here.

This process needs to be repeated on both of your hosts.

Tim Brigham
  • 15,465
  • 7
  • 72
  • 113
0

The only way I can see this as an option is to have a IPSec VPN server setup on your SQL server and have your client create the tunnel to that first then the traffic can flow. This is a messy solution but is what the documentation is referring to when it says that IPSec is provided by the client and server operating systems.

You would need to have a secondary network setup with IP's being issued by the VPN system and rebind your SQL server to that IP range, that way only people connected to the VPN can connect the SQL server.

Payload
  • 256
  • 2
  • 7
  • Windows can do peer to peer IPSec just fine (Server to Server Template), not much to set up besides the IPSec config – eckes Oct 13 '17 at 00:41