jumpserver堡垒机搭建以及摆设认证服务器

打印 上一主题 下一主题

主题 979|帖子 979|积分 2937

Jumpserver在线安装及摆设认证服务器CA

主机IP功能JumpServer192.168.1.34堡垒机管理资产及权限CA认证服务器192.168.1.37提供HTTPS安全加密 堡垒机一键在线安装

  1. ##z在线安装
  2. curl -sSL https://resource.fit2cloud.com/jumpserver/jumpserver/releases/latest/download/quick_start.sh | bash
复制代码
注意事项
  1. ##默认密码
  2. admin/admin
  3. ##启动JumpServer
  4. 首先进入/opt/jumpserver-installer-v3.9.3/
  5. 执行 ./jmsctl.sh start
  6. ##关闭JumpServer
  7. 首先进入/opt/jumpserver-installer-v3.9.3/
  8. 执行 ./jmsctl.sh stop
  9. ##需要使用HTTPS服务
  10. 将文件证书放在/opt/jumpserver/config/nginx/cert路径下
  11. 修改配置文件  vi /opt/jumpserver/config/config.txt
  12. SSL_CERTIFICATE=/opt/jumpserver/config/nginx/cert/httpd.crt
  13. SSL_CERTIFICATE_KEY=/opt/jumpserver/config/nginx/cert/httpd.key
  14. ps:注意,需要先停止JumpServer服务后再修改配置文件
  15. ##关闭setenforce
  16. setenforce 0
复制代码
摆设CA服务器

  1. ###简历CA服务器
  2. ##生成密钥
  3. [root@localhost ~]# (umask 007; openssl genrsa -out /etc/pki/CA/private/cakey.pem 2048)
  4. ps:
  5. ():表示此命令在子进程中运行,其目的是为了不改变当前Shell中的umask值;
  6. genrsa:生成私钥;
  7. -out:私钥的存放路径,cakey.pem:为密钥名,与配置文件中保持一致;
  8. 2048:密钥长度,默认为1024
  9. ##自签证书
  10. [root@localhost ~]# openssl req -new -x509 -key /etc/pki/CA/private/cakey.pem -out /etc/pki/CA/cacert.pem -days 1000
  11. ps:
  12. req:生成证书签署请求;
  13. -x509:生成自签署证书;
  14. -days n:证书的有效天数;
  15. -new:新请求;
  16. -key /path/to/keyfile:指定私钥文件;
  17. -out /path/to/somefile:输出文件位置
  18. ##初始化工作环境
  19. [root@localhost ~]# touch /etc/pki/CA/{index.txt,serial}
  20. [root@localhost ~]# echo 01 > /etc/pki/CA/serial
  21. ps:
  22. index.txt:索引文件,用于匹配证书编号;
  23. serial:证书序列号文件,只在首次生成证书时赋值
复制代码
实例:堡垒机HTTPS安全加密

登录堡垒机
  1. ##生成密钥对
  2. [root@localhost ~]# mkdir -p /etc/httpd/ssl
  3. [root@localhost ~]#  (umask 077; openssl genrsa -out /etc/httpd/ssl/httpd.key 2048)
  4. ##生成证书信息
  5. [root@localhost ~]# openssl req -new -key /etc/httpd/ssl/httpd.key -out /etc/httpd/ssl/httpd.csr
  6. You are about to be asked to enter information that will be incorporated
  7. into your certificate request.
  8. What you are about to enter is what is called a Distinguished Name or a DN.
  9. There are quite a few fields but you can leave some blank
  10. For some fields there will be a default value,
  11. If you enter '.', the field will be left blank.
  12. -----
  13. Country Name (2 letter code) [CN]:CN
  14. State or Province Name (full name) [JS]:JS
  15. Locality Name (eg, city) [SZ]:SZ
  16. Organization Name (eg, company) [JFHY]:JHFY
  17. Organizational Unit Name (eg, section) [JFHY]:JFHY
  18. Common Name (eg, your name or your server's hostname) [jfhy.com]:jfhy.com
  19. Email Address [www]:www
  20. Please enter the following 'extra' attributes
  21. to be sent with your certificate request
  22. A challenge password []:123456
  23. An optional company name []:www
  24. ##将刚刚申请的请求文件发送给CA服务器
  25. [root@localhost ~]# scp /etc/httpd/ssl/httpd.csr root@192.168.1.37:/etc/pki/CA/crl
复制代码
登录CA服务器
  1. ##签署证书
  2. [root@localhost ~]#  openssl ca -in /etc/pki/CA/crl/httpd.csr -out /etc/pki/CA/crl/httpd.crt -days 1000
  3. Using configuration from /etc/pki/tls/openssl.cnf
  4. Check that the request matches the signature
  5. Signature ok
  6. The organizationName field needed to be the same in the
  7. CA certificate (JFHY) and the request (JHFY)
  8. ##将签名好的证书发送给堡垒机
  9. [root@localhost ~]# scp httpd.crt root@192.168.1.34:/etc/httpd/ssl
复制代码
吊销证书

登录CA服务器
  1. ##获取证书serial
  2. [root@localhost ~]# openssl x509 -in httpd.crt -noout -serial -subject
  3. ps:
  4. x509:证书格式;
  5. -in:要吊销的证书;
  6. -noout:不输出额外信息;
  7. -serial:显示序列号;
  8. -subject:显示subject信息
  9. ##CA验证信息
  10. [root@localhost ~]# cd /etc/pki/CA/
  11. [root@localhost CA]# cat index.txt
  12. ##吊销证书
  13. [root@localhost CA]# openssl ca -revoke /etc/pki/CA/newcerts/01.pem
  14. ##删除证书
  15. 查看被吊销的证书列表
  16. [root@localhost CA]# cat /etc/pki/CA/index.txt
  17. 生成吊销证书的编号(如果是第一次吊销)
  18. [root@localhost CA]# echo 00 > /etc/pki/CA/crlnumber
  19. 更新证书吊销列表
  20. [root@localhost CA]# cd crl
  21. [root@localhost CA]# openssl ca -gencrl -out ca.crl
  22. ps: -gencrl:生成证书吊销列表
复制代码
错误


如出现以上错误,需要在配置文件中修改https默认443端口 自定义端口 如23443
放通防火墙
firewall-cmd --per --add-port=23443/tcp
firewall-cmd --reload
注意
如果修改了端口,需要在配置文件中修改一下:
-1714440104784)]
如出现以上错误,需要在配置文件中修改https默认443端口 自定义端口 如23443
放通防火墙
firewall-cmd --per --add-port=23443/tcp
firewall-cmd --reload
注意
如果修改了端口,需要在配置文件中修改一下:


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

风雨同行

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表