duanluanlang8501 2016-04-27 03:59
浏览 414
已采纳

我如何访问我的TLS / HTTPS密钥以启动ListenAndServeTLS?

My server uses Let's Encrypt to get its TLS certificate to serve over HTTPS.

I'm electing to use the standard net/http package over Apache or nginx, so I used the webroot installation method, and it placed the cert files in /etc/letsencrypt/live/mysite.

The issue is that the live directory is only accessible by the root user. My golang program requires the certs in this directory to function and serve over HTTPS.

However for obvious reasons I'm not running my program as the root user.

So that leads me to wonder: how do I access these files without having to insecurely run my web server as root permanently?

  • 写回答

1条回答 默认 最新

  • dream6120 2016-04-27 13:03
    关注

    You have few options:

    • sudo chown -R your-user /etc/letsencrypt/live/mysite

    Or

    • sudo cp -a /etc/letsencrypt/live/mysite ./ssl/ && sudo chown -R your-user ./ssl/

    Or

    • Use a container for your app and copy your app and the certs to it, and since it will be running as root inside the container, it won't matter.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line