Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace config name with feature check in go/caddy conditions #262

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/templates/partials/caddy.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,27 @@
# {{{output.link}}}
{{#unless (minver "2.0.0" form.serverVersion)}}
# note that Caddy version 1 reached end-of-life > 4 years ago back in 2020
{{else}}
{{#if (includes "old" form.config)}}
# note that Caddy supports only TLSv1.2 and later
{{else}}
# note that Caddy automatically configures safe TLS settings
{{/if}}
{{/unless}}

# replace example.com with your domain name
example.com {

tls {
{{#if output.ciphers.length}}
{{#if (includes "TLSv1.2" output.protocols)}}
# Due to a lack of DHE support, you -must- use an ECDSA cert to support IE 11 on Windows 7

{{/if}}
# Note: Caddy automatically configures safe TLS settings,
# so 'ciphers' may safely be commented out to use Caddy defaults.
ciphers {{{join output.ciphers " "}}}
{{/if}}
{{#if (includes "modern" form.config)}}
{{#if (includes "TLSv1.2" output.protocols)}}
{{#if (includes "TLSv1.1" output.protocols)}}
# Note: Caddy supports only TLSv1.2 and later
{{/if}}
#protocols tls1.2 tls1.3
{{else if (includes "TLSv1.3" output.protocols)}}
protocols tls1.3
{{/if}}
}
Expand Down
4 changes: 3 additions & 1 deletion src/templates/partials/go.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ func main() {
{{/if}}

{{#if output.ciphers.length}}
{{#if (includes "intermediate" form.config)}}
{{#unless (includes "TLSv1.1" output.protocols)}}
{{#if (includes "TLSv1.2" output.protocols)}}
// Due to a lack of DHE support, you -must- use an ECDSA cert to support IE 11 on Windows 7
{{/if}}
{{/unless}}
{{/if}}
cfg := &tls.Config{
MinVersion: tls.{{#if (eq output.protocols.[0] "TLSv1")}}VersionTLS10{{else}}{{{replace output.protocols.[0] "TLSv1." "VersionTLS1"}}}{{/if}},
Expand Down