Skip to content

NODE_EXTRA_CA_CERTS is ignored after adding capability to node process to run on port below 1024 #22081

Closed
@dooman87

Description

@dooman87
  • Version: node:8.11-stretch
  • Platform: docker image (Linux fb58461d8443 4.9.93-linuxkit-aufs deps: update openssl to 1.0.1j #1 SMP Wed Jun 6 16:55:56 UTC 2018 x86_64 GNU/Linux)
  • Subsystem: TLS/HTTPS

We needed to add self signed root CA to nodejs, so we did it with using NODE_EXTRA_CA_CERTS environment variable. We are also running nodejs HTTP servers on port 80 and 443 and using following command to allow non-root user to do that:

setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

With that command in place though NODE_EXTRA_CA_CERTS was being ignored. It started working once we removed capability from node executable. I guess that node is not reading file as well as we didn't see warning in case NODE_EXTRA_CA_CERTS pointed to non-existing file.

Reproducible configuration can be found in this repo - https://github.com/dooman87/nodejs-setcap-bug.

To run: docker-compose up

Once you run it you will see an error: ERROR self signed certificate
If you comment line 12 in Dockerfile and run it again then you will see successful response from nginx.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions