Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the existing process of creating IPSec VPN tunnel, no matter the device is used as the initiating end or the responding end, only one proposal for negotiating the establishment of two-stage IPSec SAs is configured on the device. Therefore, only if the proposals for negotiating IPSec SA configured on the originating side and the responding side are the same, an IPSec VPN tunnel can be created between the devices on both sides. This scenario, where only one proposal is configured on the devices at both ends, when negotiating IPSec SA at both ends, IPSec SA can be established only if the proposals and protection data flows configured at both ends match completely, making the configuration at both ends inflexible. The creating of the IPSec VPN tunnel needs to go through two-stage negotiation, where one-stage negotiation establishes an IKE SA, and the main purpose is to protect security of data transmitted during tunnel establishment (for example, data transmitted in two stages for negotiating the IPSec SA) and to authenticate devices at both ends. The two-phase negotiation establishes the IPSec SA, with the primary purpose of protecting the security of data transmitted in the tunnel (e.g., data packets transmitted in the established tunnel) after the tunnel is established. The proposal configured on the device includes data for negotiating the IPSec SA in two-stage transmission, for example, the proposal includes data for negotiating the encryption algorithm, authentication algorithm, compression algorithm, and lifetime of the IPSec SA in order to ensure the security of the data transmitted in the IPSec VPN tunnel.
To solve this technical problem, the present invention configures a proposal group on a device that creates an IPSec VPN tunnel, the proposal group including at least one (usually two or more) proposal for negotiating IPSec SA, and data included in each proposal for negotiating IPSec SA being different. When IPSec SA negotiation is carried out, only proposals which can be matched are required to be arranged in proposal groups at two ends, and IPSec VPN tunnels can be established at the two ends. The probability of successful IPSec SA negotiation is improved by configuring the proposal group on the equipment, and the flexibility of two-stage matching is improved.
The method provided by this embodiment is performed by an apparatus for performing communication by creating an IPSec VPN tunnel, where the apparatus may be a server, a terminal, a router, or a gateway, and this embodiment does not specifically limit this.
When the device is used as an initiating end, fig. 1 is a schematic flowchart of a communication method based on an proposed group of IPSec VPN tunnels, which is provided in this embodiment, and referring to fig. 1, the method includes:
101: in the process of establishing an IPSec VPN tunnel communicated with a response end, judging whether an IKE SA is established by negotiation with the response end;
102: if the IKE SA is established by negotiation with the response end, selecting a first proposal used for establishing IPSec SA by negotiation with the response end from a configured proposal group;
103: sending the first proposal to the response end to establish the IPSec VPN tunnel with the response end.
In the process of establishing an IPSec VPN tunnel with a response end, the device serving as an initiating end needs to determine whether an IKE SA has been successfully negotiated before performing two-stage IPSec SA negotiation. If so, the negotiation of the two-stage IPSec SA is carried out, otherwise, the negotiation of the two-stage IPSec SA cannot be carried out. After the IPSec SA is negotiated and established, an IPSec VPN tunnel is established with the response end, and communication can be carried out with the response end through the IPSec VPN tunnel.
An offer group including a plurality of offers for negotiating IPSec SA is configured in advance in the device as an originating end. When negotiating IPSec SA, the device selects one offer from the set of offers as a first offer to negotiate IPSec SA and sends the first offer to the responder. If the response end successfully matches the first proposal, the equipment establishes an IPSec VPN tunnel with the response end. If the response end fails to match the first proposal, the IPSec VPN tunnel between the response end and the response end cannot be established, at this time, the device serving as the initiating end can select other proposals from the proposal group as the first proposal, and establishes the IPSec VPN tunnel between the first proposal and the response end through the reselected first proposal. Thus, by setting the proposal group, the device as the initiator can flexibly select a proposal for performing two-stage negotiation. After the IPSec VPN tunnel is established with the response end in a failure mode, the IPSec VPN tunnel can be reselected and proposed to be established, and the probability of the IPSec VPN tunnel establishment with the response end in a success mode is increased. In addition, when the networking is established, a plurality of communication tunnels can be established according to the configured proposed groups, so that the success rate of the networking is improved, and the flexibility of the networking is greatly improved.
The embodiment provides a communication method of IPSec VPN tunnel based on an proposal group, and the proposal group used for negotiating and establishing IPSec SA is configured in the equipment for creating the IPSec VPN tunnel. In the process of establishing the IPSec VPN tunnel, in the process of negotiating and establishing the IPSec SA in the second stage, as long as a certain offer exists in the offer group configured by the initiating end and a certain offer in the offer group configured by the responding end, the IPSec SA can be negotiated and established at the initiating end and the responding end. Compared with the method of only configuring one proposal on the equipment, the method for configuring the proposal group on the equipment greatly improves the success rate of negotiating and establishing IPSec SA. In the proposal range of which the configuration is agreed at both ends, the content options of the proposal group are more, the configuration is simplified, the two-stage negotiation process has higher flexibility, and the networking flexibility is greatly improved.
When the device is used as an initiator, further, on the basis of the above embodiment, if the IKE SA is established in negotiation with the responder, selecting a first offer for establishing IPSec SA in negotiation with the responder from a set of configured offers includes:
if the IKE SA is established by negotiation with the response end, acquiring a preset first selection rule for selecting a proposal from the proposal group each time, and selecting a proposal for establishing IPSec SA by negotiation with the response end from the proposal group as the first proposal according to the first selection rule;
the first selection rule is polling selection, random selection or selection according to a set priority order.
For the device as the initiator, not only the proposal group is configured, but also a first selection rule is set that selects the first proposal for two-stage IPSec SA negotiation from the proposal group at a time. For example, if the first selection rule is polling selection, then an order is set for each offer in the offer group, and the offers are polled and selected in the order as a first offer to negotiate IPSec SAs; or, if the first selection rule is random selection, setting a certain random algorithm, and selecting the first proposal from the proposal group as the first proposal for negotiating the IPSec SA according to the random algorithm each time; alternatively, the first selection rule is to select according to a set priority order, then set a priority for each offer in the set of offers, each time selecting an offer that meets the priority requirements as the first offer to negotiate IPSec SAs, wherein the priority requirements to be met for the offers are reset each time. The selection of the proposal by the device as the initiating end can be governed by the first selection rule, which increases the controllability of the proposal selection and, at the same time, further increases the flexibility of IPSec SA negotiation.
When the device serves as an initiating end, further, on the basis of the foregoing embodiments, the sending the first offer to the responding end to establish the IPSec VPN tunnel with the responding end includes:
sending the first proposal to the response end, and receiving first feedback information sent by the response end whether the first proposal is successfully matched or not;
if the first feedback information is that the first proposal is successfully matched, the IPSec VPN tunnel is successfully established with the response end;
and if the first feedback information is that the matching of the first proposal fails, reselecting a proposal from the proposal group as the first proposal until the IPSec VPN tunnel is successfully established with the response end, or until the response end fails to match each proposal in the proposal group.
Further, said re-selecting a proposal from said set of proposals as said first proposal comprises: reselecting an offer from the set of offers as the first offer according to the first selection rule.
Further, still include: and if the matching of each proposal in the proposal group fails, the response end sends out prompt information which can not establish the IPSec VPN tunnel with the response end.
After the device serving as the initiating end sends the first proposal to the responding end, the responding end matches the first proposal and feeds back first feedback information whether the first proposal is successfully matched or not to the device. If the first feedback information received by the device is that the matching of the first proposal is successful, the IPSec VPN tunnel is successfully established with the response end, and the communication can be carried out through the IPSec VPN tunnel. If the first feedback information received by the device is that the matching of the first proposal fails, the device serving as the initiating end can reselect the first proposal for negotiating the IPSec SA from the proposal group, and establish the IPSec VPN tunnel with the responding end again through the reselected first proposal. Through the first feedback information of the response end, the device serving as the initiating end can reselect the first proposal to create the IPSec VPN tunnel in time under the condition that the matching of the first proposal fails, so that the efficiency of the negotiation process is realized.
It should be noted that, the above-mentioned device may not only be used as an initiating end, but also be used as a responding end, and when the device is used as a responding end, further, on the basis of the above-mentioned embodiments, the method further includes:
if a second proposal which is sent by an initiating end in the process of establishing the IPSec VPN tunnel and is used for negotiating and establishing the IPSec SA is received, judging whether a proposal which is successfully matched with the second proposal exists in the configured proposal group, if so, sending second feedback information which is successfully matched with the second proposal to the initiating end, otherwise, sending third feedback information which is failed to match the second proposal to the initiating end.
In the method provided by this embodiment, the device as the responder is also configured with an offer group for negotiating IPSec SA. When a second proposal of negotiating and establishing the IPSec SA, which is sent by an initiating end, is received, whether the proposal which is the same as the second proposal exists in a proposal group configured by the device is judged, if so, the second proposal is successfully matched, namely, an IPSec VPN tunnel can be established with a responding end, otherwise, the IPSec VPN tunnel cannot be established with the responding end. And when the second proposal is successfully matched, sending second feedback information to the initiating terminal, otherwise, sending third feedback information to the initiating terminal. And the initiating end is informed whether the IPSec VPN tunnel is established successfully or not in time through the second feedback information and the third feedback information, so that the initiating end switches a new first proposal in time to reinitiate the establishment of the IPSec VPN tunnel, and the negotiation process is ensured to be carried out in time and in order.
When the device serves as a responding end, further, on the basis of the foregoing embodiments, the determining whether there is a proposal that is successfully matched with the second proposal in the configured proposal group, if yes, sending second feedback information that the matching of the second proposal is successful to the initiating end, otherwise, sending third feedback information that the matching of the second proposal is failed to the initiating end, includes:
acquiring a preset second selection rule which is selected from the proposal group each time for matching the received proposal, and selecting the proposal for matching the second proposal from the proposal group as a target proposal according to the second selection rule;
if the target offer and the second offer are successfully matched, sending the second feedback information to the initiating end;
and if the target offer and the second offer are failed to be matched, reselecting an offer used for matching the second offer from the offer group as the target offer according to the second selection rule until the second feedback information is sent to the initiating terminal after the second offer is successfully matched, or until each offer in the offer group and the second offer are failed to be matched, and sending the third feedback information by the initiating terminal.
On the device as the responder, in addition to the proposal group configured for matching with the second proposal sent by the initiator, a second selection rule is set for selecting a target proposal matching with the second proposal each time. Each time the matching of the second offer fails, the target offer is reselected from the offer group according to a second selection rule, and it is determined whether the reselected target offer matches the second offer. For example, if the second selection rule is polling selection, an order is set for each offer in the offer group, and the polling selection offers are matched with the second offers according to the order; or, if the second selection rule is random selection, setting a random algorithm, and selecting the proposal from the proposal group to match with the second proposal according to the random algorithm each time; or the second selection rule is that the proposals in the proposal group are prioritized according to the set priority order, and the proposal meeting the priority requirement is selected to be matched with the second proposal every time, wherein the priority requirement to be met by the proposal is reset every time. The device acting as the responder can be governed by the second selection rule to select the proposal matched with the second proposal, so that the controllability of proposal selection is increased, and the flexibility of IPSec SA negotiation is further increased.
Specifically, in the communication method of the IPSec VPN tunnel based on the proposed group according to the embodiment of the present invention, on the premise of one-stage IKE SA negotiation establishment, an initiating end and a responding end implement two-stage IPSec SA negotiation through the proposed group. Each offer contained in the set of offers is an instance. When the device is acting as an initiator, an offer to negotiate IPSec SAs may be selected from a set of offers configured. So that there is an optional offer to negotiate with the responding end each time an IPSec VPN tunnel is negotiated to be established. When the device is used as a response end, for example, multiple initiating ends establish IPSec VPN tunnels with the response end, that is, the device is used as a central node to negotiate with multiple branches to establish the IPSec VPN tunnels. Each instance in the proposed set of device configurations corresponds to a proposal to negotiate IPSec SAs that may be matched. Since the initiator can configure any one or proposal group type to negotiate with the responder, the proposal selected by the initiator can negotiate successfully as long as the proposal is consistent with a certain proposal in the proposal group of the responder, and different types of IPSec tunnels can be created.
It can be seen that, by the communication method based on the proposed group of IPSec VPN tunnels provided by the present embodiment, the device as the initiating end is more flexible in configuring the proposals. For the device as the response end, multiple types of IPSec tunnels can be established when the device is used as the central node. The proposed group-based communication method for the IPSec VPN tunnel provided in this embodiment only optimizes proposed matching, and does not affect the matching principle and traffic encryption, decryption, and forwarding.
Fig. 2 shows a block diagram of a communication apparatus based on an proposed group of IPSec VPN tunnels according to an embodiment of the present invention, and referring to fig. 2, the communication apparatus based on an proposed group of IPSec VPN tunnels according to the embodiment includes a determining module 201, a selecting module 202 and a sending module 203, wherein,
a determining module 201, configured to determine, in a process of creating an IPSec VPN tunnel that communicates with a response end, whether an IKE SA is negotiated with the response end;
a selecting module 202, configured to select, if an IKE SA is negotiated with the responder, a first offer for negotiating IPSec SA with the responder from a set of configured offers;
a sending module 203, configured to send the first offer to the responding end, so as to establish the IPSec VPN tunnel with the responding end.
The communication apparatus based on the proposed group IPSec VPN tunnel according to this embodiment is suitable for the communication method based on the proposed group IPSec VPN tunnel according to the foregoing embodiment, and will not be described herein again.
The embodiment of the invention provides a communication device of IPSec VPN tunnel based on an proposal group, which configures the proposal group used for negotiating the establishment of IPSec SA in a device for creating the IPSec VPN tunnel. In the process of establishing the IPSec VPN tunnel, in the process of negotiating and establishing the IPSec SA in the second stage, as long as a certain offer exists in the offer group configured by the initiating end and a certain offer in the offer group configured by the responding end, the IPSec SA can be negotiated and established at the initiating end and the responding end. Compared with the method of only configuring one proposal on the equipment, the method for configuring the proposal group on the equipment greatly improves the success rate of negotiating and establishing IPSec SA. In the proposal range of which the configuration is agreed at both ends, the content options of the proposal group are more, the configuration is simplified, the two-stage negotiation process has higher flexibility, and the networking flexibility is greatly improved.
Further, on the basis of the foregoing embodiments, the selecting module is further configured to, if an IKE SA is negotiated with the responder, obtain a preset first selection rule for each selection of a proposal from the proposal group, and select, as the first proposal, a proposal for negotiating with the responder to establish an IPSec SA from the proposal group according to the first selection rule;
the first selection rule is polling selection, random selection or selection according to a set priority order.
Further, on the basis of the foregoing embodiments, the sending module is further configured to send the first offer to the responding end, and receive first feedback information sent by the responding end whether the matching of the first offer is successful; if the first feedback information is that the first proposal is successfully matched, the IPSec VPN tunnel is successfully established with the response end; and if the first feedback information is that the matching of the first proposal fails, reselecting a proposal from the proposal group as the first proposal until the IPSec VPN tunnel is successfully established with the response end, or until the response end fails to match each proposal in the proposal group.
Further, on the basis of the above embodiments, the system further comprises a response module;
the response module is configured to, if a second offer used for negotiating establishment of IPSec SA and sent by an initiating end in a process of creating an IPSec VPN tunnel is received, determine whether an offer successfully matched with the second offer exists in the configured offer group, if so, send second feedback information that the matching of the second offer is successful to the initiating end, and otherwise, send third feedback information that the matching of the second offer is unsuccessful to the initiating end.
Further, on the basis of the foregoing embodiments, the determining whether there is a proposal that is successfully matched with the second proposal in the configured proposal group, if yes, sending second feedback information that is successfully matched with the second proposal to the originating terminal, otherwise, sending third feedback information that is unsuccessfully matched with the second proposal to the originating terminal includes:
acquiring a preset second selection rule which is selected from the proposal group each time for matching the received proposal, and selecting the proposal for matching the second proposal from the proposal group as a target proposal according to the second selection rule;
if the target offer and the second offer are successfully matched, sending the second feedback information to the initiating end;
if the target offer and the second offer are failed to be matched, reselecting an offer for matching the second offer from the offer group as the target offer according to the second selection rule until the second feedback information is sent to the initiating terminal after the second offer is successfully matched, or until each offer in the offer group and the second offer are failed to be matched, the initiating terminal sends the third feedback information;
the second selection rule is polling selection, random selection or selection according to a set priority order.
Fig. 3 is a block diagram showing the structure of the electronic apparatus provided in the present embodiment.
Referring to fig. 3, the electronic device includes: a processor (processor)310, a communication Interface (communication Interface)320, a memory (memory)330 and a communication bus 340, wherein the processor 310, the communication Interface 320 and the memory 330 communicate with each other via the communication bus 340. The processor 310 may call logic instructions in the memory 330 to perform the following method: in the process of establishing an IPSec VPN tunnel communicated with a response end, judging whether an IKE SA is established by negotiation with the response end; if the IKE SA is established by negotiation with the response end, selecting a first proposal used for establishing IPSec SA by negotiation with the response end from a configured proposal group; sending the first proposal to the response end to establish the IPSec VPN tunnel with the response end.
In addition, the logic instructions in the memory 330 may be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The present embodiments provide a non-transitory computer readable storage medium having stored thereon a computer program, the computer program being executable by a processor to perform the method of: in the process of establishing an IPSec VPN tunnel communicated with a response end, judging whether an IKE SA is established by negotiation with the response end; if the IKE SA is established by negotiation with the response end, selecting a first proposal used for establishing IPSec SA by negotiation with the response end from a configured proposal group; sending the first proposal to the response end to establish the IPSec VPN tunnel with the response end.
The present embodiments disclose a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the methods provided by the above-described method embodiments, for example, comprising: in the process of establishing an IPSec VPN tunnel communicated with a response end, judging whether an IKE SA is established by negotiation with the response end; if the IKE SA is established by negotiation with the response end, selecting a first proposal used for establishing IPSec SA by negotiation with the response end from a configured proposal group; sending the first proposal to the response end to establish the IPSec VPN tunnel with the response end.
The above-described embodiments of the electronic device and the like are merely illustrative, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may also be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the embodiments of the present invention, and are not limited thereto; although embodiments of the present invention have been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.