Firewall configuration method, device, electronic device and storage medium

By configuring the firewall software architecture in the smart cockpit system and using the preset code format to generate configuration files, it solves the problem that the Android native firewall cannot meet the network isolation and access restrictions of the in-vehicle system, achieving rapid updates of the firewall module and expanding the scope of user use. .

CN118282783BActive Publication Date: 2024-09-24CHENGDU CELIS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410711301.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-09-24
Estimated Expiration
2044-06-04

AI Technical Summary

Technical Problem

The existing Android native firewall cannot meet the needs of network isolation and access restriction in vehicle systems, and the iptables setting instructions restrict user use, making it impossible to achieve rapid updates of the firewall module.

Method used

By configuring the firewall software architecture in the smart cockpit system, loading prefabricated policy configuration files and user policy configuration files, and using the preset code format to generate and update configuration files, the rules of the firewall function are documented, replacing iptables setting instructions, and supporting the vehicle upgrade process. The firewall module in Firewall is quickly updated.

Benefits of technology

It expands the scope of user use, realizes rapid updates of firewall modules, meets the needs of network isolation and access restriction in vehicle systems, and solves the problem of single function of Android's native firewall.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118282783B
    Figure CN118282783B
Patent Text Reader

Abstract

The present application provides a firewall configuration method, device, electronic device and storage medium, which are applied to a smart cockpit system. The smart cockpit system is configured with a firewall software architecture. When the firewall module is started, the pre-set policy configuration file and the user policy configuration file in the pre-set firewall software architecture are loaded in a preset order; update instructions for the pre-set policy configuration file and the user policy configuration file are received; and the pre-set policy configuration file and the user policy configuration file are updated according to the update instructions. In the embodiment of the present invention, the firewall software architecture can solve the problem that the single function of the Android native firewall cannot meet the requirements of network isolation and network access restriction in the vehicle system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of Internet technology, and in particular to a firewall configuration method, device, electronic device and storage medium. Background Art

[0002] After the vehicle system is connected to the Internet, security issues are extremely important. It is necessary to add firewall functions to the intelligent cockpit system (In-Vehicle Infotainment, IVI) to strengthen the control of network access. The firewall should provide functions such as blacklists and whitelists, access control, attack defense, and logging. It is necessary to achieve domain isolation of the in-vehicle network to protect the integrity, confidentiality, and availability of data; prohibit inter-domain resource access, set access rights, and prohibit unauthorized access. At the same time, provide a security protection mechanism for inter-domain data interaction.

[0003] In the related technology, network management is implemented through the Android native code version, and only a simple firewall is implemented through the native system. However, the control strategy supported by the Android native firewall is insufficient, and the firewall configuration file is written through the iptables setting instructions, which restricts user use and cannot meet the rapid update of the firewall module during the vehicle upgrade process. Summary of the invention

[0004] The embodiments of the present application provide a firewall configuration method, device, system, electronic device and computer-readable storage medium to solve the problem in the related art that the firewall module cannot be quickly updated during the vehicle upgrade process.

[0005] In a first aspect, an embodiment of the present application provides an application to a smart cockpit system, wherein the smart cockpit system is configured with a firewall software architecture, and the method includes:

[0006] When the firewall module is started, a prefabricated policy configuration file and a user policy configuration file in the pre-set firewall software architecture are loaded in a preset order, wherein the firewall module is constructed based on the pre-set firewall software architecture, and the prefabricated policy configuration file and the user policy configuration file are configured and generated by a preset code format;

[0007] Receiving update instructions for the prefabricated policy configuration file and the user policy configuration file;

[0008] The prefabricated policy configuration file and the user policy configuration file are updated according to the update instruction.

[0009] Optionally, after the step of loading the prefabricated policy configuration file and the user policy configuration file in the preset firewall software architecture in a preset order when the firewall module is started, the method includes:

[0010] In response to the application sending a firewall function calling instruction, the application is connected to the communication according to the function interface encapsulation package in the preset firewall software architecture, so that the application calls the firewall function.

[0011] Optionally, when the update instruction is a control update instruction for the application, updating the prefabricated policy configuration file and the user policy configuration file according to the update instruction includes:

[0012] In response to a control update instruction for the application program, updating the application configuration policy data in the prefabricated policy configuration file and the user policy configuration file;

[0013] The configuration data corresponding to the application program is configured according to the application configuration policy data, wherein the configuration data includes at least one of a uniform resource locator, an Internet protocol address, a port, and network port information.

[0014] Optionally, when the update instruction is a firewall status update instruction, updating the prefabricated policy configuration file and the user policy configuration file according to the update instruction includes:

[0015] Replace the firewall switch tag in the user policy configuration file according to the firewall status update instruction;

[0016] The state corresponding to the firewall module is switched according to the firewall switching tag, and the state corresponding to the firewall module includes a stateful firewall and a stateless firewall.

[0017] Optionally, the firewall software architecture includes an application layer, a framework layer, a local service layer and a kernel layer, wherein the local service layer includes the prefabricated policy configuration file and the user policy configuration file, and the application layer includes a functional interface encapsulation package.

[0018] Optionally, the prefabricated policy configuration file is used to configure the firewall function and the first network access rule, and the network access rule is generated based on the network access policy; the user policy configuration file is used to generate the second network access rule according to the policy configuration information sent by the user; the priority corresponding to the prefabricated policy configuration file is greater than the priority corresponding to the user policy configuration file.

[0019] Optionally, after the step of updating the prefabricated policy configuration file and the user policy configuration file according to the update instruction, the method includes:

[0020] Receiving preset instructions generated by the firewall module through parsing the prefabricated policy configuration file and the user policy configuration file;

[0021] The corresponding controller in the smart cockpit system is set according to the preset instructions.

[0022] In a second aspect, an embodiment of the present application provides a firewall configuration device, the device comprising:

[0023] A loading configuration module, used for loading a prefabricated policy configuration file and a user policy configuration file in the pre-set firewall software architecture in a preset order when the firewall module is started, wherein the firewall module is constructed based on the pre-set firewall software architecture, and the prefabricated policy configuration file and the user policy configuration file are configured and generated by a preset code format;

[0024] A receiving module, used for receiving update instructions of the prefabricated policy configuration file and the user policy configuration file;

[0025] An updating module is used to update the prefabricated policy configuration file and the user policy configuration file according to the updating instruction.

[0026] Optionally, the device further comprises:

[0027] The calling module is used to respond to the firewall function calling instruction sent by the application program, and to communicate and connect the application program according to the function interface encapsulation package in the preset firewall software architecture, so that the application program calls the firewall function.

[0028] Optionally, when the update instruction is a control update instruction for the application, the update module includes:

[0029] A first updating submodule, configured to update the application configuration policy data in the prefabricated policy configuration file and the user policy configuration file in response to a control update instruction for the application program;

[0030] The second updating submodule is used to configure the configuration data corresponding to the application program according to the application configuration policy data, wherein the configuration data includes at least one of a uniform resource locator, an Internet protocol address, a port, and network port information.

[0031] Optionally, when the update instruction is a firewall status update instruction, the update module includes:

[0032] A third updating submodule, configured to replace the firewall switching tag in the user policy configuration file according to the firewall status update instruction;

[0033] The fourth updating submodule is used to switch the state corresponding to the firewall module according to the firewall switching label, and the state corresponding to the firewall module includes a stateful firewall and a stateless firewall.

[0034] Optionally, the loading configuration module is specifically used in the firewall software architecture including an application layer, a framework layer, a local service layer and a kernel layer, wherein the local service layer includes the prefabricated policy configuration file and the user policy configuration file, and the application layer includes a functional interface encapsulation package.

[0035] Optionally, the loading configuration module is specifically used for the prefabricated policy configuration file to configure the firewall function and the first network access rule, and the network access rule is generated based on the network access policy; the user policy configuration file is used to generate the second network access rule according to the policy configuration information sent by the user; the priority corresponding to the prefabricated policy configuration file is greater than the priority corresponding to the user policy configuration file.

[0036] Optionally, the device further comprises:

[0037] A generation module, used for receiving preset instructions generated by the firewall module through parsing the prefabricated policy configuration file and the user policy configuration file;

[0038] The setting module is used to set the corresponding controller in the smart cockpit system according to the preset instructions.

[0039] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor, wherein the processor is configured to execute the instructions to implement any of the firewall configuration methods described above.

[0040] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to execute any of the firewall configuration methods described above.

[0041] In a fifth aspect, an embodiment of the present application further provides a vehicle, comprising the firewall configuration device as described above.

[0042] In the embodiment of the present application, it is applied to the smart cockpit system, and the smart cockpit system is configured with a firewall software architecture. When the firewall module is started, the prefabricated policy configuration file and the user policy configuration file in the pre-set firewall software architecture are loaded in a preset order, wherein the firewall module is constructed based on the pre-set firewall software architecture, and the prefabricated policy configuration file and the user policy configuration file are configured and generated by a preset code format; receiving update instructions for the prefabricated policy configuration file and the user policy configuration file; and updating the prefabricated policy configuration file and the user policy configuration file according to the update instructions. In the embodiment of the present invention, the firewall software architecture can solve the problem that the single function of the Android native firewall cannot meet the requirements of network isolation and network access restriction in the vehicle system, and the command rules required to be configured by the firewall module are documented by a preset code format. The documented prefabricated policy configuration file and the user policy configuration file have a simple and single structure, which can replace the iptables setting instructions, expand the user's use range, and realize the rapid update of the firewall module during the vehicle upgrade process.

[0043] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0045] Figure 1 It is a flowchart of the steps of a firewall configuration method provided by an embodiment of the present application;

[0046] Figure 2 It is a flowchart of another method for configuring a firewall provided in an embodiment of the present application;

[0047] Figure 3 It is a flowchart of another method for configuring a firewall provided in an embodiment of the present application;

[0048] Figure 4 It is a logic block diagram of a firewall configuration device provided by the implementation of this application;

[0049] Figure 5 is a structural diagram of an electronic device provided in an embodiment of the present application;

[0050] Figure 6 This is a schematic diagram of a firewall software architecture provided by an embodiment of the present application;

[0051] Figure 7 It is a schematic diagram of a functional interface encapsulation package in a firewall software architecture provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0053] Figure 1 This is a flowchart of a method for configuring a firewall provided in an embodiment of the present application, which is applied to a smart cockpit system. The smart cockpit system is configured with a firewall software architecture. The method for configuring the firewall includes:

[0054] It should be noted that in the embodiment of the present application, the firewall software architecture includes an application layer, a framework layer, a local service layer and a kernel layer.

[0055] Among them, the local service layer includes pre-made policy configuration files and user policy configuration files, and the application layer includes function interface encapsulation packages.

[0056] Specifically, refer to Figure 6 , Figure 6 A firewall software architecture is shown.

[0057] For specific component names and function descriptions in the firewall software architecture, please refer to Table 1, which is a component name description table in an exemplary firewall software architecture.

[0058] Table 1 is a component name description table in an exemplary firewall software architecture

[0059]

[0060] in addition, Figure 6 In the , the firewall management tool is controlled by iptableControl. Hardware Interface Definition Language (HIDL) and Android Interface Definition Language (AIDL) are two interface definition languages ​​used to define and implement interfaces between different levels in the Android system.

[0061] Step 101, when the firewall module is started, a prefabricated policy configuration file and a user policy configuration file in a pre-set firewall software architecture are loaded in a pre-set order, wherein the firewall module is constructed based on the pre-set firewall software architecture, and the prefabricated policy configuration file and the user policy configuration file are configured and generated by a pre-set code format;

[0062] Furthermore, the prefabricated policy configuration file is used to configure the firewall function and the first network access rule, which is generated based on the network access policy; the user policy configuration file includes a second network access rule generated by the policy configuration information sent by the user; the priority corresponding to the prefabricated policy configuration file is greater than the priority corresponding to the user policy configuration file.

[0063] It should be noted that in the embodiment of the present application, the firewall configuration file is divided into a prefabricated policy configuration file and a user policy configuration file. The prefabricated policy configuration file is set when the IVI leaves the factory or the IVI system is upgraded and has a read-only attribute. The user policy configuration file is the policy set by the user through the firewall HMI. The user policy configuration file is a supplement to the prefabricated policy configuration file.

[0064] Therefore, when the firewall module is started, the pre-made policy configuration file is loaded first, and then the user policy configuration file is loaded.

[0065] It should be noted that in the embodiment of the present application, the priority of the preset configuration is higher than the user configuration. When the pre-configured configuration conflicts with the user configuration, the preset configuration content in the system pre-configured policy configuration file shall prevail.

[0066] First, for the prefabricated policy configuration file, the prefabricated policy configuration file configures the basic functions of the firewall and the prefabricated network access rules, and stores the network access security policy based on the prefabricated policy; the content in the prefabricated configuration cannot be modified by the user through the firewall HMI, and can only be modified by upgrading; the prefabricated configuration policy file name is set to staticconfig.json, and the storage path is / vendor / etc / firewall / . Among them, for the prefabricated policy configuration file, when the IVI is restored to factory settings, the prefabricated policy configuration file is not affected.

[0067] Among them, the prefabricated strategy configuration file is configured and defined in a preset code format. Specifically, the preset code format can use the json format. The format is defined as follows. The rule content needs to be set according to the specific project:

[0068] {

[0069] "version": "0.01",

[0070] / / 1: whitelist mode, 2: blacklist mode

[0071] "rule-mode": [ 1 ]

[0074] / / Stateful firewall switch, 0: Off, default value. 1: On

[0075] "stateful-firewall": 0,

[0076] / / User policy configuration switch, 0: off, default value; 1: on

[0077] "user-firewall-switch": 0,

[0078] / / Network access control policy

[0079] "network-management": {

[0080] / / Whitelist strategy

[0081] "white-list": {

[0082] / / This item is the configuration policy for the APP. You can set the URL, Internet Protocol address, port, and network port information that the APP can access. / / Put all app rules in this array

[0083] "apps-rules": [

[0084] {

[0085] / / Application UID information, when package is empty, this value must be set

[0086] "uid": 10030,

[0087] / / Apply package information. When uid is empty, this value must be set. When both uid and package are not set, the rule is discarded.

[0088] "package": "xxxx",

[0089] / / When not set, any URL can be accessed

[0090] "url": [

[0091] "www.baidu.com",

[0092] "www.weibo.com"

[0093] ],

[0094] / / When not set, any IP address can be accessed

[0095] "ip": [

[0096] "10.70.40.1"

[0097] ],

[0098] / / When not set, any port can be accessed

[0099] "port": [ 100 ]

[0102] / / When not set, the default route is used. When changing the configuration item, the corresponding uid must exist in ifaces-rules

[0103] "iface": "eth0"

[0104] } ]

[0106] / / IP configuration strategy, the ip in this configuration item refers to the accessible external network destination address

[0107] "destination_ip": [

[0108] {

[0109] "ip": "100.70.40.1",

[0110] "iface": ""

[0111] },

[0112] {

[0113] "ip": "100.70.40.2",

[0114] "iface": "eth0"

[0115] }

[0116] ],

[0117] "ip_port_combined": [

[0118] / / Indicates that data accessing the local port is 300 and is allowed to be received

[0119] {

[0120] "port": 300,

[0121] "source_ip": ""

[0122] },

[0123] / / Indicates that data from IP: 100.70.40.1, accessing local port 400 is allowed to be received

[0124] {

[0125] "port": 400,

[0126] "source_ip": "100.70.40.1"

[0127] }

[0128] ],

[0129] / / This item is the configuration policy for URL filtering, which can set the URLs allowed to be accessed

[0130] "url_rules": [

[0131] {

[0132] "url": [

[0133] "www.baidu.com",

[0134] "www.weibo.com"

[0135] ],

[0136] "iface": ""

[0137] / / Apply to all network ports}],

[0138] },

[0139] / / Blacklist strategy

[0140] "black-list" :

[0142] {

[0143] "port": [

[0144] 80,

[0145] 345, 510

[0147] ],

[0148] "ip": [

[0149] "100.80.40.3",

[0150] "70.90.40.4"

[0151] ],

[0152] "url": [

[0153] "www.weixin.com",

[0154] "www.qq.com"

[0155] ],

[0156] "uid": [

[0157] "10030-10067" ]

[0159] }

[0160] }

[0161] }

[0162] Secondly, for user policy configuration files, which are network access rules generated by users through HMI, the firewall module should persistently store all policies configured by users.

[0163] Users can read or modify configuration files through the firewall HMI. The user policy configuration file is a supplement to the pre-made policy configuration file. When the firewall module starts, the pre-made policy configuration file is loaded first, and then the user policy configuration file is loaded. The user policy file name is set to userconfig.json, and the storage path is / data / vendor / firewall / .

[0164] Furthermore, it should be noted that although the user policy configuration file can be edited, in order to ensure the security of the configuration data, the user policy configuration file needs to be set so that only users with root permissions can access and read and write it.

[0165] Furthermore, the user policy configuration file is empty by default, and rule records are added only when the user adds rules. When the vehicle is restored to factory settings, the user policy configuration file will be cleared. This file needs to be kept unaffected during system upgrades.

[0166] Among them, the user policy configuration file is configured and defined in a preset code format. Specifically, the preset code format also uses the json format to store the configuration policy. The reference information is as follows:

[0167] {

[0168] "version": "0.01",

[0169] / / List of network ports that users can set through the firewall HMI. For network ports outside the list, users cannot set access rules through the HMI.

[0170] "interfaces": [

[0171] "eth0",

[0172] "eth2"

[0173] ],

[0174] / / 1: Whitelist mode, 2: Blacklist mode, 3: User mode. In user mode, users can switch the firewall's blacklist and whitelist modes through the HMI.

[0175] "rule-mode": [ 1 ]

[0178] / / Firewall log switch. 0: Disable, default value. 1: Enable

[0179] "log_switch": 0,

[0180] / / Stateful firewall switch, 0: Off, default value. 1: On

[0181] "stateful-firewall" :

[0183] 0,

[0184] / / Firewall switch, 0: Off. 1: On, default value. This value can only be set in non-user mode. The user version does not set this value.

[0185] "firewall-switch": 1,

[0186] / / Network access control policy

[0187] "network-management": {

[0188] / / Whitelist strategy

[0189] "white-list": {

[0190] / / This item is a configuration item for the network port. The priority of the network port configuration is higher than the priority of apps-rules. / / All iface rules are placed in this array

[0191] "ifaces-rules": [

[0192] {

[0193] / / Specify which network port. If this item is empty, discard this rule.

[0194] "iface": "eth0",

[0195] / / Application UID information, this item and package are in an OR relationship

[0196] "uid": [

[0197] 10030, 10020

[0199] ],

[0200] / / Apply package information. If both uid and package are not set, discard this rule.

[0201] "package": "xxxxx"

[0202] } ]

[0204] / / This item is the configuration policy for the APP. You can set the URL, Internet Protocol address, port, and network port information that the APP can access. / / Put all app rules in this array

[0205] "apps-rules": [

[0206] {

[0207] / / Application UID information, when package is empty, this value must be set

[0208] "uid": 10030,

[0209] / / Apply package information. When uid is empty, this value must be set. When both uid and package are not set, the rule is discarded.

[0210] "package": "xxxxxx",

[0211] / / When not set, any URL can be accessed

[0212] "url": [

[0213] "www.baidu.com",

[0214] "www.weibo.com"

[0215] ],

[0216] / / When not set, any IP address can be accessed

[0217] "ip": [

[0218] "10.70.40.1"

[0219] ],

[0220] / / When not set, any port can be accessed

[0221] "port": [ 100

[0223] ],

[0224] / / When not set, the default route is used. When changing the configuration item, the corresponding uid must exist in ifaces-rules

[0225] "iface": "eth0"

[0226] } ]

[0228] / / This item is the configuration strategy for the destination IP, which can set the Internet Protocol address that is allowed to be accessed. / / IP configuration strategy, the IP in this configuration item refers to the accessible external network destination address

[0229] "destination_ip": [

[0230] {

[0231] "ip": "100.70.40.1",

[0232] "iface": ""

[0233] },

[0234] {

[0235] "ip": "100.70.40.2", .......

[0237] }

[0238] }

[0239] Step 102, receiving update instructions for prefabricated policy configuration files and user policy configuration files;

[0240] It should be noted that in the embodiment of the present application, since the policy configurations in the firewall architecture of the present application are all file-based, the configuration files can be downloaded from the cloud and updated to the IVI system to meet the needs of updating the policy.

[0241] Specifically, car manufacturers can update firewall configuration files through cloud services, and vehicles can update firewall configuration policies.

[0242] Step 103: Update the prefabricated policy configuration file and the user policy configuration file according to the update instruction.

[0243] Further, in one embodiment, when the update instruction is a control update instruction for an application, updating the prefabricated policy configuration file and the user policy configuration file according to the update instruction includes:

[0244] In response to a control update instruction for the application program, updating application configuration policy data in a prefabricated policy configuration file and a user policy configuration file;

[0245] Configuration data corresponding to the application program is configured according to the application configuration policy data, wherein the configuration data includes at least one of a uniform resource locator, an Internet protocol address, a port, and network port information.

[0246] It should be noted that, in the embodiment of the present application, when the system is upgraded, if the prefabricated policy needs to be updated, the prefabricated policy configuration file and the user policy configuration file are replaced with new prefabricated policy configuration file and the user policy configuration file.

[0247] The prefabricated strategy needs to fill in the APP, IP, port, and URL information that needs to be restricted into the rules according to the specific project requirements.

[0248] Specifically, the size of the pre-made policy configuration file and the user policy configuration file cannot exceed 1M. When the configuration file exceeds 1M, a log that the configuration file is too large needs to be generated and the user is notified, but the policy content needs to be executed. Too many policies will affect system performance. The Internet Protocol address configured in the policy configuration file should conform to the IPv4 or IPv6 format, otherwise the configuration will not work; the port number value range is 1~65536, and the configuration will not take effect when it exceeds the range; the URL is filtered as a string with a maximum length of 128; the network port name must comply with the vehicle system interface definition, and illegal names will not work.

[0249] Therefore, in the embodiment of the present application, network access control for a specific application can be achieved through updating, and an API interface is provided for customers to set control policies.

[0250] Specifically, you can refer to the configuration code section for the pre-made policy configuration file and the user policy configuration file in the previous section. It can be seen that through the "apps-rules": [] tag package: "Application A", the configuration policy for application A can be implemented, and the URL, Internet Protocol address, port, network port information, etc. that application A can access can be set.

[0251] In another embodiment, when the update instruction is a firewall status update instruction, updating the prefabricated policy configuration file and the user policy configuration file according to the update instruction includes:

[0252] Change the firewall switch tag in the user policy configuration file according to the firewall status update instruction;

[0253] The state corresponding to the firewall module is switched according to the firewall switching label. The state corresponding to the firewall module includes a stateful firewall and a stateless firewall.

[0254] It should be noted that in the embodiment of the present application, the change of the firewall status can be achieved through updating, that is, the firewall architecture in the present application supports switching between stateful firewalls and stateless firewalls.

[0255] You can refer to the configuration code section for the pre-made policy configuration files and user policy configuration files in the previous section. You can see that the "firewall-switch" tag in the configuration file can support stateful firewall and stateless firewall switching by modifying the file.

[0256] Specifically, for example, a switch button can be made in engineering mode to call the interface provided by the function encapsulation package to support this business.

[0257] In the embodiment of the present application, it is applied to the smart cockpit system, and the smart cockpit system is configured with a firewall software architecture. When the firewall module is started, the prefabricated policy configuration file and the user policy configuration file in the pre-set firewall software architecture are loaded in a preset order, wherein the firewall module is constructed based on the pre-set firewall software architecture, and the prefabricated policy configuration file and the user policy configuration file are configured and generated by a preset code format; receiving update instructions for the prefabricated policy configuration file and the user policy configuration file; and updating the prefabricated policy configuration file and the user policy configuration file according to the update instructions. In the embodiment of the present invention, the firewall software architecture can solve the problem that the single function of the Android native firewall cannot meet the requirements of network isolation and network access restriction in the vehicle system, and the command rules required to be configured by the firewall module are documented by a preset code format. The documented prefabricated policy configuration file and the user policy configuration file have a simple and single structure, which can replace the iptables setting instructions, expand the user's use range, and realize the rapid update of the firewall module during the vehicle upgrade process.

[0258] Figure 2 is a flowchart of a method for configuring a firewall provided in an embodiment of the present application. Figure 2 As shown, the method includes:

[0259] Step 201, when the firewall module is started, a prefabricated policy configuration file and a user policy configuration file in a pre-set firewall software architecture are loaded in a pre-set order, wherein the firewall module is constructed based on the pre-set firewall software architecture, and the prefabricated policy configuration file and the user policy configuration file are configured and generated by a pre-set code format;

[0260] Step 202, receiving update instructions for prefabricated policy configuration files and user policy configuration files;

[0261] Step 203: Update the prefabricated policy configuration file and the user policy configuration file according to the update instruction.

[0262] It should be noted that in the embodiment of the present application, steps 201-203 refer to the foregoing discussion and will not be repeated here.

[0263] Step 204, in response to the application sending a firewall function calling instruction, the application is connected to the communication package according to the function interface encapsulation package in the preset firewall software architecture, so that the application calls the firewall function.

[0264] It should be noted that, refer to Figure 7 It can be seen that the present application can encapsulate all functional interfaces in a functional interface encapsulation package, namely, the platform-library.jar package, so that the application App can statically reference the Jar package to call the firewall function in the firewall module. The firewall module provides an external SDK interface based on the platform component framework.

[0265] Refer to Table 2, which is an exemplary firewall function package component name description table. The application calls the SDK interface and needs to load the function interface package platform-library.jar. The platform-library (platform-library) includes the platform-interface component (platform-interface) and the platform-core component (platform-core) as well as the SDK package files of each service.

[0266] in addition, Figure 7 The bytecode encryption in is ClassLoader, which is used to load Class. It is responsible for converting the bytecode form of Class into the Class object in memory. The bytecode can come from the disk file *.class, the *.class in the jar package, or the byte stream provided by the remote server. The essence of the bytecode is a byte array []byte, which has a specific and complex internal format.

[0267] Table 2: An exemplary firewall function encapsulation package component name description table

[0268]

[0269] In the embodiment of the present application, it is applied to the smart cockpit system, and the smart cockpit system is configured with a firewall software architecture. When the firewall module is started, the prefabricated policy configuration file and the user policy configuration file in the pre-set firewall software architecture are loaded in a preset order, wherein the firewall module is constructed based on the pre-set firewall software architecture, and the prefabricated policy configuration file and the user policy configuration file are configured and generated by a preset code format; receiving update instructions for the prefabricated policy configuration file and the user policy configuration file; and updating the prefabricated policy configuration file and the user policy configuration file according to the update instructions. In the embodiment of the present invention, the firewall software architecture can solve the problem that the single function of the Android native firewall cannot meet the requirements of network isolation and network access restriction in the vehicle system, and the command rules required to be configured by the firewall module are documented by a preset code format. The documented prefabricated policy configuration file and the user policy configuration file have a simple and single structure, which can replace the iptables setting instructions, expand the user's use range, and realize the rapid update of the firewall module during the vehicle upgrade process.

[0270] In addition, the embodiment of the present application encapsulates the firewall function in a custom Jar package for upper-layer application calls, deviating from the Android native package and facilitating platform-based development.

[0271] Figure 3 is a flowchart of another method for configuring a firewall provided in an embodiment of the present application. Figure 3 As shown, the method includes:

[0272] Step 301, when the firewall module is started, a prefabricated policy configuration file and a user policy configuration file in the pre-set firewall software architecture are loaded in a preset order, wherein the firewall module is constructed based on the pre-set firewall software architecture, and the prefabricated policy configuration file and the user policy configuration file are configured and generated by a preset code format;

[0273] Step 302, receiving an update instruction of a prefabricated policy configuration file and the user policy configuration file;

[0274] Step 303: Update the prefabricated policy configuration file and the user policy configuration file according to the update instruction.

[0275] It should be noted that in the embodiment of the present application, the above steps 301-303 refer to the previous discussion and will not be repeated here.

[0276] Step 304, receiving a preset instruction generated by the firewall module by parsing the prefabricated policy configuration file and the user policy configuration file;

[0277] Step 305: Setting the corresponding controller in the smart cockpit system according to the preset instructions.

[0278] It should be noted that in the embodiment of the present application, the preset instructions are iptables instructions. The firewall module will parse the pre-made policy configuration file and the user policy configuration file and then dynamically generate iptables instructions and set them to the system.

[0279] Therefore, the present application can directly parse files through a simple single json format pre-made policy configuration file and a user policy configuration file, and automatically and dynamically generate iptables instructions without the user having to be familiar with iptables setting instructions.

[0280] In the embodiment of the present application, it is applied to the smart cockpit system, and the smart cockpit system is configured with a firewall software architecture. When the firewall module is started, the prefabricated policy configuration file and the user policy configuration file in the pre-set firewall software architecture are loaded in a preset order, wherein the firewall module is constructed based on the pre-set firewall software architecture, and the prefabricated policy configuration file and the user policy configuration file are configured and generated by a preset code format; receiving update instructions for the prefabricated policy configuration file and the user policy configuration file; and updating the prefabricated policy configuration file and the user policy configuration file according to the update instructions. In the embodiment of the present invention, the firewall software architecture can solve the problem that the single function of the Android native firewall cannot meet the requirements of network isolation and network access restriction in the vehicle system, and the command rules required to be configured by the firewall module are documented by a preset code format. The documented prefabricated policy configuration file and the user policy configuration file have a simple and single structure, which can replace the iptables setting instructions, expand the user's use range, and realize the rapid update of the firewall module during the vehicle upgrade process.

[0281] Corresponding to the method provided in the above-mentioned firewall configuration method embodiment of the present application, see Figure 4 The present application also provides a logic block diagram of a firewall configuration device. In this embodiment, the device 400 includes:

[0282] A loading configuration module 401 is used to load a prefabricated policy configuration file and a user policy configuration file in a pre-set firewall software architecture in a preset order when the firewall module is started, wherein the firewall module is constructed based on the pre-set firewall software architecture, and the prefabricated policy configuration file and the user policy configuration file are configured and generated by a preset code format;

[0283] The receiving module 402 is used to receive update instructions of the prefabricated policy configuration file and the user policy configuration file;

[0284] The updating module 403 is used to update the prefabricated policy configuration file and the user policy configuration file according to the updating instruction.

[0285] Optionally, the device further comprises:

[0286] The calling module is used to respond to the firewall function calling instruction sent by the application program, and to encapsulate the communication connection application program according to the function interface in the pre-set firewall software architecture, so that the application program calls the firewall function.

[0287] Optionally, when the update instruction is a control update instruction for an application program, the update module includes:

[0288] A first updating submodule, configured to update application configuration policy data in a prefabricated policy configuration file and a user policy configuration file in response to a control update instruction for the application program;

[0289] The second updating submodule is used to configure the configuration data corresponding to the application program according to the application configuration policy data, wherein the configuration data includes at least one of a uniform resource locator, an Internet protocol address, a port, and network port information.

[0290] Optionally, when the update instruction is a firewall status update instruction, the update module includes:

[0291] A third updating submodule is used to replace the firewall switching tag in the user policy configuration file according to the firewall status update instruction;

[0292] The fourth updating submodule is used to switch the state corresponding to the firewall module according to the firewall switching label, and the state corresponding to the firewall module includes a stateful firewall and a stateless firewall.

[0293] Optionally, the loading configuration module is specifically used for the firewall software architecture including an application layer, a framework layer, a local service layer and a kernel layer, wherein the local service layer includes a prefabricated policy configuration file and a user policy configuration file, and the application layer includes a functional interface encapsulation package.

[0294] Optionally, the loading configuration module is specifically used to prefabricate a policy configuration file for configuring a firewall function and a first network access rule, wherein the first network access rule is generated based on the network access policy; the user policy configuration file includes a second network access rule generated by the policy configuration information sent by the user; the priority corresponding to the prefabricated policy configuration file is greater than the priority corresponding to the user policy configuration file.

[0295] Optionally, the device further comprises:

[0296] A generation module, used for receiving iptable instructions generated by the firewall module for parsing the prefabricated policy configuration file and the user policy configuration file;

[0297] The setting module is used to set the corresponding controller in the smart cockpit system according to the iptable instructions.

[0298] In summary, a firewall configuration device is provided in an embodiment of the present application. In an embodiment of the present invention, the problem that the single function of the Android native firewall cannot meet the requirements of network isolation and network access restriction in the vehicle system can be solved through the firewall software architecture, and the preset code format documents the instruction rules required to configure the firewall module. The prefabricated policy configuration file and user policy configuration file have a simple and single structure after documentation, can replace the iptables setting instructions, expand the user's usage scope, and can realize the rapid update of the firewall module during the vehicle upgrade process.

[0299] Figure 5 This is a structural diagram of an electronic device M00 provided in an embodiment of the present application. In the figure, the electronic device M00 includes a processor M01 and a memory M02. The memory M02 stores programs or instructions that can be run on the processor M01. When the program or instruction is executed by the processor M01, the various steps of the above-mentioned firewall configuration method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0300] In an embodiment of the present application, the memory M02 can be used to store software programs and various data. The memory M02 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory M02 may include a volatile memory or a non-volatile memory, or the memory x09 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. Volatile memory can be random access memory (Random Access Memory, RAM), static random access memory (Static RAM, SRAM), dynamic random access memory (Dynamic RAM, DRAM), synchronous dynamic random access memory (Synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (Double DataRate SDRAM, DDRSDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (Synch link DRAM, SLDRAM) and direct memory bus random access memory (Direct Rambus RAM, DRRAM). The memory M02 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0301] The processor M01 may include one or more processing units; optionally, the processor M01 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor M01.

[0302] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned firewall configuration method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0303] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0304] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned firewall configuration method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0305] It should be understood that the chip involved in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0306] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned firewall configuration method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0307] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0308] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), and includes a number of instructions for a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0309] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A firewall configuration method, characterized in that: Applied to a smart cockpit system, the smart cockpit system is configured with a firewall software architecture, and the method includes: When the firewall module is started, a prefabricated policy configuration file and a user policy configuration file in the pre-set firewall software architecture are loaded in a preset order, wherein the firewall module is constructed based on the pre-set firewall software architecture, and the prefabricated policy configuration file and the user policy configuration file are configured and generated by a preset code format; Receiving update instructions for the prefabricated policy configuration file and the user policy configuration file; updating the prefabricated policy configuration file and the user policy configuration file according to the update instruction; The firewall software architecture includes an application layer, a framework layer, a local service layer and a kernel layer, wherein the local service layer includes firewall startup, firewall process, the prefabricated policy configuration file and the user policy configuration file, the application layer includes a functional interface encapsulation package, the framework layer includes firewall management and firewall services, and the kernel layer includes a network data packet processing framework; The prefabricated policy configuration file is used to configure the firewall function and the first network access rule, which is generated based on the network access policy; the user policy configuration file includes a second network access rule generated by the policy configuration information sent by the user; the priority corresponding to the prefabricated policy configuration file is greater than the priority corresponding to the user policy configuration file.

2. The firewall configuration method according to claim 1, characterized in that: After the step of loading the prefabricated policy configuration file and the user policy configuration file in the pre-set firewall software architecture in a preset order when the firewall module is started, the method includes: In response to the application sending a firewall function calling instruction, the application is connected to the communication according to the function interface encapsulation package in the preset firewall software architecture, so that the application calls the firewall function.

3. The firewall configuration method according to claim 2, characterized in that: When the update instruction is a control update instruction for the application, updating the prefabricated policy configuration file and the user policy configuration file according to the update instruction includes: In response to a control update instruction for the application program, updating the application configuration policy data in the prefabricated policy configuration file and the user policy configuration file; The configuration data corresponding to the application program is configured according to the application configuration policy data, wherein the configuration data includes at least one of a uniform resource locator, an Internet protocol address, a port, and network port information.

4. The firewall configuration method according to claim 1, characterized in that: When the update instruction is a firewall status update instruction, updating the prefabricated policy configuration file and the user policy configuration file according to the update instruction includes: Replace the firewall switch tag in the user policy configuration file according to the firewall status update instruction; The state corresponding to the firewall module is switched according to the firewall switching tag, and the state corresponding to the firewall module includes a stateful firewall and a stateless firewall.

5. The firewall configuration method according to claim 1, characterized in that: After the step of updating the prefabricated policy configuration file and the user policy configuration file according to the update instruction, the method includes: Receiving preset instructions generated by the firewall module through parsing the prefabricated policy configuration file and the user policy configuration file; The corresponding controller in the smart cockpit system is set according to the preset instructions.

6. A firewall configuration device, characterized in that: The device comprises: A loading configuration module, used for loading a prefabricated policy configuration file and a user policy configuration file in a pre-set firewall software architecture in a preset order when the firewall module is started, wherein the firewall module is constructed based on the pre-set firewall software architecture, and the prefabricated policy configuration file and the user policy configuration file are configured and generated by a preset code format; A receiving module, used for receiving update instructions of the prefabricated policy configuration file and the user policy configuration file; An updating module, used for updating the prefabricated policy configuration file and the user policy configuration file according to the updating instruction; The firewall software architecture includes an application layer, a framework layer, a local service layer and a kernel layer, wherein the local service layer includes firewall startup, firewall process, the prefabricated policy configuration file and the user policy configuration file, the application layer includes a functional interface encapsulation package, the framework layer includes firewall management and firewall services, and the kernel layer includes a network data packet processing framework; The prefabricated policy configuration file is used to configure the firewall function and the first network access rule, which is generated based on the network access policy; the user policy configuration file includes a second network access rule generated by the policy configuration information sent by the user; the priority corresponding to the prefabricated policy configuration file is greater than the priority corresponding to the user policy configuration file.

7. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the firewall configuration method according to any one of claims 1 to 5.

8. A storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the firewall configuration method as claimed in any one of claims 1 to 5.