diff --git a/Dockerfile b/Dockerfile index 575967e6..b6bbbd66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -185,10 +185,8 @@ RUN ARCH=${TARGETARCH:-amd64} && \ chmod +x /usr/local/bin/kubelogin && \ rm -rf /tmp/kubelogin.zip /tmp/bin -# Copy roxie binary and scripts from builder +# Copy roxie binary from builder COPY --from=builder /build/roxie /usr/local/bin/roxie -COPY scripts/roxcurl /usr/local/bin/roxcurl -RUN chmod +x /usr/local/bin/roxcurl # Create non-root user with / as home directory for simplified volume mounting # This allows users to mount credentials directly at their standard paths: diff --git a/cmd/subshell.go b/cmd/subshell.go index 1495b4ec..a3936961 100644 --- a/cmd/subshell.go +++ b/cmd/subshell.go @@ -205,7 +205,9 @@ func printBanner(w io.Writer, centralDeploymentInfo types.CentralDeploymentInfo) cyan.Fprintln(w, "\n[roxie] Environment is set up for talking to ACS Central. Examples:") cyan.Fprintln(w, "[roxie]") cyan.Fprintln(w, "[roxie] * roxctl central whoami") - cyan.Fprintln(w, "[roxie] * roxcurl /v1/clusters") + if !env.RunningInRoxieContainer { + cyan.Fprintln(w, "[roxie] * roxcurl /v1/clusters (https://github.com/stackrox/workflow)") + } cyan.Fprintln(w, "[roxie]") if port := centralDeploymentInfo.HAProxyPort; port > 0 { diff --git a/scripts/roxcurl b/scripts/roxcurl deleted file mode 100755 index ca8b3ac3..00000000 --- a/scripts/roxcurl +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - -# Curls StackRox Central at the specified endpoint -# Uses ROX_API_TOKEN for authentication -# Falls back to reading default admin password if no token is set - -set -eu - -: ${ROX_BASE_URL:=https://localhost:8000} - -# Validate input -if [[ $# -lt 1 ]]; then - echo "Usage: $0 url [curl options...]" >&2 - echo "" >&2 - echo "Environment variables:" >&2 - echo " ROX_BASE_URL - Base URL for Central (default: https://localhost:8000)" >&2 - echo " ROX_API_TOKEN - API token for authentication" >&2 - echo " ROX_AUTH_TOKEN - Alternative name for API token" >&2 - echo " ROX_PASSWORD - Admin password (used if no token is set)" >&2 - exit 2 -fi - -url="$1" -shift - -# Construct full URL if not fully qualified -if [[ ! "$url" =~ ^https?:// ]]; then - url="${ROX_BASE_URL%/}/${url#/}" -fi - -# Handle authentication -auth=() -token="${ROX_API_TOKEN:-${ROX_AUTH_TOKEN:-}}" -if [[ -n "${token}" ]]; then - # Use token-based authentication - auth=(-H "Authorization: Bearer ${token}") -elif [[ -n "${ROX_PASSWORD:-}" ]]; then - # Use basic authentication with provided password - auth=(-u "admin:${ROX_PASSWORD}") -else - # Try to read password from default location - # This matches the behavior of roxctl and other StackRox tools - password_file="${HOME}/.roxie/admin-password" - if [[ -f "${password_file}" ]]; then - password=$(cat "${password_file}") - auth=(-u "admin:${password}") - else - echo "Error: No authentication method available." >&2 - echo "Please set ROX_API_TOKEN, ROX_PASSWORD, or create ${password_file}" >&2 - exit 1 - fi -fi - -# Execute curl with appropriate authentication -exec curl -sSk "${auth[@]}" "$url" "$@"