简体   繁体   English

通过TLS连接到MQTT服务器的CA证书-iot.eclipse.org

[英]CA certificate to connect to MQTT server over TLS - iot.eclipse.org

I want to connect to ssl://iot.eclipse.org:8883 using Client certficate authentication. 我想使用客户端证书身份验证连接到ssl://iot.eclipse.org:8883。

How I can obtain CA certificate? 如何获得CA证书?

Do I require to generate my own client certificate with provided CA certificate. 我是否需要使用提供的CA证书生成自己的客户端证书。 Or client certificate is also bundled along with CA certificate. 或客户端证书也与CA证书捆绑在一起。

Using openssl to check it appears that the certificate for iot.eclipse.org is from the Let's Encrypt project. 使用openssl来检查iot.eclipse.org的证书似乎来自Let's Encrypt项目。

$ openssl s_client -showcerts -connect iot.eclipse.org:8883CONNECTED(00000003)
depth=1 C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/CN=iot.eclipse.org
   i:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
-----BEGIN CERTIFICATE-----

So you should be able to check this certificate is valid with the standard CA set in most modern OS/Applications. 因此,您应该能够使用大多数现代OS /应用程序中设置的标准CA来检查此证书是否有效。

You will not be able to get hold of the CA cert/private key to generate your own client certs for obvious reasons and they do not issue client certificates ( and that is assuming that the eclipse.org broker is set up to authenticate clients with the same CA, it doesn't have to). 由于明显的原因,您将无法获得CA证书/私钥来生成自己的客户端证书,并且它们不会颁发客户端证书(并且假设eclipse.org代理已设置为使用相同的CA,则不必这样做)。

Also it doesn't make sense to authenticate against this broker as you have no way to set an ACL to control which users can subscribe/publish to specific topics as it's a public demonstration broker. 同样,对这个代理进行身份验证也没有意义,因为您是一个公共演示代理,因此您无法设置ACL来控制哪些用户可以订阅/发布特定主题。 If you want to secure access then you will have to run your own public broker 如果要保护访问权限,则必须运行自己的公共经纪人

EDIT: You don't want to do client certificate authentication, you just want to verify the server cert, this is very different. 编辑:您不想执行客户端证书身份验证,您只想验证服务器证书,这是非常不同的。

To do this with mosquitto_pub or mosquitto_sub you have to specify a CA cert or a path to a directory of multiple certificates in order to enable ssl/tls for the connection. 为此,必须使用mosquitto_pubmosquitto_sub来指定CA证书或指向多个证书的目录的路径,以便为连接启用ssl / tls。 You would specify an individual CA cert if you were using a private CA, but since the iot.eclipse.org broker is using a well known public CA you need to specify the path to the system collection of CA certs. 如果使用私有CA,则需要指定一个单独的CA证书,但是由于iot.eclipse.org代理使用的是众所周知的公共CA,因此您需要指定CA证书系统集合的路径。

On Linux that is /etc/ssl/certs so you would publish as follows: /etc/ssl/certs Linux上,您可以按以下方式发布:

mosquitto_pub -h iot.eclipse.org -p 8883 --capath /etc/ssl/certs/ -t testing/ben -m foo

If a certificate is like a passport which proves your identity, then CA is just like a passport office( 1 ). 如果证书就像证明您身份的护照,那么CA就像护照办公室( 1 )。 You could consider Verisign, Entrust etc as passport offices. 您可以将Verisign,Entrust等视为护照办公室。 CA certficate is analogous to passport office providing a way to check if a passport is valid or not. CA证书类似于护照办公室,提供一种检查护照是否有效的方法。

To prove their identity any two parties,( read server and client ), could use certificates. 为了证明其身份,任何两个方(读取服务器和客户端)都可以使用证书。 To verify the authenticity of a party( read server ), you need CA certificate. 要验证一方(读取服务器)的真实性,您需要CA证书。 Linux system(Ubuntu) holds commonly used CA certificates at /etc/ssl/certs . Linux系统(Ubuntu)在/ etc / ssl / certs拥有常用的CA 证书

A client certificate is needed only if you need to authenticate yourself to the server. 仅当您需要向服务器进行身份验证时才需要客户端证书。 Here server is iot.eclipse.org which doesn't ask for client authentication and so you don't need client certificate. 这里的服务器是iot.eclipse.org,它不要求客户端身份验证,因此您不需要客户端证书。

So, to communicate securely with server ( read TLS ), you can use the CA store present in your system(Ubuntu) as below. 因此,为了与服务器进行安全通信(读取TLS),可以使用系统中存在的CA存储(Ubuntu),如下所示。

mosquitto_pub -h iot.eclipse.org -p 8883 -t my_topic -m my_message --capath /etc/ssl/certs/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM