...and beware even the errors that match exactly! I've seen multiple systems in the wild that treat 404 as an application-specific error for "content not found". It sounds perfectly reasonable at first, but it puts you one misconfigured reverse proxy away from inadvertently broadcasting to the world that all your content is gone.
This can have data-corrupting effects. If an external system deletes resources via a reliable message queue and treats 404 as a success condition, they run the risk of dropping these messages and creating an inconsistent state. I've seen it happen.
Keep application-specific error messages distinguishable from the 'plumbing'.
If a system treated 5xx responses as successful, you'd consider that a problem with the system's response handling, not a problem with your own communication of state. So why consider abuse of 4xx to be a problem with the communication protocol?
This would reflect an incorrect design on the part of the external system.
For example:
PUT /queue/_hyn3
=> {"name": "_hyn3"}
GET /queue
<= {"name": "_hyn3"}
... processing ...
GET /queue/_hyn3
404
404 is not a success condition; it's also not necessarily a permanent error.Queues might be "reliable", but the consumers should never be assumed to be, and so it's good to have consumers provide a "complete" state update somewhere, and ideally, if the queue is able, for the queue to restore the incomplete item if the consumer fails to complete it in a specific (lengthy) period of time, because the consumer itself might have ceased to exist or failed for some other reason.
If you need to ensure that each message is consumed once and only once, you need to ensure that your queue also has something like a "completed state":
PUT /queue/_hyn3
=> {"name": "_hyn3"}
GET /queue
<= {"name": "_hyn3"}
... processing ...
PUT /status/_hyn3
{"name": "_hyn3", "status": "completed"}
GET /queue/_hyn3
404
GET /status/_hyn3
{"status": "completed"}
Obviously, there's an infinite number of ways to handle the semantics here, and certainly REST is not constrained in any way to just JSON, and perhaps you would prefer to put completed in the URL, but the point is that the architecture needs to support such a use case. TL;DR: don't rely on 404 as a permanent error, but it's absolutely appropriate for a document/content/file not found, even if the content will be found later or was found earlier.Client certificates are very common for API authentication (well-known examples: Kubernetes, Puppet, Saltstack, service meshes like Envoy and Consul...)
TLS client certificates are strictly better than passwords because they don't provide an impersonator with a wildcard (and if you are running over the internet, especially with mobile devices, then you can get into that situation w/o being subject of a targeted attack). There are fairly few ways to achieve that other than client certs (SRP and SAE come to mind, both of which have virtually no deployment).
this self signed certificate now has to sign the client certificate(s). Otherwise, the clients aren't allowed to address the master.
At least thats how i've come across it. Its actually pretty common in the infrastructure world. Your OPS team can probably tell you which services utilize it in your software stack, though you as a developer probably never had to worry about it.
Though a lot of services only use a singular client certificate across all nodes and just revoke the hole chain for rotations
* remote docker daemon execution
* setting up a kubernetes cluster with kubeadm and creating certificates for remote kubectl execution (this one might be related to the previous one. I'm not sure as i don't know anything about the kubernetes internals.)
* rabbitmq cluster iirc. At least thats how you're supposed to set it up with the sensu monitoring framework
* previously mentioned puppet does its as well, though the process is mostly invisible to the user
i'm not sure how its supposedly possible to spoof though?
the master needs to sign a certificate for clients. IF the master is compromised, everything is compromised. Thats true no matter which authorization protocol you're using
The kubernete's document says:
For an identity provider to work with Kubernetes it must:
1. Support OpenID connect discovery; not all do.
2. Run in TLS with non-obsolete ciphers
3. Have a CA signed certificate (even if the CA is not a commercial CA or is self signed)
I interpret it as saying you should perferrably use a real CA or a well-behaved internal intermediate CA. Anybody remotely familiar with how TLS works will probably tell you the same. If what you are saying is correct, it's a serious problem in our industry.You only need a 'real' CA if your service is public facing.
Heck,even a Windows AD server uses self signed certs
/Edit: after re-reading your comments I get the feeling that were really talking about different things. The self signed certificate becomes the base for your chain of trust. Everything signed by this is allowed to talk to the master. This verification happens on both sides. A client getting an unexpected certificate will refuse to talk to the master just as the master won't talk with a node, unless it's got a signed client cert.
Because the master cert is self signed, it's easier to just throw everything away and recreate the hole chain of trust instead of bothering with revocations.
Finally, there is no benefit in using an official CA if you are in control of everything accessing the resources.
Am I making sense now?
The master (this is the self signed part) cert becomes part of the client certs by signing.
These client certs are now only valid with the original self signed cert.
It's essentially a CA, only for the client certificates. It just isn't formalized because it's never imported. you'd also lose the ability to rotate the certs quickly without gaining any security by importing this self signed certificate as a CA.
I'm always surprised by the resistance to client certs and all the gleeful usage of pre shared keys I find. OWASP top ten bad ideas for as long as I've been writing software.
Because HTTP error codes are fixed and have well-defined meanings for HTTP that may not map well to your application. Repurposing HTTP error codes conflates your application-specific errors unless it maps to an exact subset of one of the predefined errors.
> Why create your own authentication mechanism when you can use HTTP authentication over TLS (or client certificates, or etc.)?
Do you have a client cert? I've never encountered any server that supports client certs in my entire 15-year career. Also, TLS is not a part of HTTP and HTTP only supported Basic Auth until fairly recently.