0

我正在尝试编写一个控件,该控件应该检查​​包含 IP 的列表,并且我从中提取的配置值应该是列表中的。我不知道在哪里创建控件应该引用的列表。

control "Approved Management IPs" do
  impact 1.0
  title "Telnet Disabled"
  desc "Config should have one of the following IPs on the management plane."

  options = {
    assignment_regex: /^\s*(<permitted-ips>)(\w+)<\/permitted-ips>/,
    multiple_values: true
    }

  describe parse_config_file('pandevice_vm_config.txt', options) do
   its('<permitted-ips>') { should be_in LIST }
  end
end
4

1 回答 1

0

您可以使用以下语法:

  describe parse_config_file('pandevice_vm_config.txt', options) do
   its('<permitted-ips>') { should be_in ['localhost', '192.168.0.1'] }
  end
于 2021-08-16T08:53:49.570 回答