-
Notifications
You must be signed in to change notification settings - Fork 355
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
T4406: Add public API endpoint to display information #4380
T4406: Add public API endpoint to display information #4380
Conversation
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the trivial question of the exclamation mark, I see nothing against this. Brute force attack operators typically blast exploits at everything without any checks, so exposing the version string to the public is not a big risk even in public networks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oniko94 why not keep this endpoint with the others in api/rest/routers.py ? I can think of reasons to do it the way that you have, just curious as to the reasoning of your decision ...
@jestabro I followed mainly two reasons behind putting this endpoint in this file:
|
I fully agree; thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR introduces a new public API endpoint /info to provide basic router information, such as the hostname, version, and a pre-login banner. Key changes include:
- Adding a new endpoint in the HTTP API server to handle /info requests.
- Implementing query parameter validation via the new InfoQueryParams model.
- Integrating file-read operations and error handling to return formatted service responses.
Reviewed Changes
File | Description |
---|---|
src/services/vyos-http-api-server | Adds the /info endpoint with query parameter handling and error logging. |
src/services/api/rest/models.py | Introduces the InfoQueryParams model to validate incoming query parameters. |
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
d8acdcc
to
9fe7d85
Compare
CI integration 👍 passed! Details
|
Change summary
Adds a public endpoint
/info
to the HTTP(S) API to display some basic information about the router, namely router's hostname, VyOS version and pre-login banner.The endpoint accepts
version
andhostname
query parameters, set to valid boolean values (1, 0, 'yes', 'no' etc. are acceptable as well), which dictate whether to include respective data into the response.False
or equivalent, a correspondent field in the response object is set to an empty string.version
andhostname
are not allowed.Types of changes
Related Task(s)
https://vyos.dev/T4406
Related PR(s)
How to test / Smoketest result
curl --insecure --location --request GET 'https://<INSTANCE_ADDRESS>/info
?version=0&hostname=1
or?hostname=false
or?version=yes&hostname=0
Checklist: