Compare commits

..

No commits in common. "d402fa3f02cfd09ac9f5b5ef3d860b7b76f6a792" and "03b21d932e6769a61a7e0c9f73cc97ef569e047f" have entirely different histories.

3 changed files with 46 additions and 45 deletions

View file

@ -19,6 +19,11 @@ RUN chown -R appuser:appuser /app
# Switch to non-root user # Switch to non-root user
USER appuser 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 port
EXPOSE 8000 EXPOSE 8000

View file

@ -1,49 +1,46 @@
# Aukpad Paste Proxy # Project Name
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. 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**:
--- ---
## Usage ## Usage
- Create a pad in your aukpad instance of choice. - Create a pad in aukpad.
- 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 - Change the domain of the pad from `aukpad.com` `bin.aukpad.com`
- This will create a paste on the chosen linedump instanec of this proxy. - Create new paste in linedump instance and get redirected
Information can be found on the root page of the proxy instance.
--- ---
## Installation ## Installation
### Environment Variables WIP
| 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` |
### Docker / Podman
```bash ```bash
# Example with Podman $CONTAINER_CMD run --name ${CONTAINER_NAME} \
podman run -d --name aukpad-paste-proxy \ -p 127.0.0.1:${PORT_HOST}:${PORT_CONTAINER} \
--replace \ -e PAD_DOMAIN="${PAD_DOMAIN}" \
-p 127.0.0.1:8001:8000 \ -e DUMP_DOMAIN="${DUMP_DOMAIN}" \
-e PAD_BASEURL="https://aukpad.com" \ -e PROXY_DOMAIN="${PROXY_DOMAIN}" \
-e DUMP_BASEURL="https://linedump.com" \
-e PROXY_BASEURL="https://bin.aukpad.com" \
--read-only \ --read-only \
--security-opt no-new-privileges:true \ --security-opt no-new-privileges:true \
--cap-drop ALL \ --cap-drop ALL \
--user 1000:1000 \ --user 1000:1000 \
git.uphillsecurity.com/cf7/aukpad-paste-proxy:latest -d ${IMAGE_NAME}:latest
``` ```
_Replace 'podman' with 'docker'._
--- ---
## Security ## Security

29
main.py
View file

@ -7,15 +7,15 @@ import os
app = FastAPI(title="Aukpad Proxy Service", description="Proxy service for aukpad.com to linedump.com") app = FastAPI(title="Aukpad Proxy Service", description="Proxy service for aukpad.com to linedump.com")
# Configuration from environment variables # Configuration from environment variables
PAD_BASEURL = os.getenv("PAD_BASEURL", "https://aukpad.com") PAD_DOMAIN = os.getenv("PAD_DOMAIN", "aukpad.com")
DUMP_BASEURL = os.getenv("DUMP_BASEURL", "https://linedump.com") DUMP_DOMAIN = os.getenv("DUMP_DOMAIN", "linedump.com")
PROXY_BASEURL = os.getenv("PROXY_BASEURL", "https://bin.aukpad.com") PROXY_DOMAIN = os.getenv("PROXY_DOMAIN", "bin.aukpad.com")
@app.get("/{paste_id}") @app.get("/{paste_id}")
async def proxy_paste(paste_id: str): async def proxy_paste(paste_id: str):
try: try:
# Fetch content from pad domain # Fetch content from pad domain
pad_url = f"{PAD_BASEURL}/{paste_id}/raw" pad_url = f"https://{PAD_DOMAIN}/{paste_id}/raw"
async with httpx.AsyncClient() as client: async with httpx.AsyncClient() as client:
# Get content from pad # Get content from pad
@ -25,14 +25,14 @@ async def proxy_paste(paste_id: str):
# Post content to dump domain # Post content to dump domain
dump_response = await client.post( dump_response = await client.post(
DUMP_BASEURL, f"https://{DUMP_DOMAIN}",
data=content, data=content,
headers={"Content-Type": "text/plain"} headers={"Content-Type": "text/plain"}
) )
dump_response.raise_for_status() dump_response.raise_for_status()
# linedump.com returns the full URL in the first line of the response # linedump.com returns the full URL in the response body
dump_url = dump_response.text.strip().splitlines()[0] dump_url = dump_response.text.strip()
# Redirect to the dump URL # Redirect to the dump URL
return RedirectResponse(url=dump_url, status_code=302) return RedirectResponse(url=dump_url, status_code=302)
@ -48,14 +48,13 @@ async def proxy_paste(paste_id: str):
async def root(): async def root():
return { return {
"service": "Aukpad Proxy Service", "service": "Aukpad Proxy Service",
"description": f"This service proxies paste content from {PAD_BASEURL} to {DUMP_BASEURL}", "description": f"This service proxies paste content from {PAD_DOMAIN} to {DUMP_DOMAIN}",
"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}", "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"{PROXY_BASEURL}/abc123 → fetches {PAD_BASEURL}/abc123/raw → posts to {DUMP_BASEURL} → redirects to result URL", "example": f"https://{PROXY_DOMAIN}/abc123 → fetches https://{PAD_DOMAIN}/abc123/raw → posts to https://{DUMP_DOMAIN} → redirects to result URL",
"source_code": "https://git.uphillsecurity.com/cf7/aukpad-paste-proxy", "domains": {
"base_urls": { "proxy": PROXY_DOMAIN,
"proxy": PROXY_BASEURL, "source": PAD_DOMAIN,
"source": PAD_BASEURL, "destination": DUMP_DOMAIN
"destination": DUMP_BASEURL
} }
} }