反向代理

    • rdp 协议复制粘贴需要部署可信任的 ssl 证书
    • 通过 https 协议访问就能在 rdp 资产里面使用复制粘贴
    • 遵循 Mozilla SSL Configuration Generator 建议
    • 将证书放到 /opt/jumpserver/config/nginx/cert 里面
    1. ## Nginx 配置,这个 Nginx 是用来分发路径到不同的服务
    2. HTTP_PORT=8080
    3. HTTPS_PORT=8443
    4. SSH_PORT=2222
    5. ## LB 配置, 这个 Nginx 是 HA 时可以启动负载均衡到不同的主机
    6. USE_LB=1 # 启用 LB
    7. LB_HTTP_PORT=80 # 启用 80 端口(http)
    8. LB_HTTPS_PORT=443 # 启用 443 端口(https)
    9. LB_SSH_PORT=2223 # 启用 2223 端口(ssh)
    1. # Todo: May be can auto discovery
    2. upstream http_server {
    3. sticky name=jms_route;
    4. server nginx:80;
    5. # server HOST2:8080; # 多节点
    6. }
    7. server {
    8. listen 80;
    9. server_name demo.jumpserver.org; # 自行修改成你自己的域名
    10. return 301 https://$server_name$request_uri;
    11. }
    12. server {
    13. listen 443 ssl;
    14. server_tokens off;
    15. ssl_certificate cert/server.crt; # 修改成你自己的证书
    16. ssl_session_timeout 1d;
    17. ssl_session_cache shared:MozSSL:10m;
    18. ssl_session_tickets off;
    19. ssl_protocols TLSv1.1 TLSv1.2;
    20. ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
    21. ssl_prefer_server_ciphers off;
    22. add_header Strict-Transport-Security "max-age=63072000" always;
    23. client_max_body_size 5000m; # 上传文件大小限制
    24. location / {
    25. proxy_pass http://http_server;
    26. proxy_buffering off;
    27. proxy_request_buffering off;
    28. proxy_http_version 1.1;
    29. proxy_set_header Host $host;
    30. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    31. proxy_set_header Upgrade $http_upgrade;
    32. proxy_set_header Connection $http_connection;
    33. proxy_ignore_client_abort on;
    34. proxy_connect_timeout 600;
    35. proxy_send_timeout 600;
    36. proxy_read_timeout 600;
    37. send_timeout 6000;
    38. }
    39. }
    • 适合上层还有统一对外出口的反向代理服务器
    • 属于多层 nginx 反向代理
    • 每一层都需要设置 websocket 长连接
      • 遵循 建议
      1. listen 80;
      2. server_name demo.jumpserver.org; # 自行修改成你的域名
      3. return 301 https://$server_name$request_uri;
      4. }
      5. server {
      6. listen 443 ssl;
      7. server_name demo.jumpserver.org; # 自行修改成你的域名
      8. ssl_certificate sslkey/1_jumpserver.org_bundle.crt; # 自行设置证书
      9. ssl_certificate_key sslkey/2_jumpserver.org_bundle.key; # 自行设置证书
      10. ssl_session_timeout 1d;
      11. ssl_session_cache shared:MozSSL:10m;
      12. ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
      13. ssl_prefer_server_ciphers off;
      14. ssl_protocols TLSv1.1 TLSv1.2;
      15. ssl_prefer_server_ciphers off;
      16. add_header Strict-Transport-Security "max-age=63072000" always;
      17. client_max_body_size 4096m; # 录像及文件上传大小限制
      18. location / {
      19. # 这里的 ip 是后端 JumpServer nginx 的 ip
      20. proxy_pass http://192.168.244.144;
      21. proxy_http_version 1.1;
      22. proxy_buffering off;
      23. proxy_request_buffering off;
      24. proxy_set_header Upgrade $http_upgrade;
      25. proxy_set_header Connection "upgrade";
      26. proxy_set_header X-Real-IP $remote_addr;
      27. proxy_set_header Host $host;
      28. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      29. }
      • 需要注意 websocket 长连接设置即可