mTLS on bmcweb
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
I encountered the same issue when using Redfish to replace the certificate.
Regardless of whether the parameters include --cert --key --cacert or only --cacert, the authentication can still succeed.
Best,
P.K.
Quoted 29 lines
Date: Wed, 22 Apr 2020 14:58:06 -0700
From: Zhenfei Tai <[email protected]>
To: [email protected]
Subject: mTLS on bmcweb
Message-ID:<[email protected]mail.com>
Content-Type: text/plain; charset="utf-8"Hi,
I'm trying out bmcweb mTLS which should be enabled by default by
https://github.com/openbmc/bmcweb/blob/master/CMakeLists.txt#L89In my test, I created a self signed key and certificate pair, stacked them up into server.pem in
/etc/ssl/certs/httpsthat bmcweb uses.However when I tried to curl bmcweb service, I was able to get response by only supplying the cert.
curl --cacert cert.pem https://${bmc}/redfish/v1
With the mTLS enabled, I expected it should error out since no client certificate is provided.
Could someone with relevant knowledge help with my question?
Thanks,
Zhenfei
Quoted 34 lines · P. K. Lee (李柏寬)
Hi,
I encountered the same issue when using Redfish to replace the certificate.
Regardless of whether the parameters include --cert --key --cacert or only --cacert, the authentication can still succeed.Best,
P.K.Quoted 26 lines
Date: Wed, 22 Apr 2020 14:58:06 -0700
From: Zhenfei Tai <[email protected]>
To: [email protected]
Subject: mTLS on bmcweb
Message-ID:<[email protected]mail.com>
Content-Type: text/plain; charset="utf-8"Hi,
I'm trying out bmcweb mTLS which should be enabled by default by
https://github.com/openbmc/bmcweb/blob/master/CMakeLists.txt#L89In my test, I created a self signed key and certificate pair, stacked them up into server.pem in
/etc/ssl/certs/httpsthat bmcweb uses.However when I tried to curl bmcweb service, I was able to get response by only supplying the cert.
curl --cacert cert.pem https://${bmc}/redfish/v1
With the mTLS enabled, I expected it should error out since no client certificate is provided.
Could someone with relevant knowledge help with my question?
I'm not sure what you are asking. Are you asking how to install mTLS certs into the BMC and then use them to connect? I am still waiting for documentation that describes how to configure and use the mTLS feature.
I've added an entry to the security working group as a reminder to do this. (I don't have the skill to document this feature.)
- Joseph
Quoted 3 lines
Quoted 3 lines
Thanks,
Zhenfei
I guess part of my question is how to configure the mTLS certs to make it work properly.
So far only https works (server side TLS).
Thanks,
Zhenfei
Quoted 54 lines · Joseph Reynolds
Quoted 3 lines · P. K. Lee (李柏寬)
Hi,
I encountered the same issue when using Redfish to replace the
certificate.
Quoted 1 line
Regardless of whether the parameters include --cert --key --cacert or
only --cacert, the authentication can still succeed.
Quoted 19 lines
Best,
P.K.Quoted 15 lines
Date: Wed, 22 Apr 2020 14:58:06 -0700
From: Zhenfei Tai <[email protected]>
To: [email protected]
Subject: mTLS on bmcweb
Message-ID:<[email protected]mail.com>
Content-Type: text/plain; charset="utf-8"Hi,
I'm trying out bmcweb mTLS which should be enabled by default by
https://github.com/openbmc/bmcweb/blob/master/CMakeLists.txt#L89In my test, I created a self signed key and certificate pair, stacked
them
Quoted 3 lines
Quoted 3 lines
up into server.pem in
/etc/ssl/certs/httpsthat bmcweb uses.However when I tried to curl bmcweb service, I was able to get response
by
Quoted 8 lines
Quoted 8 lines
only supplying the cert.
curl --cacert cert.pem https://${bmc}/redfish/v1
With the mTLS enabled, I expected it should error out since no client certificate is provided.
Could someone with relevant knowledge help with my question?
I'm not sure what you are asking. Are you asking how to install mTLS certs into the BMC and then use them to connect? I am still waiting for documentation that describes how to configure and use the mTLS feature.
I've added an entry to the security working group as a reminder to do this. (I don't have the skill to document this feature.)
- Joseph
Quoted 3 lines
Quoted 3 lines
Thanks,
Zhenfei
My guess is that somehow the root cert used to validate clients isn't installed correctly, and so it's defaulting to basic auth.
At least that's my reading of this review
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/27270
Quoted 65 lines · Zhenfei Tai
I guess part of my question is how to configure the mTLS certs to make it work properly.
So far only https works (server side TLS).
Thanks,
ZhenfeiQuoted 54 lines · Joseph Reynolds
Quoted 3 lines · P. K. Lee (李柏寬)
Hi,
I encountered the same issue when using Redfish to replace the
certificate.
Quoted 1 line
Regardless of whether the parameters include --cert --key --cacert or
only --cacert, the authentication can still succeed.
Quoted 19 lines
Best,
P.K.Quoted 15 lines
Date: Wed, 22 Apr 2020 14:58:06 -0700
From: Zhenfei Tai <[email protected]>
To: [email protected]
Subject: mTLS on bmcweb
Message-ID:<[email protected]mail.com>
Content-Type: text/plain; charset="utf-8"Hi,
I'm trying out bmcweb mTLS which should be enabled by default by
https://github.com/openbmc/bmcweb/blob/master/CMakeLists.txt#L89In my test, I created a self signed key and certificate pair, stacked
them
Quoted 3 lines
Quoted 3 lines
up into server.pem in
/etc/ssl/certs/httpsthat bmcweb uses.However when I tried to curl bmcweb service, I was able to get
response by
Quoted 8 lines
Quoted 8 lines
only supplying the cert.
curl --cacert cert.pem https://${bmc}/redfish/v1
With the mTLS enabled, I expected it should error out since no client certificate is provided.
Could someone with relevant knowledge help with my question?
I'm not sure what you are asking. Are you asking how to install mTLS certs into the BMC and then use them to connect? I am still waiting for documentation that describes how to configure and use the mTLS feature.
I've added an entry to the security working group as a reminder to do this. (I don't have the skill to document this feature.)
- Joseph
Quoted 3 lines
Quoted 3 lines
Thanks,
Zhenfei
Quoted 4 lines · Richard Hanley
My guess is that somehow the root cert used to validate clients isn't installed correctly, and so it's defaulting to basic auth.
At least that's my reading of this review https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/27270
I think this would be the case. If the client certificate is not provided, TLS connection is still established, just without authenticating the client. This allows upper layer to provide other authentication methods (e.g. Basic Auth).
Quoted 38 lines · On Thu, Apr 23, 2020 at 9:47 AM Zhenfei Tai <[email protected]…
I guess part of my question is how to configure the mTLS certs to make it work properly.
So far only https works (server side TLS).
Thanks,
Zhenfei
On Thu, Apr 23, 2020 at 8:50 AM Joseph Reynolds <[email protected] <mailto:[email protected]>> wrote:
On 4/23/20 5:47 AM, P. K. Lee (李柏寬) wrote:
> Hi,
>
> I encountered the same issue when using Redfish to replace the certificate.
> Regardless of whether the parameters include --cert --key --cacert or only --cacert, the authentication can still succeed.
>
> Best,
> P.K.
>
>> Date: Wed, 22 Apr 2020 14:58:06 -0700
>> From: Zhenfei Tai <[email protected] <mailto:[email protected]>>
>> To: [email protected] <mailto:[email protected]>
>> Subject: mTLS on bmcweb
>> Message-ID:
>> <[email protected]
>> mail.com <http://mail.com>>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Hi,
>>
>> I'm trying out bmcweb mTLS which should be enabled by default by
>> https://github.com/openbmc/bmcweb/blob/master/CMakeLists.txt#L89
>>
>> In my test, I created a self signed key and certificate pair, stacked them
>> up into server.pem in /etc/ssl/certs/https that bmcweb uses.
>>Quoted 8 lines
>> However when I tried to curl bmcweb service, I was able to get response by
>> only supplying the cert.
>>
>> curl --cacert cert.pem https://${bmc}/redfish/v1
>>
>> With the mTLS enabled, I expected it should error out since no client
>> certificate is provided.
>>As mentioned, if you did not provide a client certificate, connection was established to allow for Basic Auth. And as the Service Root requires no authentication, you got a response.
- Wiktor
Quoted 15 lines
>> Could someone with relevant knowledge help with my question?
I'm not sure what you are asking. Are you asking how to install mTLS certs into the BMC and then use them to connect? I am still waiting for documentation that describes how to configure and use the mTLS feature.
I've added an entry to the security working group as a reminder to do this. (I don't have the skill to document this feature.)
- Joseph
>>
>> Thanks,
>> Zhenfei
I found a way to fix this issue, but it needs to be modified to the source code. In two steps:
Step 1.
The source code "adaptor.set_verify_mode(boost::asio::ssl::verify_peer);" in http_connection.h is replaced with "adaptor.set_verify_mode(boost::asio::ssl::verify_peer | boost::asio::ssl::verify_fail_if_no_peer_cert);"
Step 2.AccountService->Oem->OpenBMC->AuthMethods->TLS is set. (false by default)
It will enable enforce mTLS authentication.
Best,
P.K.
Quoted 109 lines
-----Original Message-----
From: Wiktor Gołgowski <[email protected]>
Sent: Saturday, April 25, 2020 1:03 AM
To: Richard Hanley <[email protected]>; Zhenfei Tai <[email protected]>
Cc: [email protected]; P. K. Lee (李柏寬) <[email protected]>; [email protected]; P. K. Lee (李柏寬) <[email protected]>; Joseph Reynolds <[email protected]>
Subject: Re: mTLS on bmcwebQuoted 1 line · Richard Hanley
My guess is that somehow the root cert used to validate clients isn't installed
correctly, and so it's defaulting to basic auth.
Quoted 4 lines
At least that's my reading of this review
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/27270I think this would be the case. If the client certificate is not provided, TLS connection is still established, just without authenticating the client. This allows upper layer to provide other authentication methods (e.g. Basic Auth).
Quoted 2 lines
On Thu, Apr 23, 2020 at 9:47 AM Zhenfei Tai <[email protected]
Quoted 2 lines · <mailto:[email protected]>> wrote:
I guess part of my question is how to configure the mTLS certs to make
it work properly.
Quoted 7 lines
So far only https works (server side TLS).
Thanks,
ZhenfeiOn Thu, Apr 23, 2020 at 8:50 AM Joseph Reynolds <[email protected]
Quoted 5 lines · <mailto:[email protected]>> wrote:
On 4/23/20 5:47 AM, P. K. Lee (李柏寬) wrote: > Hi, > > I encountered the same issue when using Redfish to replace thecertificate.
Quoted 1 line
> Regardless of whether the parameters include --cert --key
--cacert or only --cacert, the authentication can still succeed.
Quoted 6 lines
> > Best, > P.K. > >> Date: Wed, 22 Apr 2020 14:58:06 -0700 >> From: Zhenfei Tai <[email protected]<mailto:[email protected]>>
Quoted 1 line
>> To: [email protected]
<mailto:[email protected]>
Quoted 4 lines
>> Subject: mTLS on bmcweb
>> Message-ID:Quoted 1 line
<CAMXw96Pp511sUO=q1XLz2uJzh4S6D7tUwmkvpbnq_yU-iJfiKg@
mail.g
Quoted 6 lines
>> mail.com <http://mail.com>> >> Content-Type: text/plain; charset="utf-8" >> >> Hi, >> >> I'm trying out bmcweb mTLS which should be enabled bydefault by
Quoted 1 line
>>https://github.com/openbmc/bmcweb/blob/master/CMakeLists.txt#L89
Quoted 2 lines
>>
>> In my test, I created a self signed key and certificate pair,stacked them
Quoted 3 lines
>> up into server.pem in
/etc/ssl/certs/httpsthat bmcweb uses. >>
>> However when I tried to curl bmcweb service, I was able to getresponse by
Quoted 5 lines
>> only supplying the cert. >> >> curl --cacert cert.pem https://${bmc}/redfish/v1 >> >> With the mTLS enabled, I expected it should error out since noclient
Quoted 2 lines
>> certificate is provided.
>>As mentioned, if you did not provide a client certificate, connection was established to allow for Basic Auth. And as the Service Root requires no authentication, you got a response.
- Wiktor
Quoted 1 line
>> Could someone with relevant knowledge help with my
question?
Quoted 2 lines
I'm not sure what you are asking. Are you asking how to install
mTLS
Quoted 1 line
certs into the BMC and then use them to connect? I am still
waiting for
Quoted 1 line
documentation that describes how to configure and use the mTLS
feature.
Quoted 2 lines
I've added an entry to the security working group as a reminder to
do
Quoted 8 lines
this. (I don't have the skill to document this feature.)
- Joseph
>>
>> Thanks,
>> Zhenfei
Hi P.K.
I tried the same thing.
Could you share which url you tested?
With that change, if I access the https://${bmc}/redfish/v1 url in chrome, it prompts to choose a client certificate, but will also work if no certificate is chosen.
Thanks,
Zhenfei
Quoted 139 lines · P. K. Lee (李柏寬)
I found a way to fix this issue, but it needs to be modified to the source code. In two steps:
Step 1.
The source code "adaptor.set_verify_mode(boost::asio::ssl::verify_peer);" inhttp_connection.his replaced with "adaptor.set_verify_mode(boost::asio::ssl::verify_peer | boost::asio::ssl::verify_fail_if_no_peer_cert);"Step 2.
AccountService->Oem->OpenBMC->AuthMethods->TLSis set. (false by default)It will enable enforce mTLS authentication.
Best,
P.K.Quoted 11 lines
-----Original Message-----
From: Wiktor Gołgowski <[email protected]>
Sent: Saturday, April 25, 2020 1:03 AM
To: Richard Hanley <[email protected]>; Zhenfei Tai <[email protected]>
Cc: [email protected]; P. K. Lee (李柏寬) <[email protected]>; [email protected]; P. K. Lee (李柏寬) <[email protected]>; Joseph Reynolds <[email protected]>
Subject: Re: mTLS on bmcwebQuoted 2 lines
Quoted 1 line · Richard Hanley
My guess is that somehow the root cert used to validate clients isn't
installed
Quoted 7 lines
correctly, and so it's defaulting to basic auth.
Quoted 4 lines
At least that's my reading of this review
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/27270I think this would be the case. If the client certificate is not
provided, TLS
Quoted 1 line
connection is still established, just without authenticating the client.
This
Quoted 1 line
allows upper layer to provide other authentication methods (e.g. Basic
Auth).
Quoted 5 lines
Quoted 2 lines
On Thu, Apr 23, 2020 at 9:47 AM Zhenfei Tai <[email protected]
Quoted 2 lines · <mailto:[email protected]>> wrote:
I guess part of my question is how to configure the mTLS certs to
make
Quoted 8 lines
it work properly.
Quoted 7 lines
So far only https works (server side TLS).
Thanks,
ZhenfeiOn Thu, Apr 23, 2020 at 8:50 AM Joseph Reynolds <
Quoted 6 lines
Quoted 5 lines · <mailto:[email protected]>> wrote:
On 4/23/20 5:47 AM, P. K. Lee (李柏寬) wrote: > Hi, > > I encountered the same issue when using Redfish to replacethe
Quoted 23 lines
certificate.
Quoted 1 line
> Regardless of whether the parameters include --cert --key
--cacert or only --cacert, the authentication can still succeed.
Quoted 6 lines
> > Best, > P.K. > >> Date: Wed, 22 Apr 2020 14:58:06 -0700 >> From: Zhenfei Tai <[email protected]<mailto:[email protected]>>
Quoted 1 line
>> To: [email protected]
<mailto:[email protected]>
Quoted 4 lines
>> Subject: mTLS on bmcweb
>> Message-ID:Quoted 1 line
<CAMXw96Pp511sUO=q1XLz2uJzh4S6D7tUwmkvpbnq_yU-iJfiKg@mail.g
Quoted 6 lines
>> mail.com <http://mail.com>> >> Content-Type: text/plain; charset="utf-8" >> >> Hi, >> >> I'm trying out bmcweb mTLS which should be enabled byQuoted 5 lines
default by
Quoted 1 line
>>https://github.com/openbmc/bmcweb/blob/master/CMakeLists.txt#L89
Quoted 2 lines
>>
>> In my test, I created a self signed key and certificatepair,
Quoted 4 lines
stacked them
Quoted 3 lines
>> up into server.pem in
/etc/ssl/certs/httpsthat bmcweb uses. >>
>> However when I tried to curl bmcweb service, I was able toget
Quoted 6 lines
response by
Quoted 5 lines
>> only supplying the cert. >> >> curl --cacert cert.pem https://${bmc}/redfish/v1 >> >> With the mTLS enabled, I expected it should error out sinceno
Quoted 4 lines
client
Quoted 2 lines
>> certificate is provided.
>>Quoted 10 lines
As mentioned, if you did not provide a client certificate, connection was established to allow for Basic Auth. And as the Service Root requires no authentication, you got a response.
- Wiktor
Quoted 1 line
>> Could someone with relevant knowledge help with my
question?
Quoted 2 lines
I'm not sure what you are asking. Are you asking how to
install
Quoted 7 lines
mTLS
Quoted 1 line
certs into the BMC and then use them to connect? I am still
waiting for
Quoted 1 line
documentation that describes how to configure and use the mTLS
feature.
Quoted 2 lines
I've added an entry to the security working group as a
reminder to
Quoted 9 lines
do
Quoted 8 lines
this. (I don't have the skill to document this feature.)
- Joseph
>>
>> Thanks,
>> Zhenfei
Also, with that change in http_connection.h, it still accepts any client certificate provided in curl.
Here's what I did:
1. Disable BMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION
2. Uncommented ssl_key_handler.hpp:315 and added the boost::asio::ssl::verify_fail_if_no_peer_cert
Behavior after change:
1. Rejects curl without client certificate.
2. Returns when client certificate matches the one authority directory.
3. Rejects when client sends other certificates.
The change is just for testing purposes, I guess the original intention was not to mTLS every request.
Quoted 157 lines · Zhenfei Tai
Hi P.K.
I tried the same thing.
Could you share which url you tested?
With that change, if I access the https://${bmc}/redfish/v1 url in chrome, it prompts to choose a client certificate, but will also work if no certificate is chosen.Thanks,
ZhenfeiQuoted 141 lines · P. K. Lee (李柏寬)
I found a way to fix this issue, but it needs to be modified to the source code. In two steps:
Step 1.
The source code "adaptor.set_verify_mode(boost::asio::ssl::verify_peer);" inhttp_connection.his replaced with "adaptor.set_verify_mode(boost::asio::ssl::verify_peer | boost::asio::ssl::verify_fail_if_no_peer_cert);"Step 2.
AccountService->Oem->OpenBMC->AuthMethods->TLSis set. (false by default)It will enable enforce mTLS authentication.
Best,
P.K.Quoted 11 lines
-----Original Message-----
From: Wiktor Gołgowski <[email protected]>
Sent: Saturday, April 25, 2020 1:03 AM
To: Richard Hanley <[email protected]>; Zhenfei Tai <[email protected]>
Cc: [email protected]; P. K. Lee (李柏寬) <[email protected]>; [email protected]; P. K. Lee (李柏寬) <[email protected]>; Joseph Reynolds <[email protected]>
Subject: Re: mTLS on bmcwebQuoted 2 lines
Quoted 1 line · Richard Hanley
My guess is that somehow the root cert used to validate clients isn't
installed
Quoted 7 lines
correctly, and so it's defaulting to basic auth.
Quoted 4 lines
At least that's my reading of this review
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/27270I think this would be the case. If the client certificate is not
provided, TLS
Quoted 1 line
connection is still established, just without authenticating the
client. This
Quoted 1 line
allows upper layer to provide other authentication methods (e.g. Basic
Auth).
Quoted 5 lines
Quoted 2 lines
On Thu, Apr 23, 2020 at 9:47 AM Zhenfei Tai <[email protected]
Quoted 2 lines · <mailto:[email protected]>> wrote:
I guess part of my question is how to configure the mTLS certs to
make
Quoted 8 lines
it work properly.
Quoted 7 lines
So far only https works (server side TLS).
Thanks,
ZhenfeiOn Thu, Apr 23, 2020 at 8:50 AM Joseph Reynolds <
Quoted 6 lines
Quoted 5 lines · <mailto:[email protected]>> wrote:
On 4/23/20 5:47 AM, P. K. Lee (李柏寬) wrote: > Hi, > > I encountered the same issue when using Redfish to replacethe
Quoted 23 lines
certificate.
Quoted 1 line
> Regardless of whether the parameters include --cert --key
--cacert or only --cacert, the authentication can still succeed.
Quoted 6 lines
> > Best, > P.K. > >> Date: Wed, 22 Apr 2020 14:58:06 -0700 >> From: Zhenfei Tai <[email protected]<mailto:[email protected]>>
Quoted 1 line
>> To: [email protected]
<mailto:[email protected]>
Quoted 4 lines
>> Subject: mTLS on bmcweb
>> Message-ID:Quoted 1 line
<CAMXw96Pp511sUO=q1XLz2uJzh4S6D7tUwmkvpbnq_yU-iJfiKg@mail.g
Quoted 6 lines
>> mail.com <http://mail.com>> >> Content-Type: text/plain; charset="utf-8" >> >> Hi, >> >> I'm trying out bmcweb mTLS which should be enabled byQuoted 5 lines
default by
Quoted 1 line
>>https://github.com/openbmc/bmcweb/blob/master/CMakeLists.txt#L89
Quoted 2 lines
>>
>> In my test, I created a self signed key and certificatepair,
Quoted 2 lines
stacked them
Quoted 1 line
>> up into server.pem in
/etc/ssl/certs/httpsthat bmcwebuses.
Quoted 2 lines
Quoted 2 lines
>>
>> However when I tried to curl bmcweb service, I was able toget
Quoted 6 lines
response by
Quoted 5 lines
>> only supplying the cert. >> >> curl --cacert cert.pem https://${bmc}/redfish/v1 >> >> With the mTLS enabled, I expected it should error outsince no
Quoted 5 lines
client
Quoted 2 lines
>> certificate is provided.
>>As mentioned, if you did not provide a client certificate, connection
was
Quoted 9 lines
established to allow for Basic Auth. And as the Service Root requires no authentication, you got a response.
- Wiktor
Quoted 1 line
>> Could someone with relevant knowledge help with my
question?
Quoted 2 lines
I'm not sure what you are asking. Are you asking how to
install
Quoted 7 lines
mTLS
Quoted 1 line
certs into the BMC and then use them to connect? I am still
waiting for
Quoted 1 line
documentation that describes how to configure and use the mTLS
feature.
Quoted 2 lines
I've added an entry to the security working group as a
reminder to
Quoted 9 lines
do
Quoted 8 lines
this. (I don't have the skill to document this feature.)
- Joseph
>>
>> Thanks,
>> Zhenfei
I did more testing and found the reason why it accepts any client certification.
The error is due to the self signed certificate cannot be found in the list of trusted certificates.
Without the user defined verify callback function, it works as expected.
#define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
<https://docs.huihoo.com/doxygen/openssl/1.0.1c/crypto_2x509_2x509__vfy_8h.html#aa4f5a3309eae833f85dff37c36fa039d>
18
// Check if certificate is OK
int error = X509_STORE_CTX_get_error(cts);
if (error != X509_V_OK)
{
return true;
}
Quoted 178 lines · Zhenfei Tai
Also, with that change in
http_connection.h, it still accepts any client certificate provided in curl.Here's what I did:
1. DisableBMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION
2. Uncommented ssl_key_handler.hpp:315 and added theboost::asio::ssl::verify_fail_if_no_peer_certBehavior after change:
1. Rejects curl without client certificate.
2. Returns when client certificate matches the one authority directory.
3. Rejects when client sends other certificates.The change is just for testing purposes, I guess the original intention was not to mTLS every request.
Quoted 160 lines · Zhenfei Tai
Hi P.K.
I tried the same thing.
Could you share which url you tested?
With that change, if I access the https://${bmc}/redfish/v1 url in chrome, it prompts to choose a client certificate, but will also work if no certificate is chosen.Thanks,
ZhenfeiQuoted 144 lines · P. K. Lee (李柏寬)
I found a way to fix this issue, but it needs to be modified to the source code. In two steps:
Step 1.
The source code "adaptor.set_verify_mode(boost::asio::ssl::verify_peer);" inhttp_connection.his replaced with "adaptor.set_verify_mode(boost::asio::ssl::verify_peer | boost::asio::ssl::verify_fail_if_no_peer_cert);"Step 2.
AccountService->Oem->OpenBMC->AuthMethods->TLSis set. (false by default)It will enable enforce mTLS authentication.
Best,
P.K.Quoted 11 lines
-----Original Message-----
From: Wiktor Gołgowski <[email protected]>
Sent: Saturday, April 25, 2020 1:03 AM
To: Richard Hanley <[email protected]>; Zhenfei Tai <[email protected]>
Cc: [email protected]; P. K. Lee (李柏寬) <[email protected]>; [email protected]; P. K. Lee (李柏寬) <[email protected]>; Joseph Reynolds <[email protected]>
Subject: Re: mTLS on bmcwebQuoted 2 lines
Quoted 1 line · Richard Hanley
My guess is that somehow the root cert used to validate clients
isn't installed
Quoted 7 lines
correctly, and so it's defaulting to basic auth.
Quoted 4 lines
At least that's my reading of this review
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/27270I think this would be the case. If the client certificate is not
provided, TLS
Quoted 1 line
connection is still established, just without authenticating the
client. This
Quoted 1 line
allows upper layer to provide other authentication methods (e.g. Basic
Auth).
Quoted 5 lines
Quoted 2 lines
On Thu, Apr 23, 2020 at 9:47 AM Zhenfei Tai <[email protected]
Quoted 2 lines · <mailto:[email protected]>> wrote:
I guess part of my question is how to configure the mTLS certs
to make
Quoted 8 lines
it work properly.
Quoted 7 lines
So far only https works (server side TLS).
Thanks,
ZhenfeiOn Thu, Apr 23, 2020 at 8:50 AM Joseph Reynolds <
Quoted 6 lines
Quoted 5 lines · <mailto:[email protected]>> wrote:
On 4/23/20 5:47 AM, P. K. Lee (李柏寬) wrote: > Hi, > > I encountered the same issue when using Redfish to replacethe
Quoted 23 lines
certificate.
Quoted 1 line
> Regardless of whether the parameters include --cert --key
--cacert or only --cacert, the authentication can still succeed.
Quoted 6 lines
> > Best, > P.K. > >> Date: Wed, 22 Apr 2020 14:58:06 -0700 >> From: Zhenfei Tai <[email protected]<mailto:[email protected]>>
Quoted 1 line
>> To: [email protected]
<mailto:[email protected]>
Quoted 4 lines
>> Subject: mTLS on bmcweb
>> Message-ID:Quoted 1 line
<CAMXw96Pp511sUO=q1XLz2uJzh4S6D7tUwmkvpbnq_yU-iJfiKg@mail.g
Quoted 6 lines
>> mail.com <http://mail.com>> >> Content-Type: text/plain; charset="utf-8" >> >> Hi, >> >> I'm trying out bmcweb mTLS which should be enabled byQuoted 5 lines
default by
Quoted 1 line
>>https://github.com/openbmc/bmcweb/blob/master/CMakeLists.txt#L89
Quoted 2 lines
>>
>> In my test, I created a self signed key and certificatepair,
Quoted 2 lines
stacked them
Quoted 1 line
>> up into server.pem in
/etc/ssl/certs/httpsthat bmcwebuses.
Quoted 2 lines
Quoted 2 lines
>>
>> However when I tried to curl bmcweb service, I was ableto get
Quoted 6 lines
response by
Quoted 5 lines
>> only supplying the cert. >> >> curl --cacert cert.pem https://${bmc}/redfish/v1 >> >> With the mTLS enabled, I expected it should error outsince no
Quoted 5 lines
client
Quoted 2 lines
>> certificate is provided.
>>As mentioned, if you did not provide a client certificate, connection
was
Quoted 1 line
established to allow for Basic Auth. And as the Service Root requires
no
Quoted 8 lines
authentication, you got a response.
- Wiktor
Quoted 1 line
>> Could someone with relevant knowledge help with my
question?
Quoted 2 lines
I'm not sure what you are asking. Are you asking how to
install
Quoted 4 lines
mTLS
Quoted 1 line
certs into the BMC and then use them to connect? I am still
waiting for
Quoted 1 line
documentation that describes how to configure and use the
mTLS
Quoted 3 lines
feature.
Quoted 2 lines
I've added an entry to the security working group as a
reminder to
Quoted 9 lines
do
Quoted 8 lines
this. (I don't have the skill to document this feature.)
- Joseph
>>
>> Thanks,
>> Zhenfei
On May 1, 2020, at 07:39, Zhenfei Tai <[email protected]<mailto:[email protected]>> wrote:
I did more testing and found the reason why it accepts any client certification.
The error is due to the self signed certificate cannot be found in the list of trusted certificates. Without the user defined verify callback function, it works as expected.
#define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT<https://docs.huihoo.com/doxygen/openssl/1.0.1c/crypto_2x509_2x509__vfy_8h.html#aa4f5a3309eae833f85dff37c36fa039d> 18
// Check if certificate is OK
int error = X509_STORE_CTX_get_error(cts);
if (error != X509_V_OK)
{
return true;
}
Yes, I also thought the key is that the self-signed certificate is not in the trusted store.
However, the self-signed CA certificate I uploaded using the Redfish API and modify the code to another "set_verify_mode" is actually useless.
On Thu, Apr 30, 2020 at 12:09 PM Zhenfei Tai <[email protected]<mailto:[email protected]>> wrote:
Also, with that change in http_connection.h, it still accepts any client certificate provided in curl.
Here's what I did:
1. Disable BMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION
2. Uncommented ssl_key_handler.hpp:315 and added the boost::asio::ssl::verify_fail_if_no_peer_cert
Behavior after change:
1. Rejects curl without client certificate.
2. Returns when client certificate matches the one authority directory.
3. Rejects when client sends other certificates.
The change is just for testing purposes, I guess the original intention was not to mTLS every request.
It works :D
On Thu, Apr 30, 2020 at 11:34 AM Zhenfei Tai <[email protected]<mailto:[email protected]>> wrote:
Hi P.K.
I tried the same thing.
Could you share which url you tested?
With that change, if I access the https://${bmc}/redfish/v1 url in chrome, it prompts to choose a client certificate, but will also work if no certificate is chosen.
Thanks,
Zhenfei
On Thu, Apr 30, 2020 at 6:27 AM P. K. Lee (李柏寬) <[email protected]<mailto:[email protected]>> wrote:
I found a way to fix this issue, but it needs to be modified to the source code. In two steps:
Step 1.
The source code "adaptor.set_verify_mode(boost::asio::ssl::verify_peer);" in http_connection.h is replaced with "adaptor.set_verify_mode(boost::asio::ssl::verify_peer | boost::asio::ssl::verify_fail_if_no_peer_cert);"
Step 2.AccountService->Oem->OpenBMC->AuthMethods->TLS is set. (false by default)
It will enable enforce mTLS authentication.
Best,
P.K.
Quoted 109 lines
-----Original Message-----
From: Wiktor Gołgowski <[email protected]<mailto:[email protected]>>
Sent: Saturday, April 25, 2020 1:03 AM
To: Richard Hanley <[email protected]<mailto:[email protected]>>; Zhenfei Tai <[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>; P. K. Lee (李柏寬) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; P. K. Lee (李柏寬) <[email protected]<mailto:[email protected]>>; Joseph Reynolds <[email protected]<mailto:[email protected]>>
Subject: Re: mTLS on bmcwebQuoted 1 line · Richard Hanley
My guess is that somehow the root cert used to validate clients isn't installed
correctly, and so it's defaulting to basic auth.
Quoted 4 lines
At least that's my reading of this review
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/27270I think this would be the case. If the client certificate is not provided, TLS connection is still established, just without authenticating the client. This allows upper layer to provide other authentication methods (e.g. Basic Auth).
Quoted 2 lines
On Thu, Apr 23, 2020 at 9:47 AM Zhenfei Tai <[email protected]<mailto:[email protected]>
Quoted 2 lines · <mailto:[email protected]<mailto:[email protected]>>> wrote:
I guess part of my question is how to configure the mTLS certs to make
it work properly.
Quoted 7 lines
So far only https works (server side TLS).
Thanks,
ZhenfeiOn Thu, Apr 23, 2020 at 8:50 AM Joseph Reynolds <[email protected]<mailto:[email protected]>
Quoted 5 lines · <mailto:[email protected]<mailto:[email protected]>>> wrote:
On 4/23/20 5:47 AM, P. K. Lee (李柏寬) wrote: > Hi, > > I encountered the same issue when using Redfish to replace thecertificate.
Quoted 1 line
> Regardless of whether the parameters include --cert --key
--cacert or only --cacert, the authentication can still succeed.
Quoted 6 lines
> > Best, > P.K. > >> Date: Wed, 22 Apr 2020 14:58:06 -0700 >> From: Zhenfei Tai <[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>
Quoted 1 line
>> To: [email protected]<mailto:[email protected]>
<mailto:[email protected]<mailto:[email protected]>>
Quoted 4 lines
>> Subject: mTLS on bmcweb
>> Message-ID:Quoted 1 line
<CAMXw96Pp511sUO=q1XLz2uJzh4S6D7tUwmkvpbnq_yU-iJfiKg@mail.g
Quoted 6 lines
>> mail.com<http://mail.com/> <http://mail.com<http://mail.com/>>> >> Content-Type: text/plain; charset="utf-8" >> >> Hi, >> >> I'm trying out bmcweb mTLS which should be enabled bydefault by
Quoted 1 line
>>https://github.com/openbmc/bmcweb/blob/master/CMakeLists.txt#L89
Quoted 2 lines
>>
>> In my test, I created a self signed key and certificate pair,stacked them
Quoted 3 lines
>> up into server.pem in
/etc/ssl/certs/httpsthat bmcweb uses. >>
>> However when I tried to curl bmcweb service, I was able to getresponse by
Quoted 5 lines
>> only supplying the cert. >> >> curl --cacert cert.pem https://${bmc}/redfish/v1 >> >> With the mTLS enabled, I expected it should error out since noclient
Quoted 2 lines
>> certificate is provided.
>>As mentioned, if you did not provide a client certificate, connection was established to allow for Basic Auth. And as the Service Root requires no authentication, you got a response.
- Wiktor
Quoted 1 line
>> Could someone with relevant knowledge help with my
question?
Quoted 2 lines
I'm not sure what you are asking. Are you asking how to install
mTLS
Quoted 1 line
certs into the BMC and then use them to connect? I am still
waiting for
Quoted 1 line
documentation that describes how to configure and use the mTLS
feature.
Quoted 2 lines
I've added an entry to the security working group as a reminder to
do
Quoted 8 lines
this. (I don't have the skill to document this feature.)
- Joseph
>>
>> Thanks,
>> Zhenfei
Hi, proper documentation that describes how to configure and use the mTLS feature is in progress and soon will appear in OpenBmc docs. Thanks for your patience :)
pon., 4 maj 2020 o 04:29 P. K. Lee (李柏寬) <[email protected]> napisał(a):
Quoted 210 lines · Zhenfei Tai
I did more testing and found the reason why it accepts any client certification.
The error is due to the self signed certificate cannot be found in the list of trusted certificates.
Without the user defined verify callback function, it works as expected.#define
X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
<https://docs.huihoo.com/doxygen/openssl/1.0.1c/crypto_2x509_2x509__vfy_8h.html#aa4f5a3309eae833f85dff37c36fa039d>
18// Check if certificate is OK
int error =X509_STORE_CTX_get_error(cts);
if (error !=X509_V_OK)
{
return true;
}Yes, I also thought the key is that the self-signed certificate is not in the trusted store.
However, the self-signed CA certificate I uploaded using the Redfish API and modify the code to another "set_verify_mode" is actually useless.Quoted 17 lines · Zhenfei Tai
Also, with that change in
http_connection.h, it still accepts any client certificate provided in curl.Here's what I did:
1. DisableBMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION
2. Uncommented ssl_key_handler.hpp:315 and added theboost::asio::ssl::verify_fail_if_no_peer_certBehavior after change:
1. Rejects curl without client certificate.
2. Returns when client certificate matches the one authority directory.
3. Rejects when client sends other certificates.The change is just for testing purposes, I guess the original intention was not to mTLS every request.
It works :D
Quoted 163 lines · Zhenfei Tai
Quoted 163 lines
Hi P.K.
I tried the same thing.
Could you share which url you tested?
With that change, if I access the https://${bmc}/redfish/v1 url in chrome, it prompts to choose a client certificate, but will also work if no certificate is chosen.Thanks,
ZhenfeiQuoted 146 lines · P. K. Lee (李柏寬)
I found a way to fix this issue, but it needs to be modified to the source code. In two steps:
Step 1.
The source code "adaptor.set_verify_mode(boost::asio::ssl::verify_peer);" inhttp_connection.his replaced with "adaptor.set_verify_mode(boost::asio::ssl::verify_peer | boost::asio::ssl::verify_fail_if_no_peer_cert);"Step 2.
AccountService->Oem->OpenBMC->AuthMethods->TLSis set. (false by default)It will enable enforce mTLS authentication.
Best,
P.K.Quoted 5 lines
-----Original Message-----
From: Wiktor Gołgowski <[email protected]>
Sent: Saturday, April 25, 2020 1:03 AM
To: Richard Hanley <[email protected]>; Zhenfei Tai <[email protected]Quoted 9 lines
Cc: [email protected]; P. K. Lee (李柏寬) <[email protected]>; [email protected]; P. K. Lee (李柏寬) <[email protected]>; Joseph Reynolds <[email protected]>
Subject: Re: mTLS on bmcwebQuoted 1 line · Richard Hanley
My guess is that somehow the root cert used to validate clients
isn't installed
Quoted 7 lines
correctly, and so it's defaulting to basic auth.
Quoted 4 lines
At least that's my reading of this review
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/27270I think this would be the case. If the client certificate is not
provided, TLS
Quoted 1 line
connection is still established, just without authenticating the
client. This
Quoted 1 line
allows upper layer to provide other authentication methods (e.g.
Basic Auth).
Quoted 5 lines
Quoted 2 lines
On Thu, Apr 23, 2020 at 9:47 AM Zhenfei Tai <[email protected]
Quoted 2 lines · <mailto:[email protected]>> wrote:
I guess part of my question is how to configure the mTLS certs
to make
Quoted 8 lines
it work properly.
Quoted 7 lines
So far only https works (server side TLS).
Thanks,
ZhenfeiOn Thu, Apr 23, 2020 at 8:50 AM Joseph Reynolds <
Quoted 6 lines
Quoted 5 lines · <mailto:[email protected]>> wrote:
On 4/23/20 5:47 AM, P. K. Lee (李柏寬) wrote: > Hi, > > I encountered the same issue when using Redfish toreplace the
Quoted 23 lines
certificate.
Quoted 1 line
> Regardless of whether the parameters include --cert --key
--cacert or only --cacert, the authentication can still succeed.
Quoted 6 lines
> > Best, > P.K. > >> Date: Wed, 22 Apr 2020 14:58:06 -0700 >> From: Zhenfei Tai <[email protected]<mailto:[email protected]>>
Quoted 1 line
>> To: [email protected]
<mailto:[email protected]>
Quoted 4 lines
>> Subject: mTLS on bmcweb
>> Message-ID:Quoted 1 line
<CAMXw96Pp511sUO=q1XLz2uJzh4S6D7tUwmkvpbnq_yU-iJfiKg@mail.g
Quoted 6 lines
>> mail.com <http://mail.com>> >> Content-Type: text/plain; charset="utf-8" >> >> Hi, >> >> I'm trying out bmcweb mTLS which should be enabled byQuoted 5 lines
default by
Quoted 1 line
>>https://github.com/openbmc/bmcweb/blob/master/CMakeLists.txt#L89
Quoted 2 lines
>>
>> In my test, I created a self signed key and certificatepair,
Quoted 2 lines
stacked them
Quoted 1 line
>> up into server.pem in
/etc/ssl/certs/httpsthat bmcwebuses.
Quoted 2 lines
Quoted 2 lines
>>
>> However when I tried to curl bmcweb service, I was ableto get
Quoted 6 lines
response by
Quoted 5 lines
>> only supplying the cert. >> >> curl --cacert cert.pem https://${bmc}/redfish/v1 >> >> With the mTLS enabled, I expected it should error outsince no
Quoted 5 lines
client
Quoted 2 lines
>> certificate is provided.
>>As mentioned, if you did not provide a client certificate, connection
was
Quoted 1 line
established to allow for Basic Auth. And as the Service Root requires
no
Quoted 8 lines
authentication, you got a response.
- Wiktor
Quoted 1 line
>> Could someone with relevant knowledge help with my
question?
Quoted 2 lines
I'm not sure what you are asking. Are you asking how to
install
Quoted 4 lines
mTLS
Quoted 1 line
certs into the BMC and then use them to connect? I am still
waiting for
Quoted 1 line
documentation that describes how to configure and use the
mTLS
Quoted 3 lines
feature.
Quoted 2 lines
I've added an entry to the security working group as a
reminder to
Quoted 9 lines
do
Quoted 8 lines
this. (I don't have the skill to document this feature.)
- Joseph
>>
>> Thanks,
>> Zhenfei