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

New mechanism for CSR tickets #5562

Open
gunnarbeutner opened this issue Sep 7, 2017 · 8 comments
Open

New mechanism for CSR tickets #5562

gunnarbeutner opened this issue Sep 7, 2017 · 8 comments
Labels
area/distributed Distributed monitoring (master, satellites, clients) core/evaluate Analyse/Evaluate features and problems enhancement New feature or request TBD To be defined - We aren't certain about this yet

Comments

@gunnarbeutner
Copy link
Contributor

gunnarbeutner commented Sep 7, 2017

The current certificate request mechanism has a number of issues:

  • Clients can't locally verify whether their ticket is valid (this would be useful in "node wizard")
  • Tickets have infinite validity which is a security concern
  • Users have to manually verify that they're connecting to the correct parent instance

This issue describes a new mechanism for CSR tickets which would alleviate some of these problems.

V2 tickets are constructed using the following algorithm:

  1. The current timestamp is rounded to the nearest N days (using the modulo operation) where N is configurable in the range [1, 256]. This value is the notBefore timestamp.
  2. The N value in step 1 is the validityGranularity.
  3. A SHA256 hash is constructed over the notBefore timestamp and the commonName of the Icinga instance for which the ticket is being generated. This is the ticketHash.
  4. An RSA or ECDSA signature is constructed over the validityGranularity and ticketHash values. This is the ticketSignature.
  5. A base64-encoded concatenation of the validityGranularity, ticketHash and ticketSignature is generated. This is the ticketData.

The resulting ticket format is "icinga-ticket <ticketData> <comment>" where <comment> is an optional value that is not used by Icinga. In most cases this should be the commonName to enable debugging by the user.

Note that the ticketHash could in theory be omitted from the ticketData because it can be reconstructed from the ticketSignature when RSA signatures are used. However, this is not true for ECDSA which would mean that the client cannot locally verify tickets. It would however save 256 bits (+ overhead for base64).

Icinga can locally verify whether a ticket is valid by trying to construct the ticketHash value using the current timestamp and whatever common name it has been configured with. This would be a useful verification step for the "node wizard" to avoid sending known-invalid tickets to the parent instance.

Icinga agents can use the ticket to verify that they're connecting to the correct parent instance. They do this by enumerating the CA certificate(s) from their trust chain for cluster connections. Icinga then attempts to verify the ticketSignature against each of the CA certificates. If a match is found we know that we're connected to an Icinga instance that belongs to the same trust hierarchy. We then still have to verify that we're connecting to the right instance by checking the common name of the instance against the node name the user has specified for the Endpoint object.

The Icinga CA instance can validate tickets by constructing a new ticketHash for the current timestamp and the requestor's commonName. If these match the ticketHash that was provided by the requestor the ticket is both in the correct time range and for the correct commonName. The CA instance also must verify the ticketSignature to ensure that the ticketData has not been tampered with.

@gunnarbeutner gunnarbeutner added the area/distributed Distributed monitoring (master, satellites, clients) label Sep 7, 2017
@gunnarbeutner
Copy link
Contributor Author

Paging @dnsmichi and @lippserd. :)

@gunnarbeutner
Copy link
Contributor Author

The modulo division might be an issue if we're "close" to the end of the current validityGranularity period. Maybe we should just put the entire notAfter timestamp into the ticket.

@dnsmichi
Copy link
Contributor

dnsmichi commented Sep 7, 2017

As discussed, this should be included going along with #5450 and 2.8.

@dnsmichi dnsmichi added the enhancement New feature or request label Sep 7, 2017
@dnsmichi dnsmichi added this to the 2.8.0 milestone Sep 7, 2017
@gunnarbeutner
Copy link
Contributor Author

This also (optionally) depends on #5555 to get the ticket length down to a manageable value.

@dnsmichi
Copy link
Contributor

Postponed due to feature freeze.

@dnsmichi dnsmichi removed this from the 2.9.0 milestone Apr 6, 2018
@dnsmichi
Copy link
Contributor

dnsmichi commented Apr 27, 2018

Unfortunately

is a blocker here, and we cannot raise the .NET package dependency.

@dnsmichi dnsmichi added the TBD To be defined - We aren't certain about this yet label Apr 27, 2018
@dnsmichi
Copy link
Contributor

.NET 4.6.1 is now the new default, not a blocker anymore. #5555 was reverted, so those changes are needed.

@htriem htriem added the core/evaluate Analyse/Evaluate features and problems label Jan 22, 2020
@Al2Klimov
Copy link
Member

The whole concept reminds me of certificates themselves. Alternatively people could just issue and deploy certificates in favour of tickets, via icinga2 pki. Or even do neither, but instead use icinga2 ca sign.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/distributed Distributed monitoring (master, satellites, clients) core/evaluate Analyse/Evaluate features and problems enhancement New feature or request TBD To be defined - We aren't certain about this yet
4 participants