Behind a corporate proxy

Your GitLab sits behind an egress proxy, its certificate is signed by your organisation's own authority, an access gateway stands in front of it, and the only token you can get carries read_api. All four are keys on one instance in the settings file.

corporate-proxy
The instance block covers the private certificate authority, the client certificate, the proxy and the gateway headers, and certificate verification stays on throughout. The read-only badge in the context bar comes from the token's scope, and the actions that need write access are hidden rather than failing when pressed.

Steps

StepWhat you doWhy
1Put the instance block below into settings.ymlNames the host and how to reach it
2Export the token and the gateway secrets in your shell profileNothing secret enters the file
3Run labdash auth status --hostname gitlab.example.comConfirms the credential and the TLS chain before you launch
settings.yml
defaultHost: gitlab.example.com

instances:
  gitlab.example.com:
    # Credential: read from the environment, never stored by labdash
    tokenEnv: GITLAB_WORK_TOKEN

    # GitLab is not at the domain root
    subfolder: gitlab

    # Corporate root certificate. Verification stays ON
    caCert: /etc/ssl/certs/corp-root.pem

    # Mutual TLS, if your instance requires a client certificate
    clientCert: /etc/ssl/certs/client.pem
    clientKey: /etc/ssl/private/client-key.pem

    # Egress proxy
    proxy: http://proxy.internal:3128

    # An access gateway in front of GitLab
    customHeaders:
      - name: Cf-Access-Client-Id
        valueFromEnv: CF_ACCESS_ID
      - name: Cf-Access-Client-Secret
        valueFromEnv: CF_ACCESS_SECRET
export GITLAB_WORK_TOKEN="$(pass show work/gitlab-pat)"
export CF_ACCESS_ID="$(pass show work/cf-access-id)"
export CF_ACCESS_SECRET="$(pass show work/cf-access-secret)"

labdash auth status --hostname gitlab.example.com

That is the whole file. It describes the connection; what you see in the dashboard comes from Home, browsing and pinning, the same as on gitlab.com.

Log in with a token rather than OAuth, because a self-managed instance has no OAuth application unless an administrator registered one.

The settings that matter

tokenEnv names an environment variable holding a personal access token. A token created with read_api gives you read-only mode: every section, every filter, every column and every log, with the mutating keys hidden. On many corporate instances that is the only scope you will be granted, and it is a supported mode.

subfolder: gitlab is for a GitLab served from https://example.com/gitlab/ rather than from a domain root. It is applied to every URL labdash builds: GraphQL, REST and OAuth.

caCert adds your organisation's root certificate to the pool. Verification stays on.

Danger

insecureSkipVerify: true turns certificate verification off It makes the connection interceptable by anything on the path, which behind a TLS-inspecting corporate proxy is not hypothetical.

caCert solves the same problem correctly. insecureSkipVerify has one legitimate use: proving for five minutes that a failure is a certificate problem, on a machine you control.

valueFromEnv on the headers reads the secret at runtime, so it never enters the settings file and the file stays safe to commit to your dotfiles.

A self-managed instance gets its own concurrency cap. Six tabs cannot open six simultaneous connections against a box that also runs your CI. Group pipeline queries bound their own fan-out for the same reason, and a tab that needs to poll faster is set on the tab itself, in the dashboard.

Your CA certificate

SituationWhere it usually is
Linux, already trusted system-wide/etc/ssl/certs/ca-certificates.crt
macOS, in the System keychainsecurity find-certificate -a -p /Library/Keychains/System.keychain > corp.pem
Windows, in the certificate storecertutil -store root, then export as Base-64
Ask your platform teamUsually the fastest route

Connection problems

labdash doctor

One command reports settings found and valid, credential present and unexpired, instance reachable, TLS chain verified, GitLab version, and terminal capabilities. One paste answers a support thread.

For request-level detail:

LABDASH_DEBUG_HTTP=1 labdash

Requests go to a file with Authorization, PRIVATE-TOKEN and JOB-TOKEN redacted before anything is written to disk.

SymptomUsually
x509: certificate signed by unknown authoritycaCert missing, or pointing at the wrong file
404 on every requestsubfolder missing, or set when it should not be
Hangs, then times outproxy missing, or the proxy needs credentials in the URL
401 immediatelyThe token is wrong, expired, or scoped to the wrong instance
403 only on actionsThe token is read_api, and read-only mode is working as intended

Variations

Proxy from the standard environment variables

If your shell already exports them, labdash honours them and you can leave proxy out:

export HTTPS_PROXY=http://proxy.internal:3128
export NO_PROXY=.internal,localhost

An explicit proxy: in the instance block overrides them, which is what you want when only GitLab needs the proxy.

A group access token for a shared dashboard

A group access token scoped to read_api gives a whole team a dashboard without giving a whole team write access:

instances:
  gitlab.example.com:
    tokenEnv: GITLAB_TEAM_TOKEN