#3110: Correct config YAML snippets.

This commit is contained in:
Nick Todd
2025-03-13 11:36:24 +00:00
parent ea7898ce33
commit dc3dc5d9c1
19 changed files with 314 additions and 335 deletions

View File

@@ -13,20 +13,19 @@ Agents can be scripted (deterministic and stochastic), or controlled by a reinfo
.. code-block:: yaml .. code-block:: yaml
agents: agents:
- ref: red_agent_example - ref: red_agent_example
... ...
- ref: blue_agent_example - ref: blue_agent_example
... ...
- ref: green_agent_example - ref: green_agent_example
team: GREEN team: GREEN
type: probabilistic-agent type: probabilistic-agent
agent_settings: agent_settings:
start_settings: start_step: 5
start_step: 5 frequency: 4
frequency: 4 variance: 3
variance: 3 flatten_obs: False
flatten_obs: False
``ref`` ``ref``
------- -------

View File

@@ -17,19 +17,18 @@ example computer
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- ref: client_1 - hostname: client_1
hostname: client_1 type: computer
type: computer ip_address: 192.168.0.10c
ip_address: 192.168.0.10 subnet_mask: 255.255.255.0
subnet_mask: 255.255.255.0 default_gateway: 192.168.0.1
default_gateway: 192.168.0.1 dns_server: 192.168.1.10
dns_server: 192.168.1.10 applications:
applications: ...
... services:
services: ...
...
.. include:: common/common_node_attributes.rst .. include:: common/common_node_attributes.rst

View File

@@ -19,38 +19,35 @@ example firewall
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- ref: firewall - hostname: firewall
hostname: firewall type: firewall
type: firewall ports:
start_up_duration: 0 external_port: # port 1
shut_down_duration: 0 ip_address: 192.168.20.1
ports: subnet_mask: 255.255.255.0
external_port: # port 1 internal_port: # port 2
ip_address: 192.168.20.1 ip_address: 192.168.1.2
subnet_mask: 255.255.255.0 subnet_mask: 255.255.255.0
internal_port: # port 2 dmz_port: # port 3
ip_address: 192.168.1.2 ip_address: 192.168.10.1
subnet_mask: 255.255.255.0 subnet_mask: 255.255.255.0
dmz_port: # port 3 acl:
ip_address: 192.168.10.1 internal_inbound_acl:
subnet_mask: 255.255.255.0 ...
acl: internal_outbound_acl:
internal_inbound_acl: ...
... dmz_inbound_acl:
internal_outbound_acl: ...
... dmz_outbound_acl:
dmz_inbound_acl: ...
... external_inbound_acl:
dmz_outbound_acl: ...
... external_outbound_acl:
external_inbound_acl: ...
... routes:
external_outbound_acl: ...
...
routes:
...
.. include:: common/common_node_attributes.rst .. include:: common/common_node_attributes.rst
@@ -70,18 +67,18 @@ The ports should be defined with an ip address and subnet mask e.g.
.. code-block:: yaml .. code-block:: yaml
nodes: nodes:
- ref: firewall - hostname: firewall
... ...
ports: ports:
external_port: # port 1 external_port: # port 1
ip_address: 192.168.20.1 ip_address: 192.168.20.1
subnet_mask: 255.255.255.0 subnet_mask: 255.255.255.0
internal_port: # port 2 internal_port: # port 2
ip_address: 192.168.1.2 ip_address: 192.168.1.2
subnet_mask: 255.255.255.0 subnet_mask: 255.255.255.0
dmz_port: # port 3 dmz_port: # port 3
ip_address: 192.168.10.1 ip_address: 192.168.10.1
subnet_mask: 255.255.255.0 subnet_mask: 255.255.255.0
``ip_address`` ``ip_address``
"""""""""""""" """"""""""""""
@@ -129,21 +126,21 @@ example:
.. code-block:: yaml .. code-block:: yaml
nodes: nodes:
- ref: firewall - hostname: firewall
... ...
acl: acl:
internal_inbound_acl: internal_inbound_acl:
21: # position 21 on ACL list 21: # position 21 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
src_port: POSTGRES_SERVER # are emitted from the POSTGRES_SERVER port src_port: POSTGRES_SERVER # are emitted from the POSTGRES_SERVER port
dst_port: POSTGRES_SERVER # are going towards an POSTGRES_SERVER port dst_port: POSTGRES_SERVER # are going towards an POSTGRES_SERVER port
22: # position 22 on ACL list 22: # position 22 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
src_port: ARP # are emitted from the ARP port src_port: ARP # are emitted from the ARP port
dst_port: ARP # are going towards an ARP port dst_port: ARP # are going towards an ARP port
23: # position 23 on ACL list 23: # position 23 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
protocol: ICMP # are ICMP protocol: ICMP # are ICMP
``internal_outbound_acl`` ``internal_outbound_acl``
""""""""""""""""""""""""" """""""""""""""""""""""""
@@ -155,21 +152,21 @@ example:
.. code-block:: yaml .. code-block:: yaml
nodes: nodes:
- ref: firewall - hostname: firewall
... ...
acl: acl:
internal_outbound_acl: internal_outbound_acl:
21: # position 21 on ACL list 21: # position 21 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
src_port: POSTGRES_SERVER # are emitted from the POSTGRES_SERVER port src_port: POSTGRES_SERVER # are emitted from the POSTGRES_SERVER port
dst_port: POSTGRES_SERVER # are going towards an POSTGRES_SERVER port dst_port: POSTGRES_SERVER # are going towards an POSTGRES_SERVER port
22: # position 22 on ACL list 22: # position 22 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
src_port: ARP # are emitted from the ARP port src_port: ARP # are emitted from the ARP port
dst_port: ARP # are going towards an ARP port dst_port: ARP # are going towards an ARP port
23: # position 23 on ACL list 23: # position 23 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
protocol: ICMP # are ICMP protocol: ICMP # are ICMP
``dmz_inbound_acl`` ``dmz_inbound_acl``
@@ -216,29 +213,29 @@ example:
.. code-block:: yaml .. code-block:: yaml
nodes: nodes:
- ref: firewall - hostname: firewall
... ...
acl: acl:
dmz_outbound_acl: dmz_outbound_acl:
19: # position 19 on ACL list 19: # position 19 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
src_port: POSTGRES_SERVER # are emitted from the POSTGRES_SERVER port src_port: POSTGRES_SERVER # are emitted from the POSTGRES_SERVER port
dst_port: POSTGRES_SERVER # are going towards an POSTGRES_SERVER port dst_port: POSTGRES_SERVER # are going towards an POSTGRES_SERVER port
20: # position 20 on ACL list 20: # position 20 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
src_port: HTTP # are emitted from the HTTP port src_port: HTTP # are emitted from the HTTP port
dst_port: HTTP # are going towards an HTTP port dst_port: HTTP # are going towards an HTTP port
21: # position 21 on ACL list 21: # position 21 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
src_port: HTTPS # are emitted from the HTTPS port src_port: HTTPS # are emitted from the HTTPS port
dst_port: HTTPS # are going towards an HTTPS port dst_port: HTTPS # are going towards an HTTPS port
22: # position 22 on ACL list 22: # position 22 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
src_port: ARP # are emitted from the ARP port src_port: ARP # are emitted from the ARP port
dst_port: ARP # are going towards an ARP port dst_port: ARP # are going towards an ARP port
23: # position 23 on ACL list 23: # position 23 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
protocol: ICMP # are ICMP protocol: ICMP # are ICMP
@@ -254,21 +251,21 @@ example:
.. code-block:: yaml .. code-block:: yaml
nodes: nodes:
- ref: firewall - hostname: firewall
... ...
acl: acl:
external_inbound_acl: external_inbound_acl:
21: # position 19 on ACL list 21: # position 19 on ACL list
action: DENY # deny packets that action: DENY # deny packets that
src_port: POSTGRES_SERVER # are emitted from the POSTGRES_SERVER port src_port: POSTGRES_SERVER # are emitted from the POSTGRES_SERVER port
dst_port: POSTGRES_SERVER # are going towards an POSTGRES_SERVER port dst_port: POSTGRES_SERVER # are going towards an POSTGRES_SERVER port
22: # position 22 on ACL list 22: # position 22 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
src_port: ARP # are emitted from the ARP port src_port: ARP # are emitted from the ARP port
dst_port: ARP # are going towards an ARP port dst_port: ARP # are going towards an ARP port
23: # position 23 on ACL list 23: # position 23 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
protocol: ICMP # are ICMP protocol: ICMP # are ICMP
``external_outbound_acl`` ``external_outbound_acl``
""""""""""""""""""""""""" """""""""""""""""""""""""
@@ -282,17 +279,17 @@ example:
.. code-block:: yaml .. code-block:: yaml
nodes: nodes:
- ref: firewall - hotsname: firewall
... ...
acl: acl:
external_outbound_acl: external_outbound_acl:
22: # position 22 on ACL list 22: # position 22 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
src_port: ARP # are emitted from the ARP port src_port: ARP # are emitted from the ARP port
dst_port: ARP # are going towards an ARP port dst_port: ARP # are going towards an ARP port
23: # position 23 on ACL list 23: # position 23 on ACL list
action: PERMIT # allow packets that action: PERMIT # allow packets that
protocol: ICMP # are ICMP protocol: ICMP # are ICMP
.. include:: common/common_network_node_attributes.rst .. include:: common/common_network_node_attributes.rst

View File

@@ -17,16 +17,15 @@ example router
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- ref: router_1 - hostname: router_1
hostname: router_1 type: router
type: router num_ports: 5
num_ports: 5 ports:
ports: ...
... acl:
acl: ...
...
.. include:: common/common_node_attributes.rst .. include:: common/common_node_attributes.rst
@@ -49,15 +48,15 @@ Example of setting ports for a router with 2 ports:
.. code-block:: yaml .. code-block:: yaml
nodes: nodes:
- ref: router_1 - hostname: router_1
... ...
ports: ports:
1: 1:
ip_address: 192.168.1.1 ip_address: 192.168.1.1
subnet_mask: 255.255.255.0 subnet_mask: 255.255.255.0
2: 2:
ip_address: 192.168.10.1 ip_address: 192.168.10.1
subnet_mask: 255.255.255.0 subnet_mask: 255.255.255.0
``ip_address`` ``ip_address``
"""""""""""""" """"""""""""""
@@ -81,12 +80,12 @@ e.g.
.. code-block:: yaml .. code-block:: yaml
nodes: nodes:
- ref: router_1 - hostname: router_1
... ...
acl: acl:
1: 1:
action: PERMIT action: PERMIT
protocol: ICMP protocol: ICMP
See :py:mod:`primaite.simulator.network.hardware.nodes.network.router.AccessControlList` See :py:mod:`primaite.simulator.network.hardware.nodes.network.router.AccessControlList`

View File

@@ -19,16 +19,15 @@ example server
simulation: simulation:
network: network:
nodes: nodes:
- ref: server_1 - hostname: server_1
hostname: server_1 type: server
type: server ip_address: 192.168.10.10
ip_address: 192.168.10.10 subnet_mask: 255.255.255.0
subnet_mask: 255.255.255.0 default_gateway: 192.168.10.1
default_gateway: 192.168.10.1 dns_server: 192.168.1.10
dns_server: 192.168.1.10 applications:
applications:
... ...
services: services:
... ...
.. include:: common/common_node_attributes.rst .. include:: common/common_node_attributes.rst

View File

@@ -17,12 +17,11 @@ example switch
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- ref: switch_1 hostname: switch_1
hostname: switch_1 type: switch
type: switch num_ports: 8
num_ports: 8
.. include:: common/common_node_attributes.rst .. include:: common/common_node_attributes.rst

View File

@@ -45,20 +45,21 @@ Agent generation will fail pydantic checks if incorrect or invalid parameters ar
.. code-block:: yaml .. code-block:: yaml
- ref: example_green_agent - ref: example_green_agent
team: GREEN team: GREEN
type: example-agent type: example-agent
action_space: agent_settings:
action_map:
0:
action: do-nothing
options: {}
agent_settings:
start_step: 25 start_step: 25
frequency: 20 frequency: 20
variance: 5 variance: 5
starting_host: "Server_1" starting_host: "Server_1"
action_space:
action_map:
0:
action: do-nothing
options: {}
**discriminators**: **discriminators**:

View File

@@ -25,8 +25,8 @@ The following API pages describe the use of each reward component and the possib
# ... # ...
reward_function: reward_function:
reward_components: reward_components:
- type: dummy - type: dummy
weight: 1.0 weight: 1.0
:py:class:`primaite.game.agent.rewards.DatabaseFileIntegrity` :py:class:`primaite.game.agent.rewards.DatabaseFileIntegrity`
@@ -38,12 +38,12 @@ The following API pages describe the use of each reward component and the possib
# ... # ...
reward_function: reward_function:
reward_components: reward_components:
- type: database-file-integrity - type: database-file-integrity
weight: 1.0 weight: 1.0
options: options:
node_hostname: server_1 node_hostname: server_1
folder_name: database folder_name: database
file_name: database.db file_name: database.db
:py:class:`primaite.game.agent.rewards.WebServer404Penalty` :py:class:`primaite.game.agent.rewards.WebServer404Penalty`
@@ -55,12 +55,12 @@ The following API pages describe the use of each reward component and the possib
# ... # ...
reward_function: reward_function:
reward_components: reward_components:
- type: web-server-404-penalty - type: web-server-404-penalty
node_hostname: web_server node_hostname: web_server
weight: 1.0 weight: 1.0
options: options:
service_name: WebService service_name: WebService
sticky: false sticky: false
:py:class:`primaite.game.agent.rewards.WebpageUnavailablePenalty` :py:class:`primaite.game.agent.rewards.WebpageUnavailablePenalty`
@@ -72,11 +72,11 @@ The following API pages describe the use of each reward component and the possib
# ... # ...
reward_function: reward_function:
reward_components: reward_components:
- type: webpage-unavailable-penalty - type: webpage-unavailable-penalty
node_hostname: computer_1 node_hostname: computer_1
weight: 1.0 weight: 1.0
options: options:
sticky: false sticky: false
:py:class:`primaite.game.agent.rewards.GreenAdminDatabaseUnreachablePenalty` :py:class:`primaite.game.agent.rewards.GreenAdminDatabaseUnreachablePenalty`
@@ -88,11 +88,11 @@ The following API pages describe the use of each reward component and the possib
# ... # ...
reward_function: reward_function:
reward_components: reward_components:
- type: green-admin-database-unreachable-penalty - type: green-admin-database-unreachable-penalty
weight: 1.0 weight: 1.0
options: options:
node_hostname: admin_pc_1 node_hostname: admin_pc_1
sticky: false sticky: false
:py:class:`primaite.game.agent.rewards.SharedReward` :py:class:`primaite.game.agent.rewards.SharedReward`
@@ -106,10 +106,10 @@ The following API pages describe the use of each reward component and the possib
# ... # ...
reward_function: reward_function:
reward_components: reward_components:
- type: shared-reward - type: shared-reward
weight: 1.0 weight: 1.0
options: options:
agent_name: scripted_agent agent_name: scripted_agent
:py:class:`primaite.game.agent.rewards.ActionPenalty` :py:class:`primaite.game.agent.rewards.ActionPenalty`
@@ -121,8 +121,8 @@ The following API pages describe the use of each reward component and the possib
# ... # ...
reward_function: reward_function:
reward_components: reward_components:
- type: action-penalty - type: action-penalty
weight: 1.0 weight: 1.0
options: options:
action_penalty: -0.3 action_penalty: -0.3
do_nothing_penalty: 0.0 do_nothing_penalty: 0.0

View File

@@ -76,17 +76,15 @@ Via Configuration
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- ref: example_computer - hostname: example_computer
hostname: example_computer type: computer
type: computer ...
... applications:
applications: - type: database-client
- ref: database_client options:
type: database-client db_server_ip: 192.168.0.1
options:
db_server_ip: 192.168.0.1
Configuration Configuration
============= =============

View File

@@ -79,22 +79,20 @@ Via Configuration
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- ref: example_computer - hostname: example_computer
hostname: example_computer type: computer
type: computer ...
... applications:
applications: - type: dos-bot
- ref: dos_bot options:
type: dos-bot target_ip_address: 192.168.0.10
options: payload: SPOOF DATA
target_ip_address: 192.168.0.10 repeat: False
payload: SPOOF DATA port_scan_p_of_success: 0.8
repeat: False dos_intensity: 1.0
port_scan_p_of_success: 0.8 max_sessions: 1000
dos_intensity: 1.0
max_sessions: 1000
Configuration Configuration
============= =============

View File

@@ -78,15 +78,15 @@ Via Configuration
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- hostname: example_computer - hostname: example_computer
type: computer type: computer
... ...
applications: applications:
- type: web-browser - type: web-browser
options: options:
target_url: http://example.com/ target_url: http://example.com/
Configuration Configuration
============= =============

View File

@@ -80,15 +80,15 @@ Via Configuration
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- hostname: example_server - hostname: example_server
type: server type: server
... ...
services: services:
- type: database-service - type: database-service
options: options:
backup_server_ip: 192.168.0.10 backup_server_ip: 192.168.0.10
Configuration Configuration
============= =============

View File

@@ -70,17 +70,15 @@ Via Configuration
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- ref: example_server - hostname: example_server
hostname: example_server type: server
type: server ...
... services:
services: - type: dns-client
- ref: dns_client options:
type: dns-client dns_server: 192.168.0.10
options:
dns_server: 192.168.0.10
Configuration Configuration
============= =============

View File

@@ -67,17 +67,17 @@ Via Configuration
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- hostname: example_server - hostname: example_server
type: server type: server
... ...
services: services:
- type: dns-server - type: dns-server
options: options:
domain_mapping: domain_mapping:
example.com: 192.168.0.10 example.com: 192.168.0.10
another-example.com: 192.168.10.10 another-example.com: 192.168.10.10
Configuration Configuration
============= =============

View File

@@ -71,15 +71,13 @@ Via Configuration
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- ref: example_server - hostname: example_server
hostname: example_server type: server
type: server ...
... services:
services: - type: ftp-client
- ref: ftp_client
type: ftp-client
Configuration Configuration
============= =============

View File

@@ -67,15 +67,15 @@ Via Configuration
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- hostname: example_server - hostname: example_server
type: server type: server
... ...
services: services:
- type: ftp-server - type: ftp-server
options: options:
server_password: test server_password: test
Configuration Configuration
============= =============

View File

@@ -66,17 +66,15 @@ Via Configuration
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- ref: example_server - hostname: example_server
hostname: example_server type: server
type: server ...
... services:
services: - type: ntp-client
- ref: ntp_client options:
type: ntp-client ntp_server_ip: 192.168.0.10
options:
ntp_server_ip: 192.168.0.10
Configuration Configuration
============= =============

View File

@@ -66,15 +66,13 @@ Via Configuration
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- ref: example_server - hostname: example_server
hostname: example_server type: server
type: server ...
... services:
services: - type: ntp-server
- ref: ntp_server
type: ntp-server
``Common Attributes`` ``Common Attributes``

View File

@@ -66,15 +66,13 @@ Via Configuration
.. code-block:: yaml .. code-block:: yaml
simulation: simulation:
network: network:
nodes: nodes:
- ref: example_server - hostname: example_server
hostname: example_server type: server
type: server ...
... services:
services: - type: web-server
- ref: web_server
type: web-server
``Common Attributes`` ``Common Attributes``