Skip to content

Add FHEM mTLS or Authelia auth with static upstream Basic Auth#80

Merged
sidey79 merged 4 commits into
mainfrom
feat/fhem-authelia-static-basic-auth
Apr 3, 2026
Merged

Add FHEM mTLS or Authelia auth with static upstream Basic Auth#80
sidey79 merged 4 commits into
mainfrom
feat/fhem-authelia-static-basic-auth

Conversation

@sidey79

@sidey79 sidey79 commented Mar 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • allow fhem.* requests with either a valid client certificate or a successful Authelia forward_auth check
  • inject a static upstream Authorization header for FHEM from FHEM_BASIC_AUTH_HEADER
  • return 503 when the FHEM upstream Basic Auth secret is missing instead of proxying without backend credentials
  • forward client certificate metadata headers to FHEM when the request is admitted via mTLS
  • document the new environment variable and FHEM auth flow in the README

Validation

  • validated Caddyfile with caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile in a one-off caddy:2.11.2 container using dummy environment values and mounted local PKI files

Notes

  • no additional Authelia config changes are required for this flow beyond the existing one_factor access policy because FHEM no longer depends on Authelia accepting Basic Auth itself

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 61c446683b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Caddyfile Outdated
Comment on lines +263 to +266
handle @missing_mTLS_cert {
respond "mTLS client certificate required" 403
}
handle @n8nWebHooks {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore Authelia fallback for workflow webhooks

This route now returns 403 for any request without a client cert before webhook handling, which removes the Authelia-based fallback that existed in caddy/Caddyfile on the parent commit. As a result, non-mTLS users can no longer reach the workflow webhook/UI paths (for example /webhook/github-pr-dashboard) via forward_auth, so the previously supported access flow is broken.

Useful? React with 👍 / 👎.

Comment thread docker-compose.yml Outdated
condition: service_completed_successfully
volumes:
- ./caddy:/etc/caddy
- ./Caddyfile:/etc/caddy/Caddyfile

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate the deployed Caddyfile in CI

Switching the compose mount to ./Caddyfile changes production to use the repo-root config, but the lint workflow still validates /work/caddy/Caddyfile; this means CI no longer checks the file that will actually be loaded by Caddy. A syntax or routing error in the root Caddyfile can therefore pass checks and fail only at deploy/runtime.

Useful? React with 👍 / 👎.

@sidey79
sidey79 force-pushed the feat/fhem-authelia-static-basic-auth branch from 61c4466 to 8b33e03 Compare March 25, 2026 22:13
@sidey79
sidey79 merged commit f11bd24 into main Apr 3, 2026
2 checks passed
@sidey79
sidey79 deleted the feat/fhem-authelia-static-basic-auth branch April 3, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant