【问题标题】:How to install SSL Certificate on AWS EC2 Instance?如何在 AWS EC2 实例上安装 SSL 证书?
【发布时间】:2020-10-31 04:30:39
【问题描述】:

我昨天发布了问题How to copy SSL to EC2。这是我应该做的:

You can connect to your Zeppelin notebook using an HTTPS URL. This requires a Secure Sockets Layer (SSL) certificate on your Amazon EC2 instance. The notebook server must provide web browsers with a certificate to validate its authenticity and to allow encrypted traffic for sensitive data such as passwords.
If you have an SSL certificate from a certificate authority (CA), copy your SSL certificate key store onto the Amazon EC2 instance into a path that the ec2-user has write access to, such as /home/ec2-user/.

我复制了 server.crt,但我无法从我的 Mac OS 连接到 ec2 实例。 我将重复这些步骤:

  1. 已生成私钥和证书签名请求
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
openssl req -new -key server.key -out server.csr
  1. 已生成自签名 SSL 证书
openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt

我的下一步:

scp -i sparktest.pem server.crt ec2-34-245-107-45.eu-west-1.compute.amazonaws.com

 ssh -i sparktest.pem ec2-34-245-107-45.eu-west-1.compute.amazonaws.com

milenko@ec2-34-245-107-45.eu-west-1.compute.amazonaws.com:权限被拒绝(公钥)。

EC2 是使用 Cloudformation 创建的。

为什么我的权限被拒绝了? 我应该检查什么?

【问题讨论】:

  • 你应该使用ec2-user@ec2-34-245-107-45.eu-west-1.compute.amazonaws.com;如果没有ec2-user,它将以您的本地用户名登录,这可能不是您想要的。`
  • 是的,工作正常,发布答案。

标签: amazon-web-services ssl amazon-ec2


【解决方案1】:

您缺少目的地的用户名。

您需要ec2-user@ec2-ip-address.eu-west-1.compute.amazonaws.com(在sshscp 命令中),而不是只有ec2-ip-address.eu-west-1.compute.amazonaws.com。`

没有ec2-user,它会以你的本地用户名登录,这不是你想要的!

【讨论】:

    【解决方案2】:

    权限被拒绝可能有多种原因,请检查以下内容:

    • sparktest.pem 文件已将公钥添加到 authorized_keys 文件夹中。如果这是附加到您的实例的密钥,则会自动添加此密钥
    • pem 适用于您在主机上尝试连接的用户。您似乎正在尝试连接到用户名 milenko。
    • 密钥的权限应为 400,您运行命令的用户是当前用户。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-02-17
      • 2014-03-13
      • 2017-03-18
      • 2017-04-07
      • 2018-03-17
      • 2016-06-01
      • 2020-01-23
      相关资源
      最近更新 更多