Gatekeeper Pattern 把关(守门人)模式
Protect applications and services by using a dedicated host instance that acts as a broker between clients and the application or service, validates and sanitizes requests, and passes requests and data between them. This can provide an additional layer of security, and limit the attack surface of the system.
采用专用的主机实例,作为客户和应用程序或服务之间的代理保护的应用程序和服务,验证和清理的要求,并通过它们之间的请求数据。这种模式可以提供一个额外的安全层,并限制了对系统的攻击。
Context and Problem 情境和问题
Applications expose their functionality to clients by accepting and processing requests. In cloud-hosted scenarios, applications expose endpoints to which clients connect, and typically include the code to handle the requests from clients. This code may perform authentication and validation, some or all request processing, and is likely to accesses storage and other services on behalf of the client.
应用程序对通过接受和处理请求对客户端公开其功能。在云托管的情况下,应用程序暴露给客户端终结点,并通常包括来自客户端代码的请求。此代码可以执行认证和验证,一些或全部通过的请求,并有可能访问代表客户端的存储等服务。
If a malicious user is able to compromise the system and gain access to application’s hosting environment, the security mechanisms it uses such as credentials and storage keys, and the services and data it accesses, are exposed. As a result, the malicious user may be able to gain unrestrained access to sensitive information and other services.
如果恶意用户能够损害系统并访问应用程序的主机环境,诸如凭证和存储密钥,以及访问数据的服务,它使用安全机制暴露。其结果是,恶意用户可能能够获得对敏感信息和其他服务的无节制的访问。
Solution 解决方案
To minimize the risk of clients gaining access to sensitive information and services, decouple hosts or tasks that expose public endpoints from the code that processes requests and accesses storage. This can be achieved by using a façade or a dedicated task that interacts with clients and then hands off the request (perhaps through a decoupled interface) to the hosts or tasks that will handle the request. Figure 1 shows a high-level view of this approach.
为了尽量减少客户获取敏感信息和服务的风险,去耦揭露出从该处理请求和访问存储代码公共端点的主机或任务。这可以通过使用一个方面或与客户互动,然后分离请求(可能通过一个去耦接口)连接到主机或任务,将处理该请求的专用任务来实现。图1示出了这种方法的一个高层次的图。
Figure 1 - High level overview of this pattern 图1 -这个模式的高层次概述
The gatekeeper pattern may be used simply to protect storage, or it may be used as a more comprehensive façade to protect all of the functions of the application. The important factors are:
守门人模式可能只是为了保护存储,也可以作为一个更全面的外观模式保护所有应用程序的功能。重要因素是:
- Controlled validation. The Gatekeeper validates all requests, and rejects those that do not meet validation requirements.
- 控制验证。把关人模式验证了所有的请求,并拒绝那些不符合验证要求的请求。
- Limited risk and exposure. The Gatekeeper does not have access to the credentials or keys used by the trusted host to access storage and services. If the Gatekeeper is compromised, the attacker does not obtain access to these credentials or keys.
- 有限风险和暴露。守门人模式没有访问受信任的主机使用的凭据或键来访问存储和服务。如果守门人模式被攻破,攻击者不获得访问这些凭据或密钥。
- Appropriate security. The Gatekeeper runs in a limited privilege mode, whereas the remainder of the application runs in the full trust mode required to access storage and services. If the Gatekeeper is compromised, it cannot directly access the application services or data.
- 适当的安全。该看门人在有限的权限模式下运行,而应用程序的其余部分则运行在需要访问存储和服务的完全信任模式中。如果看门人被入侵,它不能直接访问应用程序服务或数据。
This pattern effectively acts like a firewall in a typical network topography. It allows the Gatekeeper to examine requests and make a decision about whether to pass the request on to the trusted host (sometimes called the Keymaster) that performs the required tasks. This decision will typically require the Gatekeeper to validate and sanitize the request content before passing it on to the trusted host.
这种模式有效扮演着在一个典型的网络防火墙。它允许把关审查请求并决定是否请求传递到受信任的主机(有时称为大师),完成要求的任务。这一决定将通常需要守门人模式验证和把关请求的内容在将它传递到受信任的主机之前。
Issues and Considerations 问题与思考
Consider the following points when deciding how to implement this pattern:
在决定如何实施这一模式时,请考虑以下几点:
- Ensure that the trusted hosts to which the Gatekeeper passes requests expose only internal or protected endpoints, and connect only to the Gatekeeper. The trusted hosts should not expose any external endpoints or interfaces.
- 确保所要传递的请求的受信任的主机只公开内部或受保护的端点,并只连接到“守门人”。受信任的主机不应公开任何外部端点或接口。
- The Gatekeeper must run in a limited privilege mode. Typically this means running the Gatekeeper and the trusted host in separate hosted services or virtual machines.
- 守关人模式必须在有限的特权模式下运行。通常,这意味着运行在单独的托管服务或虚拟机中的守关人模式和受信任的主机。
- The Gatekeeper should not perform any processing related to the application or services, or access any data. Its function is purely to validate and sanitize requests. The trusted hosts may need to perform additional validation of requests, but the core validation should be performed by the Gatekeeper.
- 守关人模式G不应该执行与应用程序或服务相关的任何处理,或访问任何数据。它的功能是纯粹的验证和审核请求。受信任的主机可能需要执行额外的请求验证,但核心验证应由守关人模式执行。
- Use a secure communication channel (HTTPS, SSL, or TLS) between the Gatekeeper and the trusted hosts or tasks where this is possible. However, some hosting environments may not support HTTPS on internal endpoints.
- 使用一个安全的通信通道(HTTPS、SSL,或TLS)在守门人模式和受信任的主机或任务之间,在任何可能的地方。然而,一些托管环境可能不支持在内部端点HTTPS。
- Adding the extra layer to the application to implement the Gatekeeper pattern is likely to have some impact on performance of the application due to the additional processing and network communication it requires.
- 添加额外的层的应用程序来实现的看门模式很可能有一定的影响,由于额外的处理和网络通信,它需要的应用程序的性能。
- The Gatekeeper instance could be a single point of failure. To minimize the impact of a failure, consider deploying additional instances and using an autoscaling mechanism to ensure sufficient capacity to maintain availability.
- 守门人的实例可能是一个单一的故障点。尽量减少失败的影响,考虑部署额外的实例和使用这个机制,确保有足够的能力保持可用性。
When to Use this Pattern 何时使用本模式
This pattern is ideally suited for:
这种模式非常适合:
- Applications that handle sensitive information, expose services that must have high a degree of protection from malicious attacks, or perform mission-critical operations that must not be disrupted.
- 处理敏感信息的应用程序,公开必须具有高度保护的恶意攻击的服务,或执行不可中断的任务关键操作的服务。
- Distributed applications where it is necessary to perform request validation separately from the main tasks, or to centralize this validation to simplify maintenance and administration.
- 分布式应用程序需要执行请求验证分别从主要任务,或集中验证简化维护和管理。
Example 例子
In a cloud-hosted scenario, this pattern can be implemented by decoupling the Gatekeeper role or virtual machine from the trusted roles and services in an application by using an internal endpoint, a queue, or storage as an intermediate communication mechanism. Figure 2 shows the basic principle when using an internal endpoint.
在云托管的情况下,这种模式可以实现的去耦的守门人角色或虚拟机从信任的角色和服务的应用程序通过使用一个内部端点,一个队列,或存储作为一个中间通信机制。图2显示了使用内部端点时的基本原则。
Figure 2 - An example of the pattern using Cloud Services web and worker roles 图2 -使用云服务的Web和工作角色的模式的一个例子
Related Patterns and Guidance 相关模式与指导
The following pattern may also be relevant when implementing this pattern:
当实现此模式时,下列模式也可能是相关的:
- Valet Key Pattern. When communicating between the Gatekeeper and trusted roles it is good practice to enhance security by using keys or tokens that limit permissions for accessing resources. The Valet Key pattern describes how to use a token or key that provides clients with restricted direct access to a specific resource or service.
- 代客主要模式。当守门人和受信任的角色之间的沟通是很好的做法,以提高安全性,通过使用密钥或令牌,限制访问资源的权限。代客主要模式描述了如何使用,提供客户限制直接访问特定的资源或服务标记或关键。
Gatekeeper Pattern 把关(守门人)模式的更多相关文章
- Java Listener pattern 监听者模式
Java Listener pattern 监听者模式 2016-5-12 监听者模式(观察者模式)能降低对象之间耦合程度.为两个相互依赖调用的类进行解耦. 便于进行模块化开发工作.不同模块的开发者可 ...
- 设计模式学习--迭代器模式(Iterator Pattern)和组合模式(Composite Pattern)
设计模式学习--迭代器模式(Iterator Pattern) 概述 ——————————————————————————————————————————————————— 迭代器模式提供一种方法顺序 ...
- Federated Identity Pattern 联合身份模式
Delegate authentication to an external identity provider. This pattern can simplify development, min ...
- [LeetCode] Word Pattern II 词语模式之二
Given a pattern and a string str, find if str follows the same pattern. Here follow means a full mat ...
- Circuit Breaker Pattern(断路器模式)
Handle faults that may take a variable amount of time to rectify when connecting to a remote service ...
- Cache-Aside Pattern(缓存模式)
Load data on demand into a cache from a data store. This pattern can improve performance and also he ...
- 使用C# (.NET Core) 实现适配器模式 (Adapter Pattern) 和外观模式 (Facade Pattern)
本文的概念内容来自深入浅出设计模式一书 现实世界中的适配器(模式) 我带着一个国标插头的笔记本电脑, 来到欧洲, 想插入到欧洲标准的墙壁插座里面, 就需要用中间这个电源适配器. 面向对象的适配器 你有 ...
- 设计模式のCommand Pattern(命令模式)----行为模式
一.产生背景 熟悉计算机的同学应该清楚,用户发出各种命令,CPU执行命令,OS负责调度.命令模式(Command Pattern)是一种数据驱动的设计模式,它属于行为型模式.请求以命令的形式包裹在对象 ...
- 4.Factory Pattern(工厂模式)
工厂模式(Factory Pattern)定义: 定义了一个创建对象的接口,但由子类决定要实例化的类是哪一个.工厂方法让类把实例化推迟到子类. 针对实现编程,但是当我们每次使用new时候,不正是在针对 ...
随机推荐
- HTML5 Boilerplate - 让页面有个好的开始
最近看到了HTML5 Boilerplate模版,系统的学习与了解了一下.在各种CSS库.JS框架层出不穷的今天,能看到这么好的HTML模版,感觉甚爽.写篇博客,推荐给大家使用. 一:HTML5 ...
- Linux安装LAMP开发环境及配置文件管理
Linux主要分为两大系发行版,分别是RedHat和Debian,lamp环境的安装和配置也会有所不同,所以分别以CentOS 7.1和Ubuntu 14.04做为主机(L) Linux下安装软件,最 ...
- 标准产品+定制开发:专注打造企业OA、智慧政务云平台——山东森普软件,交付率最高的技术型软件公司
一.公司简介山东森普信息技术有限公司(以下简称森普软件)是一家专门致力于移动互联网产品.企业管理软件定制开发的技术型企业.公司总部设在全国五大软件园之一的济南齐鲁软件园.森普SimPro是由Simpl ...
- iOS逆向工程之Theos
如果你对iOS逆向工程有所了解,那么你对Tweak并不陌生.那么由Tweak我们又会引出Theos, 那么什么是Theos呢,简单一句话,Theos是一个越狱开发工具包,Theos是越狱开发工具的首先 ...
- UWP开发之Mvvmlight实践七:如何查找设备(Mobile模拟器、实体手机、PC)中应用的Log等文件
在开发中或者后期测试乃至最后交付使用的时候,如果应用出问题了我们一般的做法就是查看Log文件.上章也提到了查看Log文件,这章重点讲解下如何查看Log文件?如何找到我们需要的Packages安装包目录 ...
- 解决Android Studio 无法显示Layout视图问题
在Android Studio 当中,如果你选择的SDK的版本 与你所显示的视图版本不一致时,会出现这个错误 Exception raised during rendering:com/android ...
- 在知乎上看到 Web Socket这篇文章讲得确实挺好,从头看到尾都非常形象生动,一口气看完,没有半点模糊,非常不错
在知乎上看到这篇文章讲得确实挺好,从头看到尾都非常形象生动,一口气看完,没有半点模糊,非常不错,所以推荐给大家,非常值得一读. 作者:Ovear链接:https://www.zhihu.com/que ...
- gulp初学
原文地址:gulp初学 至于gulp与grunt的区别,用过的人都略知一二,总的来说就是2点: 1.gulp的gulpfile.js 配置简单而且更容易阅读和维护.之所以如此,是因为它们的工作方式不 ...
- 张高兴的 UWP 开发笔记:汉堡菜单进阶
不同于Windows 8应用,Windows 10引入了"汉堡菜单"这一导航模式.说具体点,就拿官方的天气应用来说,左上角三条横杠的图标外加一个SplitView控件组成的这一导航 ...
- CentOS 7 修改主机名
今天在阿里云上买了一个centos7的服务器,连接上以后,发现一个很长很长的主机名,看着让人很是不爽,就想着怎样将其改成一个有个性的名字. 这里我想说的是,在centos7 版本的linux系统上和c ...