nextcloud: Populated and maintain a list of trusted domains

- Rename 'domain' to 'override domain'. See below.

- If override domain is not set and trusted domains list is properly maintained,
then Nextcloud can be accessed using a domain from list of trusted domains. This
is ideal as accessing from .onion domain and a regular domain will
simultaneously without forcing a single domain. However, non-localhost IP
addresses will not work with this approach and 'override domain' will be needed.

- When override domain is set to an IP address or a domain, then that domain
will forced. Also hostname are accepted on a request but after the first page
load, access will be forcefully redirected to the configured override domain.
Multiple domains, even trusted domains, will thus not work. This option should
be used as a last resort.

- All un-setting the override domain to an empty value so that trusted domains
can be used again.

- Update diagnostic checks to ensure that above logic is used with checking
domains.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2024-05-06 17:14:52 -04:00
1 parent 1272be0ad6
commit fb0dd323ff
4 files changed
+111 -34

No files matched your search

+6 -3
View File
@@ -22,9 +22,12 @@ def _get_phone_regions():
class NextcloudForm(forms.Form):
"""Nextcloud configuration form."""
domain = forms.CharField(
label=_('Domain'), required=False, help_text=_(
'Examples: "myfreedombox.example.org" or "example.onion".'))
override_domain = forms.CharField(
label=_('Override domain'), required=False, help_text=_(
'Set to the domain or IP address that Nextcloud should be forced '
'to generate URLs with. Should not be needed if a valid domain is '
'used to access Nextcloud. Examples: "myfreedombox.example.org" '
'or "example.onion".'))
admin_password = forms.CharField(
label=_('Administrator password'), help_text=_(