[ 
https://issues.apache.org/jira/browse/HBASE-30576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18151066#comment-18151066
 ] 

Xavier Fernandis edited comment on HBASE-30576 at 11/25/26, 6:35 PM:
---------------------------------------------------------------------

h2. Reproduction: a backup master aborts on failover after its Debug Dump page 
was opened
h3. Setup
 * Apache HBase 2.6.7, built from tag {{rel/2.6.7}} with 
{{-Dhadoop.profile=3.0}} (Hadoop 3.4.3), JDK 17.
 * Pseudo-distributed on one host, every daemon a separate process: ZooKeeper, 
active master, backup master ({{{}--backup{}}}), RegionServer.
 * Native TLS RPC, keystore and truststore passwords in hbase-site.xml:

{code:java}
<property><name>hbase.server.netty.tls.enabled</name><value>true</value></property>
<property><name>hbase.server.netty.tls.supportplaintext</name><value>false</value></property>
<property><name>hbase.client.netty.tls.enabled</name><value>true</value></property>
<property><name>hbase.rpc.tls.keystore.location</name><value>/path/to/keystore.p12</value></property>
<property><name>hbase.rpc.tls.keystore.type</name><value>PKCS12</value></property>
<property><name>hbase.rpc.tls.keystore.password</name><value><password></value></property>
<property><name>hbase.rpc.tls.truststore.location</name><value>/path/to/truststore.p12</value></property>
<property><name>hbase.rpc.tls.truststore.type</name><value>PKCS12</value></property>
<property><name>hbase.rpc.tls.truststore.password</name><value><password></value></property>
<!-- only so that the test certificate does not depend on local DNS, unrelated 
to the problem -->
<property><name>hbase.client.netty.tls.verify.server.hostname</name><value>false</value></property>
<property><name>hbase.server.netty.tls.verify.client.hostname</name><value>false</value></property>{code}
h3. Steps
 # Start ZooKeeper, the active master and the RegionServer, then a backup 
master with {{{}--backup{}}}.
 # Open the backup master's Debug Dump page once 
({{{}http://<backup-master>:<info-port>/dump{}}}, the "Debug Dump" link in its 
UI).
 # Stop the active master (SIGTERM) so that the backup master takes over.
 # Check the backup master's log and {{status}} from a new client.

The same steps were run three times, one after the other, with the same 
certificate files, keystore password, configuration and ports. Only two things 
differ between the runs: whether the Debug Dump page is opened, and whether 
{{StateDumpServlet}} has the fix.
h3. Results
||Case||Build||Debug Dump of the backup master||Backup master's live config 
after the visit||Failover||TLS setup failures on the backup master||
|1|2.6.7|opened once|{{******}}|*aborts, cluster has no active master*|24|
|2|2.6.7|not opened|-|becomes the active master|0|
|3|2.6.7 + fix|opened once|unchanged|becomes the active master|0|

 
h3. Case 1: 2.6.7, Debug Dump of the backup master opened once, then failover

The backup master aborts.
{code:java}
23:41:28,388  runner  start ZooKeeper, active master, RegionServer and standby 
master
23:42:14,573  rs      INFO   reportForDuty to master 192.0.2.10:17000
23:42:25,217  active  INFO   Master has completed initialization -> active 
master is up
23:42:28,229  standby INFO   Another master is the active master; waiting to 
become the next active master
23:42:37,033  runner  cluster status: 1 active master, 1 backup masters, 1 
servers, 0 dead, 2.0000 average load
23:42:37,251  runner  keystore file opens with the password from hbase-site.xml 
(checked with keytool)
23:42:37,372  runner  standby live hadoop.security.sensitive-config-keys:  
secret$ password$ ssl.keystore.pass$ fs
23:42:37,492  runner  OPEN the standby's Debug Dump page: HTTP 200, page shows 
hbase.rpc.tls.keystore.password as '******'
23:42:37,534  runner  standby live hadoop.security.sensitive-config-keys: ******
23:42:37,632  runner  active  live hadoop.security.sensitive-config-keys:  
secret$ password$ ssl.keystore.pass$ fs
23:42:41,261  runner  cluster status: 1 active master, 1 backup masters, 1 
servers, 0 dead, 2.0000 average load
23:42:41,316  runner  STOP the active master (SIGTERM) to trigger a failover
23:42:41,336  active  INFO   stopping (SIGTERM received)
23:42:41,344  standby INFO   Registered as active master -> taking over
23:42:41,662  active  INFO   process exited
23:42:46,984  standby WARN   TLS setup failed: keystore password was incorrect 
(outgoing connection, X509Util.createSslContextForClient)   [x8, last at 
23:43:35,445]
23:42:48,621  standby WARN   TLS setup failed: keystore password was incorrect 
(incoming connection, X509Util.createSslContextForServer)   [x16, last at 
23:43:33,485]
23:42:48,622  rs      WARN   cannot connect to the NEW active master :17001   
[x17, last at 23:43:44,276]
23:42:51,095  rs      WARN   cannot connect to the OLD active master :17000 
(expected, it was stopped)
23:43:35,448  standby ERROR  Failed to become active master 
(RetriesExhaustedException: Failed after attempts=46, reading hbase:meta timed 
out)
23:43:35,448  standby ERROR  ***** ABORTING master *****
23:43:35,594  standby ERROR  Master exiting -> process ends
23:43:43,659  runner  cluster status after the failover: no active master 
(NoNode for /hbase/master){code}
{code:java}
 {code}
h3. Case 2: 2.6.7, Debug Dump not opened, then failover

The backup master takes over (timeline from the step that differs).
{code:java}
23:45:04,066  runner  Debug Dump page NOT opened
23:45:07,585  runner  cluster status: 1 active master, 1 backup masters, 1 
servers, 0 dead, 2.0000 average load
23:45:07,610  runner  STOP the active master (SIGTERM) to trigger a failover
23:45:07,629  active  INFO   stopping (SIGTERM received)
23:45:07,637  standby INFO   Registered as active master -> taking over
23:45:07,967  active  INFO   process exited
23:45:13,494  standby INFO   Master has completed initialization -> it is the 
active master now
23:45:15,757  rs      WARN   cannot connect to the OLD active master :17000 
(expected, it was stopped)
23:45:22,467  runner  cluster status after the failover: 1 active master, 0 
backup masters, 1 servers, 0 dead, 2.0000 average load
{code}
h3. Case 3: 2.6.7 with the fix, Debug Dump of the backup master opened once, 
then failover

The backup master takes over (timeline from the step that differs).
{code:java}
23:46:45,245  runner  OPEN the standby's Debug Dump page: HTTP 200, page shows 
hbase.rpc.tls.keystore.password as '******'
23:46:45,291  runner  standby live hadoop.security.sensitive-config-keys:  
secret$ password$ ssl.keystore.pass$ fs
23:46:45,392  runner  active  live hadoop.security.sensitive-config-keys:  
secret$ password$ ssl.keystore.pass$ fs
23:46:48,912  runner  cluster status: 1 active master, 1 backup masters, 1 
servers, 0 dead, 2.0000 average load
23:46:48,946  runner  STOP the active master (SIGTERM) to trigger a failover
23:46:48,966  active  INFO   stopping (SIGTERM received)
23:46:48,971  standby INFO   Registered as active master -> taking over
23:46:49,282  active  INFO   process exited
23:46:54,158  standby INFO   Master has completed initialization -> it is the 
active master now
23:46:58,931  rs      WARN   cannot connect to the OLD active master :17000 
(expected, it was stopped)
23:47:03,777  runner  cluster status after the failover: 1 active master, 0 
backup masters, 1 servers, 0 dead, 2.0000 average load
{code}
h3. Why the backup master fails

The backup master opens no RPC connections while it waits, so it creates its 
TLS contexts for the first time when it takes over. In case 1 it does that with 
{{******}} as the keystore password, because the Debug Dump page overwrote it 
in the live configuration. Both its outgoing connections (to {{hbase:meta}} on 
the RegionServer) and the incoming ones (from the RegionServer) fail with 
"keystore password was incorrect", until it gives up and aborts.


was (Author: JIRAUSER311168):
h2. Reproduction: a backup master aborts on failover after its Debug Dump page 
was opened
h3. Setup
 * Apache HBase 2.6.7, built from tag {{rel/2.6.7}} with 
{{-Dhadoop.profile=3.0}} (Hadoop 3.4.3), JDK 17.
 * Pseudo-distributed on one host, every daemon a separate process: ZooKeeper, 
active master, backup master ({{{}--backup{}}}), RegionServer.
 * Native TLS RPC, keystore and truststore passwords in hbase-site.xml:

{code:java}
<property><name>hbase.server.netty.tls.enabled</name><value>true</value></property>
<property><name>hbase.server.netty.tls.supportplaintext</name><value>false</value></property>
<property><name>hbase.client.netty.tls.enabled</name><value>true</value></property>
<property><name>hbase.rpc.tls.keystore.location</name><value>/path/to/keystore.p12</value></property>
<property><name>hbase.rpc.tls.keystore.type</name><value>PKCS12</value></property>
<property><name>hbase.rpc.tls.keystore.password</name><value><password></value></property>
<property><name>hbase.rpc.tls.truststore.location</name><value>/path/to/truststore.p12</value></property>
<property><name>hbase.rpc.tls.truststore.type</name><value>PKCS12</value></property>
<property><name>hbase.rpc.tls.truststore.password</name><value><password></value></property>
<!-- only so that the test certificate does not depend on local DNS, unrelated 
to the problem -->
<property><name>hbase.client.netty.tls.verify.server.hostname</name><value>false</value></property>
<property><name>hbase.server.netty.tls.verify.client.hostname</name><value>false</value></property>{code}
h3. Steps
 # Start ZooKeeper, the active master and the RegionServer, then a backup 
master with {{{}--backup{}}}.
 # Open the backup master's Debug Dump page once 
({{{}http://<backup-master>:<info-port>/dump{}}}, the "Debug Dump" link in its 
UI).
 # Stop the active master (SIGTERM) so that the backup master takes over.
 # Check the backup master's log and {{status}} from a new client.

The same steps were run three times, one after the other, with the same 
certificate files, keystore password, configuration and ports. Only two things 
differ between the runs: whether the Debug Dump page is opened, and whether 
{{StateDumpServlet}} has the fix.
h3. Results
||Case||Build||Debug Dump of the backup master||Backup master's live config 
after the visit||Failover||TLS setup failures on the backup master||
|1|2.6.7|opened once|{{******}}|*aborts, cluster has no active master*|24|
|2|2.6.7|not opened|-|becomes the active master|0|
|3|2.6.7 + fix|opened once|unchanged|becomes the active master|0|
h3. Notes on the timelines
 * Process column: {{runner}} is the step being performed, {{active}} the 
active master, {{standby}} the backup master, {{rs}} the RegionServer.
 * "keystore file opens with the password from hbase-site.xml" is checked with 
{{keytool}} right before the failover, so the keystore file and the configured 
password are valid in all three cases.
 * The live configuration is read through {{{}/conf{}}}. {{/conf}} masks keys 
containing "password", so the timeline shows 
{{hadoop.security.sensitive-config-keys}} instead. The Debug Dump page 
overwrites it the same way as the keystore password.
 * Repeated errors are collapsed into the first occurrence plus a count. 
"cannot connect to the OLD active master :17000" is expected in every case, 
because that master was stopped.
 * Host name, IP address and home directory are anonymized. The full timelines 
are attached ({{{}CASE1-without-fix-dump.log{}}}, 
{{{}CASE2-without-fix-no-dump.log{}}}, {{{}CASE3-with-fix-dump.log{}}}).

h3. Case 1: 2.6.7, Debug Dump of the backup master opened once, then failover

The backup master aborts.
{code:java}
23:41:28,388  runner  start ZooKeeper, active master, RegionServer and standby 
master
23:42:14,573  rs      INFO   reportForDuty to master 192.0.2.10:17000
23:42:25,217  active  INFO   Master has completed initialization -> active 
master is up
23:42:28,229  standby INFO   Another master is the active master; waiting to 
become the next active master
23:42:37,033  runner  cluster status: 1 active master, 1 backup masters, 1 
servers, 0 dead, 2.0000 average load
23:42:37,251  runner  keystore file opens with the password from hbase-site.xml 
(checked with keytool)
23:42:37,372  runner  standby live hadoop.security.sensitive-config-keys:  
secret$ password$ ssl.keystore.pass$ fs
23:42:37,492  runner  OPEN the standby's Debug Dump page: HTTP 200, page shows 
hbase.rpc.tls.keystore.password as '******'
23:42:37,534  runner  standby live hadoop.security.sensitive-config-keys: ******
23:42:37,632  runner  active  live hadoop.security.sensitive-config-keys:  
secret$ password$ ssl.keystore.pass$ fs
23:42:41,261  runner  cluster status: 1 active master, 1 backup masters, 1 
servers, 0 dead, 2.0000 average load
23:42:41,316  runner  STOP the active master (SIGTERM) to trigger a failover
23:42:41,336  active  INFO   stopping (SIGTERM received)
23:42:41,344  standby INFO   Registered as active master -> taking over
23:42:41,662  active  INFO   process exited
23:42:46,984  standby WARN   TLS setup failed: keystore password was incorrect 
(outgoing connection, X509Util.createSslContextForClient)   [x8, last at 
23:43:35,445]
23:42:48,621  standby WARN   TLS setup failed: keystore password was incorrect 
(incoming connection, X509Util.createSslContextForServer)   [x16, last at 
23:43:33,485]
23:42:48,622  rs      WARN   cannot connect to the NEW active master :17001   
[x17, last at 23:43:44,276]
23:42:51,095  rs      WARN   cannot connect to the OLD active master :17000 
(expected, it was stopped)
23:43:35,448  standby ERROR  Failed to become active master 
(RetriesExhaustedException: Failed after attempts=46, reading hbase:meta timed 
out)
23:43:35,448  standby ERROR  ***** ABORTING master *****
23:43:35,594  standby ERROR  Master exiting -> process ends
23:43:43,659  runner  cluster status after the failover: no active master 
(NoNode for /hbase/master){code}
{code:java}
 {code}
h3. Case 2: 2.6.7, Debug Dump not opened, then failover

The backup master takes over (timeline from the step that differs).
{code:java}
23:45:04,066  runner  Debug Dump page NOT opened
23:45:07,585  runner  cluster status: 1 active master, 1 backup masters, 1 
servers, 0 dead, 2.0000 average load
23:45:07,610  runner  STOP the active master (SIGTERM) to trigger a failover
23:45:07,629  active  INFO   stopping (SIGTERM received)
23:45:07,637  standby INFO   Registered as active master -> taking over
23:45:07,967  active  INFO   process exited
23:45:13,494  standby INFO   Master has completed initialization -> it is the 
active master now
23:45:15,757  rs      WARN   cannot connect to the OLD active master :17000 
(expected, it was stopped)
23:45:22,467  runner  cluster status after the failover: 1 active master, 0 
backup masters, 1 servers, 0 dead, 2.0000 average load
{code}
h3. Case 3: 2.6.7 with the fix, Debug Dump of the backup master opened once, 
then failover

The backup master takes over (timeline from the step that differs).
{code:java}
23:46:45,245  runner  OPEN the standby's Debug Dump page: HTTP 200, page shows 
hbase.rpc.tls.keystore.password as '******'
23:46:45,291  runner  standby live hadoop.security.sensitive-config-keys:  
secret$ password$ ssl.keystore.pass$ fs
23:46:45,392  runner  active  live hadoop.security.sensitive-config-keys:  
secret$ password$ ssl.keystore.pass$ fs
23:46:48,912  runner  cluster status: 1 active master, 1 backup masters, 1 
servers, 0 dead, 2.0000 average load
23:46:48,946  runner  STOP the active master (SIGTERM) to trigger a failover
23:46:48,966  active  INFO   stopping (SIGTERM received)
23:46:48,971  standby INFO   Registered as active master -> taking over
23:46:49,282  active  INFO   process exited
23:46:54,158  standby INFO   Master has completed initialization -> it is the 
active master now
23:46:58,931  rs      WARN   cannot connect to the OLD active master :17000 
(expected, it was stopped)
23:47:03,777  runner  cluster status after the failover: 1 active master, 0 
backup masters, 1 servers, 0 dead, 2.0000 average load
{code}
h3. Why the backup master fails

The backup master opens no RPC connections while it waits, so it creates its 
TLS contexts for the first time when it takes over. In case 1 it does that with 
{{******}} as the keystore password, because the Debug Dump page overwrote it 
in the live configuration. Both its outgoing connections (to {{hbase:meta}} on 
the RegionServer) and the incoming ones (from the RegionServer) fail with 
"keystore password was incorrect", until it gives up and aborts.

> Debug Dump overwrites sensitive properties in the live configuration of the 
> Master and RegionServers
> ----------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-30576
>                 URL: https://issues.apache.org/jira/browse/HBASE-30576
>             Project: HBase
>          Issue Type: Bug
>          Components: UI
>    Affects Versions: 3.0.0, 2.6.5, 2.6.6, 2.6.7
>            Reporter: Xavier Fernandis
>            Assignee: Xavier Fernandis
>            Priority: Major
>
> The Debug Dump page is meant to hide passwords in what it SHOWS, but in HBase 
> 2.6.5+ it hides them in the server's RUNNING configuration, so the server 
> itself loses its real passwords.
> *How it happens:*
>  #  Every HBase Master and RegionServer keeps one configuration object in 
> memory. It is loaded from hbase-site.xml and core-site.xml at startup, and 
> the server reads its settings from it whenever it needs them.
>  #  Every Master and RegionServer web UI has a "Debug Dump" link in its 
> navigation bar (/dump).  It shows threads, tasks, logs and the server's 
> configuration, and is a standard troubleshooting page.
>  # Since HBASE-29761 (2.6.5, 2.6.6, 2.6.7, 3.0.0), the page hides sensitive 
> values by writing  "******" INTO that configuration 
> object: StateDumpServlet.getRedactedConfiguration()  ->  conf.set(key, 
> "******")
>   It should write them into a copy, as the /conf page already does 
> (ConfServlet.mask()).
>  # So after ONE visit, the running server has "******" instead of:
>        - the TLS keystore and truststore passwords
>        - object store keys (S3A / ABFS / GCS)
>        - ZooKeeper TLS passwords
>        - its own list of redaction patterns 
> (hadoop.security.sensitive-config-keys)
> *Impact :*
> The server can no longer set up new TLS connections Its keystore password is 
> now "******", so every TLS connection it has to set up from scratch fails 
> with "keystore password was incorrect". 
>  - Master failover: a standby master sets up its TLS connections only when it 
> takes over. If  its Debug Dump page was opened at any time before, it cannot 
> reach the RegionServers or  hbase:meta, fails to become the active master and 
> aborts. The cluster is left with no active master.
> - Certificate renewal: with certificate hot reload on, the server rebuilds 
> its TLS setup when the certificate file is renewed, fails, and refuses every 
> new connection.
> -Only a restart recovers Reloading the configuration (update_config / 
> update_all_config) does not bring the real values back.
> *The Fix :*
>  Redact a copy of the configuration instead of the live one (about 4 lines in 
> StateDumpServlet.getRedactedConfiguration()). Both the Master and 
> RegionServer dump pages use this one method, so one change covers both. 



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

Reply via email to