Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
install: Reject non-ASCII hostnames before installing anything.
Alex Vandiverf349e4fd39dd
diff --git a/docs/production/install.md b/docs/production/install.mdindex 7976c2dc3ed..540b3c8fa43 100644--- a/docs/production/install.md+++ b/docs/production/install.md@@ -102,7 +102,8 @@ of the failure, you can just rerun the script. For more information, see- `--hostname=zulip.example.com`: The user-accessible domain name for this Zulipserver, i.e., what users will type in their web browser. This becomes- `EXTERNAL_HOST` in the Zulip [settings][doc-settings].+ `EXTERNAL_HOST` in the Zulip [settings][doc-settings]. Use Punycode for+ non-ASCII domains.- `--certbot`: With this option, the Zulip installer automatically obtains anSSL certificate for the server [using Certbot][doc-certbot], and configures adiff --git a/scripts/lib/install b/scripts/lib/installindex f1c6d900a08..db975982509 100755--- a/scripts/lib/install+++ b/scripts/lib/install@@ -13,6 +13,7 @@ Options:The user-accessible domain name for this Zulip server, i.e.,what users will type in their web browser. Required, unless--no-init-db or --puppet-classes is set, and --certbot is not.+ Use Punycode for non-ASCII domains.The email address of the person or team who should get support@@ -225,6 +226,33 @@ if [ "$EXTERNAL_HOST" = zulip.example.com ] \exit 1fi+case "$EXTERNAL_HOST" in+ *[![:ascii:]]*)+ # Non-ASCII hostnames are specifically checked for and would+ # fail later; see zerver/checks.py+ echo "error: The hostname ($EXTERNAL_HOST) contains non-ASCII characters." >&2+ echo 'Internationalized domain names must be specified in punycode ("xn--") form:' >&2+ # python3 is not installed until later, so it may not be+ # available to compute the suggested encoding.+ if command -v python3 >/dev/null 2>&1; then+ suggestion="$(python3 -c '+import sys++hostname, sep, port = sys.argv[1].partition(":")+print(+ ".".join(+ "xn--" + label.encode("punycode").decode() if not label.isascii() else label+ for label in hostname.split(".")+ )+ + sep+ + port+)' "$EXTERNAL_HOST")"+ echo " --hostname=$suggestion" >&2+ fi+ exit 1+ ;;+esac+case "$POSTGRESQL_VERSION" in[0-9] | [0-9].* | 1[0-3] | 1[0-3].*)echo "error: PostgreSQL 14 or newer is required." >&2