security - 限制一个 Elastic Beanstalk 应用程序对另一个应用程序的访问

标签 security amazon-web-services amazon-elastic-beanstalk

我有两个 Elastic Beanstalk 应用程序“a”和“b”。任何人都应该能够通过 http 与 (a) 对话,但只有 (a) 能够与 (b) 对话。即

internet -> a -> b

现在,如果两个应用程序都完全向互联网开放,则一切正常。但当我尝试限制 (b) 的 ELB 的安全组时,(a) 似乎无法再连接。

即如果我允许 (b) 的负载均衡器安全组允许 http:0.0.0.0/0,则一切正常。但是,如果我将同一安全组设置为仅允许 http:[(a) 的安全组],则 (a) 无法再与 (b) 通信。

两个应用程序位于同一 VPC 中。我错过了什么?

-- 编辑--

明确地说:

  • 应用 B:
    • ELB 安全组:sg-a3d3ccc6
    • EC2 安全组:sg-aed3cccb
  • 应用程序 A:
    • ELB 安全组:sg-4fe5fd2a
    • EC2 安全组:sg-5ee5fd3b

工作:

应用程序 A 的 ELB 安全组设置,以允许任何人访问 HTTP/S App A's ELB Security Group Settings, to allow access from anyone to HTTP/S

应用程序 A 的 EC2 安全组,仅允许从 A 的 ELB 进行访问(是的,我在这里缺少 https,但现在没问题) App A's EC2 Security Group, to allow access only from A's ELB

应用程序 B 的 ELB 安全组,允许任何人访问 App B's ELB Security Group, to allow access from anyone

应用程序 B 的 EC2 安全组,仅允许从 B 的 ELB 进行访问 App B's EC2 Security Group, to allow access only from B's ELB

不工作:

一切与上面相同,但将 B 的 ELB 安全组更改为仅允许来自 A 的 EC2 组的访问。哎呀,为了确保安全,我们将添加 A 的 EC2 和 ELB。

应用程序 B 的 ELB 安全组,仅允许从应用程序 A 访问 App B's ELB Security Group, allowing access only from App A

最佳答案

如果有人能做到这一点(正如一些人声称的那样),我会对细节非常感兴趣。我注册了一个支持帐户并向 AWS 开具了一张票证,但他们官方说这是不可能的:

After researching this more the setup that you are trying to implement isn't supported. In the section of the security group rules it states that when referencing a security group in a SG rule it allows access from the local IP addresses of instances associated with the source group, not their public or Elastic IP. Below is the documentation page with more information on the topic.

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html#security-group-rules

To accomplish what you want to do will require a bit more setup, but is possible.

Below I've included a link to a tutorial that lays out the process of deploying an EB environment into a VPC with instances in a private subnet as well as the process of setting up a NAT instance on AWS. Using this it will allow you to have your private EB applications instances accessible from only the public EB application.

I would recommend setting up a new VPC with this architecture in mind rather than try to modify your existing VPC.

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/AWSHowTo-vpc-basic.html http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html#NATInstance

即两个 EB 实例之间的流量来自 A 的公共(public) IP 地址,但安全组仅适用于私有(private) IP 地址。我还没读完,但看起来解决方案是创建一个新的 VPC 并将两者一起进行 NAT,因此所有请求看起来都来自私有(private) IP 地址。

这有点恶心,尤其是创建所有新的 VPC 将是一件巨大的痛苦。非常好奇其他人是否可以在没有这个的情况下工作。

关于security - 限制一个 Elastic Beanstalk 应用程序对另一个应用程序的访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30628944/

相关文章:

Elastic Beanstalk 上的 Django Weasyprint - 无法加载 GDK-Pixbuf

php - 公开访问服务器的 phpSysInfo - 安全吗?

spring - 另一个 Controller 中的Grails Spring安全性登录表单

security - 关于SRP算法的问题

amazon-web-services - 在 AWS EC2 免费套餐实例上安装 TURN 服务器

python - 我的弹性 beanstalk env 变量已设置,但我无法在我的 python 脚本中访问它们

node.js - 在AWS Elastic Beanstalk上的node.js项目中编译less文件并缩小js文件

php - 在php中从flash文件获取请求时检查ip

ruby-on-rails - 使用 presigned_url 触发 S3 文件的下载

amazon-web-services - 从 lambda 记录到 cloudwatch 中的特定日志流