NPS配置https访问web管理页面

因为NPS默认也支持http的访问,所以在部署完后就一直没在意这个事情。
因为服务器是暴露在公网内的,所以还是要安全一点才行。不然一旦远控的机器被破解了就很危险了

一、使用nginx反向代理访问

1、首先在nps的配置文件里关闭使用https选项,同时修改端口为只允许本机连接

配置文件位于 /etc/nps/conf/nps.conf

#HTTP(S) proxy port, no startup if empty
http_proxy_ip=127.0.0.1  #注意修改
http_proxy_port=34565
https_proxy_port=34566
https_just_proxy=false
#default https certificate setting
#https_default_cert_file=conf/qingtongqing.cc_bundle.pem
#https_default_key_file=conf/qingtongqing.cc.key


#web
web_host=a.o.com
web_username=admin
web_password=xxxxxx
web_port = 34567
web_ip=127.0.0.1   #注意修改
web_base_url=
web_open_ssl=false
web_cert_file=conf/qingtongqing.cc_bundle.pem
web_key_file=conf/qingtongqing.cc.key

2、在nginx的配置文件下添加有关nps的配置文件,不建议直接修改nginx配置
在路径/etc/nginx/conf.d 下添加 nps.conf 配置文件

server {
   
    listen 3456 ssl;
    server_name www.qingtongqing.cc;  # 替换成你的NPS域名

    ssl_protocols TLSv1.2;  # 使用与NPS相同的SSL/TLS版本
    ssl_ciphers 'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384';

    ssl_certificate /ssl/qingtongqing.cc_nginx/qingtongqing.cc_bundle.crt;  # 替换成你的SSL证书文件路径
    ssl_certificate_key /ssl/qingtongqing.cc_nginx/qingtongqing.cc.key;  # 替换成>你的SSL私钥文件路径

    location / {
   
        proxy_pass https://127.0.0.1:34567;  # 替换成你NPS服务的实际IP地址和端口号
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

配置文件做完后要等待一段时间,记得重启nps客户端和nginx程序

二、直接配置文件修改使用https

nps的配置文件里打开使用https选项,同时修改端口为允许所有客户端连接
配置文件位于 /etc/nps/conf/nps.conf

#HTTP(S) proxy port, no startup if empty
http_proxy_ip=0.0.0.0
http_proxy_port=34565
https_proxy_port=34566
https_just_proxy=false
#default https certificate setting
#https_default_cert_file=conf/qingtongqing.cc_bundle.pem
#https_default_key_file=conf/qingtongqing.cc.key


#web
web_host=a.o.com
web_username=admin
web_password=xxxxxx
web_port = 34567
web_ip=0.0.0.0
web_base_url=
web_open_ssl=true
web_cert_file=/ssl/qingtongqing.cc_nginx/qingtongqing.cc_bundle.crt  #注意修改文件路径
web_key_file=/ssl/qingtongqing.cc_nginx/qingtongqing.cc.key   #注意修改文件路径

三、重启验证

在这里插入图片描述

在这里还是推荐使用nginx反向代理的方法去做,NPS毕竟是非商业化的开源软件,开放端口暴露在公网上有一定的风险存在。

相关推荐

  1. 【安卓配置WebView以允许非HTTPS页面访问摄像头】

    2024-01-11 09:42:04       31 阅读
  2. web配置https

    2024-01-11 09:42:04       38 阅读
  3. nginx怎么配置https访问

    2024-01-11 09:42:04       32 阅读
  4. SpringBoot配置Swagger开启页面访问限制

    2024-01-11 09:42:04       30 阅读
  5. Apache配置ssl证书-实现https访问

    2024-01-11 09:42:04       47 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-11 09:42:04       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-11 09:42:04       106 阅读
  3. 在Django里面运行非项目文件

    2024-01-11 09:42:04       87 阅读
  4. Python语言-面向对象

    2024-01-11 09:42:04       96 阅读

热门阅读

  1. 力扣173. 二叉搜索树迭代器

    2024-01-11 09:42:04       58 阅读
  2. 设计模式的7大基本原则

    2024-01-11 09:42:04       47 阅读
  3. http首部

    2024-01-11 09:42:04       58 阅读
  4. K8S---kubectl patch

    2024-01-11 09:42:04       60 阅读
  5. 用Promise实现util函数

    2024-01-11 09:42:04       54 阅读
  6. GPM合并资料整理-GEM部分

    2024-01-11 09:42:04       49 阅读
  7. 【架构详细解读】

    2024-01-11 09:42:04       44 阅读
  8. mysql 分组函数,分组查询

    2024-01-11 09:42:04       60 阅读