Avamar:如何使用 edit-firewall-rules.sh 添加或删除自定义 Avamar 防火墙规则(v7.3 及更高版本)

Summary: 本文介绍如何使用 edit-firewall-rules.sh 脚本添加或删除自定义 Avamar 防火墙规则。 此功能在 Avamar v7.3 及更高版本中可用。

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

在 Avamar v7.3 及更高版本中,提供了一个工具,允许用户添加或删除自己的自定义 iptables 规则。

特征: 
  • 是随 v7.3 提供的标准 Avamar 防火墙 RPM 的一部分。
  • 用户可以添加或删除自己的自定义 iptables 规则。
  • 自定义规则在 Avamar 版本升级后仍然存在。
  • 自定义规则在防火墙软件包更新后仍然存在。
以下新文件由 avfwb 安全 RPM 安装到系统上。文件位于:/usr/local/avamar/lib/admin/security。
  • edit-firewall-rules.sh
  • manage-custom-rules.sh
  • avfwb_custom_config.txt

edit-firewall-rules.sh:
  • 此文件是一个交互式脚本,它接受用户输入并将其格式化为 iptables 格式。
  • 此文件以客户友好的方式列出信息。
manage-custom-rules.sh:
  • 此文件是 edit-firewall-rules.sh 交互式脚本背后的引擎。
  • 此文件基于配置文件中保存的自定义规则集创建 iptables 规则和命令。
  • 此文件将重新启动 avfirewall 服务以应用新规则。

以 root 用户身份运行上述脚本。
以管理员用户身份加载密钥后,使用“su - 运行脚本”


切换到 root 用户
在运行脚本之前加载 SSH 密钥。  

如果未加载密钥,脚本在将规则复制到其他节点时可能会失败。  

有关详细信息,请参阅文章“备注”或 Avamar 系统管理指南
 
Choose an Action
----------------
1) Add a custom rule
2) Remove a custom rule
3) List Current Custom Rules
4) Exit
5) Save & Exit
Enter desired action:

Add a Custom Rule
The user can make selections for iptables fields to construct the rule they wish to add.
  • 规则类型:IPv4 或 IPv6。
  • 链:Output、Input、Logdrop 或 Forward。
  • Protocol:TCP、UDP、ICMP。
  • 源 IP。
  • 源端口。
  • 目标 IP。
  • 目标端口。
  • 目标:Accept、Reject、Drop、Reject。
  • 节点类型:全部、数据、实用程序。
自定义规则以竖线分隔 线的形式存储在avfwb_custom_config.txt 文件中。

格式:
源 IP |源端口 |目标 IP |目标端口 |协议 |ICMP型 |目标 |链条 |节点类型

示例:
10.10.10.10||10.10.10.11||tcp||ACCEPT|OUTPUT|ALL

Add Rule Example

Select the type of firewall rule to add
Firewall Rule Types
-------------------
1) IPv4 Rule
2) IPv6 Rule
Enter Firewall Rule Type:
Protocol
--------
1) TCP
2) UDP
3) ICMP
Enter Protocol:
Select the desired CHAIN
Firewall Chains
---------------
1) OUTPUT
2) INPUT
3) LOGDROP
4) FORWARD
Select Chain:
Select the Protocol type to be used
Protocol
--------
1) TCP
2) UDP
3) ICMP
Enter Protocol:

Enter source IP (leave blank for none):
Enter source port (leave blank for none):
Enter destination IP (leave blank for none):
Enter destination port (leave blank for none):
Select the desired target action
Targets
-------
1) ACCEPT
2) REJECT
3) DROP
4) LOGDROP
Select Target:

Select which type of node this new rule will be applied to
Node Types
----------
1) ALL
2) DATA
3) UTILITY
Select node type to apply rule to:

The script will ask you to confirm that you want to add the new rule to the avfwb_custom_config.txt file
Add rule ||||tcp||ACCEPT|OUTPUT|ALL to file? (Y/N): y
Adding ||||tcp||ACCEPT|OUTPUT|ALL to file...

The script asks if you wish to add another rule or return to the main menu
Add another rule? (Y/N):
Return to main menu? (Y/N):

Saving and applying rules
Choose an Action
----------------
1) Add a custom rule
2) Remove a custom rule
3) List Current Custom Rules
4) Exit
5) Save & Exit
Enter desired action: 5

Rules have been saved to /usr/local/avamar/lib/admin/security/avfwb_custom_config.txt
Save and execute rules now? (Y/N):

Choosing Y when asked to save and execute will propagate the config file to all 
nodes, applies the rules accordingly and restarts the avfirewall service.

kA5j00000008VAYCA2_1_0

Removing a rule 
 Choose an Action
----------------
1) Add a custom rule
2) Remove a custom rule
3) List Current Custom Rules
4) Exit
5) Save & Exit
Enter desired action: 2

kA5j00000008VAYCA2_1_1
Select the rule to remove.  The script will confirm "Line xxx has been removed from configuration file"

Return to the main menu.  If we select option 3 "List Current Custom Rules" we will see the list of rules and a list of 'Changes Pending'.

kA5j00000008VAYCA2_1_2

Pending changes will be executed when exiting the script and selecting Y to "Save and execute rules now".
 Rules have been saved to /usr/local/avamar/lib/admin/security/avfwb_custom_config.txt
Save and execute rules now? (Y/N):

Additional Information

请注意不要创建任何可能影响 Avamar 应用程序功能的防火墙规则。例如,拒绝传入或传出 Avamar Server 端口的流量。

有关 Avamar 所需端口的信息,请参阅最新版本的 《Avamar 产品安全指南 》。

产品安全指南中还有一个类似的工具“manage-custom-rules.sh”,它是非交互式的。

如何检查 SSH 密钥是否已加载,如果没有,如何加载它们。
admin@util:~/>: ssh-add -l
Could not open a connection to your authentication agent.   <-- keys not loaded
admin@util:~/>: ssh-agent bash
admin@util:~/>: ssh-add ~/.ssh/dpnid
Identity added: .ssh/dpnid (.ssh/dpnid)
admin@util:~/>: ssh-add -l
1024 1b:af:88:95:7a:d8:a9:16:fb:cb:9e:0e:49:32:a3:cd [MD5] .ssh/dpnid (DSA)  <-- keys loaded 

Affected Products

Avamar

Products

Avamar, Avamar Server
Article Properties
Article Number: 000019911
Article Type: How To
Last Modified: 03 Apr 2025
Version:  8
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.