有效地使用LDAP身份验证机制的PostgreSQL通常需要广博的知识在这两个领域。在试图尽可能完整而简洁,我详细说明如何启用TLS PostgreSQL和OpenLDAP服务器。跨度>
具有讽刺意味的是,最复杂的方面与PostgreSQL或OpenLDAP无关,但与创建的步骤和签名私钥和证书。跨度>
注意:我已经认真考虑过离开OpenLDAP的命令,但我想它可能受益你如果你像我一样经常因为我不要碰这个。
总结步骤
基本假设是:跨度>
- PostgreSQL和LDAP主机安装在同一个主机上。跨度>
- 用户账户,但不是密码,是Postgres服务器上创建的。跨度>
- 用户账户和密码都在LDAP服务器上配置。跨度>
- 私钥/公钥,sic证书,被创建。跨度>
- 自签名证书权威,CA,存在于主机和签署了上述Postgres和LDAP证书。跨度>
环境
本文档中描述的概念证明由一个单独的服务器:跨度>
- Linux操作系统,Ubuntu 18.04跨度>
- 主机名:my-ldap跨度>
- PostgreSQL版本14跨度>
- OpenLDAP 2.4.45版本跨度>
- 专有名称:“cn = admin, dc = nodomain”跨度>
- 密码:admin跨度>
- 最高的领域:“dn: dc = pg_user, dc = nodomain”跨度>
- 超级用户、postgres:“dn: cn = postgres, dc = pg_user, dc = nodomain”跨度>
- user1:“dn: cn = user1, dc = pg_user, dc = nodomain”跨度>
- user2:“dn: cn = user2, dc = pg_user, dc = nodomain”跨度>
- 用户帐号:跨度>
- postgres(密码跨度>postgres)跨度>
安装PostgreSQL
除了标准的安装和配置步骤Postgres远程访问、编辑基于主机的认证文件启用Postgres指LDAP服务进行身份验证。跨度>
角色和useraccount用于Postgres应该宣布。记住,不需要分配的密码:跨度>
|
1
2
3
|
——示例跨度>
创建跨度><跨度class="crayon-h">
角色跨度><跨度class="crayon-h">user1<跨度class="crayon-h">
与跨度><跨度class="crayon-h">
登录跨度><跨度class="crayon-h">
密码跨度><跨度class="crayon-h">
零跨度>;
创建跨度><跨度class="crayon-h">
角色跨度><跨度class="crayon-h">user2<跨度class="crayon-h">
与跨度><跨度class="crayon-h">
登录跨度><跨度class="crayon-h">
密码跨度><跨度class="crayon-h">
零跨度>;
|
pg_hba。相依的假设:跨度>
- LDAP URL跨度>127.0.01,本地主机,或主机名URL(如果需要的话)。跨度>
- IPv4和IPv6都宣布规则。跨度>
- 之间没有启用加密Postgres和LDAP服务。跨度>
|
1
2
3
4
5
|
#<跨度class="crayon-h">IPv4<跨度class="crayon-h">
当地的跨度><跨度class="crayon-h">连接:
主机跨度><跨度class="crayon-h">
所有跨度><跨度class="crayon-h">
所有跨度><跨度class="crayon-h">0.0.0.0<跨度class="crayon-o">/跨度>0<跨度class="crayon-h">ldap<跨度class="crayon-h">ldapserver<跨度class="crayon-o">=跨度>127.0.0.1<跨度class="crayon-h">ldapprefix =<跨度class="crayon-i">“cn =”跨度><跨度class="crayon-h">ldapsuffix =<跨度class="crayon-i">”,dc = pg_user, dc = nodomain”跨度>
#<跨度class="crayon-h">IPv6<跨度class="crayon-h">
当地的跨度><跨度class="crayon-h">连接:
主机跨度><跨度class="crayon-h">
所有跨度><跨度class="crayon-h">
所有跨度><跨度class="crayon-h">::0<跨度class="crayon-o">/跨度>0<跨度class="crayon-h">ldap<跨度class="crayon-h">ldapserver<跨度class="crayon-o">=跨度>127.0.0.1<跨度class="crayon-h">ldapprefix =<跨度class="crayon-i">“cn =”跨度><跨度class="crayon-h">ldapsuffix =<跨度class="crayon-i">”,dc = pg_user, dc = nodomain”跨度>
|
安装LDAP
|
1
|
恰当的<跨度class="crayon-o">- - - - - -跨度>得到<跨度class="crayon-h">安装<跨度class="crayon-h">可能是<跨度class="crayon-h">slapd<跨度class="crayon-h">ldap<跨度class="crayon-o">- - - - - -跨度>跑龙套
|
运行netstat, (netstat -tlnp),返回以下:跨度>
|
1
2
3
|
原型跨度><跨度class="crayon-v">Recv跨度><跨度class="crayon-o">- - - - - -跨度><跨度class="crayon-i">问跨度><跨度class="crayon-h">
发送跨度><跨度class="crayon-o">- - - - - -跨度><跨度class="crayon-i">问跨度><跨度class="crayon-h">
当地的跨度><跨度class="crayon-e">地址跨度><跨度class="crayon-e">外国跨度><跨度class="crayon-e">地址跨度><跨度class="crayon-e">状态跨度><跨度class="crayon-v">PID跨度><跨度class="crayon-o">/跨度><跨度class="crayon-e">程序跨度><跨度class="crayon-e">的名字跨度>
tcp跨度><跨度class="crayon-h">
0跨度><跨度class="crayon-h">
0跨度><跨度class="crayon-h">
0.0.0.0跨度><跨度class="crayon-o">:跨度><跨度class="crayon-cn">389年跨度><跨度class="crayon-h">
0.0.0.0跨度><跨度class="crayon-o">:跨度><跨度class="crayon-o">*跨度><跨度class="crayon-h">
听跨度><跨度class="crayon-h">
7742年跨度><跨度class="crayon-o">/跨度><跨度class="crayon-e">slapd跨度>
tcp6跨度><跨度class="crayon-h">
0跨度><跨度class="crayon-h">
0跨度><跨度class="crayon-h">
::跨度><跨度class="crayon-o">:跨度><跨度class="crayon-cn">389年跨度><跨度class="crayon-h">
::跨度><跨度class="crayon-o">:跨度><跨度class="crayon-o">*跨度><跨度class="crayon-h">
听跨度><跨度class="crayon-h">
7742年跨度><跨度class="crayon-o">/跨度><跨度class="crayon-i">slapd跨度><跨度class="crayon-h">
|
命令行实用工具
你可以控制OpenLDAP的行为通过使用这些命令行实用工具:跨度>
- ldapmodify跨度>
- 用ldapadd跨度>
- ldapdelete跨度>
- ldapmodrdn跨度>
- ldapsearch跨度>
- ldapwhoami跨度>
设置管理员密码
据悉,管理LDAP服务器需要设置密码。尽管LDAP的安装包括设置密码,这将是跨度>管理,通过执行以下命令,可以重置密码:跨度>
|
1
2
3
4
5
6
|
#<跨度class="crayon-h">
选择跨度><跨度class="crayon-h">
“不”跨度><跨度class="crayon-h">
当跨度><跨度class="crayon-h">问<跨度class="crayon-h">
来跨度><跨度class="crayon-h">配置<跨度class="crayon-h">的<跨度class="crayon-h">
数据库跨度><跨度class="crayon-h">
与跨度><跨度class="crayon-h">dbconfig<跨度class="crayon-o">- - - - - -跨度>常见的。
#<跨度class="crayon-h">
集跨度><跨度class="crayon-h">的<跨度class="crayon-h">
域跨度><跨度class="crayon-h">
的名字跨度><跨度class="crayon-h">
为跨度><跨度class="crayon-h">你的<跨度class="crayon-h">LDAP<跨度class="crayon-h">
服务器跨度>,<跨度class="crayon-h">
为跨度><跨度class="crayon-h">的例子,<跨度class="crayon-h">
“example.com”跨度>。
#<跨度class="crayon-h">
集跨度><跨度class="crayon-h">的<跨度class="crayon-h">组织<跨度class="crayon-h">
的名字跨度><跨度class="crayon-h">
为跨度><跨度class="crayon-h">你的<跨度class="crayon-h">LDAP<跨度class="crayon-h">
服务器跨度>,<跨度class="crayon-h">
为跨度><跨度class="crayon-h">的例子,<跨度class="crayon-h">
“示例公司”跨度>。
#<跨度class="crayon-h">
集跨度><跨度class="crayon-h">的<跨度class="crayon-h">管理员<跨度class="crayon-h">
密码跨度><跨度class="crayon-h">
为跨度><跨度class="crayon-h">你的<跨度class="crayon-h">LDAP<跨度class="crayon-h">
服务器跨度>。
dpkg<跨度class="crayon-o">- - - - - -跨度>重新配置<跨度class="crayon-h">slapd
|
配置
下面的bash脚本演示了配置OpenLDAP验证三个Postgres的角色,也就是说,跨度>postgres跨度>,跨度>user1跨度>,跨度>user2跨度>:跨度>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20.
21
22
23
24
25
26
27
28
29日
30.
31日
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# ! / bin / bash跨度>
集跨度><跨度class="crayon-h">
- - - - - -跨度><跨度class="crayon-i">e跨度>
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #跨度>
#跨度>
#管理密码是“admin”跨度>
#顶级域分配为“nodomain”跨度>
#跨度>
用ldapadd跨度><跨度class="crayon-h">
- - - - - -跨度><跨度class="crayon-v">v跨度><跨度class="crayon-h">
- - - - - -跨度><跨度class="crayon-i">xD跨度><跨度class="crayon-h">
“cn = admin, dc = nodomain”跨度><跨度class="crayon-h">
- - - - - -跨度><跨度class="crayon-i">w跨度><跨度class="crayon-h">
管理跨度><跨度class="crayon-h">
< <跨度><跨度class="crayon-v">_eof跨度><跨度class="crayon-sy">_跨度>
#创建最顶层域跨度>
dn跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
直流跨度><跨度class="crayon-o">=跨度><跨度class="crayon-v">pg_user跨度><跨度class="crayon-sy">,跨度><跨度class="crayon-v">直流跨度><跨度class="crayon-o">=跨度><跨度class="crayon-e">nodomain跨度>
对象类跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
dcObject跨度>
对象类跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
组织跨度>
直流跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
pg跨度><跨度class="crayon-sy">_跨度>用户
o跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
Postgres跨度><跨度class="crayon-e">用户跨度>
描述跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
所有跨度><跨度class="crayon-e">postgres跨度><跨度class="crayon-e">用户跨度><跨度class="crayon-e">驻留跨度><跨度class="crayon-i">在这里跨度>
#创建超级用户角色postgres跨度>
dn跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
cn跨度><跨度class="crayon-o">=跨度><跨度class="crayon-v">postgres跨度><跨度class="crayon-sy">,跨度><跨度class="crayon-v">直流跨度><跨度class="crayon-o">=跨度><跨度class="crayon-v">pg_user跨度><跨度class="crayon-sy">,跨度><跨度class="crayon-v">直流跨度><跨度class="crayon-o">=跨度><跨度class="crayon-e">nodomain跨度>
对象类跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
前跨度>
对象类跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
人跨度>
cn跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
postgres跨度>
sn跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
postgres跨度>
userPassword跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
postgres跨度>
_eof跨度><跨度class="crayon-sy">_跨度>
#跨度>
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #跨度>
#添加角色跨度>
用ldapadd跨度><跨度class="crayon-h">
- - - - - -跨度><跨度class="crayon-v">v跨度><跨度class="crayon-h">
- - - - - -跨度><跨度class="crayon-i">xD跨度><跨度class="crayon-h">
“cn = admin, dc = nodomain”跨度><跨度class="crayon-h">
- - - - - -跨度><跨度class="crayon-i">w跨度><跨度class="crayon-h">
管理跨度><跨度class="crayon-h">
< <跨度><跨度class="crayon-v">_eof跨度><跨度class="crayon-sy">_跨度>
#创建其他用户帐户跨度>
# user1创建角色跨度>
dn跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
cn跨度><跨度class="crayon-o">=跨度><跨度class="crayon-v">user1跨度><跨度class="crayon-sy">,跨度><跨度class="crayon-v">直流跨度><跨度class="crayon-o">=跨度><跨度class="crayon-v">pg_user跨度><跨度class="crayon-sy">,跨度><跨度class="crayon-v">直流跨度><跨度class="crayon-o">=跨度><跨度class="crayon-e">nodomain跨度>
对象类跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
前跨度>
对象类跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
人跨度>
cn跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
user1跨度>
sn跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
user1跨度>
userPassword跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
user1跨度>
#创建角色user2跨度>
dn跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
cn跨度><跨度class="crayon-o">=跨度><跨度class="crayon-v">user2跨度><跨度class="crayon-sy">,跨度><跨度class="crayon-v">直流跨度><跨度class="crayon-o">=跨度><跨度class="crayon-v">pg_user跨度><跨度class="crayon-sy">,跨度><跨度class="crayon-v">直流跨度><跨度class="crayon-o">=跨度><跨度class="crayon-e">nodomain跨度>
对象类跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
前跨度>
对象类跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
人跨度>
cn跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
user2跨度>
sn跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
user2跨度>
userPassword跨度><跨度class="crayon-o">:跨度><跨度class="crayon-h">
user2跨度>
_eof_跨度>
|
测试没有TLS连接
一个简单的登录确认LDAP和PostgreSQL正确工作。即使有一个加密psql和Postgres服务器之间的会话,之间没有加密的会话Postgres和LDAP身份验证执行:跨度>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
SSL<跨度class="crayon-h">
连接跨度><跨度class="crayon-h">(协议:<跨度class="crayon-h">TLSv1.3,<跨度class="crayon-h">密码:<跨度class="crayon-h">TLS_AES_256_GCM_SHA384,<跨度class="crayon-h">位:<跨度class="crayon-h">256年,<跨度class="crayon-h">压缩:<跨度class="crayon-h">
从跨度>)
根<跨度class="crayon-o">@跨度>我的<跨度class="crayon-o">- - - - - -跨度>ldap:~#<跨度class="crayon-h">psql<跨度class="crayon-h">
“主机= my-ldap dbname = postgres用户= = postgres postgres密码'跨度><跨度class="crayon-h">- c<跨度class="crayon-h">
“选择“ping”作为test_connectivity”跨度><跨度class="crayon-h">
test_connectivity<跨度class="crayon-h">
- - - - - - - - - - - - - - - - - - -跨度>
平
根<跨度class="crayon-o">@跨度>我的<跨度class="crayon-o">- - - - - -跨度>ldap:~#<跨度class="crayon-h">psql<跨度class="crayon-h">
“主机= my-ldap dbname = postgres用户= = user1密码user1 '跨度><跨度class="crayon-h">- c<跨度class="crayon-h">
“选择萍从user1 test_connectivity”跨度><跨度class="crayon-h">
test_connectivity<跨度class="crayon-h">
- - - - - - - - - - - - - - - - - - -跨度>
平<跨度class="crayon-h">
从跨度><跨度class="crayon-h">user1
根<跨度class="crayon-o">@跨度>我的<跨度class="crayon-o">- - - - - -跨度>ldap:~#<跨度class="crayon-h">psql<跨度class="crayon-h">
“主机用户= = my-ldap dbname = postgres user2密码= user2 '跨度><跨度class="crayon-h">- c<跨度class="crayon-h">
“选择”萍从user2的test_connectivity”跨度><跨度class="crayon-h">
test_connectivity<跨度class="crayon-h">
- - - - - - - - - - - - - - - - - - -跨度>
平<跨度class="crayon-h">
从跨度><跨度class="crayon-h">user2
|
使用TLS加密
安装额外的包
使用SSL证书,这些包应该存在,即。Ubuntu的地理分布:跨度>
|
1
|
恰当的<跨度class="crayon-h">安装<跨度class="crayon-h">可能是<跨度class="crayon-h">gnutls<跨度class="crayon-o">- - - - - -跨度>本<跨度class="crayon-h">ssl<跨度class="crayon-o">- - - - - -跨度>cert
|
管理认证中心
认证之间的Postgres和LDAP服务器包括主机进行连接尝试,实际上,合法的。出于这个原因,服务器必须签署的证书,也就是说。,需要认证授权机制。跨度>
|
1
2
3
4
|
#
#<跨度class="crayon-h">生成<跨度class="crayon-h">私人<跨度class="crayon-h">
关键跨度><跨度class="crayon-h">
为跨度><跨度class="crayon-h">自我<跨度class="crayon-o">- - - - - -跨度>签署<跨度class="crayon-h">证书<跨度class="crayon-h">权威
#
certtool<跨度class="crayon-h">
——generate-privkey比特4096——外部档案/etc/ssl/private/mycakey.pem跨度>
|
在这种情况下,CA证书配置为在十年内到期:跨度>
|
1
2
3
4
5
6
7
|
#
#<跨度class="crayon-h">定义<跨度class="crayon-h">CA<跨度class="crayon-h">证书<跨度class="crayon-h">属性
#
回声<跨度class="crayon-h">
“cn = my-ldap跨度>
ca跨度>
cert_signing_key跨度>
expiration_days = 3650”跨度><跨度class="crayon-h">
>跨度><跨度class="crayon-h">/等<跨度class="crayon-o">/跨度>ssl<跨度class="crayon-o">/跨度>ca.info
|
内部系统可以使用自签名CA证书,否则,强烈建议由授权CA签署的证书。在这种情况下,证书,一旦签署,被放置在相同的目录中存储CA证书,即跨度>/usr/local/share/ca-certificates:跨度>
|
1
2
3
4
5
6
7
8
9
|
#
#<跨度class="crayon-h">生成<跨度class="crayon-h">一个<跨度class="crayon-h">自我<跨度class="crayon-o">- - - - - -跨度>签署<跨度class="crayon-h">CA<跨度class="crayon-h">证书<跨度class="crayon-h">
和跨度>
#<跨度class="crayon-h">
复制跨度><跨度class="crayon-h">的<跨度class="crayon-h">阴极射线管<跨度class="crayon-h">
来跨度><跨度class="crayon-h">其他<跨度class="crayon-h">
受信任的跨度><跨度class="crayon-h">CA<跨度class="crayon-h">证书<跨度class="crayon-h">那<跨度class="crayon-h">包括
#<跨度class="crayon-h">
这两个跨度><跨度class="crayon-h">postgres<跨度class="crayon-h">
和跨度><跨度class="crayon-h">ldap<跨度class="crayon-h">服务器<跨度class="crayon-h">(/ usr<跨度class="crayon-o">/跨度><跨度class="crayon-r">当地的跨度><跨度class="crayon-o">/跨度><跨度class="crayon-r">分享跨度><跨度class="crayon-o">/跨度>ca<跨度class="crayon-o">- - - - - -跨度>证书/)
#
certtool<跨度class="crayon-h">
——generate-self-signed跨度>
——load-privkey /etc/ssl/private/mycakey.pem跨度>
——模板/etc/ssl/ca.info跨度>
——外部档案/usr/local/share/ca-certificates / mycacert.crt跨度>
|
注意:一旦签署,CA证书分别复制到Postgres和LDAP服务器。在这种情况下,他们是在同一个主机上,它位于主机跨度>my-ldap。否则,它必须被复制到所有Postgres和LDAP主机。跨度>
一旦复制到正确的目录,CA证书更新的列表,添加签名CA证书:跨度>
|
1
2
3
4
5
|
#
#<跨度class="crayon-h">
更新跨度><跨度class="crayon-h">列表<跨度class="crayon-h">
的跨度><跨度class="crayon-h">CA<跨度class="crayon-h">证书<跨度class="crayon-h">
在跨度><跨度class="crayon-h">
这两个跨度>
#<跨度class="crayon-h">postgres<跨度class="crayon-h">
和跨度><跨度class="crayon-h">LDAP<跨度class="crayon-h">服务器
#
更新跨度><跨度class="crayon-o">- - - - - -跨度>ca<跨度class="crayon-o">- - - - - -跨度>证书
|
LDAP公钥/私钥生成
从这里开始,重要的是要包括LDAP的完全限定域名证书的主机名,例如,跨度>my-ldap。跨度>
生成一个LDAP服务器私钥:跨度>
|
1
2
3
|
certtool<跨度class="crayon-h">
——generate-privkey跨度>
——位2048跨度>
——外部档案/etc/ldap/my-ldap_slapd_key.pem跨度>
|
定义LDAP属性证书:跨度>
|
1
2
3
4
5
6
7
8
9
|
#<跨度class="crayon-h">
为跨度><跨度class="crayon-h">一个<跨度class="crayon-h">证书<跨度class="crayon-h">请求<跨度class="crayon-h">哪一个<跨度class="crayon-h">到期
#<跨度class="crayon-h">
在跨度><跨度class="crayon-h">一个<跨度class="crayon-h">
一年跨度>
#
回声<跨度class="crayon-h">
“组织= mycompany跨度>
cn = my-ldap跨度>
tls_www_server跨度>
encryption_key跨度>
signing_key跨度>
expiration_days = 365”跨度><跨度class="crayon-h">
>跨度><跨度class="crayon-h">/等<跨度class="crayon-o">/跨度>ssl<跨度class="crayon-o">/跨度>我的<跨度class="crayon-o">- - - - - -跨度>ldap.info
|
LDAP使用自签名证书的私钥签署授权证书和私钥:跨度>
|
1
2
3
4
5
6
|
certtool<跨度class="crayon-h">
——生成证书跨度>
——load-privkey /etc/ldap/my-ldap_slapd_key.pem跨度>
——load-ca-certificate /etc/ssl/certs/mycacert.pem跨度>
——load-ca-privkey /etc/ssl/private/mycakey.pem跨度>
——模板/etc/ssl/my-ldap.info跨度>
——外部档案/etc/ldap/my-ldap_slapd_cert.pem跨度>
|
私钥更新访问权限:跨度>
|
1
2
|
sudo<跨度class="crayon-h">chgrp<跨度class="crayon-h">openldap<跨度class="crayon-h">/等<跨度class="crayon-o">/跨度>ldap<跨度class="crayon-o">/跨度>我的<跨度class="crayon-o">- - - - - -跨度>ldap_slapd_key.pem
sudo<跨度class="crayon-h">修改文件权限<跨度class="crayon-h">0640年<跨度class="crayon-h">/等<跨度class="crayon-o">/跨度>ldap<跨度class="crayon-o">/跨度>我的<跨度class="crayon-o">- - - - - -跨度>ldap_slapd_key.pem
|
创建并保存LDAP TLS配置文件,跨度>certinfo.ldif:跨度>
|
1
2
3
4
5
6
7
8
9
|
回声<跨度class="crayon-h">
“dn: cn =配置跨度>
添加:olcTLSCACertificateFile跨度>
olcTLSCACertificateFile: /etc/ssl/certs/mycacert.pem跨度>
- - - - - -跨度>
添加:olcTLSCertificateFile跨度>
olcTLSCertificateFile: /etc/ldap/my-ldap_slapd_cert.pem跨度>
- - - - - -跨度>
添加:olcTLSCertificateKeyFile跨度>
olcTLSCertificateKeyFile: /etc/ldap/my-ldap_slapd_key.pem”跨度><跨度class="crayon-h">
>跨度><跨度class="crayon-h">/等<跨度class="crayon-o">/跨度>ldap<跨度class="crayon-o">/跨度><跨度class="crayon-r">模式跨度><跨度class="crayon-o">/跨度>certinfo.ldif
|
让OpenLDAP使用TLS:跨度>
|
1
|
ldapmodify<跨度class="crayon-h">可能是<跨度class="crayon-h">
外部跨度><跨度class="crayon-h">- h<跨度class="crayon-h">ldapi: / / /<跨度class="crayon-h">- f<跨度class="crayon-h">/等<跨度class="crayon-o">/跨度>ldap<跨度class="crayon-o">/跨度><跨度class="crayon-r">模式跨度><跨度class="crayon-o">/跨度>certinfo.ldif
|
验证测试# 1
验证返回的字符串“匿名”:跨度>
|
1
|
ldapwhoami<跨度class="crayon-h">- x<跨度class="crayon-h">zz<跨度class="crayon-h">- h<跨度class="crayon-h">ldap: / /我<跨度class="crayon-o">- - - - - -跨度>ldap
|
验证测试# 2
这个测试证实了先前的行为没有TLS仍然适用:跨度>
|
1
2
|
#<跨度class="crayon-h">
没有跨度><跨度class="crayon-h">TLS
ldapsearch<跨度class="crayon-h">- x<跨度class="crayon-h">- h<跨度class="crayon-h">ldap: / /我<跨度class="crayon-o">- - - - - -跨度>ldap<跨度class="crayon-h">- b<跨度class="crayon-h">直流<跨度class="crayon-o">=跨度>nodomain<跨度class="crayon-h">- d<跨度class="crayon-h">cn<跨度class="crayon-o">=跨度><跨度class="crayon-r">管理跨度>特区<跨度class="crayon-o">=跨度>nodomain<跨度class="crayon-h">- w<跨度class="crayon-h">
管理跨度>
|
这个测试前ldapsearch应该返回的输出。失败是由一个短消息表示调用使用开关“zz”。跨度>
|
1
2
|
#<跨度class="crayon-h">
与跨度><跨度class="crayon-h">TLS
ldapsearch<跨度class="crayon-h">- x<跨度class="crayon-h">zz<跨度class="crayon-h">- h<跨度class="crayon-h">ldap: / /我<跨度class="crayon-o">- - - - - -跨度>ldap<跨度class="crayon-h">- b<跨度class="crayon-h">直流<跨度class="crayon-o">=跨度>nodomain<跨度class="crayon-h">- d<跨度class="crayon-h">cn<跨度class="crayon-o">=跨度><跨度class="crayon-r">管理跨度>特区<跨度class="crayon-o">=跨度>nodomain<跨度class="crayon-h">- w<跨度class="crayon-h">
管理跨度>
|
使用TLS使用PostgreSQL
配置
这是基于主机与TLS配置规则;注意到小编辑跨度><跨度风格="font-weight: 400; color: #ff0000;">红色的跨度><跨度风格="font-weight: 400;">:跨度>
|
1
2
3
4
5
|
#<跨度class="crayon-h">IPv4<跨度class="crayon-h">
当地的跨度><跨度class="crayon-h">连接:
hostssl<跨度class="crayon-h">
所有跨度><跨度class="crayon-h">
所有跨度><跨度class="crayon-h">0.0.0.0<跨度class="crayon-o">/跨度>0<跨度class="crayon-h">ldap<跨度class="crayon-h">ldapserver<跨度class="crayon-o">=跨度>tmp<跨度class="crayon-h">ldapprefix =<跨度class="crayon-i">“cn =”跨度><跨度class="crayon-h">ldapsuffix =<跨度class="crayon-i">”,dc = pg_user, dc = nodomain”跨度><跨度class="crayon-h">
<跨度>跨度<跨度class="crayon-h">风格=<跨度class="crayon-i">"颜色:# ff0000;“跨度><跨度class="crayon-h">>跨度>ldaptls<跨度class="crayon-o">=跨度>1<跨度class="crayon-h"><跨度>/跨度<跨度class="crayon-h">>跨度>
#<跨度class="crayon-h">IPv6<跨度class="crayon-h">
当地的跨度><跨度class="crayon-h">连接:
主机跨度><跨度class="crayon-h">
所有跨度><跨度class="crayon-h">
所有跨度><跨度class="crayon-h">::0<跨度class="crayon-o">/跨度>0<跨度class="crayon-h">ldap<跨度class="crayon-h">
<跨度>跨度<跨度class="crayon-h">风格=<跨度class="crayon-i">“颜色:# 000000;”跨度><跨度class="crayon-h">>跨度>ldapserver<跨度class="crayon-o">=跨度>tmp<跨度class="crayon-h"><跨度>/跨度<跨度class="crayon-h">>跨度><跨度class="crayon-h">ldapprefix =<跨度class="crayon-i">“cn =”跨度><跨度class="crayon-h">ldapsuffix =<跨度class="crayon-i">”,dc = pg_user, dc = nodomain”跨度><跨度class="crayon-h">
<跨度>跨度<跨度class="crayon-h">风格=<跨度class="crayon-i">"颜色:# ff0000;“跨度><跨度class="crayon-h">>跨度>ldaptls<跨度class="crayon-o">=跨度>1<跨度class="crayon-h"><跨度>/跨度<跨度class="crayon-h">>跨度>
|
验证测试:TLS
后更新pg_hba。配置与新论点,跨度>ldaptls = 1执行,服务器重新加载,其次是psql萍:跨度>
|
1
|
systemctl跨度><跨度class="crayon-e">重新加载跨度><跨度class="crayon-v">postgresql跨度><跨度class="crayon-sy">@跨度><跨度class="crayon-cn">14跨度><跨度class="crayon-o">- - - - - -跨度><跨度class="crayon-v">主要跨度>
|
|
1
2
3
4
|
根跨度><跨度class="crayon-sy">@跨度><跨度class="crayon-v">我的跨度><跨度class="crayon-o">- - - - - -跨度><跨度class="crayon-v">ldap跨度><跨度class="crayon-o">:跨度><跨度class="crayon-o">~跨度><跨度class="crayon-p"># psql '主机= 10.231.38.243 dbname = postgres用户= postgres密码= postgres ' - c”选择“萍从postgres”作为test_connectivity”跨度>
test_connectivity跨度><跨度class="crayon-h">
- - -跨度><跨度class="crayon-o">- - -跨度><跨度class="crayon-o">- - -跨度><跨度class="crayon-o">- - -跨度><跨度class="crayon-o">- - -跨度><跨度class="crayon-o">- - -跨度><跨度class="crayon-o">- - -跨度><跨度class="crayon-o">- - -跨度><跨度class="crayon-o">- - -跨度><跨度class="crayon-o">- - -跨度>
平跨度><跨度class="crayon-e">从跨度><跨度class="crayon-v">postgres跨度>
|
雷竞技下载官网Percona分布PostgreSQL提供最好的和最重要的开源社区的企业组件,在一个单一的分布,设计和测试一起工作。
今天下载Perco雷竞技下载官网na分布PostgreSQL !一个>




