1.环境准备
操作系统:Centos 7.5
主机名:t-10-10-35-15 IP地址:10.10.35.15
windows 电脑
需要安装的软件:
①JDK
②presto
③apacheds
官网地址:http://directory.apache.org/apacheds/
下载地址:
https://mirrors.bfsu.edu.cn/apache/directory/apacheds/dist/2.0.0.AM26/apacheds-2.0.0.AM26-64bit.bin
④Apache Directory Studio (windows 环境运行连接ApacheDS可视化工具)
官网地址:http://directory.apache.org/studio/
下载地址:
https://mirrors.bfsu.edu.cn/apache/directory/studio/2.0.0.v20200411-M15/ApacheDirectoryStudio-2.0.0.v20200411-M15-win32.win32.x86_64.zip
Centos服务器关闭防火墙和selinux
systemctl stop firewalld
setenforce 0
2.安装JDK
Centos安装jdk环境
tar -zxvf jdk8.0.202-linux_x64.tar.gz -C /data
vi ~/.bash_profile
export JAVA_HOME=/data/jdk8.0.202-linux_x64
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/jre/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
使配置生效
source ~/.bash_profile
查看java版本信息
java -version
3.安装Presto
过程略,网上很多教程都有
4.安装ApacheDS
1.下载安装包
cd /data
wget https://mirrors.bfsu.edu.cn/apache//directory/apacheds/dist/2.0.0.AM26/apacheds-2.0.0.AM26-64bit.bin
2.添加执行权限
chmod +x apacheds-2.0.0.AM26-64bit.bin
3.安装ApacheDS
输入y ,后续直接回车,使用默认配置
4.启动ApacheDS
/etc/init.d/apacheds-2.0.0.AM26-default start #启动
/etc/init.d/apacheds-2.0.0.AM26-default stop #停止
/etc/init.d/apacheds-2.0.0.AM26-default restart #重启
5.查看启动服务状态
netstat -lntp
10636和10389为ApacheDS的默认使用端口
5.Apache Directory Studio连接LDAP
Windows电脑下载Apache Directory Studio
官网地址:http://directory.apache.org/studio/
下载地址:
https://mirrors.bfsu.edu.cn/apache/directory/studio/2.0.0.v20200411-M15/ApacheDirectoryStudio-2.0.0.v20200411-M15-win32.win32.x86_64.zip
下载完成后解压,并进入解压目录,双击ApacheDirectoryStudio.exe 运行
连接ApacheDS
设置用户名密码,默认:user:uid=admin,ou=system password:secret
添加分区
ctrl+s保存,登陆ApacheDS服务器重启服务
/etc/init.d/apacheds-2.0.0.AM26-default restart
刷新新增的分区
添加组
添加用户
添加用户密码
5.ApacheDS启用LDAPS
登陆服务器
1.创建keystore
cd /var/lib/apacheds-2.0.0.AM26/default/conf/
keytool -genkeypair -alias apacheds -keyalg RSA -validity 3650 -keystore ads.keystore
chown apacheds:apacheds ./ads.keystore
2.导出证书,需要输入密码,密码为上一步设置的值,这里为manager
keytool -export -alias apacheds -keystore ads.keystore -rfc -file apacheds.cer
3.将证书导入到系统证书库,实现自认证,这里的密钥口令是默认的:changeit
keytool -import -file apacheds.cer -alias apacheds -keystore /data/jdk8.0.202-linux_x64/jre/lib/security/cacerts
注意:-keystore 后面的值根据实际Jdk环境替换对应的路径
4.设置Apache Directory Studio 访问LDAPS,测试LDAPS是否配置成功
打开Apache Directory Studio
证书为ApacheDS中生成的ads.keystore证书
ctrl+s保存,登陆ApacheDS服务器重启服务
/etc/init.d/apacheds-2.0.0.AM26-default restart
重启完成后,配置Apache Directory Studio支持LDAPS连接
LDAPS配置无误,能正常连接
6.Presto配置LDAPS认证
进入presto部署目录
cd <presto部署目录>/etc
①编辑config.properties配置文件
vi config.properties
添加以下配置:
http-server.authentication.type=PASSWORD #认证模式
http-server.https.enabled=true #开启https
http-server.https.port=8443 #https端口
http-server.https.keystore.path=/var/lib/apacheds-2.0.0.AM26/default/conf/ads.keystore #证书路径
http-server.https.keystore.key=manager #证书密码
②添加配置文件password-authenticator.properties
vi password-authenticator.properties
输入以下配置(apacheds 创建的用户):
password-authenticator.name=ldap
ldap.url=ldaps://t-10-10-35-15:10636
ldap.user-bind-pattern=uid=${USER},ou=people,dc=smartbi,dc=com
重启presto即可。
Presto JDBC连接字符串参考:
jdbc:presto://t-10-10-35-15:8443?SSL=true&SSLKeyStorePath=/var/lib/apacheds-2.0.0.AM26/default/conf/ads.keystore&SSLKeyStorePassword=manager