Skip to content

USE CASE / DEVICES & TOOLS

Linux proxy workflows

Linux workloads can use proxy settings from a shell, service manager, library, container, or application. Verify the process environment that actually sends the request.

In this guide

WORKFLOW SNAPSHOT

  • Diagnose a command that works interactively but fails when run as a scheduled service.
  • Suggested starting behavior: Static assignment
  • Validate the real application and destination

A practical Linux workflow

Diagnose a command that works interactively but fails when run as a scheduled service.

  • Record the service user and effective configuration source.
  • Check whether proxy and bypass settings reach the process.
  • Use a minimal request under the same execution context.

Which Linux process reads the proxy configuration?

Keep one assignment while comparing the interactive command and the failing scheduled process. Environment variables, service configuration and library options can differ. Identify the sender’s configuration source instead of assuming a shell export reaches every process.

What should match between a Linux shell, service and container?

Shell variables in your terminal are not proof that a background service inherited them. A bypass rule can also send selected destinations directly.

Compare the observed exit from both execution contexts and redact environment values before sharing logs.

Verify the Linux connection boundary

Record executable or library version, execution user, environment source, bypass rules and any container boundary. A working curl command does not prove that a service using another library reads the same options.

Reproduce a Linux service fetch with the same target

Fetches a fixed diagnostic document from the process running this sample, giving you a response fingerprint to compare between the interactive shell and the affected Linux job.

  1. 01
    Generate your endpoint

    Choose HTTP / HTTPS and Sticky session for the complete workflow in Configure proxies.

  2. 02
    Set your proxy URL

    Set PS_PROXY_URL to http://USERNAME:PASSWORD@HOST:PORT using your generated endpoint. For IP authentication, whitelist your machine and use http://HOST:PORT. Percent-encode special characters in credentials; these are proxy credentials, separate from your account password or API key.

  3. 03
    Choose the destination

    Set PS_TARGET_URL before running the code. Use a small HTTPS document you control that the affected shell, service or container is permitted to retrieve; use the identical URL in each execution context.

    Example URL · replace placeholders with your targethttps://example.com/diagnostics/linux-service.html

    Set PS_EXPECT_TEXT to a non-secret fixture label in your diagnostic document. This optional check inspects the returned text without running JavaScript.

ps_linux.pyFetches a fixed diagnostic document from the process running this sample, giving you a response fingerprint to compare between the interactive shell and the affected Linux job.
Before you runPython 3.10+ · python -m pip install requests · python ps_linux.py
# Fetches a fixed diagnostic document from the process running this sample, giving you a response fingerprint to compare between the interactive shell and the affected Linux job.
# Use a small HTTPS document you control that the affected shell, service or container is permitted to retrieve; use the identical URL in each execution context.
import hashlib
import json
import os
import time
from pathlib import Path
from urllib.parse import urlsplit

import requests

class InspectSession(requests.Session):
    # Leave redirect bodies streamed instead of preparing the next request.
    def resolve_redirects(self, *args, **kwargs):
        return iter(())

proxy = os.environ["PS_PROXY_URL"]  # HTTP endpoint from ProxySight
target = os.environ["PS_TARGET_URL"]  # https://example.com/diagnostics/linux-service.html
if urlsplit(proxy).scheme != "http":
    raise ValueError("Use your generated HTTP proxy endpoint for this example.")
if urlsplit(target).scheme not in ("http", "https"):
    raise ValueError("PS_TARGET_URL must be an HTTP or HTTPS URL.")

with InspectSession() as client:
    client.trust_env = False  # No ambient proxy, NO_PROXY or netrc overrides
    started = time.monotonic()
    with client.get(
        target,
        proxies={"http": proxy, "https": proxy},
        headers={"Accept-Language": "en-US,en;q=0.9"},
        timeout=(10, 20), allow_redirects=False, stream=True,
    ) as response:
        body = bytearray()
        for chunk in response.iter_content(16384):
            body.extend(chunk)
            if len(body) > 1048576:
                raise RuntimeError("Response exceeds this example's 1 MiB limit.")
        Path("linux-service-response.html").write_bytes(body)
        print(json.dumps({
            "workflow": "linux", "status": response.status_code,
            "elapsed_ms": round((time.monotonic() - started) * 1000),
            "bytes": len(body), "sha256": hashlib.sha256(body).hexdigest(),
            "headers": {name: response.headers.get(name) for name in ['Content-Type', 'Content-Language', 'Location']},
        }, indent=2))
        expected = os.getenv("PS_EXPECT_TEXT", "")
        if expected:
            text = body.decode(response.encoding or "utf-8", errors="replace")
            print("Expected text:", "found" if expected in text else "absent")
        # A 200 status alone does not prove the intended page was returned.
        # Inspect redirects, login prompts, 403 and 429 before another request.
Understand the result

Compare status, type, cache headers, byte count and body hash while holding the target and assignment steady. Run the sample under the actual service user or container; success in a terminal does not prove another process inherited its proxy configuration.

Response bodies are limited to 1 MiB for a small diagnostic. TLS verification stays enabled; redirects are left for you to inspect. Connection guide

Example: compare an interactive command with a service job

When a command works in a terminal but not as a service, compare the effective user, environment, configuration source, and bypass rules. Run the same minimal request in the actual execution context.

Do not paste the full environment into a report: it may contain credentials. Record which settings are present and the observed result after redaction.

Illustrative observation record · replace with your test data
{
  "execution": "SERVICE_OR_SHELL",
  "user_context": "RECORD_CONTEXT",
  "config_source": "RECORD_SOURCE",
  "observed_exit": "RECORD_EXIT"
}

Linux verification checklist

For this Linux workflow, record execution user, configuration and request alongside the actual result. Use the evidence below to decide whether another observation is comparable before increasing the workload.

CheckpointHold constant or recordExpected evidence
Execution userInteractive or service identityCorrect context
ConfigurationProxy and bypass sourceEffective settings understood
RequestSame URL and timeoutComparable route observation

Troubleshoot Linux results and connection errors

SymptomCheck nextWhat the result tells you
Terminal works, service failsCheck inherited settingsThe service may not share the shell environment
Only some destinations go directInspect bypass rulesThe behavior may be deliberate
Container differs from hostVerify its egress and settingsAnother network context applies

Reproduce the request under the same Linux execution context

Use the same small destination and timeout under the affected execution context. Record the exit or redacted error, then compare with the interactive baseline. Keep credentials out of process listings, shared unit files and diagnostic exports.

A LITTLE CLARITY

Common questions.

Will setting a shell proxy route every Linux process?

No. Each process or library must use the relevant setting, and some traffic may bypass it.

What is the safest environment evidence to share?

A redacted description of relevant settings and execution context, rather than an unfiltered environment dump.

What should match between a Linux shell, service and container?

Record executable or library version, execution user, environment source, bypass rules and any container boundary. A working curl command does not prove that a service using another library reads the same options.

PUT THE KNOWLEDGE TO WORK

Your workflow.
Your next connection.

Try the controls, choose your IP behavior, and start with one clear connection check.

Explore the configurator ↗