Skip to content

fix(docker): Add nsswitch.conf into the dockerfiles#1816

Merged
aeneasr merged 1 commit intoory:masterfrom
silveraid:dev
Apr 23, 2020
Merged

fix(docker): Add nsswitch.conf into the dockerfiles#1816
aeneasr merged 1 commit intoory:masterfrom
silveraid:dev

Conversation

@silveraid
Copy link
Contributor

Go's netgo implementation currently does not respect hostname overrides
defined in /etc/hosts if the /etc/nsswitch.conf does not exists.

Made changes to the Dockerfiles to add a standard /etc/nsswitch.conf
to fix this issue.

Related issue

No issue have been opened for this.

Proposed changes

When hydra is being used in a form of a docker image in an environment where hostname overrides are being used through /etc/hosts the overrides are not respected. This is not an issue with hydra all, but a well known one with golang and alpine, as the alpine base image a few years ago got rid of the nsswitch.conf saying that it is not needed anymore. Unfortunately golang depends on the presence of this file and when it is missing it just ignores whatever is in the /etc/hosts file.

This change adds the nsswitch.conf back to the docker image of hydra.

Checklist

  • I have read the contributing guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security. vulnerability, I
    confirm that I got green light (please contact
    security@ory.sh) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Further comments

Go's netgo implementation currently does not respect hostname overrides
defined in /etc/hosts if the /etc/nsswitch.conf does not exists.

Made changes to the Dockerfiles to add a standard /etc/nsswitch.conf
to fix this issue.
@CLAassistant
Copy link

CLAassistant commented Apr 22, 2020

CLA assistant check
All committers have signed the CLA.

@aeneasr
Copy link
Member

aeneasr commented Apr 23, 2020

Is it this issue golang/go#35305?

@aeneasr
Copy link
Member

aeneasr commented Apr 23, 2020

Looks like it!

@aeneasr aeneasr merged commit 48cf366 into ory:master Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants