小编kro*_*tar的帖子

使用证书颁发机构签署证书请求

我想使用TLS相互身份验证来验证在go中制作的API上的客户端.我已经创建了一个证书颁发机构,让我们说Bob有一个他希望与客户端一起使用的密钥对.Bob创建了一个证书请求,并希望我验证他的证书,以便在API上进行授权和身份验证.

我用它来创建我的证书颁发机构:

openssl genrsa -aes256 -out ca.key 4096
openssl req -new -x509 -sha256 -days 730 -key ca.key -out ca.crt
Run Code Online (Sandbox Code Playgroud)

Bob用它来创建他的证书和证书请求:

openssl genrsa -out bob.key 4096
openssl req -new -key bob.key -out bob.csr
Run Code Online (Sandbox Code Playgroud)

我想得到这个,但是在去:

openssl x509 -req -days 365 -sha256 -in bob.csr -CA ca.crt -CAkey ca.key -set_serial 3 -out bob.crt
Run Code Online (Sandbox Code Playgroud)

现在,使用theses命令,Bob可以创建一个到我的API的TLS连接,使用这个tls.Config:

func createTLSConfig(certFile string, keyFile string, clientCAFilepath string) (config *tls.Config, err error) {
    cer, err := tls.LoadX509KeyPair(certFile, keyFile)
    if err != nil {
        return nil, err
    }

    clientCAFile, err := ioutil.ReadFile(clientCAFilepath) …
Run Code Online (Sandbox Code Playgroud)

pki go x509certificate mutual-authentication tls1.2

7
推荐指数
2
解决办法
5514
查看次数

解压缩最简单的Dockerfile:找不到文件

我是一个新的docker用户.我花了很多时间在一个错误上,Dockerfile非常简短,但我无法解决这个问题.

我正在尝试下载tar文件,并将其解压缩

这是我的Dockerfile(每次尝试都不在Dockerfile中,同时为了简单起见我将它们放在一起)

FROM ubuntu:latest

# 1st try
ADD https://download.gnome.org/sources/glib/2.52/glib-2.52.1.tar.xz /tmp/
RUN ls -lah /tmp/glib-2.52.1.tar.xz
ADD /tmp/glib-2.52.1.tar.xz /tmp

# 2nd try
ADD https://download.gnome.org/sources/glib/2.52/glib-2.52.1.tar.xz /tmp/
RUN ls -lah /tmp/glib-2.52.1.tar.xz
RUN tar -C /tmp/ -xf /tmp/glib-2.52.1.tar.xz

# 3rd try
WORKDIR /tmp/
RUN wget https://download.gnome.org/sources/glib/2.52/glib-2.52.1.tar.xz
RUN ls -lah glib-2.52.1.tar.xz
RUN tar -xf glib-2.52.1.tar.xz

# 4th try
RUN wget https://download.gnome.org/sources/glib/2.52/glib-2.52.1.tar.xz -O /tmp/glib-2.52.1.tar.xz
RUN ls -lah /tmp/glib-2.52.1.tar.xz
ADD /tmp/glib-2.52.1.tar.xz /tmp

# 5th try
RUN wget https://download.gnome.org/sources/glib/2.52/glib-2.52.1.tar.xz -O /tmp/glib-2.52.1.tar.xz
RUN ls -lah /tmp/glib-2.52.1.tar.xz
RUN tar -C …
Run Code Online (Sandbox Code Playgroud)

tar docker dockerfile

0
推荐指数
1
解决办法
3007
查看次数