Connecting a private git server¶
If your git server is on a private network or behind a VPN, Aegis can't reach it directly. A connector solves that. It's a small program you run inside your network. It connects out to Aegis and carries Aegis's git traffic to the servers you name, and nowhere else.
With a connector running, Aegis can:
- push your state repository to that git server
- import context and configuration from a repository hosted there
The connector only makes outgoing HTTPS connections, so nothing needs opening in your firewall.
What you need¶
- A machine inside your network that stays on and can reach your git server. It can be a server or a small virtual machine. A laptop works only while it's awake.
- The Aegis CLI on that machine. See Install.
- An administrator account in your organisation.
1. Create a connector token¶
- Open Settings, then Private network.
- Choose Create token, and enter your password (and a code, if you use two-step verification).
- Copy the token. Aegis shows it once.
Your organisation has one connector token. Creating a new one replaces the old one, and any connector still using the old token is disconnected.
2. Run the connector¶
On the machine inside your network, run aegis connect with your organisation's address and
each git server Aegis may reach, as host:port:
AEGIS_CONNECTOR_TOKEN=aegc_… nohup aegis connect \
--server https://acme.aegis.krathos.systems \
--allow git.example.internal:22 \
--allow git.example.internal:443 \
> ~/aegis-connect.log 2>&1 &
This runs in the background and keeps running after you log out. Its output goes to
~/aegis-connect.log. To stop it, run pkill -f "aegis connect".
Use port 22 (or your server's SSH port) for ssh:// and git@host:path remotes, and 443 for
https:// ones. Use the host name exactly as it appears in the remote URL you give Aegis.
The token is read from AEGIS_CONNECTOR_TOKEN, or from standard input with --token-stdin.
It can't be passed as a flag, because other users on the machine can see a command's flags.
When it's connected, the log shows Connected, and Settings → Private network
switches from the set-up steps to a card showing the destinations it allows. It reconnects by
itself if the connection drops.
Keeping it running¶
Run it as a service so it starts with the machine. With systemd:
# /etc/systemd/system/aegis-connect.service
[Unit]
Description=Aegis connector
After=network-online.target
Wants=network-online.target
[Service]
EnvironmentFile=/etc/aegis-connect.env
ExecStart=/usr/local/bin/aegis connect --server https://acme.aegis.krathos.systems --allow git.example.internal:22
Restart=always
DynamicUser=yes
[Install]
WantedBy=multi-user.target
Put AEGIS_CONNECTOR_TOKEN=aegc_… in /etc/aegis-connect.env, readable only by root
(chmod 600), then run systemctl enable --now aegis-connect.
3. Use your git server¶
Set the remote in Settings → State repository, or the repository's address on the Repositories page, as you would for any git host. When Aegis sees that your connector allows that host and port, it goes through the connector.
What the connector can reach¶
Only the destinations you list with --allow. If Aegis asks for anything else, the connector
refuses and prints Refused.
No other organisation can use your connector, and Aegis uses it only for your git operations.
Aegis checks your git server's TLS certificate and SSH host key itself, as it does for a public git host. The connector passes the encrypted traffic through unread.
Removing it¶
In Settings → Private network, choose Remove token. The connector is disconnected and stops trying. Then stop the service on your machine.