Skip to content

Commit 52c79a4

Browse files
committed
Rename JWT OIDC inputs
Having the names include both JWT and OIDC is probably the most correct, since we aren't talking about the full OAuth2 OIDC, but rather JWT tokens relying on OIDC Discovery. It's likely also the most helpful, since it maps both towards the Vault configuration focusing on the JWT as well as the corresponding GitHub documentation focusing on the OIDC.
1 parent a2e208b commit 52c79a4

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

.github/workflows/tester.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ jobs:
5151
uses: ./
5252
with:
5353
vault_server: http://127.0.0.1:8200
54-
oidc_backend_path: github-oidc
55-
oidc_role: cert-action-user
54+
jwt_oidc_backend_path: github-oidc
55+
jwt_oidc_role: cert-action-user
5656
ssh_backend_path: arrakis/ssh2
5757
ssh_role: cert-action-cert
5858

@@ -65,8 +65,8 @@ jobs:
6565
with:
6666
vault_server: http://127.0.0.1:8200
6767
jwt_audience: a-test-audience
68-
oidc_backend_path: github-oidc
69-
oidc_role: cert-action-at-user
68+
jwt_oidc_backend_path: github-oidc
69+
jwt_oidc_role: cert-action-at-user
7070
ssh_backend_path: arrakis/ssh2
7171
ssh_role: cert-action-cert
7272

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
- name: Generate SSH client certificate
2020
if: github.ref == 'refs/heads/main'
2121
id: ssh_cert
22-
uses: andreaso/vault-oidc-ssh-cert-action@v0.11
22+
uses: andreaso/vault-oidc-ssh-cert-action@v0.12
2323
with:
2424
vault_server: https://vault.example.com:8200
2525
jwt_audience: vault.example.com
26-
oidc_backend_path: github-oidc
27-
oidc_role: example-user
26+
jwt_oidc_backend_path: github-oidc
27+
jwt_oidc_role: example-user
2828
ssh_backend_path: ssh-client-ca
2929
ssh_role: github-actions-example
3030

action.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ inputs:
88
vault_server:
99
description: URL of the Vault server
1010
required: true
11-
oidc_backend_path:
12-
description: Path to Vault's GitHub configured JWT/OIDC backend
11+
jwt_oidc_backend_path:
12+
description: Path to Vault's GitHub configured JWT OIDC backend
1313
required: true
14-
oidc_role:
15-
description: Name of the Vault server OIDC role to use
14+
jwt_oidc_role:
15+
description: Name of the Vault server JWT OIDC role to use
1616
required: true
1717
ssh_backend_path:
1818
description: Path to Vault's SSH CA backend
@@ -44,8 +44,8 @@ runs:
4444
env:
4545
PYTHONPATH: ${{ github.action_path }}
4646
JWT_AUDIENCE: ${{ inputs.jwt_audience }}
47-
OIDC_BACKEND_PATH: ${{ inputs.oidc_backend_path }}
48-
OIDC_ROLE: ${{ inputs.oidc_role }}
47+
JWT_OIDC_BACKEND_PATH: ${{ inputs.jwt_oidc_backend_path }}
48+
JWT_OIDC_ROLE: ${{ inputs.jwt_oidc_role }}
4949
SSH_BACKEND_PATH: ${{ inputs.ssh_backend_path }}
5050
SSH_ROLE: ${{ inputs.ssh_role }}
5151
VAULT_SERVER: ${{ inputs.vault_server }}

vault_oidc_ssh_cert_action.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def _set_step_output(name: str, value: str) -> None:
2929

3030
def _check_inputs() -> None:
3131
required_inputs = [
32-
"oidc_backend_path",
33-
"oidc_role",
32+
"jwt_oidc_backend_path",
33+
"jwt_oidc_role",
3434
"ssh_backend_path",
3535
"ssh_role",
3636
"vault_server",
@@ -98,10 +98,10 @@ def _issue_github_jwt(jwt_aud: str) -> str:
9898

9999

100100
def _issue_vault_token(
101-
vault_server: str, oidc_backend: str, oidc_role: str, jwt_token: str
101+
vault_server: str, oidc_backend: str, jwt_oidc_role: str, jwt_token: str
102102
) -> str:
103103
login_url = f"{vault_server}/v1/auth/{oidc_backend}/login"
104-
payload = {"jwt": jwt_token, "role": oidc_role}
104+
payload = {"jwt": jwt_token, "role": jwt_oidc_role}
105105

106106
try:
107107
response = requests.post(login_url, data=payload, timeout=10)
@@ -189,16 +189,16 @@ def run() -> None:
189189
_check_inputs()
190190

191191
input_audience = os.environ["JWT_AUDIENCE"].strip()
192-
oidc_role = os.environ["OIDC_ROLE"].strip()
193-
oidc_backend = os.environ["OIDC_BACKEND_PATH"].strip("/ ")
192+
jwt_oidc_role = os.environ["JWT_OIDC_ROLE"].strip()
193+
oidc_backend = os.environ["JWT_OIDC_BACKEND_PATH"].strip("/ ")
194194
ssh_role = os.environ["SSH_ROLE"].strip()
195195
ssh_backend = os.environ["SSH_BACKEND_PATH"].strip("/ ")
196196
vault_server = os.environ["VAULT_SERVER"].strip("/ ")
197197

198198
jwt_aud: str = _determine_audience(input_audience, vault_server)
199199
jwt_token: str = _issue_github_jwt(jwt_aud)
200200
vault_token: str = _issue_vault_token(
201-
vault_server, oidc_backend, oidc_role, jwt_token
201+
vault_server, oidc_backend, jwt_oidc_role, jwt_token
202202
)
203203

204204
try:

0 commit comments

Comments
 (0)