大网数据广告活动
服务器运维问答

How to encrypt connections to SQL Server with IPSec?

· 52CE 我爱测

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 va…

问题原文

原帖链接 · Ian Boyd · CC BY-SA 3.0

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:

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

  • for an IP port:

  • for destination TCP port 1433

  • Allow the connection, if it is secure

  • Finish

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

Bonus Reading

已采纳解答

原帖链接 · Tim Brigham · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-09-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。