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

✨ feat(envoy-proxy): Enable access logging for HTTP requests #68

Merged
merged 2 commits into from
Nov 23, 2023

Conversation

olivier97
Copy link
Contributor

@olivier97 olivier97 commented Nov 15, 2023

HTTP request logging

Goal

We want to be able to better track what has happened (and when). This PR enables us to do just that - access logs are written to stdout.

Example: Command injection (via proxy-service)

Command executed:

$ ug-exploit cmd-inject-proxy "echo test"

The envoy-proxy logs can then for example be retrieved as follows:

$ kubectl -n unguard logs <name of envoy proxy pod>

Matching log line (formatted for better readability):

{
    "response_code": 500,
    "downstream_remote_address": "...",
    "timestamp": "2023-11-15T13:48:12.118Z",
    "payload": "imgurl=example.com+%26%26+echo+test+%23",
    "content_type": "application/x-www-form-urlencoded",
    "hostname": "unguard-envoy-proxy-6fcbb8ddf4-92b9m",
    "message": "",
    "upstream_remote_address": "...",
    "user_agent": "python-requests/2.28.2",
    "original_path": "/ui/post",
    "response_code_details": "via_upstream"
}

As can be seen in the log line above, the command we've attempted to inject (echo test) has been logged as well as the time stamp, the content type of the request etc.

@olivier97 olivier97 requested a review from a team as a code owner November 15, 2023 15:36
@olivier97 olivier97 force-pushed the feature/envoy-proxy-request-logging branch 2 times, most recently from 01b55af to ec295eb Compare November 21, 2023 08:44
@olivier97 olivier97 force-pushed the feature/envoy-proxy-request-logging branch from ec295eb to ea1306b Compare November 22, 2023 08:42
@olivier97 olivier97 merged commit ea1306b into main Nov 23, 2023
4 checks passed
@olivier97 olivier97 deleted the feature/envoy-proxy-request-logging branch November 24, 2023 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants