CN106686035B - Method and device for realizing customized FTP server based on Apache FtpServer - Google Patents

Method and device for realizing customized FTP server based on Apache FtpServer Download PDF

Info

Publication number
CN106686035B
CN106686035B CN201510762694.7A CN201510762694A CN106686035B CN 106686035 B CN106686035 B CN 106686035B CN 201510762694 A CN201510762694 A CN 201510762694A CN 106686035 B CN106686035 B CN 106686035B
Authority
CN
China
Prior art keywords
user
file
information
event
directory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510762694.7A
Other languages
Chinese (zh)
Other versions
CN106686035A (en
Inventor
温树庭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201510762694.7A priority Critical patent/CN106686035B/en
Publication of CN106686035A publication Critical patent/CN106686035A/en
Application granted granted Critical
Publication of CN106686035B publication Critical patent/CN106686035B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0815Network architectures or network communication protocols for network security for authentication of entities providing single-sign-on or federations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/535Tracking the activity of the user
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/563Data redirection of data network streams

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method and a device for realizing a customized FTP server based on Apache FtpServer, which can accurately manage users through configuration, archive historical uploaded files so as to realize fault recovery, and simultaneously realize broadcast file delivery to meet the requirement of multi-user downloading. The method for realizing the customized FTP server based on the Apache FtpServer comprises the following steps: completing configuration information and storing the configuration information in a database; when the occurrence of the user event is monitored, executing corresponding operation according to the configuration information read from the database; and saving the information of the user event and the process and the result of the operation in a log table for further analysis.

Description

Method and device for realizing customized FTP server based on Apache FtpServer
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for realizing a customized FTP server based on Apache FtpServer.
Background
The FTP Server file transmission Server is a special computer special for other computers to retrieve and store files. In a TCP/IP network, a client can download or upload files from or to a file server via a file transfer protocol FTP (file Transport protocol) to implement resource sharing, and a user can connect his computer to all servers operating the FTP protocol worldwide via the file transfer protocol FTP to access a large amount of programs and information on the servers. FTP Server has become an important resource on the internet.
A schematic diagram of a conventional FTP server implementation principle is shown in fig. 1, and the implementation steps are as follows:
1. installing an FTP service operation environment on a server;
2. creating a user on the FTP server, distributing authority for the user and setting a root directory;
3. and the user assigned with the authority authenticates according to the configuration on the server, and executes file uploading or downloading operation after the authentication is successful.
Fig. 2 is a schematic diagram showing the multi-user operation of a conventional FTP server. The network bandwidth of the FTP server is limited, for example, 10M is fixed, under the condition of multi-user operation, a certain bandwidth needs to be occupied for both uploading and downloading, and if the uploading or downloading rate of the user is not set, bandwidth blocking may be caused, which causes service abnormality of the FTP server or slows down the service efficiency of the FTP server, resulting in degradation of service quality. However, this is only the most common operating situation of the FTP server, and the conventional FTP server has the following disadvantages because the service mode is fixed and single:
1. the traditional FTP server has limited configurable capacity, such as incapability of controlling the uploading or downloading rate of a user, freezing the user within a set time and the like;
2. the traditional FTP server does not have the customized development capability and cannot meet the customized requirements, such as file broadcasting, file transferring, file archiving, user behavior tracking and the like.
In summary, the conventional FTP server cannot meet the requirements of user precision control and customized development. Therefore, it is necessary to enrich the functions by implementing a customizable FTP server based on an extensible FTP server.
Apache FtpServer is found to be a scalable FTP server through research. The basic module of the Apache FtpServer is similar to the function of the traditional FTP server, and in addition, the Apache FtpServer also has the function of controlling the uploading and downloading rate of a user. The Apache FtpServer is pure Java open source FTP server software, is developed by adopting a MINA network framework, has very good performance, and can realize the customized function by expanding the source code of the Apache FtpServer.
Therefore, the present invention provides a method and an apparatus for implementing a customized FTP server based on Apache FtpServer, which aims at the defects and shortcomings of the prior art. Since Apache FtpServer has good extensibility, freezing users within a set time can be realized by extending configuration information, and function extension can be performed to realize some customized requirements, such as: broadcasting, file distribution, file relocation, file archiving, tracking user behaviors and the like.
Disclosure of Invention
In view of the above, the present invention provides a solution for extending the configuration capability of an FTP server and a method for tracking the interaction process of an FTP file. The invention provides a method and a device for realizing a customized FTP server based on Apache FtpServer, which can accurately manage users through configuration, for example, freezing the users in a set time, tracking the behaviors of the users, isolating the user authority, archiving historical uploaded files so as to realize fault recovery, and simultaneously realizing broadcasting and issuing the files to meet the requirement of multi-user downloading.
To achieve the above object, according to one aspect of the present invention, a method for implementing a customized FTP server based on Apache FtpServer is provided.
A method for realizing a customized FTP server based on Apache FtpServer comprises the following steps: completing configuration information and storing the configuration information in a database; when the occurrence of the user event is monitored, executing corresponding operation according to the configuration information read from the database; and saving the information of the user event and the process and the result of the operation in a log table for further analysis.
Optionally, the configuration information includes: user basic information, file relocation information, file filing information, and file cleaning information.
Optionally, the user basic information includes user freezing information, the file relocation information includes a file relocation directory, the file archiving information includes a file archiving directory, and the file cleaning information includes a timing task name, a timing expression, and a directory to be cleaned.
Optionally, the method further comprises: and setting a timing task, regularly cleaning expired filing files according to the file cleaning information, and recording an execution process in the log table.
Optionally, the method further comprises: and judging the legality of the user according to a preset judgment rule by analyzing the log table, and setting the illegal user to be in a frozen state.
Optionally, after it is monitored that the user event occurs, executing corresponding operations according to the configuration information read from the database includes: reading the basic information of the user from the database and authenticating the user after monitoring the event of user login; reading the basic information of the user from the database after monitoring an event that the user starts uploading or downloading, and judging whether the user is in a frozen state; after monitoring the event that the user finishes uploading, reading the file relocation information from the database, and relocating the uploaded file to the file relocation directory; and when an event that the user finishes downloading is monitored, reading the file filing information from the database, and transferring the downloaded file to the file filing directory.
Optionally, the file relocation directory includes one or more.
According to another aspect of the invention, an apparatus for implementing a customized FTP server based on Apache FtpServer is provided.
An apparatus for implementing customized FTP server based on Apache FtpServer, comprising: the information configuration module is used for completing configuration information and storing the configuration information into a database; the monitoring execution module is used for executing corresponding operation according to the configuration information read from the database after monitoring that the user event occurs; and the log recording module is used for saving the information of the user event and the process and the result of the operation into a log recording table so as to further analyze.
Optionally, the configuration information includes: user basic information, file relocation information, file filing information, and file cleaning information.
Optionally, the user basic information includes user freezing information, the file relocation information includes a file relocation directory, the file archiving information includes a file archiving directory, and the file cleaning information includes a timing task name, a timing expression, and a directory to be cleaned.
Optionally, the method further comprises: and the timing task module is used for regularly cleaning expired filing files according to the file cleaning information and recording the execution process in the log table.
Optionally, the method further comprises: and the log analysis module is used for judging the legality of the user according to a preset judgment rule by analyzing the log table and setting the illegal user into a frozen state.
Optionally, the listening execution module is further configured to: reading the basic information of the user from the database and authenticating the user after monitoring the event of user login; reading the basic information of the user from the database after monitoring an event that the user starts uploading or downloading, and judging whether the user is in a frozen state; after monitoring the event that the user finishes uploading, reading the file relocation information from the database, and relocating the uploaded file to the file relocation directory; and when an event that the user finishes downloading is monitored, reading the file filing information from the database, and transferring the downloaded file to the file filing directory.
Optionally, the file relocation directory includes one or more.
According to the technical scheme of the invention, on the basis of the basic module of the Apache FtpServer, the user attribute is enriched by expanding the configuration information of the Apache FtpServer, so that the operation control of a user can be realized, and the user can be managed accurately. A monitor realized based on an event mechanism is arranged to receive an event and complete subsequent operation, so that file relocation can be realized, user permissions are isolated, and the problem of file damage caused by file operation disorder among users is avoided; meanwhile, the file can be broadcast and issued, and the requirement of multi-user downloading is met; in addition, the document may also be archived for failure recovery. In addition, the operation process and the operation result are stored in the log for analysis, the user behavior can be tracked through the interactive log, the problem that the traditional FTP user cannot track is solved, the user behavior can be used as the basis to optimize the configuration, and the performance of the FTP server can be greatly improved.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a schematic diagram of the implementation principle of a conventional FTP server;
FIG. 2 is a schematic diagram of the multi-user operation of a conventional FTP server;
FIG. 3 is a schematic diagram of the main steps of a method for implementing a customized FTP server based on Apache FtpServer according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of the main modules of an apparatus for implementing a customized FTP server based on Apache FtpServer according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of the working principle of a customized FTP server according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a framework of a customized FTP server according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a customized FTP server implementation of an embodiment of the present invention;
FIG. 8 is a diagram illustrating an implementation mechanism of a listener submodule according to an embodiment of the present invention;
FIG. 9 is a timing diagram of the processing of user login events according to an embodiment of the present invention;
FIG. 10 is a timing diagram of the processing of a user initiated upload event in accordance with an embodiment of the present invention;
FIG. 11 is a timing diagram of the processing of a user upload complete event in accordance with an embodiment of the present invention;
FIG. 12 is a timing diagram illustrating the processing of a user initiated download event in accordance with an embodiment of the present invention;
FIG. 13 is a timing diagram illustrating the processing of a user download complete event in accordance with an embodiment of the present invention;
FIG. 14 is a schematic diagram of the snooping activity of a snooper sub-module of an embodiment of the present invention;
FIG. 15 is a timing diagram illustrating the execution of the timed task module according to an embodiment of the present invention;
FIG. 16 is a schematic diagram of an implementation process for tracking user behavior through log analysis according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The customized FTP server is based on a basic module of Apache FtpServer, and realizes the expansion of the configuration capability of the FTP server and the tracking of the FTP file interaction process by expanding the Apache FtpServer, such as rich configuration attribute, user authentication, operation track recording and the like.
Fig. 3 is a schematic diagram of main steps of a method for implementing a customized FTP server based on Apache FtpServer according to an embodiment of the present invention. As shown in fig. 3, the method for implementing customized FTP server based on Apache FtpServer of the present invention mainly includes the following steps S31 to S33.
Step S31: and finishing the configuration information and storing the configuration information in a database. The configuration information includes: user basic information, file relocation information, file filing information, and file cleaning information. The basic user information includes user freezing information and the like, the file moving information includes a file moving directory, the file filing information includes a file filing directory, and the file cleaning information includes contents such as a timing task name, a timing expression and a directory to be cleaned.
Step S32: and when the occurrence of the user event is monitored, executing corresponding operation according to the configuration information read from the database. According to different user events, the following operations can be included:
operation 1: reading the basic information of the user from the database and authenticating the user after monitoring the event of user login;
operation 2: reading the basic information of the user from the database after monitoring an event that the user starts uploading or downloading, and judging whether the user is in a frozen state;
operation 3: after monitoring the event that the user finishes uploading, reading the file relocation information from the database, and relocating the uploaded file to the file relocation directory;
and operation 4: and when an event that the user finishes downloading is monitored, reading the file filing information from the database, and transferring the downloaded file to the file filing directory.
According to the technical scheme of the invention, the file relocation directory comprises one or more files.
Step S33: and saving the information of the user event and the process and the result of the operation in a log table for further analysis.
According to the implementation process of the invention, a timing task can be set, the outdated archive file is cleaned periodically according to the file cleaning information, and the execution process is recorded in the log table.
In addition, the invention can judge the legality of the user according to the preset judgment rule by analyzing the log table and set the illegal user in the frozen state.
Fig. 4 is a schematic diagram of main modules of an apparatus for implementing a customized FTP server based on Apache FtpServer according to an embodiment of the present invention. As shown in fig. 4, the apparatus 40 for implementing a customized FTP server based on Apache FtpServer mainly includes an information configuration module 41, a listening execution module 42, and a logging module 43.
The information configuration module 41 is used for completing configuration information and storing the configuration information into a database; the monitoring execution module 42 is configured to execute a corresponding operation according to the configuration information read from the database after monitoring that the user event occurs; the logging module 43 is used to save the information of the user event and the process and result of the operation into a logging table for further analysis.
According to the implementation principle of the present invention, the configuration information includes: user basic information, file relocation information, file filing information, and file cleaning information. The basic user information comprises user freezing information and the like, the file moving information comprises a file moving directory, the file filing information comprises a file filing directory, and the file cleaning information comprises a timing task name, a timing expression and a directory to be cleaned. In addition, the file relocation directory in the present invention may include one or more file relocation directories.
The monitoring execution module 42 may be further configured to, after monitoring an event of user login, read the user basic information from the database, and authenticate the user; reading the basic information of the user from the database after monitoring an event that the user starts uploading or downloading, and judging whether the user is in a frozen state; after monitoring the event that the user finishes uploading, reading the file relocation information from the database, and relocating the uploaded file to the file relocation directory; and when an event that the user finishes downloading is monitored, reading the file filing information from the database, and transferring the downloaded file to the file filing directory.
In addition, the apparatus 40 for implementing a customized FTP server based on Apache FtpServer of the present invention may further include a timing task module, configured to periodically clean up an expired archive file according to the file cleaning information, and record an execution process in the log table; and the log analysis module is used for judging the legality of the user according to a preset judgment rule by analyzing the log table and setting the illegal user into a frozen state.
The following describes the implementation of the present invention by way of specific examples. Fig. 5-16 illustrate a specific implementation of an embodiment of the present invention. Fig. 5 is a schematic diagram of the working principle of the customized FTP server in the embodiment of the present invention. As shown in fig. 5, the customized FTP server of the present invention is different from the conventional FTP server, the upload user is not used for downloading files, but only responsible for uploading files to the designated directory (denoted by reference numeral 1), and the FTP server system will move files to the download directory (denoted by reference numeral 2), wherein the download directory may be one or more, and respectively implements point-to-point download and broadcast mode download; likewise, the downloading user is only used to download files. After the file download is completed, the FTP server system will move the files in the download directory to the archive directory (indicated by reference numeral 3).
According to the working principle, the customized FTP server can avoid the situation that files are damaged due to disordered file operation among users possibly caused by the fact that user permissions are not isolated in the prior art; in addition, the file can be moved to a plurality of downloading directories, so that the file is issued by broadcasting; and the problem of abnormal file recovery is solved through file archiving.
Fig. 6 is a schematic diagram of a framework structure of a customized FTP server according to an embodiment of the present invention. The function of the Apache FtpServer basic module is similar to that of the traditional FTP server, and only the function of controlling the file uploading and downloading rates is added, so that the FTP basic module part is omitted in the figure. As can be seen from the figure, compared with the conventional FTP server, the customized FTP server of the present invention can further include an FTP function extension module and an FTP visual tracking module.
The FTP function extension module can also comprise a core configuration submodule, a listener submodule and a timing task submodule according to the sequence of function realization. The core configuration submodule is used for expanding the configuration attribute of the customization requirement of the FTP, the listener submodule is mainly used for monitoring user operation and executing corresponding tasks of file moving, filing and the like, and the timing task submodule is mainly used for cleaning expired filed files so as to ensure that the FTP server has enough space to serve users.
The FTP visual tracking module is mainly used for storing interactive logs in the function realization process of the listener submodule and the timing task submodule and further analyzing the interactive logs so as to solve the problem that a user of the traditional FTP server cannot track the interactive logs and optimize core configuration information.
Fig. 7 is a schematic diagram of a customized FTP server implementation of the present invention. As shown in fig. 7, the present embodiment mainly includes 4 modules, which are respectively denoted by numerals 1 to 4. The implementation of each module will be described in detail below.
1. Core configuration submodule
The module is mainly used for configuring necessary information for realizing each function, wherein the configuration information mainly comprises 3 parts:
1.1, user basic information, wherein the user basic information comprises the attribute of whether a user is frozen, namely user freezing information, the user basic information is newly added according to the function realization requirement, and the user basic information is mainly used for a monitor submodule and a timing task submodule;
1.2 file relocation information and file filing information, which are mainly served for a listener submodule;
1.3 File cleaning information, mainly serving the timed task sub-module.
As shown in fig. 7, the core configuration sub-module may configure information such as whether a file needs to be backed up and a file backup directory, whether a file needs to be archived and a file archiving directory, and configure whether the file is moved point-to-point or distributed, and may also configure file cleaning, such as timing task rule configuration and a directory to be cleaned, where the timing task rule mainly includes a timing task name, a timing expression, and the like.
For clarity, the original FTP _ USER attribute of Apache FtpServer is listed in table 1; the extended attributes of FTP _ USER are listed in table 2, including: whether the user is frozen, a file relocation directory and a file filing directory; the configuration attributes of the timing task are listed in table 3, and mainly include the name of the timing task, the timing expression, and the directory to be cleaned. The attribute information listed in table 2 for determining whether the USER is frozen and the original FTP _ USER attribute of Apache FtpServer in table 1 together constitute basic USER information.
TABLE 1 Apache FtpServer original FTP _ USER attribute
Figure GDA0002259380760000101
Figure GDA0002259380760000111
TABLE 2 FTP _ USER extended Attribute
frozen Whether the user is frozen
goaldirectory File relocation directory
backdirectory File filing directory
TABLE 3 timed task configuration attributes
task_Name Timed task name
CRON_EXPRESSION Timing expression
clear_director Directory to be cleaned
Apache FtpServer can conveniently set parameter information of a user by providing an interface, and store configuration information into a database. The listener sub-module can judge whether the user is frozen according to the user freezing information in the extended attribute of the user to limit whether the user can operate files, such as uploading or downloading files and the like.
In addition, the freezing information of the user can be flexibly set, and the freezing time of the user can also be set. For example, whether the high frequency user is frozen or not may be set to limit the user from being inoperable in a specific time period, and when the resource utilization rate is low, the high frequency user is set to be frozen and disabled to be operable.
2. Monitor submodule
The listener submodule is mainly used for monitoring user operation, executing corresponding operations of file relocation, filing and the like, and recording the operation process and results in a log table. The listener submodule is implemented based on an event mechanism, and the listener receives an event and completes corresponding subsequent operations after the event is triggered, as shown in fig. 8, which is a schematic diagram of an implementation mechanism of the listener submodule according to the embodiment of the present invention. And when the monitor submodule monitors that the user logs in the FTP server, the user starts uploading or finishes uploading the event, and the user starts downloading or finishes downloading the event, the monitor submodule receives the event and finishes subsequent operation. In addition, the listener sub-module also provides an extended listening interface for extended listening to new user events. The following takes these several common user events as examples to describe in detail the functional implementation of the sub-module.
Fig. 9 is a timing chart illustrating a process of a user login event according to an embodiment of the present invention. When the listener sub-module monitors the event of user logging in, it loads the user basic information according to the user name, and calls the authentication program to authenticate, and writes the event information of user logging in and the loading result and authentication result of listener sub-module to the user basic information into the authentication log.
Fig. 10 is a timing chart illustrating a process of a user starting an upload event according to an embodiment of the present invention. When the monitor submodule monitors an event that a user starts to upload, user basic information is loaded firstly, whether the user is in a frozen state is detected according to user freezing information in the user basic information, and when the user is not frozen, an uploading track of the user is written into a log table so as to be used for tracking and recording the uploading frequency of the user.
Fig. 11 is a timing diagram of the processing of a user upload complete event according to an embodiment of the present invention. When the listener submodule monitors an event which is uploaded by a user, the listener submodule loads user basic information and file relocation information, finds a storage root directory of a file through configuration of the user basic information, finds a file relocation directory through the file relocation information, relocates the file to one or more preset downloading directories, and writes a relocation result into a log table. Here, the file relocation directory is determined according to a directory available for downloading which is set in advance.
Fig. 12 is a timing diagram of a process of a user initiating a download event according to an embodiment of the present invention. When the monitor submodule monitors an event that a user starts downloading, user basic information is loaded firstly, whether the user is in a frozen state is detected according to user freezing information in the user basic information, and when the user is not frozen, a downloading track of the user is written into a log table so as to be used for tracking the downloading frequency of the user.
Fig. 13 is a sequence diagram of a user download complete event process according to an embodiment of the present invention. When the listener submodule monitors the event that the user finishes downloading, the basic information of the user and the filing information of the file are loaded firstly, then the storage root directory of the file is found through the basic information of the user, the filing directory of the file is found through the filing information of the file, then the file is moved to the filing directory by calling the filing function, and the filing result is written into the log table.
As can be seen from the processing sequence diagrams of the user events in fig. 9 to fig. 13, the listener module is implemented based on an event mechanism, and the listener receives the event after the event is triggered and completes the corresponding subsequent operation. Taking the file uploaded after the user logs in as an example, a monitoring activity diagram of a listener sub-module is introduced below. Fig. 14 is a schematic diagram of the listening activity of the listener sub-module according to the embodiment of the present invention. When the FTP user logs in the FTP server, a user login event is triggered and notified to a login monitoring unit of the listener sub-module, then the login monitoring unit performs authentication according to the basic information of the user, and after the authentication is passed, the user executes the operation of uploading the file. Firstly, a user triggers an event for starting uploading files and informs an uploading monitoring unit of a listener sub-module, after the files are uploaded, the uploading monitoring unit informs a file relocation device according to configuration information, and the files are relocated to a corresponding directory. Therefore, the purpose of executing subsequent operation through the listener submodule can be achieved.
3. Timing task submodule
The timing task submodule is used for cleaning out expired filing files, and the directory to be cleaned of the timing task is a file filing directory. The timing task submodule scans the file filing directory by setting a timing task mode, and deletes the file when the storage time of the scanned file is longer than the set time (such as one month), and releases the FTP disk space, thereby ensuring that the FTP server has enough space to serve users. The execution process sequence of the timing task sub-module according to the embodiment of the present invention is shown in fig. 15. The timing task submodule loads a timing task rule by loading the file cleaning information in the configuration information, and then can verify whether the file can be cleaned or not, and if so, calls a cleaning file logic to finish cleaning the overdue file. The timing task rule mainly includes a timing task name, a timing expression and the like, and the timing expression may include information such as file survival time (default to one month) and the like. And the timed task submodule traverses all files in the directory to be cleaned after loading the timed task rule, and cleans the files if the survival time of the files exceeds the set survival time of the files so as to achieve the effect of cleaning the expired files. In addition, important history files can be set according to needs to be transferred to other disk spaces and the like.
4. FTP visual tracking module
The FTP visual tracking module comprises a log recording system and a log analysis system, wherein the log recording system is mainly used for storing the information of user events and the process and the result of the operation executed by the listener submodule, and the log analysis system is used for analyzing the stored log data. User behavior can be tracked through the interactive log, and the problem that a user of a traditional FTP server cannot track is solved, such as: the log records in the log table can track the user login times and the operated file track to find whether the file is uploaded completely; whether the file is moved to a downloading directory or not; whether the downloading user finishes downloading or not; whether the file is archived, etc., as shown in table 4. Meanwhile, the user behavior can be used as the basis for resetting the basic information of the user to optimize the configuration. For example, by analyzing the log table, the validity of the user can be determined according to a predetermined determination rule, and an illegal user can be set in a frozen state. Here, the determination rule may be formulated according to specific service requirements, and the determination rule may be, for example, to determine whether the behavior of the user is legal according to an operation trajectory of the user, a file type uploaded by the user, a file format uploaded by the user, and the like, and if the behavior of the user is an illegal user, the operation of the user may be limited by setting the user to be in a frozen state.
Table 4 log table example
Figure GDA0002259380760000141
Figure GDA0002259380760000151
FIG. 16 is a schematic diagram of an implementation process for tracking user behavior through log analysis according to an embodiment of the present invention. The operation track of the user is taken as an example to analyze the behavior of the user. As shown in fig. 16, the operation state of the entire FTP server is divided into a configuration state and an operation state. In the configuration state, the administrator analyzes the user operation track through the log (step S161), and compares the operation frequency of the user with the predetermined operation frequency limit to determine whether the operation frequency of the user exceeds the limit (step S162), and if the operation frequency exceeds the limit, the user is an illegal user, otherwise, the user is a legal user. If the user is a valid user, the state setting is not necessary, and if the user is an invalid user, the user is set to be in the frozen state (step S163) and saved in the configuration information. In the running state, when a user logs in, configuration information is loaded (step S164), when the user needs to perform uploading or downloading operation, whether the user is in the frozen state is judged firstly (step S165), and if the user is in the non-frozen state, the uploading or downloading operation of the user is not limited (step S166); otherwise, when the user is in the frozen state, the upload or download operation of the user will be restricted (step S167).
The foregoing is illustrative of the principles and implementations of embodiments of the present invention. According to the technical scheme of the embodiment of the invention, the basic module of the Apache FtpServer is taken as the basis, the configuration information of the Apache FtpServer is expanded to enrich the user attribute, the operation control of the user can be realized, and the user can be managed accurately. A monitor realized based on an event mechanism is arranged to receive an event and complete subsequent operation, so that file relocation can be realized, user permissions are isolated, and the problem of file damage caused by file operation disorder among users is avoided; meanwhile, the file can be broadcast and issued, and the requirement of multi-user downloading is met; in addition, the document may also be archived for failure recovery. In addition, the operation process and the operation result are stored in the log for analysis, the user behavior can be tracked through the interactive log, the problem that the traditional FTP user cannot track is solved, the user behavior can be used as the basis to optimize the configuration, and the performance of the FTP server can be greatly improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (14)

1. A method for realizing a customized FTP server based on Apache FtpServer is characterized by comprising the following steps:
completing configuration information and storing the configuration information into a database, wherein the configuration information comprises file relocation information and file filing information;
when the occurrence of the user event is monitored, corresponding operations are executed according to the configuration information read from the database, and the operations comprise: after monitoring the event that the user finishes uploading, reading the file relocation information from the database, and relocating the uploaded file to a file relocation directory; after monitoring the event that the user finishes downloading, reading the file filing information from the database, and transferring the downloaded file to a file filing directory;
and saving the information of the user event and the process and the result of the operation in a log table for further analysis.
2. The method of claim 1, wherein the configuration information further comprises: user basic information and file cleaning information.
3. The method according to claim 2, wherein the user basic information comprises user freeze information, the file relocation information comprises a file relocation directory, the file archiving information comprises a file archiving directory, and the file cleaning information comprises a timing task name, a timing expression, and a directory to be cleaned.
4. The method of claim 2, further comprising:
and setting a timing task, regularly cleaning expired filing files according to the file cleaning information, and recording an execution process in the log table.
5. The method of claim 1, further comprising:
and judging the legality of the user according to a preset judgment rule by analyzing the log table, and setting the illegal user to be in a frozen state.
6. The method of claim 2, wherein after monitoring that a user event occurs, performing corresponding operations according to the configuration information read from the database further comprises:
reading the basic information of the user from the database and authenticating the user after monitoring the event of user login;
and when an event that the user starts uploading or downloading is monitored, reading the basic information of the user from the database, and judging whether the user is in a frozen state.
7. The method of claim 3 or 6, wherein the file relocation directory comprises one or more files.
8. An apparatus for implementing customized FTP server based on Apache FtpServer, comprising:
the information configuration module is used for completing configuration information and storing the configuration information into a database, wherein the configuration information comprises file relocation information and file filing information;
a monitoring execution module, configured to execute corresponding operations according to the configuration information read from the database after monitoring that a user event occurs, including: after monitoring the event that the user finishes uploading, reading the file relocation information from the database, and relocating the uploaded file to a file relocation directory; after monitoring the event that the user finishes downloading, reading the file filing information from the database, and transferring the downloaded file to a file filing directory;
and the log recording module is used for saving the information of the user event and the process and the result of the operation into a log table so as to further analyze.
9. The apparatus of claim 8, wherein the configuration information further comprises: user basic information and file cleaning information.
10. The apparatus of claim 9, wherein the user basic information comprises user freeze information, the file relocation information comprises a file relocation directory, the file archiving information comprises a file archiving directory, and the file cleaning information comprises a timed task name, a timed expression, and a directory to be cleaned.
11. The apparatus of claim 9, further comprising:
and the timing task module is used for regularly cleaning expired filing files according to the file cleaning information and recording the execution process in the log table.
12. The apparatus of claim 8, further comprising:
and the log analysis module is used for judging the legality of the user according to a preset judgment rule by analyzing the log table and setting the illegal user into a frozen state.
13. The apparatus of claim 9, wherein the snoop execution module is further configured to:
reading the basic information of the user from the database and authenticating the user after monitoring the event of user login;
and when an event that the user starts uploading or downloading is monitored, reading the basic information of the user from the database, and judging whether the user is in a frozen state.
14. The apparatus according to claim 10 or 13, wherein the file relocation directory comprises one or more.
CN201510762694.7A 2015-11-10 2015-11-10 Method and device for realizing customized FTP server based on Apache FtpServer Active CN106686035B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510762694.7A CN106686035B (en) 2015-11-10 2015-11-10 Method and device for realizing customized FTP server based on Apache FtpServer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510762694.7A CN106686035B (en) 2015-11-10 2015-11-10 Method and device for realizing customized FTP server based on Apache FtpServer

Publications (2)

Publication Number Publication Date
CN106686035A CN106686035A (en) 2017-05-17
CN106686035B true CN106686035B (en) 2020-11-24

Family

ID=58864763

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510762694.7A Active CN106686035B (en) 2015-11-10 2015-11-10 Method and device for realizing customized FTP server based on Apache FtpServer

Country Status (1)

Country Link
CN (1) CN106686035B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110213100B (en) * 2019-06-03 2022-04-08 杭州安恒信息技术股份有限公司 Disaster recovery method, device and equipment for configuration data and readable storage medium
CN111796985B (en) * 2020-07-08 2023-11-17 北京首汽智行科技有限公司 Database operation log uploading method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101231647A (en) * 2007-01-26 2008-07-30 鸿富锦精密工业(深圳)有限公司 File management system and method
CN102571476A (en) * 2010-12-27 2012-07-11 中国银联股份有限公司 Method and device for monitoring terminal command line in real time
CN103188325A (en) * 2011-12-31 2013-07-03 上海百事通信息技术有限公司 Operator file transfer protocol (FTP) document processing system
CN103501241A (en) * 2013-09-18 2014-01-08 华为技术有限公司 Method, device and system for cleaning useless files
CN104980401A (en) * 2014-04-09 2015-10-14 北京亿赛通科技发展有限责任公司 Secure data storage system and secure data storage and reading method of NAS server

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101231647A (en) * 2007-01-26 2008-07-30 鸿富锦精密工业(深圳)有限公司 File management system and method
CN102571476A (en) * 2010-12-27 2012-07-11 中国银联股份有限公司 Method and device for monitoring terminal command line in real time
CN103188325A (en) * 2011-12-31 2013-07-03 上海百事通信息技术有限公司 Operator file transfer protocol (FTP) document processing system
CN103501241A (en) * 2013-09-18 2014-01-08 华为技术有限公司 Method, device and system for cleaning useless files
CN104980401A (en) * 2014-04-09 2015-10-14 北京亿赛通科技发展有限责任公司 Secure data storage system and secure data storage and reading method of NAS server

Also Published As

Publication number Publication date
CN106686035A (en) 2017-05-17

Similar Documents

Publication Publication Date Title
US10546129B2 (en) Method to scan a forensic image of a computer system with multiple malicious code detection engines simultaneously from a master control point
US9323462B2 (en) File system snapshot data management in a multi-tier storage environment
US10826991B2 (en) Downloading files from a cloud storage being used as temporary cache
US20230096032A1 (en) Hybrid Approach To Data Governance
US10264065B2 (en) Application aware input/output fencing
CN104737135B (en) The information processing terminal and synchronisation control means
US10536538B2 (en) Secure data erasure verification in hyperscale computing systems
CN103593351A (en) Electronic file filing method and system
CN106686035B (en) Method and device for realizing customized FTP server based on Apache FtpServer
US8943364B2 (en) Appliance for storing, managing and analyzing problem determination artifacts
US11609928B2 (en) Systems and methods of determining target database for replication of tenant data
CN114090344B (en) Method, device, equipment and medium for deleting backup resources of container cluster
CN110175070B (en) Distributed database management method, device, system, medium and electronic equipment
CN100372307C (en) Method for managing system log
CN104063294B (en) A kind of linux system backup and restoration methods
US10162717B2 (en) Synchronization of a disaster-recovery system
CN117389684A (en) SaaS multi-tenant data isolation method and system
CN114661420B (en) Application protection method, device and system based on Kubernetes container platform
CN111355770A (en) Equipment centralized control method, server and electronic equipment
JP2021077023A (en) Server management system and program
AU2019244116B2 (en) Techniques for scheduled anti-entropy repair design
CN106341634A (en) Video acquisition system based on hard disk video recorder and method thereof
US8190579B2 (en) IMS change mapper
JP3215125U (en) Backup system
CN110990196B (en) Data backup method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant