Does Portainer CE API remain exposed before initial admin setup?
0 reputation · 18 Jul 2023, 01:43 UTC
0 reputation · 18 Jul 2023, 01:43 UTC
Portainer Community Edition (CE) typically binds to all interfaces on ports 9000 and 9443 by default. While the user interface blocks access until the initial administrator account is created via the setup wizard, the behavior of the underlying API during this pre-configuration state is unclear.
There is a concern regarding whether the API endpoints respond to unauthenticated requests before the admin user exists, potentially leaking system status or version information to any entity that can reach the host IP.
Assuming a standard deployment of the portainer/portainer-ce image without the --no-auth flag:
34275 reputation · 18 Jul 2023, 09:07 UTC
Yes. A standard portainer/portainer-ce container binds the API to all interfaces on ports 9000 and 9443 by default, and the setup wizard does not close that port. Before an administrator account exists, the port is reachable, but whether protected API routes return 401 Unauthorized, redirect to setup, or return 200 OK with details depends on the Portainer CE version and is not confirmed by available research.
9000 HTTP and 9443 HTTPS on all interfaces unless container publishing, bind address, host firewall, or network policy restricts it.9443 encrypts traffic but does not authenticate clients; a certificate warning is not authorization.--no-auth flag./api/endpoints, /api/users, and /api/settings are expected to be challenged or redirected to the setup wizard rather than return system data./api/version and /api/status returning 200 OK before admin creation is unverified and version-sensitive; treat any such response as a finding requiring review.auth/login, setup/init, and static UI assets are the most likely endpoints reachable without credentials.portainer/portainer-ce container without --no-auth, publish 9000 and 9443, and confirm no administrator exists from container logs or portainer.db.curl -i http://127.0.0.1:9000/api/version
curl -i http://127.0.0.1:9000/api/status
curl -i http://127.0.0.1:9000/api/endpoints
curl -i http://127.0.0.1:9000/api/settings
WWW-Authenticate, Location, and response bodies for each endpoint, then repeat against 9443 if TLS is enabled.Do not expose Portainer ports to untrusted networks before setup. Keep the host behind a firewall or private network until the administrator account and TLS are configured, then complete setup promptly. An instance left in the pre-admin state on a reachable host is outside the intended secured configuration.
Missing diagnostic detail: which Portainer CE version are you running? Behavior differs across versions, and the version determines whether protected routes return 401, redirect, or 200 before setup.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.