Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx: [emerg] invalid IPv6 address in resolver "[NOTE:]" in /etc/nginx/conf.d/upstreams.conf:2 #171

Closed
jdoig opened this issue Sep 13, 2023 · 2 comments

Comments

@jdoig
Copy link

jdoig commented Sep 13, 2023

Describe the bug
Poorly constrained grep in the bash scripts seems to pick up a comment from the /etc/resolv.conf file.

To Reproduce
Steps to reproduce the behavior:

  1. Start container docker run --env-file ./settings --publish 8011:80 --name nginx-s3-gateway nginx-s3-gateway:oss
  2. View logs
  3. See error:
2023/09/13 11:50:22 [emerg] 1#1: invalid IPv6 address in resolver "[NOTE:]" in /etc/nginx/conf.d/upstreams.conf:2
nginx: [emerg] invalid IPv6 address in resolver "[NOTE:]" in /etc/nginx/conf.d/upstreams.conf:2

Expected behavior
The server starts as expected.

Your environment

  • Local clone of the master branch at time of writing.

Additional context
See this line beginning with # NOTE and ending in nameservers...

nameserver 8.8.4.4
nameserver 94.198.184.14
nameserver 94.198.184.34
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 8.8.8.8

... it qualifies for the grep commands found here: https://github.com/search?q=repo%3Anginxinc%2Fnginx-s3-gateway%20%22grep%20nameserver%22&type=code
Sensitive Information

dekobon added a commit to dekobon/nginx-s3-gateway that referenced this issue Sep 13, 2023
@dekobon
Copy link
Collaborator

dekobon commented Sep 13, 2023

Thank you for reporting this!

@thresheek
Copy link

We probably should be using https://github.com/nginxinc/docker-nginx/blob/master/entrypoint/15-local-resolvers.envsh instead

elJosho pushed a commit to elJosho/nginx-s3-gateway that referenced this issue Oct 25, 2023
…ginxinc#176)

# What
Fixes an issue where comments in the `/etc/resolv.conf` would get into the dns resolvers list and cause an error when starting the s3 gateway.

## How
Following a suggestion on the issue, the logic from [this file](https://github.com/nginxinc/docker-nginx/blob/master/entrypoint/15-local-resolvers.envsh) in the official NGINX docker container was ported over to replace the existing logic.

Given a `/etc/resolv.conf` that looks like this:
```
nameserver 127.0.0.11
nameserver 8.8.4.4
nameserver 94.198.184.14
nameserver 94.198.184.34
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 8.8.8.8
options ndots:0

```

The existing code would produce this:
```
127.0.0.11 8.8.4.4 94.198.184.14 94.198.184.34 [NOTE:] The 8.8.8.8
```

With this change applied it looks like this:
```
127.0.0.11 8.8.4.4 94.198.184.14 94.198.184.34 8.8.8.8
```

The startup printout looks like this with the change applied:
```
Origin: http://bucket-1.minio:9000
Region: us-east-1
Addressing Style: virtual
AWS Signatures Version: v2
DNS Resolvers: 127.0.0.11 8.8.4.4 94.198.184.14 94.198.184.34 8.8.8.8
Directory Listing Enabled: false
Directory Listing Path Prefix:
Provide Index Pages Enabled:
Append slash for directory enabled:
Stripping the following headers from responses: x-amz-;
CORS Enabled: 0
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
```


## Notes
Ideally we should be incorporating the entrypoint scripts from the official nginx docker image.  For now we're just porting key logic to get the issue solved quickly.  The integration of these scripts will have some other concerns.  An issue has been filed for this work: nginxinc#175
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

No branches or pull requests

3 participants