Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCP => listen tcp :443: bind: permission denied

I have an issue trying to setup an https on Google Cloud Platform using golang + let's encrypt

  • I already have a domain targeting the IP of the instance

  • Also I got a let's encrypt certificate and chain saved on /etc/letsencrypt/live/mydomain.com/

  • I already setup myapp to use the cert and configured to run as a service using myapp.service via systemctl

And after all this configurations I always get the next error message:


Feb 14 11:29:47 https https[1982]: 2019/02/14 11:29:47 listen tcp :443: bind: permission denied
Feb 14 11:29:47 https systemd[1]: https.service: Main process exited, code=exited, status=1/FAILURE
Feb 14 11:29:47 https systemd[1]: https.service: Unit entered failed state.
Feb 14 11:29:47 https systemd[1]: https.service: Failed with result 'exit-code'.
like image 654
Roberto Avatar asked Dec 03 '22 18:12

Roberto


2 Answers

If you want to bind to a privileged port (ports less than 1024). You either need to be root or have the CAP_NET_BIND_SERVICE capability.

like image 191
ifnotak Avatar answered Dec 29 '22 14:12

ifnotak


Ok, I just look for more info about CAP_NET_BIND_SERVICE and I found an answer of Scott Stensland inside this other post:

https://unix.stackexchange.com/questions/455221/setcap-not-found-in-debian-9/455234#455234

Now looks fixed ... thanks

But now I have a "open /etc/letsencrypt/live/mydomain.com/cert.pem: permission denied" error :\ (looking for other solutions in progress...)

like image 20
Roberto Avatar answered Dec 29 '22 16:12

Roberto