Skip to content

feat: Add Client Authentication and Provisioning Plugin - #21

Merged
sortedcord merged 2 commits into
masterfrom
feat/auth-plugin
Jun 28, 2026
Merged

feat: Add Client Authentication and Provisioning Plugin#21
sortedcord merged 2 commits into
masterfrom
feat/auth-plugin

Conversation

@sortedcord

@sortedcord sortedcord commented Jun 27, 2026

Copy link
Copy Markdown
Owner

This Pull Request implements the Client Authentication and Provisioning flow. It enables secure onboarding of new client devices and authorization by administrators using SSH Ed25519 key verification and age encryption.

Closes #20

Changes Proposed

1. Cryptographic Client Plugin (plugins/auth.sh)

  • Implemented plugins/auth.sh handling both requester (me) and approver (trust) roles.
  • Requester Flow (b me):
    • Generates SSH Ed25519 keys securely without passphrase under ~/.config/bootstrap-client/.
    • Submits hardware metrics (hostname, os) alongside the public key to /api/register.
    • Obtains user_code and challenge_nonce.
    • Polls /api/challenge/poll by signing the nonce using ssh-keygen -Y sign (namespace: bootstrap).
    • Decrypts the payload dynamically using age -d -i ~/.config/bootstrap-client/id_ed25519 and writes it to secrets.decrypted.
  • Approver Flow (b trust <user_code>):
    • Resolves pending public keys via /api/pending/<user_code>.
    • Prompts the administrator for verification.
    • Digitally signs the public key using the admin's private key (ssh-keygen -Y sign) and submits the base64 signature alongside the fingerprint to /api/approve.

2. Router Integration (lib/routes.sh)

  • Intercepts me and trust commands to lazy-load the auth plugin via run_plugin "auth".

3. Autocompletion (b.sh)

  • Updated autocomplete options to support completing the me and trust commands after b.

4. Local Installation Updates (bootstrap.sh)

  • Updated the local installation routine to copy the plugins/ directory (similar to installers/) to $BOOTSTRAP_DIR during local development bootstrapping.

5. Plugin Manifest (plugins.json)

  • Registered auth in the local plugin catalog.

Verification & Testing

  1. Run bootstrap.sh to sync the changes locally.
  2. Initiated the requester flow:
    $ b me
    [INFO] Running plugin 'auth'...
    [INFO] Registering device with https://b.adityagupta.dev/auth...
    --------------------------------------------------------
    [SUCCESS] Device registration initiated successfully!
    Please authorize this device on your administrator machine using:
      b trust Oi1r2P --server https://b.adityagupta.dev/auth
    --------------------------------------------------------
    Verification Code: Oi1r2P
    --------------------------------------------------------
    [INFO] Waiting for administrator approval (polling every 5s)...
  3. Verified that all generated signature files are securely removed from /tmp upon script termination.

@sortedcord sortedcord linked an issue Jun 27, 2026 that may be closed by this pull request
@sortedcord sortedcord changed the title feat: Implemented client spec for bootstrap-auth-server with b me and… feat: Add Client Authentication and Provisioning Plugin Jun 27, 2026
@sortedcord
sortedcord merged commit f6df53a into master Jun 28, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Bootstrap Authentication: b me and b trust

1 participant