palo_alto 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/examples/test_config.rb +4 -3
- data/examples/test_op.rb +60 -63
- data/lib/palo_alto/config.rb +10623 -10600
- data/lib/palo_alto/version.rb +1 -1
- data/lib/palo_alto.rb +137 -36
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 783ea2d46ba8b4ad6b68ca42ac611d96a73b22585c0fe0da0abb01a547617638
|
4
|
+
data.tar.gz: 2be0229664b9c6c2cacad27a0d003867a9ea65bafa30117ff08924b1ea45acbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aee427bd8157bd7d739322333bb3daeeea9dbad9d84b45f7540ed8b6a7d7751b0a440ba55d226dc5d9efc2d1360c2bc29f5460f0d4d457ad5c87a8abadc231b3
|
7
|
+
data.tar.gz: 69ce66f69c0b3cc641fa215cb33dcd66f834be2de2f521886b7b95ffd0712750a4d45bfcc824432c2b87e9649732ffb6da18d53803c82ba1955c3cd666b78af1
|
data/README.md
CHANGED
data/examples/test_config.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'palo_alto'
|
2
2
|
|
3
|
-
client = PaloAlto::XML.new(host:
|
3
|
+
client = PaloAlto::XML.new(host: 'panorama-test', username: 'admin', password: 'Admin123!',
|
4
|
+
debug: %i[sent received statistics])
|
4
5
|
dg = 'PLAYGROUND'
|
5
6
|
|
6
7
|
# create a tag
|
@@ -43,7 +44,7 @@ pp rules
|
|
43
44
|
pp rules.length
|
44
45
|
|
45
46
|
pp rules.first.api_attributes # attributes like uuid and loc
|
46
|
-
pp rules.first.values
|
47
|
+
pp rules.first.values # values as hash
|
47
48
|
|
48
49
|
rule = rules.first
|
49
50
|
rule.tag.member = [new_tag.name]
|
@@ -59,5 +60,5 @@ pp rule.name
|
|
59
60
|
exit 0
|
60
61
|
|
61
62
|
# create a new template
|
62
|
-
new_template = client.config.devices.entry(name:'localhost.localdomain').template.entry(name: 'testtemplate').create!
|
63
|
+
new_template = client.config.devices.entry(name: 'localhost.localdomain').template.entry(name: 'testtemplate').create!
|
63
64
|
new_template.push!
|
data/examples/test_op.rb
CHANGED
@@ -1,63 +1,62 @@
|
|
1
1
|
require 'palo_alto'
|
2
2
|
|
3
|
-
a= {commit: { partial:[
|
4
|
-
{
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
b= { show: {devices: 'all' } }
|
16
|
-
|
17
|
-
c = {revert: { config: {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
3
|
+
a = { commit: { partial: [
|
4
|
+
{ admin: ['admin'] },
|
5
|
+
'no-template',
|
6
|
+
'no-template-stack',
|
7
|
+
'no-log-collector',
|
8
|
+
'no-log-collector-group',
|
9
|
+
'no-wildfire-appliance',
|
10
|
+
'no-wildfire-appliance-cluster',
|
11
|
+
{ 'device-and-network': 'excluded' },
|
12
|
+
{ 'shared-object': 'excluded' }
|
13
|
+
] } }
|
14
|
+
|
15
|
+
b = { show: { devices: 'all' } }
|
16
|
+
|
17
|
+
c = { revert: { config: {
|
18
|
+
partial: [
|
19
|
+
{ admin: ['admin'] },
|
20
|
+
'no-template',
|
21
|
+
'no-template-stack',
|
22
|
+
'no-log-collector',
|
23
|
+
'no-log-collector-group',
|
24
|
+
'no-wildfire-appliance',
|
25
|
+
'no-wildfire-appliance-cluster',
|
26
|
+
{ 'device-and-network': 'excluded' },
|
27
|
+
{ 'shared-object': 'excluded' }
|
28
|
+
]
|
29
|
+
} } }
|
30
|
+
|
31
|
+
d = { commit: nil }
|
31
32
|
|
32
33
|
e = 'commit'
|
33
34
|
|
34
|
-
f = {revert: 'config'}
|
35
|
+
f = { revert: 'config' }
|
35
36
|
|
36
|
-
g= {show: 'templates'}
|
37
|
+
g = { show: 'templates' }
|
37
38
|
|
38
|
-
h= {show: 'devicegroups'}
|
39
|
+
h = { show: 'devicegroups' }
|
39
40
|
|
40
|
-
j={show: {jobs: {id:
|
41
|
+
j = { show: { jobs: { id: 12_431 } } }
|
41
42
|
|
42
|
-
k={check: 'full-commit-required'}
|
43
|
+
k = { check: 'full-commit-required' }
|
43
44
|
|
44
|
-
push_to_device={ 'commit-all': { 'shared-policy': { 'device-group': [{name:'TEST-DG'}]}}}
|
45
|
+
push_to_device = { 'commit-all': { 'shared-policy': { 'device-group': [{ name: 'TEST-DG' }] } } }
|
45
46
|
|
46
|
-
#validate:
|
47
|
-
p={ 'commit-all':
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
}
|
58
|
-
|
59
|
-
i = {show: {query: {result: {id: 10438 }}}}
|
47
|
+
# validate:
|
48
|
+
p = { 'commit-all':
|
49
|
+
{
|
50
|
+
'shared-policy': [
|
51
|
+
{ 'device-group': [{ name: 'PLAYGROUND' }] },
|
52
|
+
{ 'include-template': 'yes' },
|
53
|
+
{ 'merge-with-candidate-cfg': 'yes' },
|
54
|
+
{ 'force-template-values': 'no' },
|
55
|
+
{ 'validate-only': 'yes' }
|
56
|
+
]
|
57
|
+
} }
|
60
58
|
|
59
|
+
i = { show: { query: { result: { id: 10_438 } } } }
|
61
60
|
|
62
61
|
# hit counts:
|
63
62
|
device_group = 'PLAYGROUND'
|
@@ -69,11 +68,11 @@ l = {
|
|
69
68
|
entry: [{
|
70
69
|
name: device_group
|
71
70
|
}, {
|
72
|
-
|
71
|
+
'pre-rulebase': [{
|
73
72
|
entry: [{
|
74
73
|
name: 'security'
|
75
74
|
}, {
|
76
|
-
|
75
|
+
rules: 'all'
|
77
76
|
}]
|
78
77
|
}]
|
79
78
|
}]
|
@@ -83,7 +82,7 @@ l = {
|
|
83
82
|
}
|
84
83
|
|
85
84
|
# hit count for one rule, with more details:
|
86
|
-
rule_name =
|
85
|
+
rule_name = 'Rule 27'
|
87
86
|
l = {
|
88
87
|
show: {
|
89
88
|
'rule-hit-count': [{
|
@@ -91,12 +90,12 @@ l = {
|
|
91
90
|
entry: [{
|
92
91
|
name: device_group
|
93
92
|
}, {
|
94
|
-
|
93
|
+
'pre-rulebase': [{
|
95
94
|
entry: [{
|
96
95
|
name: 'security'
|
97
96
|
}, {
|
98
|
-
|
99
|
-
|
97
|
+
rules: {
|
98
|
+
'rule-name': [{
|
100
99
|
entry: [{
|
101
100
|
name: rule_name
|
102
101
|
}]
|
@@ -110,18 +109,16 @@ l = {
|
|
110
109
|
}
|
111
110
|
}
|
112
111
|
|
112
|
+
client = PaloAlto::XML.new(host: 'panorama-test', username: 'admin', password: 'Admin123!', debug: %i[sent received])
|
113
113
|
|
114
|
-
|
115
|
-
|
116
|
-
#pp client.op.execute(
|
117
|
-
#pp client.op.execute(b)
|
118
|
-
#pp client.op.execute(c)
|
114
|
+
# pp client.op.execute(a)
|
115
|
+
# pp client.op.execute(b)
|
116
|
+
# pp client.op.execute(c)
|
119
117
|
pp client.op.execute(d)
|
120
|
-
puts
|
118
|
+
puts '---------------------------'
|
121
119
|
pp client.op.execute(e)
|
122
|
-
puts
|
120
|
+
puts '---------------------------'
|
123
121
|
|
124
|
-
#pp client.op.execute(f)
|
122
|
+
# pp client.op.execute(f)
|
125
123
|
|
126
124
|
pp client.op.execute(k)
|
127
|
-
|