mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-28 23:02:25 -05:00
[feature] Allow loading TLS certs from disk (#1586)
Currently, GtS only supports using the built-in LE client directly for TLS. However, admins may still want to use GtS directly (so without a reverse proxy) but with certificates provided through some other mechanism. They may have some centralised way of provisioning these things themselves, or simply prefer to use LE but with a different challenge like DNS-01 which is not supported by autocert. This adds support for loading a public/private keypair from disk instead of using LE and reconfigures the server to use a TLS listener if we succeed in doing so. Additionally, being able to load TLS keypair from disk opens up the path to using a custom CA for testing purposes avoinding the need for a constellation of containers and something like Pebble or Step CA to provide LE APIs.
This commit is contained in:
parent
ef074752d0
commit
d2f6de0185
12 changed files with 153 additions and 4 deletions
|
|
@ -29,6 +29,7 @@ These contribution guidelines were adapted from / inspired by those of Gitea (ht
|
|||
- [SQLite](#sqlite)
|
||||
- [Postgres](#postgres)
|
||||
- [CLI Tests](#cli-tests)
|
||||
- [Federation](#federation)
|
||||
- [Updating Swagger docs](#updating-swagger-docs)
|
||||
- [CI/CD configuration](#cicd-configuration)
|
||||
- [Release Checklist](#release-checklist)
|
||||
|
|
@ -418,6 +419,20 @@ In [./test/envparsing.sh](./test/envparsing.sh) there's a test for making sure t
|
|||
|
||||
Although this test *is* part of the CI/CD testing process, you probably won't need to worry too much about running it yourself. That is, unless you're messing about with code inside the `main` package in `cmd/gotosocial`, or inside the `config` package in `internal/config`.
|
||||
|
||||
#### Federation
|
||||
|
||||
By using the support for loading TLS files from disk it is possible to have two local instances with TLS to allow for (manually) testing federation.
|
||||
|
||||
You'll need to set the following configuration options:
|
||||
* `GTS_TLS_CERTIFICATE_CHAIN`: poiting to a PEM-encoded certificate chain including the public certificate
|
||||
* `GTS_TLS_CERTIFICATE_KEY`: pointing to a PEM-encoded private key
|
||||
|
||||
Additionally, for the Go HTTP client to recognise certificates issued by a custom CA as valid, you'll need to set one of:
|
||||
* `SSL_CERT_FILE`: pointing to the public key of your custom CA
|
||||
* `SSL_CERT_DIR`: a `:`-separated list of directories to load CA certificates from
|
||||
|
||||
You'll additionally need functioning DNS for your two instance names which you can achieve through entries in `/etc/hosts` or by running a local DNS server like [dnsmasq](https://thekelleys.org.uk/dnsmasq/doc.html).
|
||||
|
||||
### Updating Swagger docs
|
||||
|
||||
GoToSocial uses [go-swagger](https://goswagger.io) to generate Swagger API documentation from code annotations.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue