-
Notifications
You must be signed in to change notification settings - Fork 482
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
Added support for custom SSL certificate #969
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,10 @@ def ssl? | |
proxy_config.fetch("ssl", false) | ||
end | ||
|
||
def custom_ssl_certificate? | ||
proxy_config["ssl_certificate_path"].present? | ||
end | ||
|
||
def hosts | ||
proxy_config["hosts"] || proxy_config["host"]&.split(",") || [] | ||
end | ||
|
@@ -30,6 +34,8 @@ def deploy_options | |
{ | ||
host: hosts, | ||
tls: proxy_config["ssl"].presence, | ||
"tls-certificate-path": proxy_config["ssl_certificate_path"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should mount a single volume into the proxy when we boot it. This avoids having to set application level configuration for proxy volumes, which we want to avoid because multiple applications can share the same proxy. We can then re-use that volume for any other features that need to provide files to the proxy (such as custom error pages for maintenance mode). Also ideally we wouldn't need to pass paths around and kamal-proxy should be able to infer the location of the certificate. I think it would mean that kamal-proxy would need to assume that app supplied files live in a different subdirectory to
Then we can have What to do think @kevinmcconnell? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll also need to update There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
"tls-private-key-path": proxy_config["ssl_private_key_path"], | ||
"deploy-timeout": seconds_duration(config.deploy_timeout), | ||
"drain-timeout": seconds_duration(config.drain_timeout), | ||
"health-check-interval": seconds_duration(proxy_config.dig("healthcheck", "interval")), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,8 +150,8 @@ def asset_volume_directory(version = config.version) | |
end | ||
|
||
def ensure_one_host_for_ssl | ||
if running_proxy? && proxy.ssl? && hosts.size > 1 | ||
raise Kamal::ConfigurationError, "SSL is only supported on a single server, found #{hosts.size} servers for role #{name}" | ||
if running_proxy? && proxy.ssl? && hosts.size > 1 && !proxy.custom_ssl_certificate? | ||
raise Kamal::ConfigurationError, "SSL is only supported on a single server or with custom SSL certificates, found #{hosts.size} servers for role #{name}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe |
||
end | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should read these directly from the Kamal secrets. Then here we can set the name of the secret rather than specifying a path.
We can also nest the pems under the ssl key. A hash for the ssl key would imply
ssl: true
.E.g:
Then in your secrets file: