<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Oidc on inetshell</title><link>https://inet.sh/en/tags/oidc/</link><description>Recent content in Oidc on inetshell</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sat, 26 Sep 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://inet.sh/en/tags/oidc/index.xml" rel="self" type="application/rss+xml"/><item><title>GitHub Actions → Google Cloud without keys: Workload Identity Federation with gcloud and Terraform</title><link>https://inet.sh/en/posts/gcp/github-actions-workload-identity-federation/</link><pubDate>Sat, 26 Sep 2026 00:00:00 +0000</pubDate><guid>https://inet.sh/en/posts/gcp/github-actions-workload-identity-federation/</guid><description>Authenticate a GitHub Actions workflow to Google Cloud without storing a service account JSON key: Workload Identity Federation pool and OIDC provider, an attribute condition that limits it to your org or repo, the workloadIdentityUser binding, and the google-github-actions/auth@v3 step with permissions id-token: write. The same setup in Terraform with the gh-oidc module, and the usual permission errors.</description><content:encoded><![CDATA[<h2 id="tldr">TL;DR</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">PROJECT_ID</span><span class="o">=</span>my-project
</span></span><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">PROJECT_NUMBER</span><span class="o">=</span><span class="k">$(</span>gcloud projects describe <span class="nv">$PROJECT_ID</span> --format<span class="o">=</span><span class="s1">&#39;value(projectNumber)&#39;</span><span class="k">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">GITHUB_ORG</span><span class="o">=</span>my-org
</span></span><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">REPO</span><span class="o">=</span>my-org/my-repo
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">gcloud iam workload-identity-pools create github <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>  --project<span class="o">=</span><span class="nv">$PROJECT_ID</span> --location<span class="o">=</span>global --display-name<span class="o">=</span><span class="s2">&#34;GitHub Actions&#34;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">gcloud iam workload-identity-pools providers create-oidc github-oidc <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>  --project<span class="o">=</span><span class="nv">$PROJECT_ID</span> --location<span class="o">=</span>global --workload-identity-pool<span class="o">=</span>github <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>  --display-name<span class="o">=</span><span class="s2">&#34;GitHub OIDC&#34;</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>  --issuer-uri<span class="o">=</span><span class="s2">&#34;https://token.actions.githubusercontent.com&#34;</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>  --attribute-mapping<span class="o">=</span><span class="s2">&#34;google.subject=assertion.sub,attribute.actor=assertion.actor,attribute.repository=assertion.repository,attribute.repository_owner=assertion.repository_owner&#34;</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>  --attribute-condition<span class="o">=</span><span class="s2">&#34;assertion.repository_owner == &#39;</span><span class="nv">$GITHUB_ORG</span><span class="s2">&#39;&#34;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">gcloud iam service-accounts create github-actions --project<span class="o">=</span><span class="nv">$PROJECT_ID</span> --display-name<span class="o">=</span><span class="s2">&#34;GitHub Actions&#34;</span>
</span></span><span class="line"><span class="cl">gcloud iam service-accounts add-iam-policy-binding github-actions@<span class="nv">$PROJECT_ID</span>.iam.gserviceaccount.com <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>  --project<span class="o">=</span><span class="nv">$PROJECT_ID</span> --role<span class="o">=</span>roles/iam.workloadIdentityUser <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>  --member<span class="o">=</span><span class="s2">&#34;principalSet://iam.googleapis.com/projects/</span><span class="nv">$PROJECT_NUMBER</span><span class="s2">/locations/global/workloadIdentityPools/github/attribute.repository/</span><span class="nv">$REPO</span><span class="s2">&#34;</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>And in the workflow:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">jobs</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">deploy</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">runs-on</span><span class="p">:</span><span class="w"> </span><span class="l">ubuntu-latest</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">permissions</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">contents</span><span class="p">:</span><span class="w"> </span><span class="l">read</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">id-token</span><span class="p">:</span><span class="w"> </span><span class="l">write           </span><span class="w"> </span><span class="c"># without this GitHub does not issue the OIDC token</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">steps</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">actions/checkout@v4</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span>- <span class="nt">id</span><span class="p">:</span><span class="w"> </span><span class="l">auth</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">google-github-actions/auth@v3</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="nt">with</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">workload_identity_provider</span><span class="p">:</span><span class="w"> </span><span class="l">projects/123456789012/locations/global/workloadIdentityPools/github/providers/github-oidc</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">service_account</span><span class="p">:</span><span class="w"> </span><span class="l">github-actions@my-project.iam.gserviceaccount.com</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">google-github-actions/setup-gcloud@v3</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span>- <span class="nt">run</span><span class="p">:</span><span class="w"> </span><span class="l">gcloud storage ls</span><span class="w">
</span></span></span></code></pre></td></tr></table>
</div>
</div><p>Whatever roles the pipeline needs (Artifact Registry, Cloud Run, GKE…) go to <code>github-actions@…</code> like to any service account.</p>
<h2 id="why">Why</h2>
<p>The classic alternative is exporting a service account JSON key and storing it as a GitHub secret. That key never expires, anyone with access to the repo or the logs can copy it, and rotating it is manual work nobody does. With <strong>Workload Identity Federation</strong> GitHub issues a short-lived OIDC token for each job, Google verifies it against GitHub&rsquo;s issuer, checks your <em>attribute condition</em>, and hands out temporary service account credentials. There is no secret to store or rotate, and you can restrict who gets in down to the repo or branch.</p>
<h2 id="the-pieces">The pieces</h2>
<table>
  <thead>
      <tr>
          <th>Piece</th>
          <th>What it is</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>Pool</strong> (<code>github</code>)</td>
          <td>Container for external identities; one per provider is enough</td>
      </tr>
      <tr>
          <td><strong>OIDC provider</strong> (<code>github-oidc</code>)</td>
          <td>Trusts <code>https://token.actions.githubusercontent.com</code> and maps token claims (<code>repository</code>, <code>repository_owner</code>, <code>actor</code>, <code>ref</code>) to attributes</td>
      </tr>
      <tr>
          <td><strong>Attribute condition</strong></td>
          <td>CEL filter over those claims. Without it, <strong>any GitHub repo</strong> could try to enter the pool; the official README says to always set one</td>
      </tr>
      <tr>
          <td><strong><code>workloadIdentityUser</code> binding</strong></td>
          <td>Which pool identities may impersonate the service account: <code>attribute.repository/my-org/my-repo</code>, or <code>attribute.repository_owner/my-org</code> for the whole organization</td>
      </tr>
      <tr>
          <td><strong><code>auth@v3</code></strong></td>
          <td>Exchanges GitHub&rsquo;s token for Google credentials and leaves them configured for <code>gcloud</code>, the SDKs, and Terraform</td>
      </tr>
  </tbody>
</table>
<p>To restrict to a branch, map the claim and use it in both the condition and the binding:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">--attribute-mapping=&#34;…,attribute.ref=assertion.ref&#34;
</span></span><span class="line"><span class="cl">--attribute-condition=&#34;assertion.repository_owner == &#39;my-org&#39; &amp;&amp; assertion.ref == &#39;refs/heads/main&#39;&#34;
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="with-terraform">With Terraform</h2>
<p>The official module creates pool, provider, and bindings in one block:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span><span class="lnt">20
</span><span class="lnt">21
</span><span class="lnt">22
</span><span class="lnt">23
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-hcl" data-lang="hcl"><span class="line"><span class="cl"><span class="k">module</span> <span class="s2">&#34;github_actions_sa&#34;</span> {
</span></span><span class="line"><span class="cl"><span class="n">  source</span>     <span class="o">=</span> <span class="s2">&#34;terraform-google-modules/service-accounts/google&#34;</span>
</span></span><span class="line"><span class="cl"><span class="n">  version</span>    <span class="o">=</span> <span class="s2">&#34;~&gt; 4.0&#34;</span>
</span></span><span class="line"><span class="cl"><span class="n">  project_id</span> <span class="o">=</span> <span class="k">var</span><span class="p">.</span><span class="k">project_id</span>
</span></span><span class="line"><span class="cl"><span class="n">  names</span>      <span class="o">=</span> <span class="p">[</span><span class="s2">&#34;github-actions&#34;</span><span class="p">]</span>
</span></span><span class="line"><span class="cl"><span class="n">  project_roles</span> <span class="o">=</span><span class="n"> [&#34;${var.project_id}</span><span class="o">=</span><span class="err">&gt;</span><span class="k">roles</span><span class="err">/</span><span class="k">artifactregistry</span><span class="p">.</span><span class="k">writer</span><span class="err">&#34;</span><span class="p">]</span>
</span></span><span class="line"><span class="cl">}
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">module</span> <span class="s2">&#34;gh_oidc&#34;</span> {
</span></span><span class="line"><span class="cl"><span class="n">  source</span>              <span class="o">=</span> <span class="s2">&#34;terraform-google-modules/github-actions-runners/google//modules/gh-oidc&#34;</span>
</span></span><span class="line"><span class="cl"><span class="n">  project_id</span>          <span class="o">=</span> <span class="k">var</span><span class="p">.</span><span class="k">project_id</span>
</span></span><span class="line"><span class="cl"><span class="n">  pool_id</span>             <span class="o">=</span> <span class="s2">&#34;github&#34;</span>
</span></span><span class="line"><span class="cl"><span class="n">  provider_id</span>         <span class="o">=</span> <span class="s2">&#34;github-oidc&#34;</span>
</span></span><span class="line"><span class="cl"><span class="n">  attribute_condition</span> <span class="o">=</span><span class="n"> &#34;assertion.repository_owner</span> <span class="o">==</span> <span class="err">&#39;</span><span class="k">my</span><span class="err">-</span><span class="k">org</span><span class="err">&#39;&#34;</span>
</span></span><span class="line"><span class="cl"><span class="n">  sa_mapping</span> <span class="o">=</span> {
</span></span><span class="line"><span class="cl"><span class="n">    &#34;github-actions&#34;</span> <span class="o">=</span> {
</span></span><span class="line"><span class="cl"><span class="n">      sa_name</span>   <span class="o">=</span> <span class="s2">&#34;projects/${var.project_id}/serviceAccounts/${module.github_actions_sa.email}&#34;</span>
</span></span><span class="line"><span class="cl"><span class="n">      attribute</span> <span class="o">=</span> <span class="s2">&#34;attribute.repository/my-org/my-repo&#34;</span>
</span></span><span class="line"><span class="cl">    }
</span></span><span class="line"><span class="cl">  }
</span></span><span class="line"><span class="cl">}
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">output &#34;workload_identity_provider&#34; { value</span> <span class="o">=</span> <span class="k">module</span><span class="p">.</span><span class="k">gh_oidc</span><span class="p">.</span><span class="k">provider_name</span> }
</span></span></code></pre></td></tr></table>
</div>
</div><p>The <code>output</code> is exactly the value that goes into the workflow&rsquo;s <code>workload_identity_provider</code>.</p>
<h2 id="without-a-service-account">Without a service account</h2>
<p><code>auth@v3</code> also supports <strong>direct federation</strong>: the <code>principalSet</code> gets IAM roles without going through a service account (<code>workload_identity_provider</code> and <code>project_id</code>, no <code>service_account</code>). Fewer pieces, but not every service accepts federated principals; Artifact Registry, GCS, and most APIs do, and it is the path Google recommends for new setups.</p>
<h2 id="traps">Traps</h2>
<ul>
<li><strong><code>id-token: write</code></strong> in the job&rsquo;s <code>permissions</code>. Without it, <code>auth</code> fails with <em>&ldquo;Unable to get ACTIONS_ID_TOKEN_REQUEST_URL&rdquo;</em>.</li>
<li><strong>Project number, not ID</strong>, in the provider path and the <code>principalSet</code>: <code>projects/123456789012/…</code>.</li>
<li><strong><code>Permission 'iam.serviceAccounts.getAccessToken' denied</code></strong>: the <code>roles/iam.workloadIdentityUser</code> binding is missing or <code>attribute.repository</code> does not match (case and exact repo name).</li>
<li><strong>The condition must reference mapped claims</strong>: if you use <code>assertion.ref</code> in the condition without mapping it to an attribute, the provider gets created but never matches.</li>
<li><strong>Forks and external PRs</strong>: tokens from a fork&rsquo;s PR carry the fork&rsquo;s <code>repository</code>; a condition on <code>repository_owner</code> keeps them out, which is usually what you want.</li>
<li><strong>Rotation</strong>: nothing to rotate, but something to review. <code>gcloud iam workload-identity-pools providers describe</code> and the STS audit logs tell you who is coming in.</li>
</ul>
<p>Reference: <a href="https://github.com/google-github-actions/auth">google-github-actions/auth</a> and <a href="https://docs.cloud.google.com/iam/docs/workload-identity-federation">Workload Identity Federation</a> in the Google Cloud documentation.</p>
]]></content:encoded></item><item><title>Proxmox VE with Keycloak: OpenID Connect login (openid realm)</title><link>https://inet.sh/en/posts/proxmox/keycloak-openid-connect/</link><pubDate>Fri, 25 Sep 2026 00:00:00 +0000</pubDate><guid>https://inet.sh/en/posts/proxmox/keycloak-openid-connect/</guid><description>Authenticate to Proxmox VE with Keycloak through an OpenID Connect realm: confidential client on Keycloak 26, pveum realm add with issuer-url, client-id, client-key and username-claim preferred_username, auto-created users, permissions and groups. No extra mappers, no /auth/ in the URL.</description><content:encoded><![CDATA[<h2 id="tldr">TL;DR</h2>
<p>In Keycloak: <strong>Clients → Create client</strong> → OpenID Connect, Client ID <code>proxmox</code>, <em>Client authentication</em> <strong>On</strong>, <em>Standard flow</em> <strong>On</strong>, <em>Valid redirect URIs</em> <code>https://pve.example.local:8006</code> and <code>https://pve.example.local:8006/*</code>. Copy the secret from the <strong>Credentials</strong> tab.</p>
<p>On a Proxmox node:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span><span class="lnt">6
</span><span class="lnt">7
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">pveum realm add keycloak --type openid <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>  --issuer-url https://id.example.local/realms/lab <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>  --client-id proxmox <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>  --client-key <span class="s1">&#39;&lt;client-secret&gt;&#39;</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>  --username-claim preferred_username <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>  --autocreate <span class="m">1</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>  --comment <span class="s1">&#39;Keycloak&#39;</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>Users log in as <code>alice@keycloak</code>. They are created on first login, <strong>with no permissions</strong>; permissions are still Proxmox ACLs:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">pveum group add sso-admins
</span></span><span class="line"><span class="cl">pveum acl modify / --groups sso-admins --roles Administrator
</span></span><span class="line"><span class="cl">pveum user modify alice@keycloak --groups sso-admins     <span class="c1"># after their first login</span>
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="how-it-works">How it works</h2>
<p>Proxmox has supported <code>openid</code> realms since PVE 7. From <code>issuer-url</code> it downloads <code>/.well-known/openid-configuration</code> and takes the endpoints from there; the login screen shows the realm in the dropdown and the <strong>Login</strong> button redirects to Keycloak. On the way back, the value of the claim you picked in <code>username-claim</code> becomes the user <code>&lt;claim&gt;@&lt;realm&gt;</code>.</p>
<p><code>username-claim</code> accepts any claim name. Keycloak sends <code>preferred_username</code> by default (it comes from the <em>username</em> mapper in the <code>profile</code> client scope), so the <strong>extra mapper</strong> old guides added to expose a claim called <code>username</code> <strong>is not needed</strong>. If you prefer the email, <code>--username-claim email</code>.</p>
<h2 id="keycloak-step-by-step-26">Keycloak, step by step (26)</h2>
<ol>
<li><strong>Realm.</strong> Use the one you have (<code>lab</code> in the example). The issuer is <code>https://id.example.local/realms/lab</code>. Since Keycloak 17 there is no <code>/auth/</code> in the path; if you copy <code>/auth/realms/...</code> from an old guide, discovery fails.</li>
<li><strong>Clients → Create client.</strong>
<ul>
<li><em>Client type</em>: OpenID Connect. <em>Client ID</em>: <code>proxmox</code>. <em>Name</em>: whatever you like.</li>
<li><em>Capability config</em>: <strong>Client authentication On</strong> (confidential client, with secret). <strong>Standard flow On</strong>. Everything else Off: <em>Direct access grants</em>, <em>Implicit flow</em>, <em>Service accounts</em>, <em>Authorization</em>.</li>
<li><em>Login settings</em>: <em>Root URL</em> <code>https://pve.example.local:8006</code>; <em>Valid redirect URIs</em> <code>https://pve.example.local:8006</code> and <code>https://pve.example.local:8006/*</code>. <em>Web origins</em> empty: it is a redirect flow, there is no CORS.</li>
</ul>
</li>
<li><strong>Credentials</strong> → <em>Client secret</em>. That is the <code>--client-key</code>.</li>
<li><strong>Groups (optional).</strong> Clients → <code>proxmox</code> → <em>Client scopes</em> → <code>proxmox-dedicated</code> → <em>Add mapper</em> → <em>By configuration</em> → <strong>Group Membership</strong>: <em>Name</em> <code>groups</code>, <em>Token Claim Name</em> <code>groups</code>, <em>Full group path</em> Off, <em>Add to ID token</em> and <em>Add to userinfo</em> On.</li>
</ol>
<h2 id="proxmox-step-by-step">Proxmox, step by step</h2>
<p>Through the GUI: <strong>Datacenter → Permissions → Realms → Add → OpenID Connect Server</strong>: <em>Issuer URL</em>, <em>Realm</em> (the short name, <code>keycloak</code>), <em>Client ID</em>, <em>Client Key</em>, <em>Username Claim</em> <code>preferred_username</code>, <em>Autocreate Users</em>. Or the <code>pveum realm add</code> from the TL;DR; the configuration lands in <code>/etc/pve/domains.cfg</code> and replicates across the cluster.</p>
<p>With groups coming from Keycloak, on recent PVE 8 releases and on PVE 9 (<code>pveum realm add --help</code> tells you whether your version has <code>--groups-claim</code>):</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">pveum realm modify keycloak --groups-claim groups --groups-autocreate <span class="m">1</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>Each group in the claim is created as <code>&lt;group&gt;-keycloak</code> and the user joins them on every login; you assign the ACLs to those groups.</p>
<p>Test before touching anything else: login screen → Realm <strong>Keycloak</strong> → <strong>Login</strong> → you come back authenticated and <code>pveum user list</code> shows <code>alice@keycloak</code>.</p>
<h2 id="traps">Traps</h2>
<ul>
<li><strong><code>Invalid parameter: redirect_uri</code></strong> in Keycloak: the URL you typed in the browser (name, port <code>8006</code>, <code>https</code>) is not in <em>Valid redirect URIs</em>. If you use both the IP and the FQDN, add both.</li>
<li><strong>The node must trust Keycloak&rsquo;s certificate</strong>, not just your browser. With an internal CA: copy the <code>.crt</code> to <code>/usr/local/share/ca-certificates/</code> and run <code>update-ca-certificates</code>.</li>
<li><strong><code>issuer-url</code> has to match exactly</strong> the <code>iss</code> in the tokens: <code>https</code>, no trailing slash, <code>/realms/&lt;realm&gt;</code>.</li>
<li><strong>Time.</strong> A skewed clock invalidates tokens; <code>chrony</code> on the nodes.</li>
<li><strong>Do not let users edit their own username</strong> in Keycloak (a warning from Proxmox&rsquo;s own docs): renaming yourself to <code>root</code> is switching accounts in Proxmox.</li>
<li><strong>Do not set <code>--default 1</code> until it works</strong>, and keep <code>root@pam</code> as the emergency door: if Keycloak is down, the <code>openid</code> realm cannot authenticate anyone.</li>
<li><strong>API and CLI.</strong> OIDC users have no password in Proxmox; for Terraform, Ansible, or <code>pvesh</code> from outside create a token: <code>pveum user token add alice@keycloak automation --privsep 0</code>.</li>
</ul>
<p>Reference: <a href="https://pve.proxmox.com/pve-docs/chapter-pveum.html#user-realms-oidc">User Management — OpenID Connect</a> in the Proxmox guide and <a href="https://www.keycloak.org/docs/latest/server_admin/index.html#_oidc_clients">client creation</a> in the Keycloak documentation.</p>
]]></content:encoded></item></channel></rss>