runner image and setup for gitea workflow with self signed cert
This commit is contained in:
+7
-6
@@ -39,10 +39,10 @@ variable "gitea_admin_token" {
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
# kubectl -n kube-system exec $(kubectl -n kube-system get pod -l app.kubernetes.io/name=traefik -o jsonpath="{.items[0]['.metadata.name']}") -- cat /data/acme.json | jq '(.letsencrypt.Certificates | map(select(.domain.main=="arcodange.lab")))[0]' | jq '.certificate' -r | base64 -d | openssl x509
|
||||
# variable "ca_pem" {
|
||||
# type = string
|
||||
# }
|
||||
# same as vault CA
|
||||
variable "ca_pem" {
|
||||
type = string
|
||||
}
|
||||
terraform {
|
||||
required_providers {
|
||||
vault = {
|
||||
@@ -63,7 +63,7 @@ resource "vault_jwt_auth_backend" "gitea" {
|
||||
path = "gitea"
|
||||
type = "oidc"
|
||||
oidc_discovery_url = var.gitea_app.url
|
||||
# oidc_discovery_ca_pem = var.ca_pem
|
||||
oidc_discovery_ca_pem = file(var.ca_pem)
|
||||
oidc_client_id = var.gitea_app.id
|
||||
oidc_client_secret = var.gitea_app.secret
|
||||
bound_issuer = var.gitea_app.url
|
||||
@@ -92,6 +92,7 @@ resource "vault_jwt_auth_backend_role" "gitea" {
|
||||
"http://localhost:8250/oidc/callback", # for command line login
|
||||
"${var.vault_address}/ui/vault/auth/gitea/oidc/callback",
|
||||
"https://webapp.arcodange.fr/oauth-callback",
|
||||
"https://webapp.arcodange.lab/oauth-callback",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -101,7 +102,7 @@ resource "vault_jwt_auth_backend" "gitea_jwt" {
|
||||
path = "gitea_jwt"
|
||||
type = "jwt"
|
||||
oidc_discovery_url = var.gitea_app.url
|
||||
# oidc_discovery_ca_pem = var.ca_pem
|
||||
oidc_discovery_ca_pem = file(var.ca_pem)
|
||||
bound_issuer = var.gitea_app.url
|
||||
|
||||
tune {
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ const browser = await chromium.launch({
|
||||
log: (name, severity, message, args) => console.warn(`${severity}| ${name} :: ${message} __ ${args}`)
|
||||
},
|
||||
});
|
||||
const context = await browser.newContext({locale: "gb-GB"});
|
||||
const context = await browser.newContext({locale: "gb-GB", ignoreHTTPSErrors: true}); // Using self signed cert - could improve with NODE_EXTRA_CA_CERTS env variable
|
||||
const page = await context.newPage();
|
||||
|
||||
async function doLogin() {
|
||||
|
||||
+5
@@ -11,6 +11,7 @@
|
||||
GITEA_USER: '{{ gitea_admin_user }}'
|
||||
GITEA_PASSWORD: '{{ gitea_admin_password }}'
|
||||
VAULT_ADDRESS: '{{ vault_address }}'
|
||||
NODE_EXTRA_CA_CERTS: ''
|
||||
|
||||
- include_role:
|
||||
name: arcodange.factory.playwright
|
||||
@@ -31,6 +32,8 @@
|
||||
-v {{ volume_name }}:/tofu -w /tofu
|
||||
-v {{ role_path }}/files/hashicorp_vault.tf:/tofu/hashicorp_vault.tf
|
||||
-v ~/.config/gcloud:/root/.config/gcloud
|
||||
-v /etc/ssl/certs/arcodange-root.pem:/etc/ssl/custom/arcodange-root.pem:ro
|
||||
-e VAULT_CACERT=/etc/ssl/custom/arcodange-root.pem
|
||||
--entrypoint=''
|
||||
ghcr.io/opentofu/opentofu:latest
|
||||
{{ command }}
|
||||
@@ -44,6 +47,7 @@
|
||||
# -var='vault_token={{ vault_root_token }}'
|
||||
# -var='postgres_admin_credentials={{ postgres_admin_credentials | to_json }}'
|
||||
# -var='gitea_admin_token={{ gitea_admin_token }}'
|
||||
# -var="ca_pem=/etc/ssl/custom/arcodange-root.pem"
|
||||
- >-
|
||||
tofu apply -auto-approve -no-color
|
||||
-var='gitea_app={{ gitea_app | to_json }}'
|
||||
@@ -51,6 +55,7 @@
|
||||
-var='vault_token={{ vault_root_token }}'
|
||||
-var='postgres_admin_credentials={{ postgres_admin_credentials | to_json }}'
|
||||
-var='gitea_admin_token={{ gitea_admin_token }}'
|
||||
-var="ca_pem=/etc/ssl/custom/arcodange-root.pem"
|
||||
loop_control:
|
||||
loop_var: command
|
||||
extended: true
|
||||
|
||||
+5
-2
@@ -4,7 +4,7 @@ set -eu
|
||||
# Variables à ajuster selon ta configuration
|
||||
CLIENT_ID="{{ OIDC_CLIENT_ID }}"
|
||||
CLIENT_SECRET="{{ OIDC_CLIENT_SECRET }}"
|
||||
REDIRECT_URI="{{ OIDC_CLIENT_CALLBACK | default('https://webapp.arcodange.fr/oauth-callback') }}" # Redirige ici après l'authentification
|
||||
REDIRECT_URI="{{ OIDC_CLIENT_CALLBACK | default('https://webapp.arcodange.lab/oauth-callback') }}" # Redirige ici après l'authentification
|
||||
AUTH_URL="{{ GITEA_BASE_URL | default('https://gitea.arcodange.lab') }}/login/oauth/authorize"
|
||||
TOKEN_URL="{{ GITEA_BASE_URL | default('https://gitea.arcodange.lab') }}/login/oauth/access_token"
|
||||
ISSUER="https://gitea.arcodange.lab/"
|
||||
@@ -26,7 +26,7 @@ poll_state() {
|
||||
#echo "Tentative $attempt/$MAX_ATTEMPTS: Requête à l'endpoint /retrieve pour state=$STATE..."
|
||||
|
||||
# Effectuer la requête GET
|
||||
RESPONSE=$(curl -s -w "%{http_code}" -o /tmp/response_body "https://webapp.arcodange.fr/retrieve?state=$STATE")
|
||||
RESPONSE=$(curl -s -w "%{http_code}" -o /tmp/response_body "https://webapp.arcodange.lab/retrieve?state=$STATE")
|
||||
HTTP_CODE=$(tail -n1 <<< "$RESPONSE")
|
||||
|
||||
if [ "$HTTP_CODE" == "200" ]; then
|
||||
@@ -50,6 +50,9 @@ poll_state() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# 0. Installer le certificat arcodange.lab (droits sudo)
|
||||
# curl https://ssl-ca.arcodange.lab:8443/roots.pem -ks > /usr/local/share/ca-certificates/arcodange-root.crt && update-ca-certificates 2>/dev/null >/dev/null && export VAULT_CACERT=/usr/local/share/ca-certificates/arcodange-root.crt || echo "couldn't install self signed .crt" >&2
|
||||
|
||||
# 1. Rediriger l'utilisateur vers l'URL d'authentification
|
||||
echo "Ouvrez le lien suivant dans votre navigateur pour vous authentifier dans Gitea:"
|
||||
echo "$AUTH_URL?client_id=$CLIENT_ID&redirect_uri=$REDIRECT_URI&response_type=code&scope=$(sed 's/ /%20/g' <<<$SCOPE)&state=$STATE"
|
||||
|
||||
Reference in New Issue
Block a user