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

Bug: (v2.20) Could not add remote Docker host: API with TLS-enabled #11665

Open
2 tasks done
leo9800 opened this issue Apr 23, 2024 · 4 comments
Open
2 tasks done

Bug: (v2.20) Could not add remote Docker host: API with TLS-enabled #11665

leo9800 opened this issue Apr 23, 2024 · 4 comments
Labels

Comments

@leo9800
Copy link

leo9800 commented Apr 23, 2024

Before you start please confirm the following.

Problem Description

Could not add docker standalone environment via API if TLS is enabled. Probably because incorrect handling of URL.

Expected Behavior

Environment added to Portainer, without any issue.

Actual Behavior

Portainer failed to establish connection to the environment. Emitting the log pasted in Portainer logs or screenshots.

Steps to Reproduce

  1. Log into Portainer
  2. Go to Environment-related -> Environments
  3. Click Add environment
  4. Select Docker Standalone and click Start Wizard
  5. Select API
  6. Enter Name and Docker API URL
  7. Toggle TLS on
  8. Upload server cert, client cert and client key
  9. Click Connect
  10. Error pops up at top-right corner

Portainer logs or screenshots

Error during connect: Get "http://address-of-remote-docker-host:9007/_ping": EOF

Portainer version

2.20.1

Portainer Edition

Business Edition (BE/EE) with 5NF / 3NF license

Platform and Version

Docker 26.0.2

OS and Architecture

Arch Linux, AMD64

Browser

Firefox 125.0.2

What command did you use to deploy Portainer?

x-logging:
  &default-logging
  driver: 'journald'
  options:
    tag: '{{.Name}}'

services:
  portainer:
    container_name: portainer
    # 2.20.1 as of writing this bug report
    image: portainer/portainer-ee:alpine-sts
    ports:
      - 127.0.0.10:50900:9000
    environment:
      - VIRTUAL_HOST=hostname-omitted
      - VIRTUAL_PORT=443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./data:/data
    restart: unless-stopped
    logging: *default-logging

Additional Information

No response

@leo9800
Copy link
Author

leo9800 commented Apr 23, 2024

Dived deeper:

I have just wiresharked on the remote docker environment (which exposed its docker socket at address-of-remote-docker-host:9007 with TLS enabled) and run the Steps to Reproduce again, then I got this:

Screenshot from 2024-04-23 12-55-42-censored

Please be notice that:

  1. It is a HTTP request to a TLS-enabled docker daemon socket, while a TLS handshake is expected in the packet capture.
  2. /_ping in the URL of HTTP request is also occured in the Portainer log, indicates this request is send by Portainer.

It seems the problem is, Portainer is talking to a TLS-enabled docker daemon in plaintext HTTP, despite toggling on TLS switch in the new environment wizard.

@leo9800
Copy link
Author

leo9800 commented Apr 23, 2024

Besides, I could confirm that there is no issue with certificates, since I tried connect to address-of-remote-docker-host:9007 on my computer with same certificates and keys:

$ docker --tlsverify --tlscacert /path/to/server.crt --tlscert /path/to/client.crt --tlskey /path/to/client.key -H address-of-remote-docker-host:9007 version
Client:
 Version:           26.0.2
 API version:       1.45
 Go version:        go1.22.2
 Git commit:        3c863ff8d3
 Built:             Fri Apr 19 07:36:40 2024
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          26.0.2
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.22.2
  Git commit:       7cef0d9cd1
  Built:            Fri Apr 19 07:36:40 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.7.15
  GitCommit:        926c9586fe4a6236699318391cd44976a98e31f1.m
 runc:
  Version:          1.1.12
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

@Herr-Sepp
Copy link

Duplicate of #11606

@Herr-Sepp
Copy link

Was fixed with Release 2.20.2
#11518

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants