From 028a41d86afd4c14e83678f06da9eb66a5855b95 Mon Sep 17 00:00:00 2001 From: CaffeineFueled Date: Fri, 17 Oct 2025 23:17:05 +0200 Subject: [PATCH 1/4] CAHNGE *-DOMAIN to *-BASEURL to handle protocols better #5 --- Dockerfile | 5 ----- README.md | 33 ++++++++++++++++++++++++++++----- main.py | 28 ++++++++++++++-------------- 3 files changed, 42 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index e5b75ee..c99b05a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,11 +19,6 @@ RUN chown -R appuser:appuser /app # Switch to non-root user USER appuser -# Set default environment variables -ENV PAD_DOMAIN=aukpad.com -ENV DUMP_DOMAIN=linedump.com -ENV PROXY_DOMAIN=bin.aukpad.com - # Expose port EXPOSE 8000 diff --git a/README.md b/README.md index e9f637d..02034cc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Project Name +# Aukpad Paste Proxy This proxy allows the paste creation from temporary aukpads via linedump. Can be used as a 'GUI' for linedump. @@ -26,19 +26,42 @@ This proxy allows the paste creation from temporary aukpads via linedump. Can be ## Installation -WIP +### Environment Variables + +| Variable | Description | Default | +|----------|-------------|---------| +| `PAD_BASEURL` | Source paste service base URL including protocol | `https://aukpad.com` | +| `DUMP_BASEURL` | Destination paste service base URL including protocol | `https://linedump.com` | +| `PROXY_BASEURL` | This proxy's base URL for documentation including protocol | `https://bin.aukpad.com` | + + +### Manual Container Run ```bash +# Using variables $CONTAINER_CMD run --name ${CONTAINER_NAME} \ -p 127.0.0.1:${PORT_HOST}:${PORT_CONTAINER} \ - -e PAD_DOMAIN="${PAD_DOMAIN}" \ - -e DUMP_DOMAIN="${DUMP_DOMAIN}" \ - -e PROXY_DOMAIN="${PROXY_DOMAIN}" \ + -e PAD_BASEURL="${PAD_BASEURL}" \ + -e DUMP_BASEURL="${DUMP_BASEURL}" \ + -e PROXY_BASEURL="${PROXY_BASEURL}" \ --read-only \ --security-opt no-new-privileges:true \ --cap-drop ALL \ --user 1000:1000 \ -d ${IMAGE_NAME}:latest + +# Example with Podman +podman run --name aukpad-paste-proxy \ + --replace \ + -p 127.0.0.1:8001:8000 \ + -e PAD_BASEURL="https://aukpad.com" \ + -e DUMP_BASEURL="https://linedump.com" \ + -e PROXY_BASEURL="http://127.0.0.1:8001" \ + --read-only \ + --security-opt no-new-privileges:true \ + --cap-drop ALL \ + --user 1000:1000 \ + -d localhost/aukpad-proxy:dev ``` --- diff --git a/main.py b/main.py index b3a97bc..77b1110 100644 --- a/main.py +++ b/main.py @@ -7,25 +7,25 @@ import os app = FastAPI(title="Aukpad Proxy Service", description="Proxy service for aukpad.com to linedump.com") # Configuration from environment variables -PAD_DOMAIN = os.getenv("PAD_DOMAIN", "aukpad.com") -DUMP_DOMAIN = os.getenv("DUMP_DOMAIN", "linedump.com") -PROXY_DOMAIN = os.getenv("PROXY_DOMAIN", "bin.aukpad.com") +PAD_BASEURL = os.getenv("PAD_BASEURL", "https://aukpad.com") +DUMP_BASEURL = os.getenv("DUMP_BASEURL", "https://linedump.com") +PROXY_BASEURL = os.getenv("PROXY_BASEURL", "https://bin.aukpad.com") @app.get("/{paste_id}") async def proxy_paste(paste_id: str): try: # Fetch content from pad domain - pad_url = f"https://{PAD_DOMAIN}/{paste_id}/raw" - + pad_url = f"{PAD_BASEURL}/{paste_id}/raw" + async with httpx.AsyncClient() as client: # Get content from pad pad_response = await client.get(pad_url) pad_response.raise_for_status() content = pad_response.text - + # Post content to dump domain dump_response = await client.post( - f"https://{DUMP_DOMAIN}", + DUMP_BASEURL, data=content, headers={"Content-Type": "text/plain"} ) @@ -48,13 +48,13 @@ async def proxy_paste(paste_id: str): async def root(): return { "service": "Aukpad Proxy Service", - "description": f"This service proxies paste content from {PAD_DOMAIN} to {DUMP_DOMAIN}", - "usage": f"Visit https://{PROXY_DOMAIN}/{{paste_id}} to fetch content from https://{PAD_DOMAIN}/{{paste_id}}/raw and redirect to the posted URL on {DUMP_DOMAIN}", - "example": f"https://{PROXY_DOMAIN}/abc123 → fetches https://{PAD_DOMAIN}/abc123/raw → posts to https://{DUMP_DOMAIN} → redirects to result URL", - "domains": { - "proxy": PROXY_DOMAIN, - "source": PAD_DOMAIN, - "destination": DUMP_DOMAIN + "description": f"This service proxies paste content from {PAD_BASEURL} to {DUMP_BASEURL}", + "usage": f"Visit {PROXY_BASEURL}/{{paste_id}} to fetch content from {PAD_BASEURL}/{{paste_id}}/raw and redirect to the posted URL on {DUMP_BASEURL}", + "example": f"{PROXY_BASEURL}/abc123 → fetches {PAD_BASEURL}/abc123/raw → posts to {DUMP_BASEURL} → redirects to result URL", + "base_urls": { + "proxy": PROXY_BASEURL, + "source": PAD_BASEURL, + "destination": DUMP_BASEURL } } From 6a4053f7e1bbf4cb154b31703672dd2168362b50 Mon Sep 17 00:00:00 2001 From: CaffeineFueled Date: Fri, 17 Oct 2025 23:22:08 +0200 Subject: [PATCH 2/4] FIX the processing of the new linedump response format #3 --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 77b1110..55f29c9 100644 --- a/main.py +++ b/main.py @@ -30,9 +30,9 @@ async def proxy_paste(paste_id: str): headers={"Content-Type": "text/plain"} ) dump_response.raise_for_status() - - # linedump.com returns the full URL in the response body - dump_url = dump_response.text.strip() + + # linedump.com returns the full URL in the first line of the response + dump_url = dump_response.text.strip().splitlines()[0] # Redirect to the dump URL return RedirectResponse(url=dump_url, status_code=302) From a4d6d7feb9f5583903c58511dc20c94be6000cf9 Mon Sep 17 00:00:00 2001 From: CaffeineFueled Date: Fri, 17 Oct 2025 23:26:17 +0200 Subject: [PATCH 3/4] ADD info about source code to frontpage #6 --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index 55f29c9..91a4484 100644 --- a/main.py +++ b/main.py @@ -51,6 +51,7 @@ async def root(): "description": f"This service proxies paste content from {PAD_BASEURL} to {DUMP_BASEURL}", "usage": f"Visit {PROXY_BASEURL}/{{paste_id}} to fetch content from {PAD_BASEURL}/{{paste_id}}/raw and redirect to the posted URL on {DUMP_BASEURL}", "example": f"{PROXY_BASEURL}/abc123 → fetches {PAD_BASEURL}/abc123/raw → posts to {DUMP_BASEURL} → redirects to result URL", + "source_code": "https://git.uphillsecurity.com/cf7/aukpad-paste-proxy", "base_urls": { "proxy": PROXY_BASEURL, "source": PAD_BASEURL, From d402fa3f02cfd09ac9f5b5ef3d860b7b76f6a792 Mon Sep 17 00:00:00 2001 From: CaffeineFueled Date: Fri, 17 Oct 2025 23:34:52 +0200 Subject: [PATCH 4/4] ADD more installation instructions and clean up README #1 --- README.md | 44 ++++++++++++-------------------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 02034cc..5fc6600 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,16 @@ # Aukpad Paste Proxy -This proxy allows the paste creation from temporary aukpads via linedump. Can be used as a 'GUI' for linedump. - -- Status: Beta - Docs missing, not suited for current linedump version - ---- - -## Features - -**Available**: - -**Ideas**: - -**Not planned**: +This proxy allows the paste creation from temporary [aukpad](https://aukpad.com/) via [linedump](https://linedump.com/). Can be used as a 'GUI' for linedump. --- ## Usage -- Create a pad in aukpad. -- Change the domain of the pad from `aukpad.com` `bin.aukpad.com` -- Create new paste in linedump instance and get redirected +- Create a pad in your aukpad instance of choice. +- Replace the domain of the aukpad instance with the domain of the this proxy while leaving the {paste_id}- for example: https://aukpad.com/fef3 into https://bin.aukpad.com/fef3 +- This will create a paste on the chosen linedump instanec of this proxy. + +Information can be found on the root page of the proxy instance. --- @@ -35,35 +25,25 @@ This proxy allows the paste creation from temporary aukpads via linedump. Can be | `PROXY_BASEURL` | This proxy's base URL for documentation including protocol | `https://bin.aukpad.com` | -### Manual Container Run +### Docker / Podman ```bash -# Using variables -$CONTAINER_CMD run --name ${CONTAINER_NAME} \ - -p 127.0.0.1:${PORT_HOST}:${PORT_CONTAINER} \ - -e PAD_BASEURL="${PAD_BASEURL}" \ - -e DUMP_BASEURL="${DUMP_BASEURL}" \ - -e PROXY_BASEURL="${PROXY_BASEURL}" \ - --read-only \ - --security-opt no-new-privileges:true \ - --cap-drop ALL \ - --user 1000:1000 \ - -d ${IMAGE_NAME}:latest - # Example with Podman -podman run --name aukpad-paste-proxy \ +podman run -d --name aukpad-paste-proxy \ --replace \ -p 127.0.0.1:8001:8000 \ -e PAD_BASEURL="https://aukpad.com" \ -e DUMP_BASEURL="https://linedump.com" \ - -e PROXY_BASEURL="http://127.0.0.1:8001" \ + -e PROXY_BASEURL="https://bin.aukpad.com" \ --read-only \ --security-opt no-new-privileges:true \ --cap-drop ALL \ --user 1000:1000 \ - -d localhost/aukpad-proxy:dev + git.uphillsecurity.com/cf7/aukpad-paste-proxy:latest ``` +_Replace 'podman' with 'docker'._ + --- ## Security