# Can Prometheus scrape TLS and mTLS targets using a common scrape job?

**URL:** <https://discuss.prometheus.io/t/can-prometheus-scrape-tls-and-mtls-targets-using-a-common-scrape-job/919>\
**Category:** Prometheus server\
**Created:** [April 20, 2022, 12:00am UTC](https://discuss.prometheus.io/t/can-prometheus-scrape-tls-and-mtls-targets-using-a-common-scrape-job/919 "2022-04-20T00:00:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tejaswini](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.prometheus.io/tejaswini/32/137_2.png) [@Tejaswini](https://discuss.prometheus.io/u/Tejaswini)\
**Post date:** [April 20, 2022, 12:00am UTC](https://discuss.prometheus.io/t/can-prometheus-scrape-tls-and-mtls-targets-using-a-common-scrape-job/919/1 "2022-04-20T00:00:08Z")

</div>

I tested this myself, I can see both TLS and mTLS targets scraped by Prometheus with a common scrape job.

My Prometheus job has the below configuration:  
scheme: https  
tls\_config:  
ca\_file: /run/cacertbundle.pem  
cert\_file: /run/clicert.pem  
key\_file: /run/cliprivkey.pem  
server\_name: my-favorite-target  
insecure\_skip\_verify: false

I expected TLS config as below:  
scheme: https  
tls\_config:  
ca\_file: /run/cacertbundle.pem  
server\_name: my-favorite-target  
insecure\_skip\_verify: false

I wonder how TLS and mTLS work simultaneously. I’m happy that Prometheus can scrape TLS and mTLS targets using a common scrape job but I didn’t understand the underlying design pattern. Can someone explain this behavior?

Thanks,  
Teja

---

<div class="post-metadata">

**Author:** ![Tejaswini](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.prometheus.io/tejaswini/32/137_2.png) [@Tejaswini](https://discuss.prometheus.io/u/Tejaswini)\
**Post date:** [April 20, 2022, 12:35am UTC](https://discuss.prometheus.io/t/can-prometheus-scrape-tls-and-mtls-targets-using-a-common-scrape-job/919/2 "2022-04-20T00:35:24Z")

</div>

[https://www.ietf.org/rfc/rfc5246.txt](https://www.ietf.org/rfc/rfc5246.txt), 7.4.6. Client Certificate section says

" This is the first message the client can send after receiving a  
ServerHelloDone message. This message is only sent if the server  
requests a certificate. If no suitable certificate is available,  
the client MUST send a certificate message containing no  
certificates. That is, the certificate\_list structure has a  
length of zero. If the client does not send any certificates, the  
server MAY at its discretion either continue the handshake without  
client authentication, or respond with a fatal handshake\_failure  
alert. Also, if some aspect of the certificate chain was  
unacceptable (e.g., it was not signed by a known, trusted CA), the  
server MAY at its discretion either continue the handshake  
(considering the client unauthenticated) or send a fatal alert."

Now I understand how this works.

- TLS Server, Scrape Target will send its certificates to TLS Client
- TLS Client, Prometheus will verify TLS Server Certificate
- TLS Client, Prometheus will send its certificates to TLS Server
- TLS Server, Scrape Target continue the handshake without client authentication (let’s say it doesn’t support mTLS, clientAuthType is set to “NoClientCert”)
