Este container estabelece uma conexão IPsec utilizando o strongSwan, ideal para conectar a firewalls como Fortigate com autenticação via XAuth + PSK.
This container establishes an IPsec connection using strongSwan, ideal for connecting to firewalls like Fortigate using XAuth + PSK authentication.
ipsec.conf: Configuração da VPN | VPN configurationipsec.secrets: Credenciais de autenticação | Authentication credentialsentrypoint.sh: Script de inicialização do serviço | Startup script for the VPN service
| Variável | Descrição (PT) | Description (EN) |
|---|---|---|
FGT_VPN_NAME |
Nome da conexão VPN | VPN connection name |
SENHA_USER_VPN |
Senha do usuário (XAuth) | User password (XAuth) |
USERNAME_VPN |
Nome de usuário (XAuth) | Username (XAuth) |
PUBLIC_IP_FW |
IP público do firewall remoto | Remote firewall public IP |
INTERNAL_IP_FW |
Identificação esperada pelo peer | Expected peer identity |
NETWORK_IP |
Sub-rede remota roteada pelo túnel | Remote subnet routed via VPN tunnel |
| Variável | Descrição (PT) | Description (EN) |
|---|---|---|
PUBLIC_IP_FW |
IP do peer com PSK | Peer IP with PSK |
PSK_KEY_IPSEC |
Chave pré-compartilhada (PSK) | Pre-shared key (PSK) |
USERNAME_VPN |
Nome de usuário | Username |
SENHA_USER_VPN |
Senha | Password |
203.0.113.1 : PSK "SuperSecretKey"
vpnuser01 : XAUTH "SecurePassword123"
docker build -t my-ipsec-vpn .docker run --privileged --cap-add=NET_ADMIN --network host \
-v $(pwd)/ipsec.conf:/etc/ipsec.conf \
-v $(pwd)/ipsec.secrets:/etc/ipsec.secrets \
my-ipsec-vpn
⚠️ Necessário o uso de--privilegede--cap-add=NET_ADMINpara manipular interfaces.
⚠️ --privilegedand--cap-add=NET_ADMINare required to manipulate network interfaces.
Após a conexão ser estabelecida, será exibido um comando como:
After the connection is established, a command like this will be displayed:
ip route add 10.0.0.0/16 via 172.17.0.2Execute isso no host para rotear o tráfego via container.
Run this on the host to route traffic through the container.
docker exec -it <container_id> ipsec statusall- Docker
- Suporte IPsec com XAuth + PSK no firewall remoto
- IPsec support with XAuth + PSK on the remote firewall
Sugestões e melhorias são bem-vindas!
Suggestions and improvements are welcome!