在Linux上禁用Server安装上的远程连接(CentOS 7)的最佳方法是什么?即迫使SSH隧道在本地主机上连接。
我通常使用IPTables/Firewalld规则显式阻止端口,并关闭1443个外部端口。
然而,对于MySQL,我也倾向于只关闭用户对本地访问的访问,即'testUser'@'localhost‘而不是'testUser'@'%’。此外,如果运行mysql-secure-installation,默认的做法是将远程连接转换为根(Server中的SA)。这确保了,如果我的网络被攻破,他们仍然必须SSH隧道进入服务器。
我怎样才能做到这一点?
我正在阅读此文档,在运行时无法关闭远程连接:
EXEC sp_configure 'remote access', 0 ;
GO
RECONFIGURE ;
GO 发布于 2019-06-12 15:23:57
感谢大卫·布朗为我指明了正确的方向。有时候知道要找什么术语是最难的部分。我还得到了这篇文章的指示
因此,要更改Server以侦听localhost或127.0.0.1,只需将以下配置添加到/var/opt/mssql/mssql.conf文件中:
[network]
ipaddress = 127.0.0.1然后用以下方式重新启动服务器:
sudo systemctl restart mssql-server如果要获得所有配置参数的完整列表,则可以运行
/opt/mssql/bin/mssql-conf list注意,输出的一个示例如下
hadr.hadrenabled Allow SQL Server to use availability groups for high availability and disaster recovery
language.lcid Locale identifier for SQL Server to use (e.g. 1033 for US - English)
memory.memorylimitmb SQL Server memory limit (megabytes)
network.disablesssd Disable querying SSSD for AD account information and default to LDAP calls
network.enablekdcfromkrb5conf Enable looking up KDC information from krb5.conf
network.forceencryption Force encryption of incoming client connections
network.forcesecureldap Force using LDAPS to contact domain controller
network.ipaddress IP address for incoming connections因此,您可以将其中任何一个添加到/var/opt/mssql/mssql.conf文件中。语法是圆点之前的前缀放在方括号中,后面列出了后缀(例如,参见上文)。
为了测试它是否有效,我检查了:
1)使用它的应用程序已启动。
2)运行sudo nmap -PN <servername>以确定端口是否打开
3)尝试从远程计算机打开一个连接,而我以前可以通过sqlcmd -S <servername> -U <username>打开连接,这会导致错误
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2749.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..https://dba.stackexchange.com/questions/240296
复制相似问题