pulp-oci-images icon indicating copy to clipboard operation
pulp-oci-images copied to clipboard

pulp-in-one: nginx doesn't listen on IPv6 addresses

Open kbrantley opened this issue 1 year ago • 0 comments

Version docker.io/pulp/pulp:latest "Created": "2024-02-05T18:49:01.533467888Z",

Describe the bug nginx's config uses "listen 80 default_server deferred;" as the definition for which port to use. This prevents pulp from working in a dual stack (or IPv6 only) environment.

To Reproduce Steps to reproduce the behavior:

  1. Start a pulp-in-one container in an environment that assigns an IPv6 address.
  2. Try to access the service over IPv6.

Expected behavior The instance of nginx running within the container should be accessible over IPv6.

Additional context

Fixing this may be as simple as the config file to read "listen [::]:80 default_server deferred;" -- and that's it. In fact, doing that within the container and reloading nginx shows that it starts listening on IPv6 appropriately:

# From within the container, observe that nginx is only listening on IPv4:
[root@d7a3b2234942 /]# ss -lnp | grep 80
tcp   LISTEN 0      0                                0.0.0.0:80         0.0.0.0:*    users:(("nginx",pid=376,fd=7))

# Tweak the config, and reload nginx:
[root@d7a3b2234942 /]# sed -i 's/listen 80/listen [::]:80/g' /etc/nginx/nginx.conf
[root@d7a3b2234942 /]# killall -SIGHUP nginx

# Observe that nginx is now listening on IPv4+IPv6:
[root@d7a3b2234942 /]# ss -lnp | grep 80
tcp   LISTEN 0      0                                      *:80               *:*    users:(("nginx",pid=376,fd=10))

While this likely resolves the TODO on line one, this fix would also "complicate" fixing #582. To fix both this and #582, some additional logic would need to be added to the container to change the configuration depending on if IPv6 is enabled (no matter if an IPv6 address is assigned) or not.

kbrantley avatar Feb 10 '24 20:02 kbrantley