[ 
https://issues.apache.org/jira/browse/IGNITE-29212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Anton Vinogradov updated IGNITE-29212:
--------------------------------------
    Description: 
h3. Goal

Let operators reload the keys and trusted certificates that Jetty uses for 
Ignite’s HTTP REST endpoint. An operator can update the configured source and 
run {{control.sh --ssl reload}} without restarting the node. Ignite also 
reloads them automatically before the certificates expire, as it does for its 
other TLS transports.

h3. Design decisions and constraints

* *Keep the existing Jetty configuration.* Use the TLS factory already serving 
HTTPS, with its settings from {{jetty.xml}}. This applies to both standard and 
custom factories. Operators should not have to configure HTTPS a second time in 
Ignite.
* *Let the factory load its keys.* The command and the hourly hot reload check 
ask the factory to reload. The factory reads its source itself. A source can 
deliver new keys directly without the factory having to fetch them again.
* *Hot reload covers HTTPS without settings.* The hourly check from 
IGNITE-29211 also checks the Jetty factory. It takes the date from the 
certificates that the factory loaded. A certificate becomes due before it 
expires by a third of its lifetime, but by no more than 7 days. Ignite 
factories use the same rule and have no hot reload settings either. A fixed 7 
days does not work for certificates valid for less than 7 days: they are due 
right after loading, so the node would reload them and log a failure every hour.
* *Do not switch to keys that fail to load.* This applies to both the command 
and hot reload. As with Ignite factories, a failed reload leaves the last 
working keys and trust settings in use, even while the source remains 
unreadable. New connections never get a factory without keys: during a reload 
they wait and then get either the replacement or the previous keys. Established 
connections stay open. If an automatic update installed certificate B, clients 
must still see B after a failed manual reload. The hot reload date stays as 
well, so the next hourly check tries again.
* *Report what happened on each node.* The command reports {{HTTP REST}} as 
reloaded once new connections can use the replacement. On failure it reports 
the node and the cause, even if HTTPS recovered. The operator can fix the 
source and retry the same command. Hot reload logs its attempts for {{HTTP 
REST}} and counts them in the {{ssl}} metrics, as for other transports.
* *Peers must trust the replacement first.* Hot reload is always on, so a node 
loads a replaced key store by itself within an hour once the old certificate is 
due. If clients or other nodes do not trust the new certificate yet, their new 
connections fail. The documentation presents the trust-first order as the 
general rule for replacing certificates.

h3. Implementation idea

On each node serving HTTPS, obtain the TLS factory from the running Jetty 
connector and call {{SslContextFactory.reload(...)}} on that instance. Jetty 
12.1.14’s standard factory clears its active TLS state before loading the 
replacement, and its public API cannot build a replacement next to the active 
one. New connections take the TLS state under the factory’s lock. So do the 
whole reload under that lock: if loading fails, give the factory its last 
working context back before releasing the lock.

  was:
h3. Goal

Let operators reload the keys and trusted certificates that Jetty uses for 
Ignite’s HTTP REST endpoint. An operator can update the configured source and 
run {{control.sh --ssl reload}} without restarting the node. Ignite also 
reloads them automatically before the certificates expire, as it does for its 
other TLS transports.

h3. Design decisions and constraints

* *Keep the existing Jetty configuration.* Use the TLS factory already serving 
HTTPS, with its settings from {{jetty.xml}}. This applies to both standard and 
custom factories. Operators should not have to configure HTTPS a second time in 
Ignite.
* *Let the factory load its keys.* The command and the hourly hot reload check 
ask the factory to reload. The factory reads its source itself. A source can 
deliver new keys directly without the factory having to fetch them again.
* *Hot reload covers HTTPS without settings.* The hourly check from 
IGNITE-29211 also checks the Jetty factory. It takes the date from the 
certificates that the factory loaded. A certificate becomes due before it 
expires by a third of its lifetime, but by no more than 7 days. Ignite 
factories use the same rule and have no hot reload settings either. A fixed 7 
days does not work for certificates valid for less than 7 days: they are due 
right after loading, so the node would reload them and log a failure every hour.
* *Recover from a failed reload.* This applies to both the command and hot 
reload. Established connections stay open. A new connection may briefly fail 
during reload. After a failure, HTTPS must automatically accept new connections 
with the last working keys and trust settings, even while the source remains 
unreadable. If an automatic update installed certificate B, clients must still 
see B after a failed manual reload. The hot reload date stays as well, so the 
next hourly check tries again.
* *Report what happened on each node.* The command reports {{HTTP REST}} as 
reloaded once new connections can use the replacement. On failure it reports 
the node and the cause, even if HTTPS recovered. The operator can fix the 
source and retry the same command. Hot reload logs its attempts for {{HTTP 
REST}} and counts them in the {{ssl}} metrics, as for other transports.
* *Peers must trust the replacement first.* Hot reload is always on, so a node 
loads a replaced key store by itself within an hour once the old certificate is 
due. If clients or other nodes do not trust the new certificate yet, their new 
connections fail. The documentation presents the trust-first order as the 
general rule for replacing certificates.

h3. Implementation idea

On each node serving HTTPS, obtain the TLS factory from the running Jetty 
connector and call {{SslContextFactory.reload(...)}} on that instance. Jetty 
12.1.14’s standard factory clears its active TLS state before loading the 
replacement. One way to recover is to retain the last working keys and trust 
settings and reuse them if loading fails.


> Reload HTTP REST certificates from the Jetty configuration
> ----------------------------------------------------------
>
>                 Key: IGNITE-29212
>                 URL: https://issues.apache.org/jira/browse/IGNITE-29212
>             Project: Ignite
>          Issue Type: Sub-task
>            Reporter: Anton Vinogradov
>            Assignee: Anton Vinogradov
>            Priority: Major
>              Labels: ise
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> h3. Goal
> Let operators reload the keys and trusted certificates that Jetty uses for 
> Ignite’s HTTP REST endpoint. An operator can update the configured source and 
> run {{control.sh --ssl reload}} without restarting the node. Ignite also 
> reloads them automatically before the certificates expire, as it does for its 
> other TLS transports.
> h3. Design decisions and constraints
> * *Keep the existing Jetty configuration.* Use the TLS factory already 
> serving HTTPS, with its settings from {{jetty.xml}}. This applies to both 
> standard and custom factories. Operators should not have to configure HTTPS a 
> second time in Ignite.
> * *Let the factory load its keys.* The command and the hourly hot reload 
> check ask the factory to reload. The factory reads its source itself. A 
> source can deliver new keys directly without the factory having to fetch them 
> again.
> * *Hot reload covers HTTPS without settings.* The hourly check from 
> IGNITE-29211 also checks the Jetty factory. It takes the date from the 
> certificates that the factory loaded. A certificate becomes due before it 
> expires by a third of its lifetime, but by no more than 7 days. Ignite 
> factories use the same rule and have no hot reload settings either. A fixed 7 
> days does not work for certificates valid for less than 7 days: they are due 
> right after loading, so the node would reload them and log a failure every 
> hour.
> * *Do not switch to keys that fail to load.* This applies to both the command 
> and hot reload. As with Ignite factories, a failed reload leaves the last 
> working keys and trust settings in use, even while the source remains 
> unreadable. New connections never get a factory without keys: during a reload 
> they wait and then get either the replacement or the previous keys. 
> Established connections stay open. If an automatic update installed 
> certificate B, clients must still see B after a failed manual reload. The hot 
> reload date stays as well, so the next hourly check tries again.
> * *Report what happened on each node.* The command reports {{HTTP REST}} as 
> reloaded once new connections can use the replacement. On failure it reports 
> the node and the cause, even if HTTPS recovered. The operator can fix the 
> source and retry the same command. Hot reload logs its attempts for {{HTTP 
> REST}} and counts them in the {{ssl}} metrics, as for other transports.
> * *Peers must trust the replacement first.* Hot reload is always on, so a 
> node loads a replaced key store by itself within an hour once the old 
> certificate is due. If clients or other nodes do not trust the new 
> certificate yet, their new connections fail. The documentation presents the 
> trust-first order as the general rule for replacing certificates.
> h3. Implementation idea
> On each node serving HTTPS, obtain the TLS factory from the running Jetty 
> connector and call {{SslContextFactory.reload(...)}} on that instance. Jetty 
> 12.1.14’s standard factory clears its active TLS state before loading the 
> replacement, and its public API cannot build a replacement next to the active 
> one. New connections take the TLS state under the factory’s lock. So do the 
> whole reload under that lock: if loading fails, give the factory its last 
> working context back before releasing the lock.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to