Skip to content

Commit 208d876

Browse files
committed
Merge branch 'GHSA-wvxv-4j8q-4wjq' into develop
2 parents 63b7da2 + fb0263a commit 208d876

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

docs/api/restful.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,49 @@ You can configure JWT settings in the Glances configuration file:
144144
**Note:** The token endpoint (``/api/4/token``) does not require authentication.
145145
Protected endpoints support both Bearer token and Basic Auth authentication methods.
146146

147+
.. _security:
148+
149+
Security
150+
--------
151+
152+
By default, Glances web server runs **without authentication** and binds to
153+
**all network interfaces** (``0.0.0.0``). This means any client that can reach
154+
the server on the network can access the full REST API, including sensitive
155+
system information such as process command-lines, which may contain credentials
156+
(passwords, API keys, tokens passed as arguments).
157+
158+
This default is intentional for ease of use on private, trusted networks (home
159+
labs, local machines, internal infrastructure). However, if your Glances
160+
instance is reachable from untrusted networks, you should take the following
161+
precautions:
162+
163+
**Enable authentication** by starting Glances with the ``--password`` option:
164+
165+
.. code-block:: bash
166+
167+
glances -w --password
168+
169+
**Bind to localhost only** if remote access is not needed:
170+
171+
.. code-block:: bash
172+
173+
glances -w --bind 127.0.0.1
174+
175+
**Use a reverse proxy** (nginx, Caddy, Apache) with TLS and authentication for
176+
any public-facing or semi-public deployment. This is the recommended approach
177+
for production environments.
178+
179+
.. code-block:: ini
180+
181+
# Example: restrict bind to localhost, access via reverse proxy
182+
# In glances.conf:
183+
[outputs]
184+
# Set the bind address to localhost
185+
# then configure your reverse proxy to forward to 127.0.0.1:61208
186+
187+
When Glances is started without authentication, a warning message is displayed
188+
at startup to remind you of the risk.
189+
147190
WebUI refresh
148191
-------------
149192

glances/outputs/glances_restful_api.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,22 @@ def _router(self) -> APIRouter:
533533
# Logo
534534
print(self._logo())
535535

536+
# Security warning if no authentication is configured
537+
if not self.args.password:
538+
is_localhost = self.args.bind_address in ('127.0.0.1', 'localhost', '::1')
539+
warn_lines = [
540+
"WARNING: Glances web server is running WITHOUT authentication.",
541+
]
542+
if is_localhost:
543+
warn_lines.append(" Use --password to enable authentication.")
544+
else:
545+
warn_lines.append(" Any client on the network can access system information.")
546+
warn_lines.append(" Use --password to enable authentication or")
547+
warn_lines.append(" --bind 127.0.0.1 to restrict access to localhost.")
548+
warn_lines.append(" See https://glances.readthedocs.io/en/latest/api/restful.html#security")
549+
print('\n'.join(warn_lines) + '\n')
550+
logger.warning("Glances web server is running without authentication")
551+
536552
# Browser WEBUI
537553
if hasattr(self.args, 'browser') and self.args.browser:
538554
# Template for the root browser.html file

0 commit comments

Comments
 (0)