Skip to content

Config UI: Add authentication - #11732

Merged
naltatis merged 42 commits into
masterfrom
feature/auth
Apr 3, 2024
Merged

naltatis merged 42 commits into
masterfrom
feature/auth

Conversation

@naltatis

@naltatis naltatis commented Jan 17, 2024 •

Copy link
Copy Markdown
Member

Add password authentication to secure sensitive configuration data. Limited scope to one "admin" user.

  • 🔐 admin password can be set via api once(!)
  • 🎟️ using JWT tokens via httpOnly cookie (90d validity)
  • 🔮 using bcrypt to store encrypted admin pw hash in db

addresses #6029

TODOs

  • login UI
  • pw reset via CLI -> evcc password [set|reset]
  • secure all /config routes
  • e2e test: login, existing flow
  • e2e test: set password, logout
  • move auth from site to global
  • pw change function

Ideas for some time in the future

  • Option to require auth for all evcc UI/APIs
  • Support for multiple users or integration tokens

Video

auth.mp4

@naltatis naltatis added enhancement New feature or request infrastructure Basic functionality labels Jan 17, 2024
@naltatis
naltatis requested a review from andig January 17, 2024 10:40
@naltatis naltatis mentioned this pull request Jan 17, 2024
24 of 29 tasks
@VolkerK62

Copy link
Copy Markdown
Collaborator

ist das dann Zwang, oder geht es auch ohne?

@naltatis

Copy link
Copy Markdown
Member Author

Für alles, was Config-UI ist, würde ich das als "Pflicht" sehen. Das offen im Netzwerk stehen zu haben (auch im eigenen) ist keine gute Idee. Da wird ja später auch so etwas wie Scripting/Plugins drüber möglich sein.

@VolkerK62

Copy link
Copy Markdown
Collaborator

Ah, also nur, wenn die Config betroffen ist. Nicht beim normalen Zugriff aufs UI.

@naltatis naltatis mentioned this pull request Jan 17, 2024
5 of 7 tasks
@andig

andig commented Jan 18, 2024

Copy link
Copy Markdown
Member

admin password can be set via api once(!)

I don't think thats a good idea. First user could run any script. We should either do this during

evcc configure

or/plus add a cli command.

Comment thread server/db/settings/setting.go Resolved
Comment thread core/auth/auth.go Resolved
Comment thread core/auth/auth.go Resolved
Comment thread core/auth/auth.go Resolved
Comment thread core/auth/auth_test.go Resolved
@naltatis

Copy link
Copy Markdown
Member Author

I don't think thats a good idea. First user could run any script. We should either do this during
evcc configure

Ja, wir müssen noch über den Flow sprechen, wie das initiale Setzen des Passworts passiert. Vmtl. müssen wir das bei der Einrichtung durch die UI erzwingen. Das Passwort in die Umgebungsvariable oder evcc.yaml (via evcc configure) zu schreiben ist keine Lösung. Unser Ziel ist es ja eine 100% via Webbrowser-Einrichtung zu ermöglichen.

@AnBo83

AnBo83 commented Feb 14, 2024

Copy link
Copy Markdown

Moin, da immer mehr über die UI zu konfigurieren ist wird dieses Thema immer aktueller. Da sich seit einem Monat nichts getan hat wollte ich mal vorsichtig nachfragen wie weit die Implementierung ist?

@naltatis

Copy link
Copy Markdown
Member Author

Ongoing. Mehrere Baustellen, die hier zusammenführen.

@andig

andig commented Feb 14, 2024

Copy link
Copy Markdown
Member

Die Rückfragen halten uns offen gesagt nur von der Arbeit ab. Wenn sich etwas tut wird es hier sichtbar...

Comment thread server/http_auth.go Resolved
@naltatis

Copy link
Copy Markdown
Member Author

Mandatory "Set Password" Modal (wip)

matching

empty

@naltatis

Copy link
Copy Markdown
Member Author

Set initial password flow.

set.password.mp4

Comment thread cmd/password_reset.go Resolved
Comment thread cmd/password_set.go Resolved
Comment thread core/auth/auth.go Resolved
Comment thread core/auth/auth.go Resolved
Comment thread core/auth/auth.go Resolved
Comment thread server/http_auth.go Resolved
Comment thread server/http_auth.go Resolved
Comment thread server/http_auth.go Resolved
Comment thread server/http_auth.go Resolved
Comment thread server/http_auth.go Resolved
@andig

andig commented Mar 26, 2024

Copy link
Copy Markdown
Member

Schick, ich hab nur Kleinigkeiten.

@naltatis naltatis added needs documentation Triggers issue creation in evcc-io/docs and removed needs documentation Triggers issue creation in evcc-io/docs labels Apr 2, 2024
@naltatis

naltatis commented Apr 3, 2024

Copy link
Copy Markdown
Member Author

@andig Ich hab jetzt erstmal alle UI relevanten Stellen (Passwort anlegen/aktualisieren, Login) abgeklemmt. Damit können wir diesen PR in den Master mergen. Auch die entsprechenden Tests sind erstmal geskippt. Alle Stellen sind mit einem entsprechenden TODO versehen (... once auth is released).

Zusammen mit dem ersten echten Use-Case (#11739) würden wir das Feature dann komplett aktivieren.

Einzige offene Frage: jetzt rein oder kurz nach dem nächsten Release?

@naltatis
naltatis merged commit dc13701 into master Apr 3, 2024
@naltatis
naltatis deleted the feature/auth branch April 3, 2024 19:17
@StevieC121176

Copy link
Copy Markdown

eine Frage, ist dieses Feature schon aktiviert da schon im Master?

@naltatis

naltatis commented Apr 5, 2024

Copy link
Copy Markdown
Member Author

Das Feature ist im Master aber aktuell noch Code-seitig auskommentiert. Wir werden es vmtl. zusammen mit dem YAML Editor aktiv schalten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request infrastructure Basic functionality needs documentation Triggers issue creation in evcc-io/docs prio Priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants