使用TLS安全的访问Minio服务​​​​​​​

使用TLS安全的访问Minio服务

 

本文,我们讲介绍如何在Linux和Windows上配置Minio服务使用TLS。

 

1. 前提条件

 

2. 配置已存在的证书

如果你已经有私钥和公钥证书,你需要将它们拷贝到Minio的config/certs文件夹,分别取名为private.key 和 public.crt

如果这个证书是被证书机构签发的,public.crt应该是服务器的证书,任何中间体的证书以及CA的根证书的级联。

 

3. 生成证书

Linux环境下生成证书

Minio在Linux只支持使用PEM格式的key/certificate。

使用 Let's Encrypt

更多信息,请访问 这里

使用 generate_cert.go (self-signed certificate)

你需要下载 generate_cert.go,它是一个简单的go工具,可以生成自签名的证书,不过大多数情况下用着都是木有问题的。

generate_cert.go 已经提供了带有DNS和IP条目的SAN证书:

Copygo run generate_cert.go -ca --host "10.10.0.3"

使用 OpenSSL:

生成私钥:

Copyopenssl genrsa -out private.key 2048

生成自签名证书:

Copyopenssl req -new -x509 -days 3650 -key private.key -out public.crt -subj "/C=US/ST=state/L=location/O=organization/CN=domain"

 

Windows环境下生成证书

Minio在Windows上只支持PEM格式的key/certificate,目前不支持PFX证书。

安装 GnuTLS

下载并解压GnuTLS

确保将解压后的binary路径加入到系统路径中。

Copysetx path "%path%;C:\Users\MyUser\Downloads\gnutls-3.4.9-w64\bin"

你可能需要重启powershell控制台来使其生效。

生成private.key

运行下面的命令来生成 private.key

Copycerttool.exe --generate-privkey --outfile private.key 

生成public.crt

创建文件cert.cnf,填写必要信息来生成证书。

Copy# X.509 Certificate options
#
# DN options

# The organization of the subject.
organization = "Example Inc."

# The organizational unit of the subject.
#unit = "sleeping dept."

# The state of the certificate owner.
state = "Example"

# The country of the subject. Two letter code.
country = "EX"

# The common name of the certificate owner.
cn = "Sally Certowner"

# In how many days, counting from today, this certificate will expire.
expiration_days = 365

# X.509 v3 extensions

# DNS name(s) of the server
dns_name = "localhost"

# (Optional) Server IP address
ip_address = "127.0.0.1"

# Whether this certificate will be used for a TLS server
tls_www_server

# Whether this certificate will be used to encrypt data (needed
# in TLS RSA ciphersuites). Note that it is preferred to use different
# keys for encryption and signing.
encryption_key

生成公钥证书

Copycerttool.exe --generate-self-signed --load-privkey private.key --template cert.cnf --outfile public.crt 

 

4. 安装第三方CAs

Minio可以配置成连接其它服务,不管是Minio节点还是像NATs、Redis这些。如果这些服务用的不是在已知证书机构注册的证书,你可以让Minio服务信任这些CA,怎么做呢,将这些证书放到Minio配置路径下(~/.minio/certs/CAs/ Linux 或者 C:\Users\<Username>\.minio\certs\CAs Windows).

 

了解更多

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值