(fix) Improve collabora's regex (#1108)

* Improve collabora's regex

* Also allow root domains, and disallow `--`

* Shorten regex steps a bit
This commit is contained in:
Stavros Kois
2021-10-08 10:27:13 +03:00
committed by GitHub
parent d8935bf292
commit ce48246b9b
2 changed files with 30 additions and 9 deletions

View File

@@ -79,7 +79,7 @@ questions:
schema:
type: string
default: 'nextcloud.domain.tld|othernextcloud.domain.tld'
valid_chars: '^([a-z]{1,}\.[a-z]{1,}\.[a-z]{1,})((\|[a-z]{1,}\.[a-z]{1,}\.[a-z]{1,}))*$'
valid_chars: '^(([a-z\d](-?[a-z\d]){0,62})\.)*(([a-z\d](-?[a-z\d]){0,62})\.)([a-z](-?[a-z\d]){1,62})((\|((([a-z\d](-?[a-z\d]){0,62})\.)*(([a-z\d](-?[a-z\d]){0,62})\.)([a-z](-?[a-z\d]){1,62})))*)$'
required: true
- variable: username
label: "Username for WebUI"
@@ -118,7 +118,8 @@ questions:
schema:
type: string
default: 'collabora.domain.tld'
valid_chars: '^([a-z]{1,}\.[a-z]{1,}\.[a-z]{1,})$'
valid_chars: '^(([a-z\d](-?[a-z\d]){0,62})\.)*(([a-z\d](-?[a-z\d]){0,62})\.)([a-z](-?[a-z\d]){1,62})$'
# Include{containerConfig}
- variable: service

View File

@@ -3,19 +3,39 @@
__`Domain(s) using collabora`__
Accepted formats are:
- Single domain (eg. `cloud.mydomain.com`)
- Multiple domains (eg. `cloud.mydomain.com|nextcloud.mydomain.com`) - Each domain is separated with `|`
- Single FQDN (eg. `cloud.mydomain.com` or `mydomain.com`)
- Multiple FQDN (eg. `cloud.mydomain.com|nextcloud.mydomain.com` or `mydomain.com|cname.mydomain.com`) - Each FQDN is separated with `|`
Regex used to match those: `^([a-z]{1,}\.[a-z]{1,}\.[a-z]{1,})((\|[a-z]{1,}\.[a-z]{1,}\.[a-z]{1,}))*$`
You can try live [here](https://regex101.com/r/AQFh2g/1)
Each FQDN is split into parts
* Hostname (`cname`.domain.com) _Optional_
* Can have from 1 up to 127 levels deep cnames.
* Can contain [0-9], [a-z] and `-`.
* Must be at least 1 char and no longer than 63 chars.
* Must start with [a-z], [0-9].
* Must NOT end with `-`.
* Domain (cname.`domain`.com)
* Can contain [0-9], [a-z] and `-`.
* Must be at least 1 chars and no longer than 63 chars.
* Must start with [a-z], [0-9].
* Must NOT end with `-`.
* Top-Level-Domains (cname.domain.`com`)
* Can contain [0-9], [a-z] and `-`.
* Must be at least 2 chars and no longer than 63 chars.
* Must start with [a-z].
* Must NOT end with `-`.
Regex used to match those: `^(([a-z\d](-?[a-z\d]){0,62})\.)*(([a-z\d](-?[a-z\d]){0,62})\.)([a-z](-?[a-z\d]){1,62})((\|((([a-z\d](-?[a-z\d]){0,62})\.)*(([a-z\d](-?[a-z\d]){0,62})\.)([a-z](-?[a-z\d]){1,62})))*)$`
You can try live [here](https://regex101.com/r/rIxhye/1)
__`Server Name`__
Accepted formats are:
- Single domain (eg. `collabora.mydomain.com`)
- Single FQDN (eg. `collabora.mydomain.com` or `mydomain.com`)
Regex used to match this: `^([a-z]{1,}\.[a-z]{1,}\.[a-z]{1,})$`
You can try live [here](https://regex101.com/r/xCjpW7/1)
_Same rules apply for FQDN as in the section above_
Regex used to match this: `^(([a-z\d](-?[a-z\d]){0,62})\.)*(([a-z\d](-?[a-z\d]){0,62})\.)([a-z](-?[a-z\d]){1,62})$`
You can try live [here](https://regex101.com/r/0HpkSI/1)
__`Password for WebUI`__
Accepted formats are: