Socket for GitLab network and certificates
The connections the Socket GitLab app makes, and how to allow its webhooks, trust an internal certificate authority, and route traffic through a proxy.
Socket for GitLab is in beta. Behavior may change between releases.
The Socket GitLab app receives webhooks from GitLab and makes outbound HTTPS calls to GitLab and Socket. Open these paths before you start the app, and set up certificates and a proxy if your network needs them.
Connections the app makes
The app needs these network paths:
| Direction | Destination | Purpose |
|---|---|---|
| Inbound | The app on TCP 5050, path /webhook/gitlab, from your GitLab | Push and merge request webhooks |
| Outbound | Your GitLab over HTTPS | GitLab API calls and shallow clones |
| Outbound | api.socket.dev on TCP 443 | Scan uploads and results, and the app's logs |
| Outbound | o555220.ingest.us.sentry.io on TCP 443 | Error reports to Socket's error tracking |
| Image pull | Docker Hub, or your registry mirror | Install and upgrade |
Allowlist api.socket.dev by hostname. Its DNS name returns more than one address, and a client connects to any of them.
The container serves plain HTTP on port 5050. To receive webhooks over HTTPS, put the app behind your load balancer or reverse proxy and use that address in EXTERNAL_WEBHOOK_URL.
Allow webhooks to the app's address
Self-managed GitLab blocks webhook requests to local network addresses by default. If the app's address is an internal IP address or hostname, an administrator must allow it before you start the app:
- In GitLab, select Admin, and go to Settings > Network.
- Expand Outbound requests.
- Add the app's hostname or IP address to Local IP addresses and domain names that hooks and integrations can access, and select Save changes.
Selecting Allow requests to the local network from webhooks and integrations also works, but it opens every local address to every webhook. The allowlist entry is the narrower change.
Trust an internal certificate authority
If your GitLab's certificate is signed by an internal certificate authority (CA), or a proxy inspects outbound HTTPS, the container must trust that CA. Without it, the app restarts in a loop at startup.
-
Save the CA certificate in PEM format, with any intermediate CA certificates and any inspection CA, as
internal-ca.pemin the folder that holdssocket-gitlab.env. -
Point two standard variables at the file.
NODE_EXTRA_CA_CERTScovers the app's API calls, andGIT_SSL_CAINFOcovers clones:cat >> socket-gitlab.env <<'EOF' NODE_EXTRA_CA_CERTS=/certs/internal-ca.pem GIT_SSL_CAINFO=/certs/internal-ca.pem EOF -
Mount the file by adding this line to the app's
docker runcommand, above the image name. Keep it in the command every time you recreate or upgrade the container.-v "$PWD/internal-ca.pem:/certs/internal-ca.pem:ro" \
GIT_SSL_CAINFO replaces git's default CA list. That works here because git connects only to your GitLab.
Route outbound traffic through a proxy
The app has no proxy setting of its own. If the host reaches the internet only through a proxy, append the standard proxy variables to socket-gitlab.env:
cat >> socket-gitlab.env <<'EOF'
https_proxy=PROXY_URL
no_proxy=GITLAB_HOST,socket-gitlab-db,localhost,127.0.0.1
NODE_USE_ENV_PROXY=1
EOFReplace the following:
PROXY_URL: your proxy's URL, such ashttp://proxy.example.com:8080.GITLAB_HOST: your GitLab's hostname, exactly as it appears inGITLAB_INSTANCE.
NODE_USE_ENV_PROXY=1 makes Node.js in the container send its API calls through the proxy, and no_proxy keeps GitLab and the database direct. Keep the variable names lowercase, because the app's error reporting library reads only the lowercase form. If the proxy inspects TLS, add its CA as described in Trust an internal certificate authority.
Related topics
Updated about 5 hours ago