Linux application construction access method and device, medium, and equipment
By building container images and remotely connecting to hosts through a bastion host, the lack of application publishing capabilities in the Linux operating system is resolved, remote access and convenient deployment of Linux applications are achieved, and system stability and compatibility are improved.
Patent Information
- Application Number
- CN202411082098.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-08-08
AI Technical Summary
In the absence of a Windows Server machine, the Linux operating system lacks application publishing capabilities similar to Windows Server, making remote access to Linux applications impossible.
Build a container image through the bastion host, use the secure shell protocol to remotely connect to the host, create a container and render the desktop environment to achieve access to Linux applications.
It realizes the function of creating and accessing Linux applications in the Linux operating system, has the advantages of stability, compatibility and portability, provides convenient web browser access, and releases host resources through scheduled tasks, reducing porting costs and risks.
Smart Images

Figure CN119011575B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Linux applications, and in particular to a method, device, medium and equipment for constructing and accessing Linux applications. Background Art
[0002] The Windows Server version provides a remote application publishing mode, which publishes applications on the operating system as remotely accessible services, allowing users to access them using their usernames and passwords. However, in some use cases, the corresponding Windows Server machines are unavailable, and a domestic Linux operating system must be used. Because the Linux operating system lacks application publishing capabilities similar to those in Windows Server, Linux applications cannot be accessed in the same way as Windows applications. Summary of the Invention
[0003] In response to at least one of the above technical problems, embodiments of the present invention provide a method, apparatus, medium, and device for constructing and accessing a Linux application.
[0004] According to a first aspect, an embodiment of the present invention provides a method for constructing and accessing a Linux application, which is performed by a bastion host. The method includes:
[0005] Build a container image of a specified Linux application on the host by configuring the container text file;
[0006] When receiving an access request for the specified Linux application initiated by a user on a browser, obtaining host information corresponding to the host where the specified Linux application is located;
[0007] Remotely connect to the host where the specified Linux application is located through the secure shell protocol according to the host information;
[0008] Based on the container image of the specified Linux application, create a container corresponding to the specified Linux application on the host through a Linux application service script, and configure container information corresponding to the container;
[0009] According to the host information and the container information, the operating system in the container is connected, a desktop environment is rendered, and the specified Linux application is started in the desktop environment to enable the user to access the specified Linux application.
[0010] In one embodiment, the method further comprises:
[0011] Storing the host information and the container information in a configuration table of the specified Linux application;
[0012] When the user ends accessing the specified Linux application, the session state of the Linux application is set to ended; based on the host information and the container information, the container deletion function in the Linux application service script is called through the secure shell protocol to delete the container, and the deletion result is saved in the configuration table.
[0013] In one embodiment, the method further comprises:
[0014] Read the configuration table regularly through a scheduled task;
[0015] Extract the host information and container information corresponding to the container whose session status is ended and whose deletion result is failed from the read data;
[0016] According to the host information and the container information, the container deletion function in the Linux application service script is called through the secure shell protocol to delete the container again.
[0017] In one embodiment, the host information includes the host IP, the host secure shell protocol port, the host username and the host password; and / or the container information includes the container code, the container access port, the container username and the container password.
[0018] In one embodiment, connecting to the operating system in the container according to the host information and the container information, rendering a desktop environment, and starting the specified Linux application in the desktop environment includes:
[0019] According to the host IP, the container access port, the container user name, and the machine password, the remote desktop protocol access function provided by the remote desktop agent service is called to connect to the operating system in the container;
[0020] Among them, the container access port points to the port of the remote desktop protocol service inside the container; when the bastion host is connected to the container, the remote desktop protocol service is triggered, and the lightweight desktop environment is loaded. When loading the lightweight desktop environment, the desktop configuration information of the lightweight desktop environment is loaded, and the lightweight desktop environment is rendered according to the desktop configuration information, and the specified Linux application is automatically started in the rendered lightweight desktop environment.
[0021] In one embodiment, the remote desktop proxy service is an access plug-in pre-installed on the bastion host. The installation and operation process of the remote desktop proxy service includes: obtaining the container image of the remote desktop proxy service through a container pull command, starting the container image of the remote desktop proxy service through a container run command, and providing the container port of the remote desktop proxy service for the bastion host to call the remote desktop proxy service.
[0022] In one embodiment, building a container image of a specified Linux application on a host by configuring a container text file includes:
[0023] Configuring the base image of the specified Linux application in the container text file;
[0024] Updating the apt source for managing software packages in the container text file and installing xfce4-related software packages, where xfce4 is a lightweight desktop environment;
[0025] Specifying the lightweight desktop environment to be started in the container text file;
[0026] Configuring the display language of the Linux distribution operating system in the container text file;
[0027] Configure the running script when the container is started in the container text file.
[0028] According to a second aspect, an apparatus for constructing and accessing a Linux application provided by an embodiment of the present invention is deployed on a bastion host, and the apparatus includes:
[0029] The first building module is used to build a container image of a specified Linux application on the host by configuring a container text file;
[0030] A first acquisition module is configured to, upon receiving an access request for the specified Linux application initiated by a user on a browser, acquire host information corresponding to the host where the specified Linux application is located;
[0031] A host connection module, configured to remotely connect to the host where the specified Linux application is located through a secure shell protocol according to the host information;
[0032] A second construction module is configured to create a container corresponding to the specified Linux application on the host through a Linux application service script based on the container image of the specified Linux application, and configure container information corresponding to the container;
[0033] The application access module is used to connect to the operating system in the container according to the host information and the container information, render a desktop environment, and start the specified Linux application in the desktop environment to enable user access to the specified Linux application.
[0034] According to a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method provided in the first aspect.
[0035] According to a fourth aspect, an embodiment of the present invention provides a computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method provided in the first aspect is implemented.
[0036] Embodiments of the present invention provide a method, apparatus, medium, and device for building and accessing Linux applications. First, a bastion host builds a container image of a specified Linux application on a host by configuring a container text file. Upon receiving a user's browser-initiated access request for the specified Linux application, the bastion host connects to the host hosting the specified Linux application based on the host information corresponding to the host hosting the specified Linux application. Furthermore, a container corresponding to the specified Linux application is created on the host based on the container image, thereby completing the construction of the Linux application image and container. Next, to enable access, the bastion host connects to the operating system within the container based on the host and container information, renders a desktop environment, and launches the specified Linux application within the desktop environment. After the specified Linux application is launched, the user can access the specified Linux application. While the Linux operating system lacks application publishing functionality similar to that in Windows Server, the method provided by embodiments of the present invention can still enable the creation and access of Linux applications. Furthermore, installing Linux applications through images offers significant advantages in stability, compatibility, and portability. Deployment using containers improves compatibility with various Linux operating systems and provides convenient web browser access. Using images to deploy Linux applications makes it easier to port Linux applications to other operating systems, reducing porting costs and risks. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 A schematic diagram of a flow chart of a method for constructing and accessing a Linux application in one embodiment of the present invention;
[0038] Figure 2 This is a structural block diagram of a device for constructing access to Linux applications in one embodiment of the present invention. DETAILED DESCRIPTION
[0039] In the first aspect, an embodiment of the present invention provides a method for building access to a Linux application, which is executed by a bastion host. Figure 1 The method includes the following steps S110 to S150:
[0040] S110. Build a container image of a specified Linux application on the host by configuring a container text file;
[0041] The container text file is Dockerfile.
[0042] Among them, the container image of the Linux application refers to the image of the Linux application in the container, which is essentially the image file of the Linux application.
[0043] In one embodiment, building a container image of a specified Linux application on a host by configuring a container text file in S110 may specifically include the following steps:
[0044] 1. Configure the base image of the specified Linux application in the container text file;
[0045] 2. Update the apt source for managing software packages in the container text file and install xfce4 related software packages, where xfce4 is a lightweight desktop environment;
[0046] 3. Specify the lightweight desktop environment to be started in the container text file;
[0047] 4. Configure the display language of the Linux distribution operating system in the container text file;
[0048] 5. Configure the running script when the container is started in the container text file.
[0049] The base image, for example, is the Ubuntu:18.04 base image. A Dockerfile is a text file that defines the Docker image build process and runtime environment. Using a Dockerfile, you can precisely control the image build process, including selecting a base image, setting environment variables, installing packages, copying files, and other operations.
[0050] Among them, apt source is an important resource for managing software packages in the Linux system. It defines where and how to obtain software packages.
[0051] Among them, xfce4-related software packages mainly include xfce4 itself and toolkits, such as xfce4, xfce4-clipman-plugin, xfce4-cpugraph-plugin, xfce4-netload-plugin, xfce4-screenshooter, xfce4-taskmanager, xfce4-terminal, and xfce4-xkb-plugin.
[0052] Among them, xfce4 is a free software that runs on Unix-like operating systems and is used to provide a lightweight desktop environment.
[0053] Of course, in addition to installing xfce4-related software packages, you can also install Chinese language software packages (for example, language-pack-zh*), Chinese font software packages (for example, fonts-wqy-zenhei, fonts-arphic-ukai, fonts-arphic-uming, fonts-unfonts-core), xrdp software packages (for example, xorgxrdp, xrdp, dbus-x11), ibus input method software packages (for example, ibus, ibus-table-cangjie, ibus-pinyin), specified Linux application packages and the Chinese language packages corresponding to the applications.
[0054] Of course, you can also configure X11, for example, copy the / etc / X11 / xrdp / xorg.conf file to the / etc / X11 folder. Configure xrdp's sesman, for example, replace all xrdp / xorg with xorg in / etc / xrdp / sessman.ini. The sesman file configures multiple authentication methods.
[0055] Among them, xrdp is an enhanced version of rdp, which is the Remote Desktop Protocol.
[0056] The lightweight desktop environment to be started is specified in the container text file, for example, the xfce4-session string is appended to the / etc / skel / .Xsession file.
[0057] The display language of the Linux distribution operating system is configured in the container text file, for example, by executing the command update-locale LANG=zh_CN.UTF-8.
[0058] Among them, the running script when the container is started is configured in the container text file, and its function is to receive the container user name and container password set when the container is created, and create corresponding account information in Ubuntu. Ubuntu is a Linux distribution operating system mainly for desktop applications.
[0059] S120. When receiving an access request for the specified Linux application initiated by the user on the browser, obtain host information corresponding to the host where the specified Linux application is located;
[0060] The host information may include the host IP, the host secure shell protocol port, the host user name, and the host password. The host information may be stored in a configuration table of a specified Linux application.
[0061] It can be seen that when the user initiates an access request for the specified Linux application to the bastion host on the browser, the bastion host will obtain the host information corresponding to the host where the specified Linux application is located.
[0062] S130. Remotely connect to the host where the specified Linux application is located through the secure shell protocol according to the host information;
[0063] Among them, the Secure Shell Protocol is the SSH protocol.
[0064] That is, based on the host IP, host secure shell protocol port, host user name and host password in the host information, a remote connection is made to the host where the specified Linux application is located through the SSH protocol.
[0065] S140. Based on the container image of the specified Linux application, create a container corresponding to the specified Linux application on the host through a Linux application service script, and configure container information corresponding to the container;
[0066] Among them, the role of the Linux application service script in this step is to create a container for the specified Linux application through the dockerrun command when the user accesses the specified Linux application, and specify the mapping of the container port, that is, the host port maps the 3389 port in the container, which is the xrdp service port, and sets the user name and password for accessing the container. The user name and password are implemented through a random string pattern to enhance security.
[0067] Among them, Linux application service scripts can be implemented through Shell language.
[0068] The container information may include the container code, container access port, container username, and container password. After configuring and obtaining this container information, the bastion host saves the container information in the configuration table of the specified Linux application, making it easier to delete the container based on the container code after the specified Linux application access ends.
[0069] S150. Connect to the operating system in the container according to the host information and the container information, render a desktop environment, and start the specified Linux application in the desktop environment to enable the user to access the specified Linux application.
[0070] It can be seen that in the above steps, the creation of the image of the specified Linux application is achieved, and the access to the specified Linux application is also achieved.
[0071] In one embodiment, the step of connecting to the operating system in the container according to the host information and the container information, rendering the desktop environment, and starting the specified Linux application in the desktop environment in S150 may include:
[0072] According to the host IP, the container access port, the container user name, and the machine password, the remote desktop protocol access function provided by the remote desktop agent service is called to connect to the operating system in the container;
[0073] Among them, the container access port points to the port of the remote desktop protocol service inside the container; when the bastion host is connected to the container, the remote desktop protocol service is triggered, and the lightweight desktop environment is loaded. When loading the lightweight desktop environment, the desktop configuration information of the lightweight desktop environment is loaded, and the lightweight desktop environment is rendered according to the desktop configuration information, and the specified Linux application is automatically started in the rendered lightweight desktop environment.
[0074] Among them, the remote desktop proxy service is the Guacamole service.
[0075] It can be seen that the bastion host can only connect to the operating system in the container if it calls the Guacamole service. When the bastion host is connected to the container, the xrdp service will be triggered, and the lightweight desktop environment will be loaded. For example, the xrdp service manages sessions through xsession, so when the xrdp service is triggered, xsession loads the xfce4 desktop environment by reading the configuration in / etc / X11 / Xsession. When the xfce4 desktop environment is loaded, the desktop configuration information is loaded by reading the configuration file / home / loginuser / .config / xfce4 in the directory of the currently logged-in user. After loading the desktop configuration information, the specified application can be automatically started in the lightweight desktop environment by reading the configuration file under / home / loginuser / .config / autostart / .
[0076] In one embodiment, the present invention may further include:
[0077] Storing the host information and the container information in a configuration table of the specified Linux application;
[0078] When the user ends accessing the specified Linux application, the session state of the Linux application is set to ended; based on the host information and the container information, the container deletion function in the Linux application service script is called through the secure shell protocol to delete the container, and the deletion result is saved in the configuration table.
[0079] It can be seen that when the user ends the access to the specified Linux application, the bastion host service connects to the host where the specified Linux application is located through the SSH protocol according to the recorded container code, deletes the corresponding container, and releases the operating system resources. In other words, when the bastion host receives the user's request to access the Linux application, it first sets the Linux application session status to ended according to the container code, and then uses the SSH protocol to call the delete container function in the Linux application service script according to the host IP, host SSH port, host username, and host password to delete the container and save the deletion result in the configuration table. The deletion result can be a successful deletion or a failed deletion.
[0080] At this time, the function of the Linux application service script is to terminate the corresponding container through the container code when the user terminates access to the specified Linux application, thereby releasing host resources.
[0081] In one embodiment, the present invention may further include:
[0082] Read the configuration table regularly through a scheduled task;
[0083] Extract the host information and container information corresponding to the container whose session status is ended and whose deletion result is failed from the read data;
[0084] According to the host information and the container information, the container deletion function in the Linux application service script is called through the secure shell protocol to delete the container again.
[0085] As can be seen, a scheduled task is added to the bastion host to clear the containers of Linux applications whose access has ended. When a user ends access to a Linux application, the container may not be successfully deleted due to network, host, or other reasons. The container remains running, occupying a large amount of host resources. At regular intervals, the scheduled task reads the data indicating that the Linux application session status is ended and the container deletion failed, and calls the delete container function in the Linux application service script to delete the container. After successful deletion, the corresponding deletion status of the container is set to success.
[0086] In one embodiment, the remote desktop proxy service is an access plug-in pre-installed on the bastion host. The installation and operation process of the remote desktop proxy service includes: obtaining the container image of the remote desktop proxy service through a container pull command, starting the container image of the remote desktop proxy service through a container run command, and providing the container port of the remote desktop proxy service for the bastion host to call the remote desktop proxy service.
[0087] Among them, the remote desktop proxy service is Guacamole, which provides a remote desktop proxy server based on HTML5 web applications. By using the Guacamole server, you can easily access the Guacamole proxy host remotely through a browser.
[0088] The Docker pull command is used to pull image files from the Docker Registry, allowing users to download the required images from the remote repository to the local computer for subsequent use. The docker run command is used to run a command in a new container, pulling the image and starting the container if necessary.
[0089] Among them, the Linux application configuration function mainly records data such as Linux application type, host IP, host SSH port, host username, host password, container code, container access port, Docker container access username and password, Linux application session status, container deletion status, etc. into the configuration table.
[0090] When the bastion host creates a container image for a specified Linux application, it records the type of the specified Linux application, host IP, host SSH port, host user name, and host password in the configuration table.
[0091] When the bastion host uses the SSH protocol to call the create container function in the Linux application service script, it records the container code, container access port, container user name, and container password in the configuration table.
[0092] It can be seen that the embodiments of the present invention can enable users to access specified Linux applications through a Web browser, making access easier and faster. Installing Linux applications through images has significant advantages in stability, compatibility, and portability. By monitoring the session and container status release of Linux applications through scheduled tasks, host resources can be better released and server pressure can be reduced. Due to the use of containers for deployment, it is more compatible with various types of Linux operating systems and convenient Web browser access. Scheduled tasks monitor the access to ended Linux application sessions, release container resources, and reduce server pressure. Using images to deploy Linux applications makes it easier to port Linux applications to other operating systems, reducing porting costs and risks.
[0093] In a second aspect, an embodiment of the present invention provides a device for building access to a Linux application, which is deployed on a bastion host. Figure 2 , the device 100 includes:
[0094] A first building module 110 is configured to build a container image of a specified Linux application on a host by configuring a container text file;
[0095] The first acquisition module 120 is configured to, upon receiving an access request for the specified Linux application initiated by a user on a browser, acquire host information corresponding to the host where the specified Linux application is located;
[0096] A host connection module 130 is configured to remotely connect to the host where the specified Linux application is located through a secure shell protocol according to the host information;
[0097] The second construction module 140 is configured to create a container corresponding to the specified Linux application on the host through a Linux application service script based on the container image of the specified Linux application, and configure container information corresponding to the container;
[0098] The application access module 150 is used to connect to the operating system in the container according to the host information and the container information, render the desktop environment, and start the specified Linux application in the desktop environment to enable the user to access the specified Linux application.
[0099] In one embodiment, the apparatus may further include:
[0100] An information storage module, configured to store the host information and the container information in a configuration table of the specified Linux application;
[0101] The container deletion module is used to set the session status of the Linux application to ended when the user ends accessing the specified Linux application; based on the host information and the container information, and through the secure shell protocol, call the container deletion function in the Linux application service script to delete the container, and save the deletion result in the configuration table.
[0102] In one embodiment, the apparatus may further include:
[0103] A timing reading module, configured to read the configuration table at regular intervals through a timing task;
[0104] An information extraction module is used to extract host information and container information corresponding to containers whose session status is ended and whose deletion result is failed from the read data;
[0105] The deleting module is used to delete the container again based on the host information and the container information and by calling the container deletion function in the Linux application service script through the secure shell protocol.
[0106] In one embodiment, the host information includes the host IP, the host secure shell protocol port, the host username and the host password; and / or the container information includes the container code, the container access port, the container username and the container password.
[0107] In one embodiment, the application access module is specifically used to: call the remote desktop protocol access function provided by the remote desktop proxy service according to the host IP, the container access port, the container user name and the machine password, and connect to the operating system in the container; wherein the container access port points to the port of the remote desktop protocol service inside the container; when the bastion host is connected to the container, the remote desktop protocol service is triggered, and a lightweight desktop environment is loaded, and when the lightweight desktop environment is loaded, the desktop configuration information of the lightweight desktop environment is loaded, the lightweight desktop environment is rendered according to the desktop configuration information, and the specified Linux application is automatically started in the rendered lightweight desktop environment.
[0108] In one embodiment, the remote desktop proxy service is an access plug-in pre-installed on the bastion host. The installation and operation process of the remote desktop proxy service includes: obtaining the container image of the remote desktop proxy service through a container pull command, starting the container image of the remote desktop proxy service through a container run command, and providing the container port of the remote desktop proxy service for the bastion host to call the remote desktop proxy service.
[0109] In one embodiment, the first construction module is specifically used to: configure the basic image of the specified Linux application in the container text file; update the apt source for managing software packages in the container text file, and install xfce4-related software packages, where xfce4 is a lightweight desktop environment; specify the lightweight desktop environment to be started in the container text file; configure the display language of the Linux distribution operating system in the container text file; and configure the run script when the container is started in the container text file.
[0110] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the device provided by the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.
[0111] In a third aspect, an embodiment of the present invention provides a computer-readable medium having computer instructions stored thereon. When the computer instructions are executed by a processor, the processor executes the method provided in the first aspect.
[0112] Specifically, a system or device equipped with a storage medium can be provided, on which software program codes that implement the functions of any of the above-mentioned embodiments are stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program codes stored in the storage medium.
[0113] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute part of the present invention.
[0114] Examples of storage media for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program code can be downloaded from a server computer via a communication network.
[0115] In addition, it should be clear that the functions of any of the above embodiments can be achieved not only by executing the program code read by the computer, but also by enabling the operating system operating on the computer to complete part or all of the actual operations based on the instructions of the program code.
[0116] In addition, it can be understood that the program code read from the storage medium is written into a memory provided in an expansion board inserted into the computer or into a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above embodiments.
[0117] It is understandable that the explanation, specific implementation methods, beneficial effects, examples, etc. of the relevant contents in the computer-readable medium provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.
[0118] In a fourth aspect, an embodiment of this specification provides a computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the method in any one of the embodiments in the specification.
[0119] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the computing device provided by the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.
[0120] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences from other embodiments. In particular, the device embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.
[0121] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in the present invention may be implemented using hardware, software, widgets, or any combination thereof. When implemented using software, these functions may be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0122] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for building and accessing Linux applications, characterized in that: The method is performed by a bastion host, and includes: Build a container image of a specified Linux application on the host by configuring the container text file; When receiving an access request for the specified Linux application initiated by a user on a browser, obtaining host information corresponding to the host where the specified Linux application is located; Remotely connect to the host where the specified Linux application is located through the secure shell protocol according to the host information; Based on the container image of the specified Linux application, create a container corresponding to the specified Linux application on the host through a Linux application service script, and configure container information corresponding to the container; According to the host information and the container information, the operating system in the container is connected, a desktop environment is rendered, and the specified Linux application is started in the desktop environment to enable the user to access the specified Linux application.
2. The method according to claim 1, characterized in that Also includes: Storing the host information and the container information in a configuration table of the specified Linux application; When the user ends accessing the specified Linux application, the session state of the Linux application is set to ended; based on the host information and the container information, the container deletion function in the Linux application service script is called through the secure shell protocol to delete the container, and the deletion result is saved in the configuration table.
3. The method according to claim 2, characterized in that Also includes: Read the configuration table regularly through a scheduled task; Extract the host information and container information corresponding to the container whose session status is ended and whose deletion result is failed from the read data; According to the host information and the container information, the container deletion function in the Linux application service script is called through the secure shell protocol to delete the container again.
4. The method according to claim 1, wherein The host information includes the host IP, the host secure shell protocol port, the host user name and the host password; and / or the container information includes the container code, the container access port, the container user name and the container password.
5. The method according to claim 4, characterized in that The step of connecting to the operating system in the container according to the host information and the container information, rendering a desktop environment, and starting the specified Linux application in the desktop environment includes: According to the host IP, the container access port, the container user name, and the container password, the remote desktop protocol access function provided by the remote desktop agent service is called to connect to the operating system in the container; Among them, the container access port points to the port of the remote desktop protocol service inside the container; when the bastion host is connected to the container, the remote desktop protocol service is triggered, and the lightweight desktop environment is loaded. When loading the lightweight desktop environment, the desktop configuration information of the lightweight desktop environment is loaded, and the lightweight desktop environment is rendered according to the desktop configuration information, and the specified Linux application is automatically started in the rendered lightweight desktop environment.
6. The method according to claim 5, characterized in that The remote desktop proxy service is an access plug-in pre-installed on the bastion host. The installation and operation process of the remote desktop proxy service includes: obtaining the container image of the remote desktop proxy service through a container pull command, starting the container image of the remote desktop proxy service through a container run command, and providing the container port of the remote desktop proxy service for the bastion host to call the remote desktop proxy service.
7. The method according to claim 1, characterized in that The method of building a container image of a specified Linux application on a host by configuring a container text file includes: Configuring the base image of the specified Linux application in the container text file; Updating the apt source for managing software packages in the container text file and installing xfce4-related software packages, where xfce4 is a lightweight desktop environment; Specifying the lightweight desktop environment to be started in the container text file; Configuring the display language of the Linux distribution operating system in the container text file; Configure the running script when the container is started in the container text file.
8. A device for constructing and accessing Linux applications, characterized in that: The device is deployed on a bastion host and includes: The first building module is used to build a container image of a specified Linux application on the host by configuring a container text file; A first acquisition module is configured to, upon receiving an access request for the specified Linux application initiated by a user on a browser, acquire host information corresponding to the host where the specified Linux application is located; A host connection module, configured to remotely connect to the host where the specified Linux application is located through a secure shell protocol according to the host information; A second construction module is configured to create a container corresponding to the specified Linux application on the host through a Linux application service script based on the container image of the specified Linux application, and configure container information corresponding to the container; The application access module is used to connect to the operating system in the container according to the host information and the container information, render a desktop environment, and start the specified Linux application in the desktop environment to enable user access to the specified Linux application.
9. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 7.
10. A computing device, characterized in that The method comprises a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
WEB-based application running method
CN113468458A
Operation and maintenance auditing method and graphic bastion host
CN115878238A