WO2019128007A1 - 一种容器登录方法、应用服务器、***及存储介质 - Google Patents
一种容器登录方法、应用服务器、***及存储介质 Download PDFInfo
- Publication number
- WO2019128007A1 WO2019128007A1 PCT/CN2018/084466 CN2018084466W WO2019128007A1 WO 2019128007 A1 WO2019128007 A1 WO 2019128007A1 CN 2018084466 W CN2018084466 W CN 2018084466W WO 2019128007 A1 WO2019128007 A1 WO 2019128007A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- control unit
- container
- random token
- proxy server
- unit address
- Prior art date
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/321—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority
- H04L9/3213—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority using tickets or tokens, e.g. Kerberos
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3226—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using a predetermined code, e.g. password, passphrase or PIN
- H04L9/3228—One-time or temporary data, i.e. information which is sent for every authentication or authorization, e.g. one-time-password, one-time-token or one-time-key
Definitions
- the present application relates to the field of computer technologies, and in particular, to a container login method, an application server, a system, and a storage medium.
- the container technology provided by the Docker container allows several containers (Containers) to be run on the same host or virtual machine, each container being a separate virtual environment or application.
- the Docker container provides the client with the ability to log in to the container, allowing the user to access the container to operate the container in the same way as the host or virtual machine.
- Kubernetes is a Google container open source container orchestration tool that combines several Docker containers into a single service, dynamically allocating hosts running on containers.
- Kubernetes locates the host where the container is located through the management unit of the cluster where the container resides, reads the docker socket on the host, and provides the websocket to the client.
- the API way allows users to log in to the container directly using the Kubernetes API.
- API requests expose the direct access of the cluster's snap-ins to the client; they cannot be combined with dynamic authentication.
- the purpose of the present application is to provide a container login method, an application server, a system, and a storage medium, which combines the need for facilitating login of a container with dynamic authentication, and does not expose the cluster control unit.
- the real address guarantees the security of the system.
- a container login method includes the following steps:
- control unit address is obtained according to the random token and returned to the proxy server, and the container login request is sent by the proxy server to the control unit. Address, which establishes a connection between the client and the control unit.
- An application server for container login comprising: a processor, a memory, and a communication bus;
- Storing on the memory is a computer readable program executable by the processor
- the communication bus implements connection communication between the processor and the memory
- the processor implements the steps in the container login method of any of the above, when the computer readable program is executed.
- a computer readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement a container login method as described above A step of.
- a container login system comprising a client and a proxy server, further comprising an application server logged in by the container as described above;
- the application server is configured to receive a user-initiated container service access request and generate a random token; and query a control unit address of the cluster where the service to be accessed is located according to the container service access request, and the random token and the control unit The address is formed into a key value pair and stored in the cache; and when the container login request in the service to be accessed is received, the container login request and the random token are sent to the proxy server, wherein the container login request includes user account information And authenticating the user account information and the random token, if the authentication is passed, acquiring the control unit address according to the random token and returning to the proxy server;
- the proxy server is configured to send the container login request to the control unit address to establish a connection between the client and the control unit.
- the container login method receives a user-initiated container service access request and generates a random token;
- the service access request queries the control unit address of the cluster where the service to be accessed is located, and stores the random token and the control unit address into a key value pair, and then stores the information in the cache; and when receiving the container login request in the service to be accessed,
- the container login request and the random token are sent to the proxy server, where the container login request includes user account information; and then the user account information and the random token are authenticated, and if the authentication is passed, according to the random
- the token acquires the control unit address and returns it to the proxy server, which sends the container login request to the control unit address to establish a connection between the client and the control unit.
- FIG. 1 is a flowchart of a container login method provided by the present application.
- step S20 is a flowchart of step S20 in the container login method provided by the present application.
- step S23 is a flowchart of step S23 in the container login method provided by the present application.
- step S30 is a flowchart of step S30 in the container login method provided by the present application.
- FIG. 5 is a flowchart of step S40 in the container login method provided by the present application.
- FIG. 6 is a flowchart of step S43 in the container login method provided by the present application.
- FIG. 7 is a schematic diagram of an operating environment of a preferred embodiment of a container login procedure of the present application.
- FIG. 8 is a functional block diagram of a system for installing a container login program according to a preferred embodiment of the present application.
- FIG. 9 is a structural block diagram of an application server for container login provided by the present application.
- Kubernetes is a Google container open source container orchestration tool, which can realize the functions of combining several Docker containers into one service and dynamically allocating the host running the container.
- Kubernetes Service is the Kubernetes service is a collection of several containers, a Service can provide services for users;
- Kubernetes cluster refers to a group of hosts or virtual machines, used to run Kubernetes services, the containers within the services of Kubernetes actually run in the cluster On each node host; each Kubernetes cluster has one and only one control unit, namely Kubernetes Master, used to schedule and manage Kubernetes services, such as allocating a container of a service to a node in the cluster.
- Kubernetes Master is a process that runs on a host or virtual machine.
- the container login method provided by the present application includes the following steps:
- the client when the user enters the Kubernetes service page, the client requests access to the container service. At this time, the client receives the container service access request and generates a random token, where the container service access request includes the service name and the container name to be accessed. And information such as user permissions.
- the service unit and the container information in the container service access request are used to query the control unit address of the cluster in which the service to be accessed is located.
- the container Since the management of Kubernetes, the container is organized in the form of a service, and the container may be Drift on different hosts to achieve higher availability. The user does not need to know which host the container to log in on, only need to know the container name, the service and the cluster, and then command kubectl through the Kubernetes client. Exec or websocket that calls the Kubernetes control unit
- the API can log in to the container.
- the dynamic authentication and control unit address query in the subsequent login operation encapsulates the control unit address of the cluster to improve the security of the system.
- FIG. 2 is a flowchart of step S20 in the container login method provided by the present application.
- the step S20 includes:
- the random token is used as a key and a control unit address as a value to form a key value pair, and then stored in a cache.
- the container service after receiving the container service request, according to the service information to be accessed in the request, that is, the service name, the container name, and the user authority, etc., first verify whether the user has the right to access the service, if the authority is verified. Passing, the container service access request is forwarded to the container service, the container service obtains the Kubernetes cluster name of the container according to the service name and the container name in the request, and accesses the database, and receives the database query according to the Kubernetes cluster name. The control unit address of the Kubernetes cluster. After that, the container service will generate the random token key and the obtained control unit address as the value ⁇ random token, control unit address> key-value pair, and store it in the cache for subsequent call query. .
- the random token is returned to the front end page of the client and saved as a variable, and the timeout period of the random token is set to be consistent with the timeout period of the system session, that is, each time the user enters the Kubernetes service page, a random order is generated. Cards and key-value pairs. If the user enters the Kubernetes service page again after exiting, a new random token will be generated again. The last saved random token will expire with the timeout, and will be generated each time the service page is entered. A new ⁇ random token, control unit address> key-value pair is used for the user to log in to the container, improving subsequent authentication and login security.
- FIG. 3 is a flowchart of step S23 in the container login method provided by the present application.
- the step S23 includes:
- the random token is used as a key and a control unit address as a value to form a key value pair.
- the generated random token and the obtained control unit address are first composed of a ⁇ random token, a control unit address> key value pair, and then the cache (such as redis) is checked. Is there a key-value pair with the same random token as the key, if there is, then regenerate a new random token, compose the new key-value pair and check again, if not, directly store the current key-value pair in the cache. To avoid the occurrence of the case where the same random token is used as the key and the different control unit addresses are used as the value in the cache, and the accuracy of the subsequent acquisition of the control unit address is ensured.
- a container login request is initiated, and the container login request includes user account information, and the container login request and the random order are received after receiving the container login request.
- the card is sent to the proxy server, and the subsequent login process is performed through the proxy server.
- the proxy server adopts Nginx, which is an open source proxy service, which can proxy the request initiated by the user and forward the request, which can be avoided by the proxy server. Expose the real control unit address when logging in to the container to ensure the security of the system.
- FIG. 4 is a flowchart of step S30 in the container login method provided by the present application.
- the step S30 includes:
- the user triggers the login request through the login container virtual button on the Kubernetes service detail page.
- the user carries the user account information and the random token to send the container login request to the proxy server.
- the user account information includes a username, a password, and a user authority, and the like.
- the user account information and the random token are first authenticated, and the user account information and the random token are verified to be correct, if the authentication is performed. Passing the red token in the cache according to the random token to obtain the corresponding control unit address and returning to the proxy server, and the proxy server sends the container login request to the control unit address to establish a connection between the client and the control unit.
- the user can directly log in to the container from the existing Kubernetes container service platform to ensure the convenience of the container login, and at the same time, the user is authenticated when the container is logged in, thereby solving the user's need for convenient login and permission authentication.
- FIG. 5 is a flowchart of step S40 in the container login method provided by the present application.
- the step S40 includes:
- control unit address is obtained according to the random token and returned to the proxy server, and the proxy login request is sent by the proxy server to the control unit address to establish a connection between the client and the control unit.
- the proxy server after receiving the login container request, the proxy server first initiates a sub-request for obtaining the control unit address.
- Nginx is used as the proxy server, and Nginx has an open source module ngx_http_auth_request_module that provides the sub-request function, that is, Before Nginx forwards the received request to its proxy's real service, it first initiates a subrequest. Only when the subrequest's response is normal (response status code is 200-299), the original request is forwarded.
- the proxy server receives After the request to the login container, the login container request is not immediately forwarded, but the user account information and the random token are first sent to the authentication service to initiate a sub-request for obtaining the control unit address, and the authentication service pairs the user account information and the random request.
- the token is authenticated and the authentication result is returned to the proxy server; specifically, the authentication service verifies that the user account information is correct, including verifying that the username and password are correct, whether the user has permission to log in to the container, etc., if correct, the control will be acquired.
- the sub-request of the unit address is forwarded to the container service; otherwise it does not turn The sub-request, the authentication failure information is returned directly to the proxy server.
- the authentication service will intercept the request and return an unauthorized response, so the sub-request fails, and the proxy server does not forward the request to the real control unit address;
- the authentication service forwards the sub-request to the container service, and the container service obtains the corresponding control unit address in the cache according to the random token. Therefore, before the user logs in the container, the authentication service is combined with the authentication service to perform the dynamic authority authentication on the account information, so as to implement the combination of the convenient login and the dynamic authentication.
- FIG. 6 is the step of the container login method provided by the present application. Flowchart of S43.
- the step S43 includes:
- the container service searches for a corresponding control unit address in the cache according to the random token.
- the proxy server sends the container login request to the control unit address to establish a connection between the client and the control unit.
- the container service After the user account information is verified and the authentication service forwards the sub-request to the container service, the container service searches the cache for the corresponding control unit address according to the random token. If the random token is missing or incorrect, the cache is cached. According to the random token, the real control unit address cannot be obtained, the response is not found, the sub-request fails, the proxy server does not forward the request to the real control unit address; if the random token is correct, the container service is based on the random token. The corresponding control unit address is obtained in the cache and returned to the proxy server. At this time, the sub-request is successful, and the proxy server forwards the original container login request to the corresponding control unit, and accesses the websocket of the control unit.
- API which establishes a connection for the client and the control unit, allows the client to successfully log in to the container, and implements the encapsulation of the real address of the cluster control unit that needs to be accessed by the login container. The user cannot intercept the information and ensure the security of the system. .
- the application further provides an application server for registering a container, and the application server for registering the container may be a mobile terminal, a desktop computer, a notebook, a palmtop computer, a server, or the like. Computing device.
- the application server to which the container logs in includes the processor 10, the memory 20, and the display 30.
- Figure 7 shows only some of the components of the application server to which the container logs in, but it should be understood that not all illustrated components may be implemented, and more or fewer components may be implemented instead.
- the memory 20 may be, in some embodiments, an internal storage unit of the application server to which the container logs in, such as a hard disk or memory of an application server to which the container logs.
- the memory 20 may also be an external storage device of the application server that the container logs in, for example, a plug-in hard disk equipped on the application server of the container login, and a smart memory card (Smart Media Card, SMC), Secure Digital (SD) card, flash card (Flash) Card) and so on.
- the memory 20 may also include an internal storage unit of the application server to which the container is logged in, and an external storage device.
- the memory 20 is configured to store application software and various types of data of an application server installed in the container, for example, a program code of an application server to which the installation container logs in.
- the memory 20 can also be used to temporarily store data that has been output or is about to be output.
- a container login program 40 is stored on the memory 20, and the container login program 40 can be executed by the processor 10 to implement the container login method of the present application.
- the processor 10 may be a central processing unit (Central Processing Unit) in some embodiments.
- the display 30 may be an LED display, a liquid crystal display, a touch liquid crystal display, and an OLED (Organic) in some embodiments. Light-Emitting Diode, organic light emitting diodes), etc.
- the display 30 is for displaying information of an application server registered in the container and a user interface for displaying visualization.
- the processor 10 executes the container login program 40 in the memory 20, the steps of the embodiments in the container login method are implemented, and details are not described herein.
- FIG. 8 is a functional block diagram of a system for installing a container login program according to a preferred embodiment of the present application.
- the system for installing the container login program may be divided into one or more modules, the one or more modules being stored in the memory 20 and being composed of one or more processors (this embodiment) Executed for the processor 10) to complete the application.
- the system in which the container login program is installed may be divided into a generation module 21, a query module 22, a login module 23, and an authentication acquisition module 24.
- a module as referred to in the present application refers to a series of computer program instruction segments capable of performing a specific function, and is more suitable than the program to describe the execution process of the container login program in the application server to which the container is logged. The following description will specifically describe the functions of the modules 21-24.
- Generating block 21 configured to receive a user-initiated container service access request and generate a random token
- the querying module 22 is configured to query, according to the container service access request, a control unit address of a cluster where the service to be accessed is located, and store the random token and the control unit address into a key value pair and store the information in the cache;
- the login module 23 is configured to send the container login request and the random token to the proxy server when receiving the container login request in the to-be-accessed service, where the container login request includes user account information;
- the authentication obtaining module 24 is configured to authenticate the user account information and the random token. If the authentication succeeds, the control unit address is obtained according to the random token and returned to the proxy server.
- the query module 22 specifically includes:
- a name obtaining unit configured to acquire a cluster name and access a database according to the to-be-accessed service information in the container service access request;
- a receiving unit configured to receive, by the database, the control unit address of the cluster that is queried according to the cluster name;
- a generating unit configured to store the random token as a key, a control unit address as a value, and then store the key value pair in a cache.
- the generating unit includes:
- a key-value pair generating sub-unit configured to use the random token as a key and a control unit address as a value to form a key-value pair;
- the search unit is configured to search whether there is a key value pair with the same random token as a key in the cache, and regenerate the random token if it exists; if not, the current key value pair is stored in the cache.
- the login module 23 includes:
- a detecting unit configured to detect whether a virtual button of the login container in the service to be accessed is triggered
- a sending unit configured to send a container login request and a random token to the proxy server when the virtual button of the login container is triggered, where the container login request includes user account information.
- the authentication obtaining module 24 includes:
- a sub-requesting initiation unit configured to initiate a sub-request for obtaining an address of the control unit according to the user account information and the random token;
- An authentication unit configured to authenticate the user account information and the random token, and return an authentication result to the proxy server;
- the address obtaining unit is configured to acquire the control unit address according to the random token and return to the proxy server when the authentication is passed.
- the address obtaining unit includes:
- An address search subunit for the container service to search for a corresponding control unit address in the cache according to the random token
- the feedback sub-unit is configured to return the sub-request failure information to the proxy server if the random token is missing or incorrect; if the random token is correct, the corresponding control unit address is obtained and returned to the proxy server.
- the present application further provides a container login system.
- the client 101, the proxy server 102, and the container login application server 103 as described above are included.
- the application server 103 is configured to receive a user-initiated container service access request and generate a random token; and query a control unit address of the cluster where the service to be accessed is located according to the container service access request, and the random token and The control unit address is stored in the cache after the key value pair is formed; and when the container login request in the service to be accessed is received, the container login request and the random token are sent to the proxy server 102, wherein the container login request includes User account information; and authenticating the user account information and the random token, if the authentication is passed, acquiring the control unit address according to the random token and returning to the proxy server 102; the proxy server 102 is configured to The login request is sent to the control unit address to establish a connection between the client 101 and the control unit.
- the container login method receives a user-initiated container service access request and generates a random token; and then accesses according to the container service.
- the need to facilitate the login of the container is combined with dynamic authentication, and the real address of the cluster control unit is not exposed to ensure the security of the system.
- a computer program to instruct related hardware (such as a processor, a controller, etc.), and the program can be stored in one.
- the program when executed, may include the processes of the various method embodiments as described above.
- the storage medium described therein may be a memory, a magnetic disk, an optical disk, or the like.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本申请公开了一种容器登录方法、应用服务器、***及存储介质,通过接收用户发起的容器服务访问请求并生成一随机令牌;根据所述容器服务访问请求查询待访问服务所在集群的控制单元地址,并将随机令牌和控制单元地址组成键值对后存入缓存;当接收到待访问服务中的容器登录请求时,将所述容器登录请求和随机令牌发送至代理服务器,容器登录请求包括用户账号信息;对用户账号信息和随机令牌进行鉴权,若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。实现便利登陆容器与动态鉴权,且不会暴露集群控制单元的真实地址,保证***的安全。
Description
本申请要求于2017年12月29日提交中国专利局、申请号为201711482082.8、发明名称为“一种容器登录方法、应用服务器、***及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,具体涉及一种容器登录方法、应用服务器、***及存储介质。
背景技术
Docker容器提供的容器技术允许在同一台主机或虚拟机上运行若干个容器(Container),每个容器就是一个独立的虚拟环境或应用。Docker容器为客户端提供了登陆容器的功能,允许用户进入到容器内部以操作主机或虚拟机的方式操作容器。Kubernetes是由谷歌开源的容器编排工具,其可以实现将若干个Docker容器组合成一个服务、动态地分配容器运行的主机等功能。
通常,用户登陆容器需要首先登入容器所在的主机上,接着再使用docker命令进入容器,比较繁琐。而Kubernetes通过容器所在集群的管理单元,定位到容器所在主机,读取该主机上docker的socket及对客户端提供websocket
API的方式,让用户可以直接利用Kubernetes的API登陆容器内部。
但这种方式仍然不够直观,需客户端知晓容器所在集群管理单元的具体地址才能发起websocket
API请求,会将集群的管理单元的直接访问方式暴露给客户端;且无法与动态的鉴权功能相结合。
因此,现有技术还有待于改进和发展。
发明内容
鉴于上述现有技术的不足之处,本申请的目的在于提供一种容器登录方法、应用服务器、***及存储介质,将便利登陆容器的需求与动态鉴权相结合,且不会暴露集群控制单元的真实地址,保证***的安全。
为了达到上述目的,本申请采取了以下技术方案:
一种容器登录方法,其包括如下步骤:
接收用户发起的容器服务访问请求并生成一随机令牌;
根据所述容器服务访问请求查询待访问服务所在集群的控制单元地址,并将所述随机令牌和控制单元地址组成键值对后存入缓存;
当接收到待访问服务中的容器登录请求时,将所述容器登录请求和随机令牌发送至代理服务器,其中,所述容器登录请求包括用户账号信息;
对所述用户账号信息和随机令牌进行鉴权,若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
一种容器登录的应用服务器,其包括:处理器、存储器和通信总线;
所述存储器上存储有可被所述处理器执行的计算机可读程序;
所述通信总线实现处理器和存储器之间的连接通信;
所述处理器执行所述计算机可读程序时实现如上任意一项所述的容器登录方法中的步骤。
一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现如上所述的容器登录方法中的步骤。
一种容器登录***,包括客户端和代理服务器,其还包括如上所述的容器登录的应用服务器;
所述应用服务器用于接收用户发起的容器服务访问请求并生成一随机令牌;以及根据所述容器服务访问请求查询待访问服务所在集群的控制单元地址,并将所述随机令牌和控制单元地址组成键值对后存入缓存;以及当接收到待访问服务中的容器登录请求时,将所述容器登录请求和随机令牌发送至代理服务器,其中,所述容器登录请求包括用户账号信息;以及对所述用户账号信息和随机令牌进行鉴权,若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器;
所述代理服务器用于将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
相较于现有技术,本申请提供的容器登录方法、应用服务器、***及存储介质中,所述容器登录方法通过接收用户发起的容器服务访问请求并生成一随机令牌;之后根据所述容器服务访问请求查询待访问服务所在集群的控制单元地址,并将所述随机令牌和控制单元地址组成键值对后存入缓存;之后当接收到待访问服务中的容器登录请求时,将所述容器登录请求和随机令牌发送至代理服务器,其中,所述容器登录请求包括用户账号信息;之后对所述用户账号信息和随机令牌进行鉴权,若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。将便利登陆容器的需求与动态鉴权相结合,且不会暴露集群控制单元的真实地址,保证***的安全。
附图说明
图1为本申请提供的容器登录方法的流程图;
图2为本申请提供的容器登录方法中步骤S20的流程图;
图3为本申请提供的容器登录方法中步骤S23的流程图;
图4为本申请提供的容器登录方法中步骤S30的流程图;
图5为本申请提供的容器登录方法中步骤S40的流程图;
图6为本申请提供的容器登录方法中步骤S43的流程图;
图7为本申请容器登录程序的较佳实施例的运行环境示意图;
图8为本申请安装容器登录程序的***较佳实施例的功能模块图;
图9为本申请提供的容器登录的应用服务器的结构框图。
具体实施方式
为使本申请的目的、技术方案及效果更加清楚、明确,以下参照附图并举实施例对本申请进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。
本申请是基于Kubernetes集群内的容器登录方法,Kubernetes是由谷歌开源的容器编排工具,其可以实现将若干个Docker容器组合成一个服务、动态地分配容器运行的主机等功能,其中Kubernetes
Service即Kubernetes服务是若干个容器的集合,一个Service即可为用户提供服务;Kubernetes集群是指一组主机或虚拟机,用于运行Kubernetes服务,Kubernetes管辖的服务内的容器实际上运行于集群的各个节点主机上;每个Kubernetes集群有且只有一个控制单元,即Kubernetes
Master,用于调度和管理Kubernetes服务,如分配某个服务的某个容器到集群内的某个节点上。Kubernetes
Master是一个进程,运行于某台主机或虚拟机上
请参阅图1,本申请提供的容器登录方法包括以下步骤:
S10、接收用户发起的容器服务访问请求并生成一随机令牌。
本实施例中,用户进入Kubernetes服务页面时请求访问容器服务,此时客户端接收该容器服务访问请求,并生成一随机令牌,所述容器服务访问请求中包含待访问的服务名称、容器名称以及用户权限等信息。
S20、根据所述容器服务访问请求查询待访问服务所在集群的控制单元地址,并将所述随机令牌和控制单元地址组成键值对后存入缓存。
当用户发起容器服务访问请求后,根据容器服务访问请求中的服务及容器信息查询待访问服务所在集群的控制单元地址,由于在Kubernetes的管理下,容器以服务的形式被组织起来,且容器可能在不同的主机上漂移,以达到更高的可用性。用户不需要知道所要登陆的容器具***于哪一台主机上,只需要知晓容器名称、所在服务及所在集群,接着通过Kubernetes客户端命令kubectl
exec或调用Kubernetes控制单元的websocket
API即可登陆容器,因此当用户进入服务页面并请求访问时先获取待访问服务所在集群的控制单元地址,并将所述随机令牌和控制单元地址组成键值对后存入缓存,以用户后续登录操作时的动态鉴权与控制单元地址查询,将集群的控制单元地址做了封装,提高***的安全性。具体查询过程请参阅图2,其为本申请提供的容器登录方法中步骤S20的流程图。
如图2所示,所述步骤S20包括:
S21、根据所述容器服务访问请求中的待访问服务信息获取其所在的集群名称并访问数据库;
S22、接收数据库反馈的根据集群名称查询的该集群的控制单元地址;
S23、将所述随机令牌作为键、控制单元地址作为值组成键值对后存入缓存。
本实施例中,在接收到容器服务服务请求后,根据该请求中的待访问服务信息,即服务名称、容器名称以及用户权限等,先对用户是否有权限访问该服务进行验证,若权限验证通过,则将该容器服务访问请求转发至容器服务,容器服务根据请求中的服务名称以及容器名称获取该容器所在的Kubernetes集群名称,并访问数据库,接收数据库反馈的根据Kubernetes集群名称查询到的该Kubernetes集群的控制单元地址,之后容器服务将生成的随机令牌键、获取到的控制单元地址作为值组成<随机令牌,控制单元地址>键值对,并存入缓存中,以便后续调用查询。
优选地,将该随机令牌返回至客户端的前端页面并作为变量保存,同时设置该随机令牌的超时时间与***会话的超时时间一致,即用户每次进入Kubernetes服务页面时均会生成随机令牌以及键值对,如果用户退出后再次进入Kubernetes服务页面时,则会再次生成新的随机令牌,上次保存的随机令牌会随着超时而失效,每次进入服务页面时,都会生成一个新的<随机令牌,控制单元地址>键值对以备用户当次登陆容器之用,提高后续鉴权以及登录的安全性。具体地键值对生成保存过程请参阅图3,其为本申请提供的容器登录方法中步骤S23的流程图。
如图3所示,所述步骤S23包括:
S231、将所述随机令牌作为键、控制单元地址作为值组成键值对;
S232、搜索缓存中是否存在以相同的随机令牌作为键的键值对,若存在则重新生成随机令牌;若不存在则将当前键值对存入缓存中。
本实施例中,在生成并保存键值对时,先将生成的随机令牌以及获取到的控制单元地址组成<随机令牌,控制单元地址>键值对,之后检查缓存(如redis)中是否有以同样的随机令牌作为键的键值对,如果有则重新生成新的随机令牌,组成新的键值对后再次检查,如果没有则直接将当前的键值对存入缓存中,避免发生缓存中存在以相同随机令牌作为键、不同控制单元地址作为值的情况,确保后续获取控制单元地址的准确性。
S30、当接收到待访问服务中的容器登录请求时,将所述容器登录请求和随机令牌发送至代理服务器,其中,所述容器登录请求包括随机令牌。
本实施例中,当用户需要登录待访问Kubernetes服务中的容器时,发起容器登录请求,所述容器登录请求包括用户账号信息,当接收到该容器登录请求后将所述容器登录请求和随机令牌发送至代理服务器,通过代理服务器来进行后续的登录过程,具体实施时,代理服务器采用Nginx,Nginx是一个开源的代理服务,可以代理用户发起的请求,并将请求转发,通过代理服务器可避免在登录容器时暴露真实的控制单元地址,保证***的安全。具体请参阅图4,其为本申请提供的容器登录方法中步骤S30的流程图。
如图4所示,所述步骤S30包括:
S31、检测待访问服务中登录容器的虚拟按钮是否被触发;
S32、当登录容器的虚拟按钮被触发时,向代理服务器发送容器登录请求和随机令牌,所述容器登录请求中包括用户账号信息。
本实施例中,用户通过Kubernetes服务详情页面上的登录容器虚拟按钮触发登录请求,当检测到登录容器的虚拟按钮被触发时,则携带用户账号信息以及随机令牌向代理服务器发送容器登录请求,以用于后续的权限验证以及控制单元地址的获取,其中用户账号信息包括用户名、密码、以及用户权限等等。
S40、对所述用户账号信息和随机令牌进行鉴权,若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
本实施例中,当向代理服务器发送了容器登录请求和随机令牌后,先对所述用户账号信息和随机令牌进行鉴权,验证用户的账号信息以及随机令牌是否正确,若鉴权通过则根据该随机令牌在缓存中红搜索获取到对应的控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接,从而让客户端成功登陆容器。本实施例中,用户可以从既有的Kubernetes容器服务平台中直接登陆容器,保证容器登录的便利性,同时在登录容器时会对其进行鉴权,解决了用户便利登陆容器的需求与权限认证的限制之间的矛盾,既保证了权限的限制,又满足了用户便利登陆容器的需求,且通过代理服务器的请求转发,使得真实的Kubernetes控制单元地址不会暴露给用户,只会暴露代理服务器的地址,极大地提高了登录容器的安全性。具体请参阅图5,其为本申请提供的容器登录方法中步骤S40的流程图。
如图5所示,所述步骤S40包括:
S41、根据所述用户账号信息和随机令牌发起获取控制单元地址的子请求;
S42、对所述用户账号信息和随机令牌进行鉴权,并返回鉴权结果至代理服务器;
S43、若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
本实施例中,代理服务器在接收到登录容器请求后,将先发起获取控制单元地址的子请求,具体实施时,采用Nginx作为代理服务器,Nginx有一个开源模块ngx_http_auth_request_module提供了子请求的功能,即Nginx将接收到的请求向其代理的真实服务转发前,先发起一个子请求,只有子请求的响应正常(响应状态码为200-299)时,才会转发原请求,基于此,代理服务器接收到登录容器请求后,并不立即转发该登录容器请求,而是先携带用户账号信息和随机令牌向鉴权服务发起获取控制单元地址的子请求,鉴权服务对所述用户账号信息和随机令牌进行鉴权,并返回鉴权结果至代理服务器;具体为鉴权服务验证用户账号信息是否正确,包括验证用户名和密码是否正确,用户是否有权限登录容器等等,若正确则将获取控制单元地址的子请求转发至容器服务;否则不转发该子请求,直接返回鉴权失败信息至代理服务器。例如,请求中的用户账号信息有误或不带用户账号信息,则鉴权服务将拦截请求,返回未授权响应,因此子请求失败,代理服务器不会转发请求到真实的控制单元地址;当用户账号信息正确时,鉴权服务将该子请求转发至容器服务,由容器服务根据随机令牌在缓存中获取对应的控制单元地址。因此在用户进行容器登陆前,结合鉴权服务对其账号信息进行了动态的权限认证,实现便利登录与动态鉴权的结合,具体请参阅图6,其为本申请提供的容器登录方法中步骤S43的流程图。
如图6所示,所述步骤S43包括:
S431、容器服务根据随机令牌在缓存中搜索对应的控制单元地址;
S432、若随机令牌缺失或有误,则返回子请求失败信息至代理服务器;若随机令牌无误则获取对应的控制单元地址并返回给代理服务器;
S433、代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
当用户账号信息验证通过,鉴权服务将子请求转发至容器服务后,容器服务将根据随机令牌在缓存中搜索对应的控制单元地址,此时若随机令牌缺失或者有误,则在缓存中根据该随机令牌无法获取真实的控制单元地址,返回未找到响应,子请求失败,代理服务器不会转发请求到真实的控制单元地址;若随机令牌无误,则容器服务根据随机令牌在缓存中获取对应的控制单元地址并返回给代理服务器,此时子请求成功,代理服务器将原容器登录请求转发至对应的控制单元,访问该控制单元的websocket
API,从而为客户端及控制单元建立了连接,让客户端成功登陆容器,实现了将登陆容器所需要访问的集群控制单元的真实地址做了封装,用户无法截获此信息,保证了***的安全。
如图7所示,基于上述容器登录方法,本申请还相应提供了一种容器登录的应用服务器,所述容器登录的应用服务器可以是移动终端、桌上型计算机、笔记本、掌上电脑及服务器等计算设备。该容器登录的应用服务器包括处理器10、存储器20及显示器30。图7仅示出了容器登录的应用服务器的部分组件,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。
所述存储器20在一些实施例中可以是所述容器登录的应用服务器的内部存储单元,例如容器登录的应用服务器的硬盘或内存。所述存储器20在另一些实施例中也可以是所述容器登录的应用服务器的外部存储设备,例如所述容器登录的应用服务器上配备的插接式硬盘,智能存储卡(Smart
Media Card, SMC),安全数字(Secure Digital, SD)卡,闪存卡(Flash
Card)等。进一步地,所述存储器20还可以既包括所容器登录的应用服务器的内部存储单元也包括外部存储设备。所述存储器20用于存储安装于所述容器登录的应用服务器的应用软件及各类数据,例如所述安装容器登录的应用服务器的程序代码等。所述存储器20还可以用于暂时地存储已经输出或者将要输出的数据。在一实施例中,存储器20上存储有容器登录程序40,该容器登录程序40可被处理器10所执行,从而实现本申请中容器登录方法。
所述处理器10在一些实施例中可以是一中央处理器(Central Processing Unit,
CPU),微处理器或其他数据处理芯片,用于运行所述存储器20中存储的程序代码或处理数据,例如执行所述容器登录方法等。
所述显示器30在一些实施例中可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic
Light-Emitting
Diode,有机发光二极管)触摸器等。所述显示器30用于显示在所述容器登录的应用服务器的信息以及用于显示可视化的用户界面。所述容器登录的应用服务器的部件10-30通过***总线相互通信。
在一实施例中,当处理器10执行所述存储器20中容器登录程序40时实现上述容器登录方法中各实施例的步骤,此处不再赘述。
请参阅图8,其为本申请安装容器登录程序的***较佳实施例的功能模块图。在本实施例中,安装容器登录程序的***可以被分割成一个或多个模块,所述一个或者多个模块被存储于所述存储器20中,并由一个或多个处理器(本实施例为所述处理器10)所执行,以完成本申请。例如,在图8中,安装容器登录程序的***可以被分割成生成模块21、查询模块22、登录模块23和鉴权获取模块24。本申请所称的模块是指能够完成特定功能的一系列计算机程序指令段,比程序更适合于描述所述容器登录程序在所述容器登录的应用服务器中的执行过程。以下描述将具体介绍所述模块21-24的功能。
生成块21,用于接收用户发起的容器服务访问请求并生成一随机令牌;
查询模块22,用于根据所述容器服务访问请求查询待访问服务所在集群的控制单元地址,并将所述随机令牌和控制单元地址组成键值对后存入缓存;
登录模块23,用于当接收到待访问服务中的容器登录请求时,将所述容器登录请求和随机令牌发送至代理服务器,其中,所述容器登录请求包括用户账号信息;
鉴权获取模块24,用于对所述用户账号信息和随机令牌进行鉴权,若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器。
查询模块22具体包括:
名称获取单元,用于根据所述容器服务访问请求中的待访问服务信息获取其所在的集群名称并访问数据库;
接收单元,用于接收数据库反馈的根据集群名称查询的该集群的控制单元地址;
生成单元,用于将所述随机令牌作为键、控制单元地址作为值组成键值对后存入缓存。
所述生成单元包括:
键值对生成子单元,用于将所述随机令牌作为键、控制单元地址作为值组成键值对;
搜索单元,用于搜索缓存中是否存在以相同的随机令牌作为键的键值对,若存在则重新生成随机令牌;若不存在则将当前键值对存入缓存中。
所述登录模块23包括:
检测单元,用于检测待访问服务中登录容器的虚拟按钮是否被触发;
发送单元,用于当登录容器的虚拟按钮被触发时,向代理服务器发送容器登录请求和随机令牌,所述容器登录请求中包括用户账号信息。
所述鉴权获取模块24包括:
子请求发起单元,用于根据所述用户账号信息和随机令牌发起获取控制单元地址的子请求;
鉴权单元,用于对所述用户账号信息和随机令牌进行鉴权,并返回鉴权结果至代理服务器;
地址获取单元,用于鉴权通过时根据所述随机令牌获取控制单元地址并返回给代理服务器。
所述地址获取单元包括:
地址搜索子单元,用于容器服务根据随机令牌在缓存中搜索对应的控制单元地址;
反馈子单元,用于若随机令牌缺失或有误,则返回子请求失败信息至代理服务器;若随机令牌无误则获取对应的控制单元地址并返回给代理服务器。
基于上述容器登录方法和应用服务器,本申请还相应提供一种容器登录***,请参阅图9,其包括客户端101、代理服务器102和如上所述的容器登录的应用服务器103。
其中所述应用服务器103用于接收用户发起的容器服务访问请求并生成一随机令牌;以及根据所述容器服务访问请求查询待访问服务所在集群的控制单元地址,并将所述随机令牌和控制单元地址组成键值对后存入缓存;以及当接收到待访问服务中的容器登录请求时,将所述容器登录请求和随机令牌发送至代理服务器102,其中,所述容器登录请求包括用户账号信息;以及对所述用户账号信息和随机令牌进行鉴权,若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器102;所述代理服务器102用于将所述登录请求发送至该控制单元地址,为客户端101和控制单元建立连接。
综上所述,本申请提供的容器登录方法、应用服务器、***及存储介质中,所述容器登录方法通过接收用户发起的容器服务访问请求并生成一随机令牌;之后根据所述容器服务访问请求查询待访问服务所在集群的控制单元地址,并将所述随机令牌和控制单元地址组成键值对后存入缓存;之后当接收到待访问服务中的容器登录请求时,将所述容器登录请求和随机令牌发送至代理服务器,其中,所述容器登录请求包括用户账号信息;之后对所述用户账号信息和随机令牌进行鉴权,若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。将便利登陆容器的需求与动态鉴权相结合,且不会暴露集群控制单元的真实地址,保证***的安全。
当然,本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关硬件(如处理器,控制器等)来完成,所述的程序可存储于一计算机可读取的存储介质中,该程序在执行时可包括如上述各方法实施例的流程。其中所述的存储介质可为存储器、磁碟、光盘等。
应当理解的是,本申请的应用不限于上述的举例,对本领域普通技术人员来说,可以根据上述说明加以改进或变换,所有这些改进和变换都应属于本申请所附权利要求的保护范围。
Claims (28)
- 一种容器登录方法,其特征在于,包括如下步骤:接收用户发起的容器服务访问请求并生成一随机令牌;根据所述容器服务访问请求查询待访问服务所在集群的控制单元地址,并将所述随机令牌和控制单元地址组成键值对后存入缓存;当接收到待访问服务中的容器登录请求时,将所述容器登录请求和随机令牌发送至代理服务器,其中,所述容器登录请求包括用户账号信息;对所述用户账号信息和随机令牌进行鉴权,若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
- 根据权利要求1所述的容器登录方法,其特征在于,所述根据所述容器服务访问请求查询待访问服务所在集群的控制单元地址,并将所述随机令牌和控制单元地址组成键值对后存入缓存包括:根据所述容器服务访问请求中的待访问服务信息获取其所在的集群名称并访问数据库;接收数据库反馈的根据集群名称查询的该集群的控制单元地址;将所述随机令牌作为键、控制单元地址作为值组成键值对后存入缓存。
- 根据权利要求2所述的容器登录方法,其特征在于,所述将所述随机令牌作为键、控制单元地址作为值组成键值对后存入缓存的步骤包括:将所述随机令牌作为键、控制单元地址作为值组成键值对;搜索缓存中是否存在以相同的随机令牌作为键的键值对,若存在则重新生成随机令牌;若不存在则将当前键值对存入缓存中。
- 根据权利要求1所述的容器登录方法,其特征在于,所述当接收到待访问服务中的容器登录请求时,将所述容器登录请求和随机令牌发送至代理服务器,其中,所述容器登录请求包括用户账号信息的步骤包括:检测待访问服务中登录容器的虚拟按钮是否被触发;当登录容器的虚拟按钮被触发时,向代理服务器发送容器登录请求和随机令牌,所述容器登录请求中包括用户账号信息。
- 根据权利要求1所述的容器登录方法,其特征在于,所述对所述用户账号信息和随机令牌进行鉴权,若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接的步骤包括:根据所述用户账号信息和随机令牌发起获取控制单元地址的子请求;对所述用户账号信息和随机令牌进行鉴权,并返回鉴权结果至代理服务器;若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
- 根据权利要求5所述的容器登录方法,其特征在于,所述对所述用户账号信息和随机令牌进行鉴权,并返回鉴权结果至代理服务器的步骤包括:验证用户账户信息是否正确,若正确则将获取控制单元地址的子请求转发至容器服务;否则不转发该子请求,直接返回鉴权失败信息至代理服务器。
- 根据权利要求6所述的容器登录方法,其特征在于,所述若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接的步骤包括:容器服务根据随机令牌在缓存中搜索对应的控制单元地址;若随机令牌缺失或有误,则返回子请求失败信息至代理服务器;若随机令牌无误则获取对应的控制单元地址并返回给代理服务器;代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
- 一种容器登录的应用服务器,其特征在于,包括:处理器、存储器和通信总线;所述存储器上存储有可被所述处理器执行的计算机可读程序;所述通信总线实现处理器和存储器之间的连接通信;所述处理器执行所述计算机可读程序时实现如下步骤:接收用户发起的容器服务访问请求并生成一随机令牌;根据所述容器服务访问请求查询待访问服务所在集群的控制单元地址,并将所述随机令牌和控制单元地址组成键值对后存入缓存;当接收到待访问服务中的容器登录请求时,将所述容器登录请求和随机令牌发送至代理服务器,其中,所述容器登录请求包括用户账号信息;对所述用户账号信息和随机令牌进行鉴权,若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
- 根据权利要求8所述的应用服务器,其特征在于,所述根据所述容器服务访问请求查询待访问服务所在集群的控制单元地址,并将所述随机令牌和控制单元地址组成键值对后存入缓存包括:根据所述容器服务访问请求中的待访问服务信息获取其所在的集群名称并访问数据库;接收数据库反馈的根据集群名称查询的该集群的控制单元地址;将所述随机令牌作为键、控制单元地址作为值组成键值对后存入缓存。
- 根据权利要求9所述的应用服务器,其特征在于,所述将所述随机令牌作为键、控制单元地址作为值组成键值对后存入缓存的步骤包括:将所述随机令牌作为键、控制单元地址作为值组成键值对;搜索缓存中是否存在以相同的随机令牌作为键的键值对,若存在则重新生成随机令牌;若不存在则将当前键值对存入缓存中。
- 根据权利要求8所述的应用服务器,其特征在于,所述当接收到待访问服务中的容器登录请求时,将所述容器登录请求和随机令牌发送至代理服务器,其中,所述容器登录请求包括用户账号信息的步骤包括:检测待访问服务中登录容器的虚拟按钮是否被触发;当登录容器的虚拟按钮被触发时,向代理服务器发送容器登录请求和随机令牌,所述容器登录请求中包括用户账号信息。
- 根据权利要求8所述的应用服务器,其特征在于,所述对所述用户账号信息和随机令牌进行鉴权,若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接的步骤包括:根据所述用户账号信息和随机令牌发起获取控制单元地址的子请求;对所述用户账号信息和随机令牌进行鉴权,并返回鉴权结果至代理服务器;若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
- 根据权利要求12所述的应用服务器,其特征在于,所述对所述用户账号信息和随机令牌进行鉴权,并返回鉴权结果至代理服务器的步骤包括:验证用户账户信息是否正确,若正确则将获取控制单元地址的子请求转发至容器服务;否则不转发该子请求,直接返回鉴权失败信息至代理服务器。
- 根据权利要求13所述的应用服务器,其特征在于,所述若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接的步骤包括:容器服务根据随机令牌在缓存中搜索对应的控制单元地址;若随机令牌缺失或有误,则返回子请求失败信息至代理服务器;若随机令牌无误则获取对应的控制单元地址并返回给代理服务器;代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现如下步骤:接收用户发起的容器服务访问请求并生成一随机令牌;根据所述容器服务访问请求查询待访问服务所在集群的控制单元地址,并将所述随机令牌和控制单元地址组成键值对后存入缓存;当接收到待访问服务中的容器登录请求时,将所述容器登录请求和随机令牌发送至代理服务器,其中,所述容器登录请求包括用户账号信息;对所述用户账号信息和随机令牌进行鉴权,若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
- 根据权利要求15所述的计算机可读存储介质,其特征在于,所述一个或者多个程序可被一个或者多个处理器执行,还实现如下步骤:根据所述容器服务访问请求中的待访问服务信息获取其所在的集群名称并访问数据库;接收数据库反馈的根据集群名称查询的该集群的控制单元地址;将所述随机令牌作为键、控制单元地址作为值组成键值对后存入缓存。
- 根据权利要求16所述的计算机可读存储介质,其特征在于,所述一个或者多个程序可被一个或者多个处理器执行,还实现如下步骤:将所述随机令牌作为键、控制单元地址作为值组成键值对;搜索缓存中是否存在以相同的随机令牌作为键的键值对,若存在则重新生成随机令牌;若不存在则将当前键值对存入缓存中。
- 根据权利要求15所述的计算机可读存储介质,其特征在于,所述一个或者多个程序可被一个或者多个处理器执行,还实现如下步骤:检测待访问服务中登录容器的虚拟按钮是否被触发;当登录容器的虚拟按钮被触发时,向代理服务器发送容器登录请求和随机令牌,所述容器登录请求中包括用户账号信息。
- 根据权利要求15所述的计算机可读存储介质,其特征在于,所述对所述用户账号信息和随机令牌进行鉴权,若鉴权通过,则所述一个或者多个程序可被一个或者多个处理器执行,还实现如下步骤:根据所述用户账号信息和随机令牌发起获取控制单元地址的子请求;对所述用户账号信息和随机令牌进行鉴权,并返回鉴权结果至代理服务器;若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
- 根据权利要求19所述的计算机可读存储介质,其特征在于,所述一个或者多个程序可被一个或者多个处理器执行,还实现如下步骤:验证用户账户信息是否正确,若正确则将获取控制单元地址的子请求转发至容器服务;否则不转发该子请求,直接返回鉴权失败信息至代理服务器。
- 根据权利要求20所述的计算机可读存储介质,其特征在于,所述若鉴权通过,则所述一个或者多个程序可被一个或者多个处理器执行,还实现如下步骤:容器服务根据随机令牌在缓存中搜索对应的控制单元地址;若随机令牌缺失或有误,则返回子请求失败信息至代理服务器;若随机令牌无误则获取对应的控制单元地址并返回给代理服务器;代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
- 一种容器登录***,包括客户端和代理服务器,其特征在于,还包括容器登录的应用服务器;所述应用服务器用于接收用户发起的容器服务访问请求并生成一随机令牌;以及根据所述容器服务访问请求查询待访问服务所在集群的控制单元地址,并将所述随机令牌和控制单元地址组成键值对后存入缓存;以及当接收到待访问服务中的容器登录请求时,将所述容器登录请求和随机令牌发送至代理服务器,其中,所述容器登录请求包括用户账号信息;以及对所述用户账号信息和随机令牌进行鉴权,若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器;所述代理服务器用于将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
- 根据权利要求22所述的容器登录***,其特征在于,所述应用服务器还用于根据所述容器服务访问请求中的待访问服务信息获取其所在的集群名称并访问数据库;接收数据库反馈的根据集群名称查询的该集群的控制单元地址;将所述随机令牌作为键、控制单元地址作为值组成键值对后存入缓存。
- 根据权利要求23所述的容器登录***,其特征在于,所述应用服务器还用于:将所述随机令牌作为键、控制单元地址作为值组成键值对;搜索缓存中是否存在以相同的随机令牌作为键的键值对,若存在则重新生成随机令牌;若不存在则将当前键值对存入缓存中。
- 根据权利要求22所述的容器登录***,其特征在于,所述应用服务器还用于:检测待访问服务中登录容器的虚拟按钮是否被触发;当登录容器的虚拟按钮被触发时,向代理服务器发送容器登录请求和随机令牌,所述容器登录请求中包括用户账号信息。
- 根据权利要求22所述的容器登录***,其特征在于,所述应用服务器还用于:根据所述用户账号信息和随机令牌发起获取控制单元地址的子请求;对所述用户账号信息和随机令牌进行鉴权,并返回鉴权结果至代理服务器;若鉴权通过,则根据所述随机令牌获取控制单元地址并返回给代理服务器,由代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
- 根据权利要求26所述的容器登录***,其特征在于,所述应用服务器还用于:验证用户账户信息是否正确,若正确则将获取控制单元地址的子请求转发至容器服务;否则不转发该子请求,直接返回鉴权失败信息至代理服务器。
- 根据权利要求27所述的容器登录***,其特征在于,所述应用服务器还用于:容器服务根据随机令牌在缓存中搜索对应的控制单元地址;若随机令牌缺失或有误,则返回子请求失败信息至代理服务器;若随机令牌无误则获取对应的控制单元地址并返回给代理服务器;代理服务器将所述容器登录请求发送至该控制单元地址,为客户端和控制单元建立连接。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711482082.8A CN107948203B (zh) | 2017-12-29 | 2017-12-29 | 一种容器登录方法、应用服务器、***及存储介质 |
CN201711482082.8 | 2017-12-29 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2019128007A1 true WO2019128007A1 (zh) | 2019-07-04 |
Family
ID=61938062
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2018/084466 WO2019128007A1 (zh) | 2017-12-29 | 2018-04-25 | 一种容器登录方法、应用服务器、***及存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN107948203B (zh) |
WO (1) | WO2019128007A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114500537A (zh) * | 2022-03-24 | 2022-05-13 | 杭州博盾习言科技有限公司 | 容器服务的访问方法、***、存储介质及电子设备 |
Families Citing this family (21)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107948203B (zh) * | 2017-12-29 | 2019-09-13 | 平安科技(深圳)有限公司 | 一种容器登录方法、应用服务器、***及存储介质 |
CN109104417B (zh) * | 2018-07-24 | 2021-08-20 | 成都安恒信息技术有限公司 | 一种运用于运维审计***的用户鉴权和选路方法 |
CN110912865A (zh) * | 2018-09-18 | 2020-03-24 | 深圳市鸿合创新信息技术有限责任公司 | 一种安全访问控制方法及服务器、电子设备 |
CN109543129B (zh) * | 2018-10-26 | 2022-04-12 | 深圳点猫科技有限公司 | 一种基于教育资源平台的网络请求方法及装置 |
CN111245774B (zh) * | 2018-11-29 | 2023-09-26 | 阿里巴巴集团控股有限公司 | 资源请求处理方法、装置和*** |
CN109831435B (zh) * | 2019-01-31 | 2021-06-01 | 广州银云信息科技有限公司 | 一种数据库操作方法、***及代理服务器和存储介质 |
US11128617B2 (en) * | 2019-01-31 | 2021-09-21 | Baidu Usa Llc | Token based secure multiparty computing framework using a restricted operating environment |
CN110175077A (zh) * | 2019-05-27 | 2019-08-27 | 浪潮云信息技术有限公司 | 一种基于命令管理容器资源的方法及*** |
CN112148348B (zh) * | 2019-06-28 | 2023-10-20 | 杭州海康威视数字技术股份有限公司 | 任务处理方法、装置及存储介质 |
CN112994909B (zh) * | 2019-12-12 | 2022-12-06 | 北京金山云网络技术有限公司 | 管理Kubernetes集群的方法、装置、设备及存储介质 |
CN113141386B (zh) * | 2020-01-19 | 2023-01-06 | 北京百度网讯科技有限公司 | 私有网络中Kubernetes集群的接入方法、装置、设备和介质 |
CN111629059B (zh) * | 2020-05-27 | 2022-12-16 | 浪潮电子信息产业股份有限公司 | 一种集群通信方法、***、设备及计算机可读存储介质 |
CN111726399B (zh) * | 2020-06-08 | 2022-10-18 | 中国工商银行股份有限公司 | Docker容器安全访问方法及装置 |
CN113742711A (zh) * | 2020-10-20 | 2021-12-03 | 北京沃东天骏信息技术有限公司 | 容器访问的方法和装置 |
CN112383613B (zh) * | 2020-11-11 | 2023-05-12 | 杭州飞致云信息科技有限公司 | 容器集群***的管理方法和装置 |
CN112306640A (zh) * | 2020-11-12 | 2021-02-02 | 广州方硅信息技术有限公司 | 容器分配方法及其装置、设备、介质 |
CN113630447B (zh) * | 2021-07-22 | 2023-04-07 | 济南浪潮数据技术有限公司 | 一种基于web的云服务提供方法、***及存储介质 |
CN113938289B (zh) * | 2021-08-31 | 2024-03-01 | 联通沃音乐文化有限公司 | 一种代理客户端预防拦截机制被滥用和攻击的***和方法 |
CN114050911B (zh) * | 2021-09-27 | 2023-05-16 | 度小满科技(北京)有限公司 | 一种容器远程登录方法及*** |
CN114615329A (zh) * | 2022-03-08 | 2022-06-10 | 北京从云科技有限公司 | 一种无客户端sdp架构实现方法及*** |
CN117978406B (zh) * | 2024-02-20 | 2024-07-19 | 国网江苏省电力有限公司信息通信分公司 | 一种异构多容器集群调度方法、***、设备及存储介质 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106685949A (zh) * | 2016-12-24 | 2017-05-17 | 上海七牛信息技术有限公司 | 一种容器访问方法、装置以及*** |
CN106899544A (zh) * | 2015-12-17 | 2017-06-27 | 腾讯科技(深圳)有限公司 | 基于Docker的容器登录方法、装置和*** |
CN107395642A (zh) * | 2017-08-31 | 2017-11-24 | 郑州云海信息技术有限公司 | 基于Websocket访问启动TLS认证的Docker容器的方法及*** |
CN107493344A (zh) * | 2017-08-29 | 2017-12-19 | 郑州云海信息技术有限公司 | 一种Web访问Docker容器的方法及*** |
CN107948203A (zh) * | 2017-12-29 | 2018-04-20 | 平安科技(深圳)有限公司 | 一种容器登录方法、应用服务器、***及存储介质 |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101810762B1 (ko) * | 2015-12-07 | 2017-12-19 | 한양대학교 에리카산학협력단 | 클라우드 환경에서 hdfs 기반의 도커 컨테이너 보안 로그 분석 방법 및 시스템 |
-
2017
- 2017-12-29 CN CN201711482082.8A patent/CN107948203B/zh active Active
-
2018
- 2018-04-25 WO PCT/CN2018/084466 patent/WO2019128007A1/zh active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106899544A (zh) * | 2015-12-17 | 2017-06-27 | 腾讯科技(深圳)有限公司 | 基于Docker的容器登录方法、装置和*** |
CN106685949A (zh) * | 2016-12-24 | 2017-05-17 | 上海七牛信息技术有限公司 | 一种容器访问方法、装置以及*** |
CN107493344A (zh) * | 2017-08-29 | 2017-12-19 | 郑州云海信息技术有限公司 | 一种Web访问Docker容器的方法及*** |
CN107395642A (zh) * | 2017-08-31 | 2017-11-24 | 郑州云海信息技术有限公司 | 基于Websocket访问启动TLS认证的Docker容器的方法及*** |
CN107948203A (zh) * | 2017-12-29 | 2018-04-20 | 平安科技(深圳)有限公司 | 一种容器登录方法、应用服务器、***及存储介质 |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114500537A (zh) * | 2022-03-24 | 2022-05-13 | 杭州博盾习言科技有限公司 | 容器服务的访问方法、***、存储介质及电子设备 |
Also Published As
Publication number | Publication date |
---|---|
CN107948203A (zh) | 2018-04-20 |
CN107948203B (zh) | 2019-09-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2019128007A1 (zh) | 一种容器登录方法、应用服务器、***及存储介质 | |
US10148643B2 (en) | Authenticating or controlling software application on end user device | |
WO2019227557A1 (zh) | 密钥管理方法、设备、存储介质及装置 | |
US10230725B2 (en) | Edge protection for internal identity providers | |
WO2019127971A1 (zh) | 镜像仓库的镜像同步方法、***、设备及存储介质 | |
US10902107B2 (en) | Information processing system, information processing device, server device, method of controlling information processing system, and program | |
WO2019192085A1 (zh) | 银企直联通信方法、装置、设备及计算机可读存储介质 | |
WO2016169410A1 (zh) | 登录方法、服务器和登录*** | |
US10826895B1 (en) | System and method for secure authenticated user session handoff | |
WO2013065915A1 (ko) | 보안 영역과 비보안 영역 사이의 보안 연동 방법 및 보안 어플리케이션 다운로드 관리방법, 관리서버, 단말기, 및 이를 적용한 관리시스템 | |
WO2020189926A1 (ko) | 블록체인 네트워크를 이용하여 사용자의 아이덴티티를 관리하는 방법 및 서버, 그리고, 블록체인 네트워크 기반의 사용자 아이덴티티를 이용하여 사용자를 인증하는 방법 및 단말 | |
WO2020189927A1 (ko) | 블록체인 네트워크를 이용하여 사용자의 아이덴티티를 관리하는 방법 및 서버, 그리고, 블록체인 네트워크 기반의 사용자 아이덴티티를 이용하여 사용자를 인증하는 방법 및 단말 | |
JP2017535896A (ja) | デバイス間にわたるコンテンツワイプアクションのローミング | |
US20180343118A1 (en) | Method employed in user authentication system and information processing apparatus included in user authentication system | |
WO2019218441A1 (zh) | 请求处理方法、装置、设备及存储介质 | |
WO2020224247A1 (zh) | 基于区块链的数据溯源方法、装置、设备及可读存储介质 | |
WO2018098881A1 (zh) | 应用程序的访问处理方法及装置 | |
WO2013075613A1 (zh) | 网络服务提供方法及装置 | |
JP2019220238A (ja) | レガシー統合のためのコンピュータ読み取り可能な記憶媒体ならびにそれを使用するための方法およびシステム | |
US20230336541A1 (en) | Method and device for two-factor authentication, computer device, and storage medium | |
WO2019161597A1 (zh) | 基于即时通讯的信息发送方法、装置、设备和存储介质 | |
US11050560B2 (en) | Secure reusable access tokens | |
CN111965996A (zh) | 智能设备控制方法、装置、设备和存储介质 | |
WO2018076870A1 (zh) | 数据处理方法、装置、存储介质、服务器及数据处理*** | |
WO2019024472A1 (zh) | 数据操作方法、装置及计算机可读存储介质 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 18894428 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 07.10.2020) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 18894428 Country of ref document: EP Kind code of ref document: A1 |