Skip to content

Commit 752ef21

Browse files
committed
Added new lines and the end of .gitingnore and yaml.example. Fixed issues with README's. Added sorting information to action generate for the action list. All changes are per Nicks comments.
1 parent d7d1327 commit 752ef21

7 files changed

+68
-63
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,4 @@ ENV/
9191
ci/
9292

9393
# Mac file system extensions
94-
.DS_Store
94+
.DS_Store

README.md

+51-50
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ Data types and payloads also mirror one-for-one.
2020

2121
``` shell
2222
st2 run algosec.afa_connect server=algosec.domain.tld username=administrator password=xxx
23+
```
2324

2425
# <a name="Configuration"></a> Configuration
2526

2627
The configuration for this pack is used to specify connection information for
2728
all AlgoSec servers you'll be communicating with. The location for the config file
28-
is `/opt/stackstorm/config/algosec.yaml`.
29+
is `/opt/stackstorm/configs/algosec.yaml`.
2930
3031
3132
**Note** : `st2 pack config` doesn't handle schemas refernences very well (known bug)
32-
so it's best to create the configuraiton file yourself and copy it into
33+
so it's best to create the configuration file yourself and copy it into
3334
`/opt/stackstorm/configs/algosec.yaml` then run `st2ctl reload --register-configs`
3435
3536
## <a name="Schema"></a> Schema
@@ -86,71 +87,71 @@ Actions in this pack are auto-generated from the AlgoSec SOAP API operations def
8687
an action created for every "Command" in the AlgoSec API. Input and output
8788
parameters should be the same with all action names and action parameters
8889
convert from CamelCase to snake_case with a few expecptions. Example: SOAP command IsSessionAlive
89-
will be converted to snake_case for the action to become `algosec.is_session_alive`.
90+
will be converted to snake_case for the action to become `algosec.afa_is_session_alive`.
9091
In this same command one of the arguments is `SessionID` that becomes the
9192
`session_id` action parameter.
9293

93-
**Note**: that there are currently issues with the some of the AlgoSec AFA Actions not returning informaiton in the proper formats. Currently working with the vendor to fix.
94+
**Note**: There are currently issues with the some of the AlgoSec AFA Actions not returning informaiton in the proper formats. Currently working with the vendor to fix.
9495

9596
| Reference of the Action | Description |
9697
|-------------------------|-------------|
97-
| algosec.fireflow_delete_object_custom_field | Invokes the AlgoSec SOAP command deleteObjectCustomField |
98-
| algosec.fireflow_authenticate | Invokes the AlgoSec SOAP command authenticate |
99-
| algosec.fireflow_create_ticket | Invokes the AlgoSec SOAP command createTicket |
100-
| algosec.fireflow_get_template_fields | Invokes the AlgoSec SOAP command getTemplateFields |
101-
| algosec.fireflow_get_ticket | Invokes the AlgoSec SOAP command getTicket |
102-
| algosec.fireflow_is_session_alive | Invokes the AlgoSec SOAP command isSessionAlive |
103-
| algosec.fireflow_get_fields | Invokes the AlgoSec SOAP command getFields |
104-
| algosec.fireflow_add_object_custom_field | Invokes the AlgoSec SOAP command addObjectCustomField |
105-
| algosec.fireflow_update_object_custom_field | Invokes the AlgoSec SOAP command updateObjectCustomField |
106-
| algosec.afa_create_role | Invokes the AlgoSec SOAP command create_role |
98+
| algosec.afa_add_device_to_group | Invokes the AlgoSec SOAP command add_device_to_group |
99+
| algosec.afa_connect | Invokes the AlgoSec SOAP command connect |
100+
| algosec.afa_create_device | Invokes the AlgoSec SOAP command create_device |
107101
| algosec.afa_create_device_group | Invokes the AlgoSec SOAP command create_device_group |
108-
| algosec.afa_delete_scheduler_job | Invokes the AlgoSec SOAP command delete_scheduler_job |
109-
| algosec.afa_get_hostgroups_by_device | Invokes the AlgoSec SOAP command get_hostgroups_by_device |
110-
| algosec.afa_get_unused_rules | Invokes the AlgoSec SOAP command get_unused_rules |
111-
| algosec.afa_get_entity_id | Invokes the AlgoSec SOAP command get_entity_id |
112-
| algosec.afa_import_risks_from_spreadsheet | Invokes the AlgoSec SOAP command import_risks_from_spreadsheet |
113-
| algosec.afa_delete_user | Invokes the AlgoSec SOAP command delete_user |
114-
| algosec.afa_get_all_hostgroups | Invokes the AlgoSec SOAP command get_all_hostgroups |
115-
| algosec.afa_get_rule_documentation | Invokes the AlgoSec SOAP command get_rule_documentation |
102+
| algosec.afa_create_domain | Invokes the AlgoSec SOAP command create_domain |
103+
| algosec.afa_create_role | Invokes the AlgoSec SOAP command create_role |
116104
| algosec.afa_create_user | Invokes the AlgoSec SOAP command create_user |
117-
| algosec.afa_connect | Invokes the AlgoSec SOAP command connect |
118-
| algosec.afa_query | Invokes the AlgoSec SOAP command query |
119-
| algosec.afa_set_configuration | Invokes the AlgoSec SOAP command set_configuration |
120-
| algosec.afa_set_scheduler_job | Invokes the AlgoSec SOAP command set_scheduler_job |
121-
| algosec.afa_get_groups_list | Invokes the AlgoSec SOAP command get_groups_list |
122-
| algosec.afa_disconnect | Invokes the AlgoSec SOAP command disconnect |
123-
| algosec.afa_search_object_by_ip | Invokes the AlgoSec SOAP command search_object_by_ip |
124-
| algosec.afa_get_configuration | Invokes the AlgoSec SOAP command get_configuration |
105+
| algosec.afa_delete_device | Invokes the AlgoSec SOAP command delete_device |
125106
| algosec.afa_delete_role | Invokes the AlgoSec SOAP command delete_role |
107+
| algosec.afa_delete_scheduler_job | Invokes the AlgoSec SOAP command delete_scheduler_job |
108+
| algosec.afa_delete_user | Invokes the AlgoSec SOAP command delete_user |
126109
| algosec.afa_device_changes_over_time_report | Invokes the AlgoSec SOAP command device_changes_over_time_report |
127-
| algosec.afa_get_members_by_device | Invokes the AlgoSec SOAP command get_members_by_device |
128-
| algosec.afa_update_user | Invokes the AlgoSec SOAP command update_user |
110+
| algosec.afa_disconnect | Invokes the AlgoSec SOAP command disconnect |
111+
| algosec.afa_edit_rule_documentation | Invokes the AlgoSec SOAP command edit_rule_documentation |
112+
| algosec.afa_get_all_hostgroups | Invokes the AlgoSec SOAP command get_all_hostgroups |
129113
| algosec.afa_get_all_services | Invokes the AlgoSec SOAP command get_all_services |
130-
| algosec.afa_get_report_pdf | Invokes the AlgoSec SOAP command get_report_pdf |
131-
| algosec.afa_add_device_to_group | Invokes the AlgoSec SOAP command add_device_to_group |
114+
| algosec.afa_get_configuration | Invokes the AlgoSec SOAP command get_configuration |
115+
| algosec.afa_get_containing_objects | Invokes the AlgoSec SOAP command get_containing_objects |
116+
| algosec.afa_get_device_statistics | Invokes the AlgoSec SOAP command get_device_statistics |
117+
| algosec.afa_get_devices_list | Invokes the AlgoSec SOAP command get_devices_list |
118+
| algosec.afa_get_entity_id | Invokes the AlgoSec SOAP command get_entity_id |
119+
| algosec.afa_get_entity_name | Invokes the AlgoSec SOAP command get_entity_name |
132120
| algosec.afa_get_group_content | Invokes the AlgoSec SOAP command get_group_content |
133-
| algosec.afa_is_session_alive | Invokes the AlgoSec SOAP command is_session_alive |
121+
| algosec.afa_get_groups_list | Invokes the AlgoSec SOAP command get_groups_list |
122+
| algosec.afa_get_hostgroup_by_name_and_device | Invokes the AlgoSec SOAP command get_hostgroup_by_name_and_device |
123+
| algosec.afa_get_hostgroups_by_device | Invokes the AlgoSec SOAP command get_hostgroups_by_device |
124+
| algosec.afa_get_license | Invokes the AlgoSec SOAP command get_license |
125+
| algosec.afa_get_members_by_device | Invokes the AlgoSec SOAP command get_members_by_device |
134126
| algosec.afa_get_nat_discovery | Invokes the AlgoSec SOAP command get_nat_discovery |
127+
| algosec.afa_get_parent_device | Invokes the AlgoSec SOAP command get_parent_device |
128+
| algosec.afa_get_report_pdf | Invokes the AlgoSec SOAP command get_report_pdf |
129+
| algosec.afa_get_rule_documentation | Invokes the AlgoSec SOAP command get_rule_documentation |
135130
| algosec.afa_get_rules_by_device | Invokes the AlgoSec SOAP command get_rules_by_device |
131+
| algosec.afa_get_service_by_name_and_device | Invokes the AlgoSec SOAP command get_service_by_name_and_device |
132+
| algosec.afa_get_services_by_device | Invokes the AlgoSec SOAP command get_services_by_device |
133+
| algosec.afa_get_unused_rules | Invokes the AlgoSec SOAP command get_unused_rules |
134+
| algosec.afa_import_risks_from_spreadsheet | Invokes the AlgoSec SOAP command import_risks_from_spreadsheet |
136135
| algosec.afa_import_risks_from_xml | Invokes the AlgoSec SOAP command import_risks_from_xml |
136+
| algosec.afa_is_session_alive | Invokes the AlgoSec SOAP command is_session_alive |
137+
| algosec.afa_query | Invokes the AlgoSec SOAP command query |
137138
| algosec.afa_risks_summary | Invokes the AlgoSec SOAP command risks_summary |
138-
| algosec.afa_get_containing_objects | Invokes the AlgoSec SOAP command get_containing_objects |
139-
| algosec.afa_get_hostgroup_by_name_and_device | Invokes the AlgoSec SOAP command get_hostgroup_by_name_and_device |
140-
| algosec.afa_create_domain | Invokes the AlgoSec SOAP command create_domain |
141-
| algosec.afa_get_entity_name | Invokes the AlgoSec SOAP command get_entity_name |
142-
| algosec.afa_create_device | Invokes the AlgoSec SOAP command create_device |
143-
| algosec.afa_get_devices_list | Invokes the AlgoSec SOAP command get_devices_list |
144-
| algosec.afa_get_services_by_device | Invokes the AlgoSec SOAP command get_services_by_device |
145-
| algosec.afa_get_parent_device | Invokes the AlgoSec SOAP command get_parent_device |
146-
| algosec.afa_delete_device | Invokes the AlgoSec SOAP command delete_device |
139+
| algosec.afa_search_object_by_ip | Invokes the AlgoSec SOAP command search_object_by_ip |
140+
| algosec.afa_search_rule | Invokes the AlgoSec SOAP command search_rule |
141+
| algosec.afa_set_configuration | Invokes the AlgoSec SOAP command set_configuration |
142+
| algosec.afa_set_scheduler_job | Invokes the AlgoSec SOAP command set_scheduler_job |
147143
| algosec.afa_start_analysis | Invokes the AlgoSec SOAP command start_analysis |
148-
| algosec.afa_get_device_statistics | Invokes the AlgoSec SOAP command get_device_statistics |
149144
| algosec.afa_update_role | Invokes the AlgoSec SOAP command update_role |
150-
| algosec.afa_edit_rule_documentation | Invokes the AlgoSec SOAP command edit_rule_documentation |
151-
| algosec.afa_get_license | Invokes the AlgoSec SOAP command get_license |
152-
| algosec.afa_search_rule | Invokes the AlgoSec SOAP command search_rule |
153-
| algosec.afa_get_service_by_name_and_device | Invokes the AlgoSec SOAP command get_service_by_name_and_device |
145+
| algosec.afa_update_user | Invokes the AlgoSec SOAP command update_user |
146+
| algosec.fireflow_add_object_custom_field | Invokes the AlgoSec SOAP command addObjectCustomField |
147+
| algosec.fireflow_authenticate | Invokes the AlgoSec SOAP command authenticate |
148+
| algosec.fireflow_create_ticket | Invokes the AlgoSec SOAP command createTicket |
149+
| algosec.fireflow_delete_object_custom_field | Invokes the AlgoSec SOAP command deleteObjectCustomField |
150+
| algosec.fireflow_get_fields | Invokes the AlgoSec SOAP command getFields |
151+
| algosec.fireflow_get_template_fields | Invokes the AlgoSec SOAP command getTemplateFields |
152+
| algosec.fireflow_get_ticket | Invokes the AlgoSec SOAP command getTicket |
153+
| algosec.fireflow_is_session_alive | Invokes the AlgoSec SOAP command isSessionAlive |
154+
| algosec.fireflow_update_object_custom_field | Invokes the AlgoSec SOAP command updateObjectCustomField |
154155

155156
## <a name="UsageBasic"></a> Usage - Basic
156157

@@ -182,7 +183,7 @@ over/over can become tedious and repetitive, luckyily there is a better way.
182183
## <a name="UsageConfig"></a> Usage - Config Connection
183184

184185
This pack is designed to store commonly used connection information in the pack's
185-
config file located in `/opt/stackstorm/config/algosec.yaml`. The connection
186+
config file located in `/opt/stackstorm/configs/algosec.yaml`. The connection
186187
info is specified in the config once, and then referenced by name within an
187188
action and/or workflow.
188189

actions/workflows/README.md

-1
This file was deleted.

algosec.yaml.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ algosec:
1313
server: algosec.prod.domain.tld
1414
1515
password: SuperSecret
16-
transport: https
16+
transport: https

etc/README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
# Men&Mice Action Generator
1+
# AlgoSec Action Generator
22

3-
Men&Mice uses a SOAP API which details all operations and data types available.
4-
In order to save lots of manual labor we've created a script to parse the
3+
AlgoSec uses a SOAP API which details all operations and data types available.
4+
In order to save lots of manual labor we've created a script to parse the
55
SOAP WSDL file and generate StackStorm actions from it.
66

77
# Typical Workflow
88

99
``` shell
10-
# fetch the latest WSDL from the Men&Mice server
11-
./action_generate.py fetch-wsdl -H menandmice.domain.tld
10+
# fetch the latest WSDL from the AlgoSec server
11+
./action_generate.py fetch-wsdl -H algosec.domain.tld
1212

1313
# gerenate actions from the latest WSDL (outpuit to ../actions)
1414
./action_generate.py generate
15-
15+
1616
# see more examples
1717
./action_generate.py examples
1818
```
1919

2020
# How it works
2121

22-
1. Fetch the SOAP WSDL from the Men&Mice server
22+
1. Fetch the SOAP WSDL from the AlgoSec server
2323
2. Parse the SOAP WSDL file
2424
3. Iterate over all of the `operations` aka commands.
2525
4. For each `operation` gather all input arguments
2626
5. Populate a `dict` with all of the information about the operation
2727
and its input arguments
28-
6. Render an action YAML for this opeartion using from the `etc/action_template.yaml.j2`
28+
6. Render an action YAML for this opeartion using from the `etc/action_template.yaml.j2`
2929
Jinja2 template. The context for the render is the `dict` created above.

etc/action_generate.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from xml.dom import minidom
2020
import yaml
2121
import zeep
22+
from operator import itemgetter
2223

2324

2425
ACTION_TEMPLATE_PATH = "./action_template.yaml.j2"
@@ -119,8 +120,10 @@ def fetch_wsdl(self):
119120
f.write(xml_str)
120121

121122
def build_action_list(self):
123+
# Sort the list of actions by the action name
124+
sorted_actions = sorted(self.all_actions, key=itemgetter('name'))
122125
action_data = self.jinja_render_file(ACTION_INFORMATION_PATH,
123-
{'all_actions': self.all_actions})
126+
{'all_actions': sorted_actions})
124127
first_line = action_data.split('\n')[0]
125128
last_line = action_data.split('\n')[-1]
126129
original_string = None

etc/action_information.md.j2

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ Actions in this pack are auto-generated from the AlgoSec SOAP API operations def
55
an action created for every "Command" in the AlgoSec API. Input and output
66
parameters should be the same with all action names and action parameters
77
convert from CamelCase to snake_case with a few expecptions. Example: SOAP command IsSessionAlive
8-
will be converted to snake_case for the action to become `algosec.is_session_alive`.
8+
will be converted to snake_case for the action to become `algosec.afa_is_session_alive`.
99
In this same command one of the arguments is `SessionID` that becomes the
1010
`session_id` action parameter.
1111

12+
**Note**: There are currently issues with the some of the AlgoSec AFA Actions not returning informaiton in the proper formats. Currently working with the vendor to fix.
13+
1214
| Reference of the Action | Description |
1315
|-------------------------|-------------|{% for action in all_actions %}
1416
| {{ action.name }} | {{ action.description }} |{% endfor %}

0 commit comments

Comments
 (0)