Inserting Root Certificate into Database Fails Due to Missing AKI
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with insert.go and reproduce the /api/v1/cfssl/certadd request using the supplied certificate and payload. Check how certificates without an authority key identifier are validated and how MySQL insertion is handled. The issue is resolved when the intended behavior for root certificates without AKI is defined, implemented, and covered by tests.
Written by the indexing model from the issue text.
Description
Description:
I am trying to store root certificate information in a MySQL database using the api/v1/cfssl/certadd API. However, I encounter an error due to the missing authority_key_identifier (AKI) in the root certificate.
I want to insert a root certificate into a MySQL database using either the cfssl HTTP API or the cfssl binary tool.
Steps to Reproduce:
Use the following API request to insert the root certificate:
root@3740aa34a622:/etc/cfssl# cat ./certs/ca.pem
-----BEGIN CERTIFICATE-----
MIID6DCCAtCgAwIBAgIUDSiWMRW9BdZNzmuNO35gl8QuqOwwDQYJKoZIhvcNAQEL
BQAwgYsxCzAJBgNVBAYTAktSMRQwEgYDVQQIEwtHeWVvbmdnaS1kbzESMBAGA1UE
BxMJQW55YW5nLXNpMRYwFAYDVQQKEw1HRU5JQU5TLCBJTkMuMSIwIAYDVQQLExlU
ZWNobmljYWwgUmVzZWFyY2ggQ2VudGVyMRYwFAYDVQQDEw0xOTIuMTY4LjM1LjYw
MB4XDTI0MDYyNzEwNDMwMFoXDTI5MDYyNjEwNDMwMFowgYsxCzAJBgNVBAYTAktS
MRQwEgYDVQQIEwtHeWVvbmdnaS1kbzESMBAGA1UEBxMJQW55YW5nLXNpMRYwFAYD
VQQKEw1HRU5JQU5TLCBJTkMuMSIwIAYDVQQLExlUZWNobmljYWwgUmVzZWFyY2gg
Q2VudGVyMRYwFAYDVQQDEw0xOTIuMTY4LjM1LjYwMIIBIjANBgkqhkiG9w0BAQEF
AAOCAQ8AMIIBCgKCAQEA2bVcpuWARNAI9mKdXyvVOOuBw+YSb87VgkYMt4UcDQky
59dtLoOjrXuIR2jh6zQIIlfpq5Yr4JINs42TW0hXEcOjnu/nUrinhYmHIybhehZQ
sphAR+1zubAba4fdyYcmA6kx7Q+Hcdg3JpEl8iofayblU7L5bmxN8yzCB/X+AZbk
e1zl0Z1nZUu/luMZeHPpyNjq8O3/PseAf84OhkglTKGAq82vOCCPYY6cRHGGwLxj
WApVCHKhiTqpH4PVxKccUDpYdV10jTVvcPBejuCNPKHE9C7MGrLrs6IjzWISQGBX
UynInksm48Zj5vcI/fFWeQ99GHtz1VJp/GHdOgRsFQIDAQABo0IwQDAOBgNVHQ8B
Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU8/CAnSjrFHJUXNNt
BOPaDmV3/TYwDQYJKoZIhvcNAQELBQADggEBAFdjg9j2n4RZnjaQAmfJpVl5J5fi
/CdGeqm4yCli6dCxgdqAPSrN+duW06UAsY6BvcJSwzAm6Wrt2KEjYjjWH71ZcGVd
sCAgp//8bCrsaGId1/UgHfcGrNnK79IQgmh5/RZUqAEpwZge6kvZ1uzzL6sSdjNU
g9comNH5jaqSisT54XNmnPDA11IDJRTuKizezT6ge6q+Jcxib9D/Qa8gyZSP1k6F
RZyRIlm0ERki7wEu3LMKUgXZ0bI1lHjLmeBv+uPQfRXJeGGlS7Bo7Hu7kYhajP9D
JRpQr3vv8ca3Q0neELalF9Ebj72eN4LJj5P06uai1s0fsOThtzks0k5PjZA=
-----END CERTIFICATE-----
root@3740aa34a622:/etc/cfssl#
root@3740aa34a622:/etc/cfssl# curl -X POST http://192.168.35.60:8889/api/v1/cfssl/certadd -H 'Content-Type: application/json' -d '{
"authority_key_identifier": "F3F0809D28EB1472545CD36D04E3DA0E6577FD36",
"expiry": "2029-06-26T10:43:00Z",
"pem": "-----BEGIN CERTIFICATE-----\nMIID6DCCAtCgAwIBAgIUDSiWMRW9BdZNzmuNO35gl8QuqOwwDQYJKoZIhvcNAQEL\nBQAwgYsxCzAJBgNVBAYTAktSMRQwEgYDVQQIEwtHeWVvbmdnaS1kbzESMBAGA1U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jaqSisT54XNmnPDA11IDJRTuKizezT6ge6q+Jcxib9D/Qa8gyZSP1k6F\nRZyRIlm0ERki7wEu3LMKUgXZ0bI1lHjLmeBv+uPQfRXJeGGlS7Bo7Hu7kYhajP9D\nJRpQr3vv8ca3Q0neELalF9Ebj72eN4LJj5P06uai1s0fsOThtzks0k5PjZA=\n-----END CERTIFICATE-----",
"serial_number": "75121993374272132312375006869829137882009217260",
"status": "good",
"common_name": "192.168.35.60"
}'
The following error occurs:
{"success":false,"result":null,"errors":[{"code":400,"message":"Authority key identifier of request and certificate do not match"}],"messages":[]}
Reason:
This error occurs because the root certificate does not have an AKI value. I attempted to use the SKI value instead of the AKI, but the same error occurs due to the following code in insert.go:
if !bytes.Equal(aki, cert.AuthorityKeyId) {
return errors.NewBadRequestString("Authority key identifier of request and certificate do not match")
}
- Dominant language
- Go
- Stars
- 9.5k
- Forks
- 1.2k
- Avg merge
- 12h 48m
- Merged PRs (30d)
- 2
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudflare/cfssl
-
gencrl: serial numbers that fail to parse are added to the CRL as 0 or a partial valuePossibly taken @sebxt claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudflare/cfssl#1460 ·
Maintainers usually reply within 2 days
-
`Bundler.BundleFromRemote` fails for IPv6 address literalsPossibly taken @reginaldalfret claimed this 13 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
cloudflare/cfssl#1448 ·
Maintainers usually reply within 2 days
-
crl_override (and extensions) in /api/v1/sign request body are silently ignored by the HTTP APIPossibly taken @Hashim1999164 claimed this 69 days ago. Open
Difficulty 2/5 Half a day Newbie friendliness 78/100
cloudflare/cfssl#1439 ·
Maintainers usually reply within 2 days
-
gencrl silently revokes the wrong serial number when a line is not plain decimalPossibly taken @RaphaelFakhri claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 30/100
cloudflare/cfssl#1458 ·
Maintainers usually reply within 2 days
-
config: LoadConfig panics when not_after is before not_beforePossibly taken @sebxt claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
cloudflare/cfssl#1456 ·
Maintainers usually reply within 2 days
All issues in cloudflare/cfssl
Similar issues
-
[Bug]: Deleting an MCP proxy leaves its API keys in the gateway's memory and in the policy engineOpenAspect/API Aspect/Other Severity/Minor Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
wso2/api-platform#3852 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Rafaeldelinares/gentle-mesh#125 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Gentleman-Programming/gentle-ai#5643 ·
Maintainers usually reply within 1 day
-
security
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
FootprintAI/Containarium#2869 ·
Maintainers usually reply within 1 day
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kubevirt/kubevirt#19559 · 1 reaction ·
Maintainers usually reply within 1 day