Skip to content

Minio console gives "Invalid login" if internal CA cert is not imported when using reverse proxying inside docker #3315

@pitastrudl

Description

@pitastrudl

NOTE

I deployed Minio in Docker swarm and was battling getting the console work for several hours. Minio gave no indication of errors and nginx was only saying '401 unahtorized'. In the end what solved it was to include the CA certificate of our internal CA being used to access our services (including minio console) into the default path /root/.minio/certs/CAs/internal.crt.

Expected Behavior

With the correct proxying settings for nginx and minio config - console is supposed to open.

Current Behavior

With the correct proxying settings for nginx and minio config - console says 'invalid login' even with correct credentials. Minio container should warn if a certificate is missing.

Possible Solution

Steps to Reproduce (for bugs)

  1. Setup a default minio deployment without a custom certificate in Docker
  2. Setup nginx loadbalancer with TLS termination endpoint, reverse proxying console to Minio docker deployment
  3. Access console via browser
  4. Receive 'invalid login'

Context

Trying to setup minio to be used within services of the Docker swarm deployment. All services are exposed via HTTPs endpoints which Minio supports. Custom internal CA is used for issuing SSL certificates for secure communication. Additional documentation for this could be done.

I only managed to solve this after finding this issue ( minio/minio#19096 ) and translating the (google translate said Chinese) and seeing that they had issues with certificates.

On an unrelated note, https://min.io/docs/minio/linux/integrations/setup-nginx-proxy-with-minio.html should note that the console does need access to the API as its defined in the environment variables. This is referenced in the README.md.

Regression

Unknown

Your Environment

  • MinIO version used: RELEASE.2024-04-18T19-09-19Z
  • Server setup and configuration: Nginx 1.25.3-alpine
  • Operating System and version (uname -a): In Docker version 24.0.9

Nginx proxy conf (double $$ due to jinja2 escaping):

    set $$upstream_minio_console http://minio:9001;
    proxy_buffering off;
    location /minioconsole/ {
        rewrite ^/minioconsole/(.*)$$ /$$1 break;
        chunked_transfer_encoding off;
        proxy_pass $$upstream_minio_console;

        proxy_set_header Host $$http_host;
        proxy_set_header X-Real-IP $$remote_addr;
        proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $$scheme;
        proxy_set_header X-NginX-Proxy true;

        #real_ip_header X-Real-IP;

        proxy_connect_timeout 300;
        proxy_set_header Upgrade $$http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_http_version 1.1;
        # proxy_set_header Connection keep-alive;
        proxy_set_header X-Forwarded-Proto $$http_x_forwarded_proto;
        proxy_cache_bypass $$http_upgrade;
        proxy_set_header Origin 'null';

        proxy_request_buffering off;
    }

    set $$upstream_minio_api http://minio:9000;
    location /{

        proxy_set_header Host $$http_host;
        proxy_set_header X-Real-IP $$remote_addr;
        proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $$scheme;
        proxy_connect_timeout 300;
        # Default is HTTP/1, keepalive is only enabled in HTTP/1.1
        proxy_http_version 1.1;
        proxy_set_header Connection "null";
        chunked_transfer_encoding off;
        proxy_pass $$upstream_minio_api;

    }

Docker command: command: 'server /data --console-address ":9001"'

Minio environmental settings:

  MINIO_ROOT_USER: examplekey
  MINIO_ROOT_PASSWORD: examplekeypass
  MINIO_SERVER_URL: 'https://example.local/'
  MINIO_BROWSER_REDIRECT_URL: 'https://example.local/minioconsole/'

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions