Discourse does not allow dot «.» symbol in bucket name while Amazon S3 allows it

AI-generated summary

The discussion addresses a feature request to allow the dot (.) symbol in Discourse bucket names, aligning with Amazon S3’s naming rules dmitry_fedyuk. While zogstrip initially noted that previous restrictions were due to a deprecated S3 gem, riking clarified that the actual barrier is an SSL certificate error: using dots in bucket names causes hostname mismatches when accessing S3 via HTTPS. Consequently, sam agreed that maintaining the restriction is necessary to ensure secure, SSL-compliant connections, suggesting s3_cdn as an alternative for users seeking vanity names. Following this analysis, zogstrip implemented a fix in commit 5de9554 to resolve the issue.

Rules for Bucket Naming from Amazon Documentation:

Bucket names must be a series of one or more labels. Adjacent labels are separated by a single period (.).
<…>
The following examples are valid bucket names:
<…>
my.aws.bucket

Using a domain name as a bucket name is so naturally, especially for site backup, so it would be nice if Discourse will support it.

We did that because we had issues with the gem we used to communicate with S3. Now that we’ve got rid of it, I think it’s safe to loosen the check a bit.

Test it out, I think we may need to use a diff Api unless they fixed it in v2

Just tested it and it worked fine :wink:

2 Likes

Wait, isn’t the dot restriction because it causes HTTPS to fail?

yes, it is:

ssl.CertificateError: hostname 'my.bucket.s3.amazonaws.com' doesn't match either of '*.s3.amazonaws.com', 's3.amazonaws.com'

It’s the SSL certificate, not the gem.

edit: If discourse isn’t always using SSL to talk to s3, that should be fixed. Both on server and client.

2 Likes

Yes I agree, we should just disallow this, its adding complexity where complexity is not needed.

If people want vanity “sexy” names then can use s3_cdn. A solution that only works with HTTP is not really acceptable.

2 Likes

Thanks for figuring that one out :sunny:

https://github.com/discourse/discourse/commit/5de955451027951600e5ad8b76fa7d38e086603d

3 Likes