Closed luispabon closed 4 years ago
I tried this with next
branch, and could not reproduce. So looks like a bug in 1.5.x
?
This also happens with 2.0.x
by the way, although I didn't think anything of it being a new major version and bc breaks are expected.
@luispabon, sure it was not what we planned to do. Thus it is a bug.
@luispabon,
So is this issue about the fact that:
domain
is repeated on both snis
and in uri
? You can also use uuid
in uri if you want. Also if you remove the repeated domain
from snis
does it work, and still adds both snis
? I didn't see the error in your first post with 2.0.2
:
$ http PUT :8001/certificates/domain.com cert=@spec/fixtures/kong_spec.crt key=@spec/fixtures/kong_spec.key snis:='["domain2.com","domain3.com"]' -v
PUT /certificates/domain.com HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 2029
Content-Type: application/json
Host: localhost:8001
User-Agent: HTTPie/2.0.0
{
"cert": "-----BEGIN CERTIFICATE-----\nMIICwTCCAiqgAwIBAgIJAOloHn/ZJQw8MA0GCSqGSIb3DQEBCwUAMHgxCzAJBgNV\nBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNp\nc2NvMRIwEAYDVQQKDAlLb25nIFNwZWMxFDASBgNVBAsMC0VuZ2luZWVyaW5nMRIw\nEAYDVQQDDAlsb2NhbGhvc3QwHhcNMTgwOTI2MTQ0MTE2WhcNMzgwOTIxMTQ0MTE2\nWjB4MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwN\nU2FuIEZyYW5jaXNjbzESMBAGA1UECgwJS29uZyBTcGVjMRQwEgYDVQQLDAtFbmdp\nbmVlcmluZzESMBAGA1UEAwwJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GN\nADCBiQKBgQC/QqEXsZFIY/hHqtMro+hkhHwbydvPHGhe/rqiOHXUVGnjJ9bBgrk6\niLFnu7L0OxsMPdckxjCLFYO2nGERlAN1wXxw0cLLUF0v1sOhJT+57pBfTgmfzLvp\niLLOWMhayRcjZ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VfR19ZLAK1KmmmZ37gmCAb1eQhAkEAvQM+uHj+f3KZ8pYBHphrvK6HSlIvUtHp\nEk23XY2N56jt2Yf92M/L5qvEQDGSIsZRlgsNKxyY0YALFDWjqYF6cQJAfDJi8Uya\njc9UZeMLtQi3eLugwB/Qx6p1xhjj358Hhprg7rFtqbZNA0IHJYuTx6W+2CXT2GpW\nt842/FWkibh8xg==\n-----END PRIVATE KEY-----\n",
"snis": [
"domain2.com",
"domain3.com"
]
}
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 2134
Content-Type: application/json; charset=utf-8
Date: Tue, 10 Mar 2020 18:03:27 GMT
Server: kong/2.0.2
X-Kong-Admin-Latency: 12
{
"cert": "-----BEGIN CERTIFICATE-----\nMIICwTCCAiqgAwIBAgIJAOloHn/ZJQw8MA0GCSqGSIb3DQEBCwUAMHgxCzAJBgNV\nBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNp\nc2NvMRIwEAYDVQQKDAlLb25nIFNwZWMxFDASBgNVBAsMC0VuZ2luZWVyaW5nMRIw\nEAYDVQQDDAlsb2NhbGhvc3QwHhcNMTgwOTI2MTQ0MTE2WhcNMzgwOTIxMTQ0MTE2\nWjB4MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwN\nU2FuIEZyYW5jaXNjbzESMBAGA1UECgwJS29uZyBTcGVjMRQwEgYDVQQLDAtFbmdp\nbmVlcmluZzESMBAGA1UEAwwJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GN\nADCBiQKBgQC/QqEXsZFIY/hHqtMro+hkhHwbydvPHGhe/rqiOHXUVGnjJ9bBgrk6\niLFnu7L0OxsMPdckxjCLFYO2nGERlAN1wXxw0cLLUF0v1sOhJT+57pBfTgmfzLvp\niLLOWMhayRcjZWJdHGcKUG3xh6o8MghdZIVoewlyqzViRXvR3U1VY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z1ud\nu7VfR19ZLAK1KmmmZ37gmCAb1eQhAkEAvQM+uHj+f3KZ8pYBHphrvK6HSlIvUtHp\nEk23XY2N56jt2Yf92M/L5qvEQDGSIsZRlgsNKxyY0YALFDWjqYF6cQJAfDJi8Uya\njc9UZeMLtQi3eLugwB/Qx6p1xhjj358Hhprg7rFtqbZNA0IHJYuTx6W+2CXT2GpW\nt842/FWkibh8xg==\n-----END PRIVATE KEY-----\n",
"snis": [
"domain.com",
"domain2.com",
"domain3.com"
],
"tags": null
}
Using PUT it created it just fine with SNIs
(one from url and others from snis).
If I have same domain in both url and SNIs
it gives me this:
$ http PUT :8001/certificates/domain.com cert=@spec/fixtures/kong_spec.crt key=@spec/fixtures/kong_spec.key snis:='["domain.com","domain3.com"]' -v
PUT /certificates/domain.com HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 2028
Content-Type: application/json
Host: localhost:8001
User-Agent: HTTPie/2.0.0
{
"cert": "-----BEGIN CERTIFICATE-----\nMIICwTCCAiqgAwIBAgIJAOloHn/ZJQw8MA0GCSqGSIb3DQEBCwUAMHgxCzAJBgNV\nBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNp\nc2NvMRIwEAYDVQQKDAlLb25nIFNwZWMxFDASBgNVBAsMC0VuZ2luZWVyaW5nMRIw\nEAYDVQQDDAlsb2NhbGhvc3QwHhcNMTgwOTI2MTQ0MTE2WhcNMzgwOTIxMTQ0MTE2\nWjB4MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwN\nU2FuIEZyYW5jaXNjbzESMBAGA1UECgwJS29uZyBTcGVjMRQwEgYDVQQLDAtFbmdp\nbmVlcmluZzESMBAGA1UEAwwJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GN\nADCBiQKBgQC/QqEXsZFIY/hHqtMro+hkhHwbydvPHGhe/r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imdb+/5t+alM7UbdcMRbWgKO8j3h0FoX\nUnInAkBUid0wFIynpUfaXY3lT1NS46qMuy5MUqzcO3O10NhBVYRa7QChK+vVz1ud\nu7VfR19ZLAK1KmmmZ37gmCAb1eQhAkEAvQM+uHj+f3KZ8pYBHphrvK6HSlIvUtHp\nEk23XY2N56jt2Yf92M/L5qvEQDGSIsZRlgsNKxyY0YALFDWjqYF6cQJAfDJi8Uya\njc9UZeMLtQi3eLugwB/Qx6p1xhjj358Hhprg7rFtqbZNA0IHJYuTx6W+2CXT2GpW\nt842/FWkibh8xg==\n-----END PRIVATE KEY-----\n",
"snis": [
"domain.com",
"domain3.com"
]
}
HTTP/1.1 400 Bad Request
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 143
Content-Type: application/json; charset=utf-8
Date: Tue, 10 Mar 2020 18:05:00 GMT
Server: kong/2.0.2
X-Kong-Admin-Latency: 1
{
"code": 2,
"fields": {
"snis": "domain.com is duplicated"
},
"message": "schema violation (snis: domain.com is duplicated)",
"name": "schema violation"
}
Which still feels quite ok. But how did you get the error you got? Can you provide a full example.
The problem is, that with previous versions of kong it was possible to use one of the names in snis
also as the name in the path, while at least with 2.x (and as @luispabon said, with 1.5) the 400 Bad Request
occurs.
While it might be quite ok to give an error in this case (though this might be discussable), it means a breaking change between 1.4 and 1.5 versions.
@jschirrmacher, I agree, but I am also confused that is the error is duplicated
OR already associated
. I can get that is duplicated
, but I am not 100% I can get the already associated
.
I will make a fix so that snis
can duplicate the sni
in url.
@jschirrmacher & @luispabon,
There is now a fix to this duplicated error, though the original error on this issue is still puzzling me. Perhaps there is another bug somewhere. If you can provide me a way to reproduce, that would be great. Please checkout the https://github.com/Kong/kong/pull/5660.
@jschirrmacher / @luispabon, we merged the #5660 which fixed one issue that I found. I reopened this issue as it did not fix the original error that was reported: https://github.com/Kong/kong/issues/5652#issue-577993076
I can still try to reproduce it but so far I couldn't.
As this is rather hard to reproduce, and no further information has been given, I'll close it. @jschirrmacher / @luispabon, please reopen if you still feel it is an issue, even after applying the #5660.
Apologies for the lack of feedback. #5660 fixed the issue for me.
Summary
On kong >= 1.0 <= 1.5 it was possible to PUT to /certificates in order to create or update certificates while specifying a list of SNIs.
On Kong 1.5 however, the same request would return a 400 error due to an sni already associated with a certificate.
This is in line with Kong's documentation for the endpoint in particular: https://docs.konghq.com/1.5.x/admin-api/#update-certificate-1
Steps To Reproduce
PUT /certificates/domain
with{ "cert": "certpayload", "key": "keypayload", "snis": ["domain", "domain2", ...]}
schema violation (snis: domain already associated with existing certificate
Additional Details & Logs
kong:1.5
container image)$ kong start --vv
): n/a<KONG_PREFIX>/logs/error.log
): n/a