douza19870617 2016-04-26 21:01
浏览 141

我的golang网络服务器是否需要以root用户身份运行才能支持HTTPS / TLS?

I want to use golang's built in ListenAndServeTLS() function to serve up my webserver (it's a very simple one), and I need to show it where my keys are stored. The keys are stored in a location only the root user can access (Let's Encrypt did this by default) and I can't listen to port 80 or 443 unless I'm the root user.

Does this mean I have to be running the script as root all the time? Is that not insecure?

  • 写回答

2条回答 默认 最新

  • dsfw2154 2016-04-26 21:07
    关注

    To blatantly quote the well-written Caddy FAQ:

    No. On Linux, you can use setcap to give Caddy permission to bind to low ports. Something like setcap cap_net_bind_service=+ep ./caddy should work. Consult the man pages of your OS to be certain. You could also use iptables to forward to higher ports.

    Privilege de-escalation is another option, but it is not yet a reliable solution. It will be implemented as soon as this becomes a robust possibility. Concerned readers are encouraged to get involved to help this become a reality.

    评论

报告相同问题?

悬赏问题

  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能