Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add Home Assistant shortname as allowed domain #81

Closed
MelleD opened this issue Jan 29, 2024 · 12 comments · Fixed by #98
Closed

[Feature Request] Add Home Assistant shortname as allowed domain #81

MelleD opened this issue Jan 29, 2024 · 12 comments · Fixed by #98
Labels
enhancement New feature or request

Comments

@MelleD
Copy link

MelleD commented Jan 29, 2024

In Tailscale there is a magic DNS resolution for the URL (https://tailscale.com/kb/1081/magicdns). Unfortunately it is not compatible with homeassistant.local because
a) The default setting uses homeassistant as DNS without local
b) Only dashes and no dots are allowed in the hostname

With the new setting CSRF trusted domain you can set the url http://homeassistant:port. This is working as well :).
Maybe it's worth considering introducing a checkbox "Enable tailscale magic dns" in the config to automatically determine the url.

@BenoitAnastay
Copy link
Owner

I'm not sure to understand, the URL isn't dynamic, so why not adding as main URL ?

There's no validation regex for domains on my addon

CSRF-setting

I'm not using it that way because it's braking TLS resolution
SSL-broken

I haven't added RAW urls options for CSRF but domains because I was thinking that people who will use a domain dedicated to paperless (not share with HA) would set is as Paperless URL

@MelleD
Copy link
Author

MelleD commented Jan 29, 2024

How I said it's also working with trusted domain.
Bildschirmfoto 2024-01-29 um 20 54 34

The internal hostname address is with local (what you figured out here)
See here: https://github.com/home-assistant/cli/blob/c1ab453cabe154729a88c165c63a41c575c30c11/cmd/banner.go#L162

But the tailscale VPN address is without local
Bildschirmfoto 2024-01-29 um 20 51 01

And dot is not allowed
Bildschirmfoto 2024-01-29 um 20 51 27

It's just nicer for external tailscale use also add the trusted domain without local or internal adress without .local.
I think this just relevant when you use Tailscale VPN.

@BenoitAnastay
Copy link
Owner

You can add homeassistant.local as CSRF allowed and https://homeassistant as Paperless URL then

@MelleD
Copy link
Author

MelleD commented Jan 29, 2024

You can add homeassistant.local as CSRF allowed and https://homeassistant as Paperless URL then

My setting works with the trusted domain. All is fine.

The url automatically for tailscale would just be a shortcut and easier for some people. Not more :). With current settings all is fine so far.

@BenoitAnastay BenoitAnastay added the wontfix This will not be worked on label Jan 29, 2024
@BenoitAnastay
Copy link
Owner

My setting works with the trusted domain. All is fine.

It shouldn't have worked that way so I'll try to allow both domains and raw urls to be added in the next release

@BenoitAnastay BenoitAnastay closed this as not planned Won't fix, can't repro, duplicate, stale Jan 29, 2024
@MelleD
Copy link
Author

MelleD commented Jan 29, 2024

It shouldn't have worked that way so I'll try to allow both domains and raw urls to be added in the next release

Okay, now I'm confused. Why shouldn't it have worked?

In my internal network i use the default url:
http://homeassistant.local:8123/xxx/ingress
This was added with the last release:

My "external" VPN link is
http://homeassistant:8123/xxx/ingress

So i just added homeassistant to the trusted domain. Works pretty well.

For the mobile apps I added a port (this was you see in the picture), because of the authorization with HA. So I added the port 7071.
So in my Tailscale VPN the url is: http://homeassistant:7071 and this I added to the trusted domains. So why not? Looks straight forward to me :)?

@BenoitAnastay
Copy link
Owner

Yes indeed, it works that way

I thought full URLs were "http://homeassistant/" and "http://homeassistant.local:8123/"

And because my script append ports to domains it will allow http://homeassistant:7071/ and http://homeassistant:8123/ by addin homeassistant to allowed domains

The input is a domain, you put an URL but it's trimmed by my script, so if you were using a proxy to use domain without a port it does only works when using Paperless_URL option

@MelleD
Copy link
Author

MelleD commented Jan 29, 2024

Ok yes, I think with Tailscale and VPN it's a simple setup also for the hostname. So therefore was just my idea to add a checkbox for Tailscale user instead of typing the "the magic dns" hostname manually as url or domain. This was just the small feature idea :)

@BenoitAnastay
Copy link
Owner

The problem is if I add an option for tailscape DNS you can either have someone using another short name like http://paperless or someone using others third party softwares, and I try the minimal required options to avoid cluttering

@MelleD
Copy link
Author

MelleD commented Jan 29, 2024

It's fine was just an idea. Yes off course you can have multiple option for different third party software, but the DNS magic name looked very simple to figure out :). And a small checkbox to use or not use looked okay for me.

Maybe you'll use Tailscale at some point and think it's a great idea, then you can reopen the ticket ;)

@BenoitAnastay
Copy link
Owner

I can indeed add shortname of the homeassistant hostaname by default, it was the case before I figured out they hard coded .local suffix

On some networks homeassistant.local can also be resolved as https://homeassistant but shortnames seem to be less commonly used

@BenoitAnastay BenoitAnastay added enhancement New feature or request and removed wontfix This will not be worked on labels Jan 29, 2024
@BenoitAnastay BenoitAnastay changed the title [Feature Request] Add Tailscale magic dns hostname/url [Feature Request] Add Home Assistant shortname as allowed domain Jan 29, 2024
@BenoitAnastay BenoitAnastay reopened this Jan 29, 2024
@MelleD
Copy link
Author

MelleD commented Jan 30, 2024

On some networks homeassistant.local can also be resolved as https://homeassistant/ but shortnames seem to be less commonly used

In my local network it's not working with the default settings. It just works in my VPN, but with port and without https (not necessary in VPN)
So in VPN it's http://homeassistant:8123 and with own port http://homeassistant:port(7071)

@BenoitAnastay BenoitAnastay linked a pull request Feb 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants