juanfont / headscale

An open source, self-hosted implementation of the Tailscale control server
BSD 3-Clause "New" or "Revised" License
22.8k stars 1.26k forks source link

[Feature] Setting DisplayName and ProfilePicURL for headscale users #2166

Open vikanezrimaya opened 1 week ago

vikanezrimaya commented 1 week ago

Use case

Mostly for niceness and completeness. I would like Headscale to know users by name, so that tailscale whois (and related solutions such as tailscale-nginx-auth) can know the user's display name and profile picture.

The OIDC rework document mentioned that CLI-based login should be able to populate these fields, so I hope the maintainers won't mind me filing this as an issue so it could be easily trackable (and to show that this is in fact desirable, and bikeshed over the minute details of the implementation).

Additionally, I may try my hand at implementing this. (I don't really know Go that well, but how hard could it be?)

Description

One or two commands in the Headscale CLI to set the user's display name and the profile picture. Optionally a way to set these fields on user creation.

Contribution

How can it be implemented?

Exact subcommand/option names subject to bikeshedding.

$ headscale users set -i 1 --display-name "Vika" --profile-pic-url "https://example.com/vika.png"
$ # Additionally, consider the following, to create a user and set their personal data in one step:
$ headscale users create vika --display-name "Vika" --profile-pic-url "https://example.com/vika.png"

Alternatively:

$ headscale users set-display-name -i 1 Vika
$ headscale users set-profile-pic-url -i 1 https://example.com/vika.png
kradalby commented 1 week ago

Yes please, I was hoping someone would pick it up so I would appreciate if you want to try to do this :)

You will need to implement the gRPC/API part as part of this, and I think your first example looks nicer for both API and CLI.

--email would also be sensible as I've already thought that it might be nice to do a fallback to services like Gravatar if there is no picture available.

kradalby commented 3 days ago

@vikanezrimaya As part of a discussion in #2170, a command for setting email would be required, not only sensible.

Let me know if you have started this work so we dont step on each others toes :)

vikanezrimaya commented 3 days ago

Kristoffer Dalby @.***> writes:

Let me know if you have started this work so we dont step on each others toes :)

Sorry, haven't had time to get started, so you may proceed with this on your own if you wish. I bet a regular contributor and a maintainer would be able to write better code than me anyway due to the familiarity with the codebase. Making a command to set the profile pic URL would be trivial copy-pasting in this case.

-- With love, Vika <3