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

Improve detection & handling of duplicate Node ID: #4195

Closed
wants to merge 1 commit into from
Closed

Improve detection & handling of duplicate Node ID: #4195

wants to merge 1 commit into from

Conversation

nbougalis
Copy link
Contributor

@nbougalis nbougalis commented Jun 4, 2022

Each node on the network is supposed to have a unique cryptographic identity. Typically, this identity is generated randomly at startup and stored for later reuse in the (poorly named) file wallet.db.

If the file is copied, it is possible for two nodes to share the same node identity. This is generally not desirable and existing servers will detect and reject connections to other servers that have the same key.

This commit achives three things:

  1. It improves the detection code to pinpoint instances where two distinct servers with the same key connect with each other. In that case, servers will log an appropriate error and shut down pending intervention by the server's operator.
  2. It makes it possible for server administrators to securely and easily generate new cryptographic identities for servers using the new --newnodeid command line arguments. When a server is started using this command, it will generate and save a random secure identity.
  3. It makes it possible to configure the identity using a command line option, which makes it possible to derive it from data or parameters associated with the container or hardware where the instance is running by passing the --nodeid option, followed by a single argument identifying the infomation from which the node's identity is derived. For example, the following command will result in nodes with different hostnames having different node identities: rippled --nodeid $HOSTNAME

The last option is particularly useful for automated cloud-based deployments that minimize the need for storing state.

Important note for server operators:
Depending on variables outside of the the control of this code, such as operating system version or configuration, permissions, and more, it may be possible for other users or programs to be able to access the command line arguments of other processes on the system.

If you are operating in a shared environment, you should avoid using this option, preferring instead to use the [node_seed] option in the configuration file.

The commit also updates the minimum supported server protocol version to XRPL/2.1, which has been supported since version 1.5.0 and eliminates support for XPRL/2.0.

High Level Overview of Change

Context of Change

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

@@ -1627,10 +1644,17 @@ ApplicationImp::run()
}

void
ApplicationImp::signalStop()
ApplicationImp::signalStop(std::string msg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider passing msg by const& since signalStop doesn't modify msg. Theoretically this could save an allocation, though after reviewing all uses of signalStop, it won't make any difference today.

Copy link
Contributor

@HowardHinnant HowardHinnant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting 3 test failures:

$ rippled --unittest=ProtocolVersion
ripple.overlay.ProtocolVersion Convert protocol version to string
ripple.overlay.ProtocolVersion Convert strings to protocol versions
ripple.overlay.ProtocolVersion Protocol version negotiation
#2 failed: ProtocolVersion_test.cpp(85)
#3 failed: ProtocolVersion_test.cpp(87)
#4 failed: ProtocolVersion_test.cpp(90)
105ms, 1 suite, 3 cases, 15 tests total, 3 failures

@nbougalis
Copy link
Contributor Author

I'm getting 3 test failures:

$ rippled --unittest=ProtocolVersion
ripple.overlay.ProtocolVersion Convert protocol version to string
ripple.overlay.ProtocolVersion Convert strings to protocol versions
ripple.overlay.ProtocolVersion Protocol version negotiation
#2 failed: ProtocolVersion_test.cpp(85)
#3 failed: ProtocolVersion_test.cpp(87)
#4 failed: ProtocolVersion_test.cpp(90)
105ms, 1 suite, 3 cases, 15 tests total, 3 failures

Weird... I'll look into it.

@nbougalis
Copy link
Contributor Author

Fixed: the unit test was expecting support for obsolete protocol version 2.0 which this commit removed support for.

@HowardHinnant
Copy link
Contributor

The test failures I'm now seeing have slightly changed:

ripple.overlay.ProtocolVersion Convert strings to protocol versions
#2 failed: ProtocolVersion_test.cpp(45)
#4 failed: ProtocolVersion_test.cpp(45)
#5 failed: ProtocolVersion_test.cpp(45)

Each node on the network is supposed to have a unique cryptographic
identity. Typically, this identity is generated randomly at startup
and stored for later reuse in the (poorly named) file `wallet.db`.

If the file is copied, it is possible for two nodes to share the
same node identity. This is generally not desirable and existing
servers will detect and reject connections to other servers that
have the same key.

This commit achives three things:

1. It improves the detection code to pinpoint instances where two
   distinct servers with the same key connect with each other. In
   that case, servers will log an appropriate error and shut down
   pending intervention by the server's operator.
2. It makes it possible for server administrators to securely and
   easily generate new cryptographic identities for servers using
   the new `--newnodeid` command line arguments. When a server is
   started using this command, it will generate and save a random
   secure identity.
3. It makes it possible to configure the identity using a command
   line option, which makes it possible to derive it from data or
   parameters associated with the container or hardware where the
   instance is running by passing the `--nodeid` option, followed
   by a single argument identifying the infomation from which the
   node's identity is derived. For example, the following command
   will result in nodes with different hostnames having different
   node identities: `rippled --nodeid $HOSTNAME`

The last option is particularly useful for automated cloud-based
deployments that minimize the need for storing state and provide
unique deployment identifiers.

**Important note for server operators:**
Depending on variables outside of the the control of this code,
such as operating system version or configuration, permissions,
and more, it may be possible for other users or programs to be
able to access the command line arguments of other processes
on the system.

If you are operating in a shared environment, you should avoid
using this option, preferring instead to use the `[node_seed]`
option in the configuration file, and use permissions to limit
exposure of the node seed.

A user who gains access to the value used to derive the node's
unique identity could impersonate that node.

The commit also updates the minimum supported server protocol
version to `XRPL/2.1`, which has been supported since version
1.5.0 and eliminates support for `XPRL/2.0`.
This was referenced Aug 4, 2022
intelliot pushed a commit to intelliot/rippled that referenced this pull request Feb 25, 2023
Fix an issue introduced by XRPLF#4195 / 5a15229 (part of 1.10.0-b1)
intelliot added a commit to intelliot/rippled that referenced this pull request Feb 25, 2023
Partially revert the functionality introduced
with XRPLF#4195 / 5a15229 (part of 1.10.0-b1).

Co-authored-by: Nik Bougalis <nikb@bougalis.net>
@intelliot intelliot mentioned this pull request Feb 25, 2023
1 task
intelliot added a commit that referenced this pull request Feb 28, 2023
Partially revert the functionality introduced
with #4195 / 5a15229 (part of 1.10.0-b1).

Acknowledgements:
Aaron Hook for responsibly disclosing this issue.

Bug Bounties and Responsible Disclosures:
We welcome reviews of the rippled code and urge researchers to
responsibly disclose any issues they may find.

To report a bug, please send a detailed report to:

    bugs@xrpl.org

---------

Co-authored-by: Nik Bougalis <nikb@bougalis.net>
dangell7 pushed a commit to Transia-RnD/rippled that referenced this pull request Mar 5, 2023
Partially revert the functionality introduced
with XRPLF#4195 / 5a15229 (part of 1.10.0-b1).

Acknowledgements:
Aaron Hook for responsibly disclosing this issue.

Bug Bounties and Responsible Disclosures:
We welcome reviews of the rippled code and urge researchers to
responsibly disclose any issues they may find.

To report a bug, please send a detailed report to:

    bugs@xrpl.org

---------

Co-authored-by: Nik Bougalis <nikb@bougalis.net>
intelliot referenced this pull request Mar 7, 2023
Each node on the network is supposed to have a unique cryptographic
identity. Typically, this identity is generated randomly at startup
and stored for later reuse in the (poorly named) file `wallet.db`.

If the file is copied, it is possible for two nodes to share the
same node identity. This is generally not desirable and existing
servers will detect and reject connections to other servers that
have the same key.

This commit achives three things:

1. It improves the detection code to pinpoint instances where two
   distinct servers with the same key connect with each other. In
   that case, servers will log an appropriate error and shut down
   pending intervention by the server's operator.
2. It makes it possible for server administrators to securely and
   easily generate new cryptographic identities for servers using
   the new `--newnodeid` command line arguments. When a server is
   started using this command, it will generate and save a random
   secure identity.
3. It makes it possible to configure the identity using a command
   line option, which makes it possible to derive it from data or
   parameters associated with the container or hardware where the
   instance is running by passing the `--nodeid` option, followed
   by a single argument identifying the infomation from which the
   node's identity is derived. For example, the following command
   will result in nodes with different hostnames having different
   node identities: `rippled --nodeid $HOSTNAME`

The last option is particularly useful for automated cloud-based
deployments that minimize the need for storing state and provide
unique deployment identifiers.

**Important note for server operators:**
Depending on variables outside of the the control of this code,
such as operating system version or configuration, permissions,
and more, it may be possible for other users or programs to be
able to access the command line arguments of other processes
on the system.

If you are operating in a shared environment, you should avoid
using this option, preferring instead to use the `[node_seed]`
option in the configuration file, and use permissions to limit
exposure of the node seed.

A user who gains access to the value used to derive the node's
unique identity could impersonate that node.

The commit also updates the minimum supported server protocol
version to `XRPL/2.1`, which has been supported since version
1.5.0 and eliminates support for `XPRL/2.0`.
@intelliot intelliot added Tech Debt Non-urgent improvements Will Need Documentation labels Mar 7, 2023
@nbougalis nbougalis deleted the nodeseedreuse branch October 16, 2023 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants