@@ -27,59 +27,26 @@ inputs:
27
27
outputs :
28
28
cert_path :
29
29
description : Full path to the generated SSH certificate
30
- value : ${{ steps.generator .outputs.cert_path }}
30
+ value : ${{ steps.run_action .outputs.cert_path }}
31
31
key_path :
32
32
description : Full path to the corresponding private SSH key
33
- value : ${{ steps.generator .outputs.key_path }}
33
+ value : ${{ steps.run_action .outputs.key_path }}
34
34
35
35
runs :
36
36
using : composite
37
37
steps :
38
- - name : Determine JWT audience
39
- id : determine
40
- run : |
41
- import os
42
- from urllib.parse import urlparse
43
- aud = os.environ["JWT_AUDIENCE"].strip()
44
- if not aud:
45
- url = os.environ["VAULT_SERVER"]
46
- fqdn = urlparse(url).netloc.split(":")[0]
47
- aud = fqdn
48
- with open(os.environ["GITHUB_OUTPUT"], "a") as ghof:
49
- ghof.write(f"audience={aud}\n")
38
+ - name : Run Action
39
+ id : run_action
50
40
shell : python
41
+ run : |
42
+ import vault_oidc_ssh_cert_action
43
+ vault_oidc_ssh_cert_action.run()
51
44
env :
45
+ PYTHONPATH : ${{ github.action_path }}
52
46
JWT_AUDIENCE : ${{ inputs.jwt_audience }}
53
- VAULT_SERVER : ${{ inputs.vault_server }}
54
-
55
- - name : Use GitHub OIDC to authenticate towards Vault
56
- id : vault_auth
57
- shell : bash
58
- run : " ${ACTION_PATH}/github-vault-auth"
59
- env :
60
- ACTION_PATH : ${{ github.action_path }}
61
- AUDIENCE : ${{ steps.determine.outputs.audience }}
62
- BACKEND : ${{ inputs.oidc_backend_path }}
63
- ROLE : ${{ inputs.oidc_role }}
64
- VAULT_SERVER : ${{ inputs.vault_server }}
65
-
66
- - name : Generate and sign SSH client certificate
67
- id : generator
68
- shell : bash
69
- run : " ${ACTION_PATH}/generate-and-sign"
70
- env :
71
- ACTION_PATH : ${{ github.action_path }}
72
- VAULT_SERVER : ${{ inputs.vault_server }}
73
- VAULT_TOKEN : ${{ steps.vault_auth.outputs.vault_token }}
74
- SSH_BACKEND : ${{ inputs.ssh_backend_path }}
47
+ OIDC_BACKEND_PATH : ${{ inputs.oidc_backend_path }}
48
+ OIDC_ROLE : ${{ inputs.oidc_role }}
49
+ SSH_BACKEND_PATH : ${{ inputs.ssh_backend_path }}
75
50
SSH_ROLE : ${{ inputs.ssh_role }}
76
- TMPDIR : ${{ runner.temp }}
77
-
78
- - name : Revoke Vault token
79
- if : success() || steps.generator.conclusion == 'failure'
80
- shell : bash
81
- run : |
82
- curl --fail --silent --show-error --tlsv1.3 --header "X-Vault-Token: ${VAULT_TOKEN}" --data "" "${VAULT_SERVER%/}/v1/auth/token/revoke-self"
83
- env :
84
51
VAULT_SERVER : ${{ inputs.vault_server }}
85
- VAULT_TOKEN : ${{ steps.vault_auth.outputs.vault_token }}
52
+ TMPDIR : ${{ runner.temp }}
0 commit comments