Trajanje: ~15 minuta
Uloga: Security-Admin
Preduvjet: Certifikat (PFX ili PEM+KEY)
HTTPS za Data Gateway aktivirati.
Opcija A: Let's Encrypt (besplatno)
# Certbot instalirati sudo apt install certbot # Certifikat zatraziti sudo certbot certonly --standalone -d gateway.example.com # Rezultat: # /etc/letsencrypt/live/gateway.example.com/fullchain.pem # /etc/letsencrypt/live/gateway.example.com/privkey.pem
Opcija B: Samopotpisani (samo za test!)
# Samopotpisani certifikat kreirati openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes \ -subj "/CN=gateway.example.com" # U PFX konvertirati openssl pkcs12 -export -out gateway.pfx -inkey key.pem -in cert.pem -passout pass:changeit
Opcija C: Interna CA
→ Pogledajte PQ Crypto: Certifikat izdati
# Windows mkdir %GATEWAY_ROOT%\certs copy gateway.pfx %GATEWAY_ROOT%\certs\ # Linux sudo mkdir -p /opt/data-gateway/certs sudo cp cert.pem key.pem /opt/data-gateway/certs/ sudo chmod 600 /opt/data-gateway/certs/* sudo chown datagateway:datagateway /opt/data-gateway/certs/*
S PFX datotekom:
{
"Kestrel": {
"Endpoints": {
"Https": {
"Url": "https://0.0.0.0:443",
"Certificate": {
"Path": "certs/gateway.pfx",
"Password": "changeit"
}
}
}
}
}
S PEM datotekama:
{
"Kestrel": {
"Endpoints": {
"Https": {
"Url": "https://0.0.0.0:443",
"Certificate": {
"Path": "certs/cert.pem",
"KeyPath": "certs/key.pem"
}
}
}
}
}
TLS verziju forsirati:
{
"Kestrel": {
"Endpoints": {
"Https": {
"Url": "https://0.0.0.0:443",
"Certificate": {
"Path": "certs/gateway.pfx",
"Password": "changeit"
},
"SslProtocols": ["Tls12", "Tls13"]
}
}
}
}
# Windows Restart-Service -Name "DataGateway" # Linux sudo systemctl restart data-gateway # Docker docker restart gateway
# Jednostavan test curl -k https://localhost/health # S provjerom certifikata curl https://gateway.example.com/health # TLS detalje prikazati curl -v https://gateway.example.com/health 2>&1 | grep -E "SSL|TLS|subject|expire" # OpenSSL test openssl s_client -connect gateway.example.com:443 -servername gateway.example.com
Samo HTTPS dozvoliti:
{
"Kestrel": {
"Endpoints": {
"Https": {
"Url": "https://0.0.0.0:443",
"Certificate": {
"Path": "certs/gateway.pfx",
"Password": "changeit"
}
}
}
}
}
Ili HTTP→HTTPS Redirect:
// Program.cs app.UseHttpsRedirection();
| # | Provjera | Da/Ne |
| — | ———– | — |
| 1 | Certifikat valjan (nije istekao) | - |
| 2 | Certifikat za ispravan hostname | - |
| 3 | Private Key zasticen (chmod 600) | - |
| 4 | HTTPS dostupan | - |
| 5 | TLS 1.2+ aktivan | - |
| 6 | HTTP deaktiviran ili Redirect | - |
| 7 | Firewall Port 443 otvoren | - |
| Problem | Uzrok | Rjesenje |
| ——— | ——— | ——– |
Unable to configure HTTPS | Pogresan put | Certifikat-put provjeriti |
Password incorrect | Pogresna PFX lozinka | Lozinku provjeriti |
Certificate expired | Certifikat istekao | Novi certifikat |
SSL_ERROR_RX_RECORD_TOO_LONG | HTTP umjesto HTTPS | Port/Protocol provjeriti |
NET::ERR_CERT_COMMON_NAME_INVALID | CN/SAN pogresan | Certifikat s ispravnim imenom |
« <- Sigurnost | -> Certifikat obnoviti »
Wolfgang van der Stille @ EMSR DATA d.o.o. - Data Gateway Professional