palo_alto 0.2.7 → 0.3.1
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/CHANGELOG.md +1 -0
- data/README.md +3 -0
- data/console.rb +0 -1
- data/examples/connecttest.rb +1 -1
- data/examples/test_config.rb +4 -3
- data/examples/test_log.rb +1 -1
- data/examples/test_op.rb +60 -63
- data/lib/palo_alto/config.rb +13383 -2926
- data/lib/palo_alto/version.rb +1 -1
- data/lib/palo_alto.rb +87 -57
- 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: f00537b8aa9a599ba43138f32b97eb01447dddcc51dcfb612739b7dd178e0c53
|
4
|
+
data.tar.gz: 70fc4d52ef2a266324e5435423e674f24e84a9421de113768bf3f2f8eab1ae67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 686fa339ef2c3b0fd1612774cb185d60136ce8b1da967741d20ae252e9946874e33208287d2152540dc0af8f344596a00a99aa1edbb6565b225d7b0da4218583
|
7
|
+
data.tar.gz: 1b66201dde43d65272f7f3bba5504a95b397b3943df30b08899a1bc787796e4b6585ceb058b3cc28008e339d8f4d622dfd3eaa0a58dee5e6946f58147adf4a4f
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
Version 0.3.0: Update schema for Panorama 10.1
|
data/README.md
CHANGED
data/console.rb
CHANGED
data/examples/connecttest.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
require 'palo_alto'
|
2
2
|
|
3
|
-
client = PaloAlto::XML.new(host: "panorama-test",
|
3
|
+
client = PaloAlto::XML.new(host: "panorama-test", username: "admin", password: "Admin123!", debug: [:sent, :received, :statistics])
|
4
4
|
|
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_log.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'palo_alto'
|
2
2
|
|
3
|
-
client = PaloAlto::XML.new(host: "panorama-test",
|
3
|
+
client = PaloAlto::XML.new(host: "panorama-test", username: "admin", password: "Admin123!", debug: [:statistics, :warnings, :_sent, :_received])
|
4
4
|
|
5
5
|
query = "( full-path contains '/config/devices/entry[@name=\\'localhost.localdomain\\']/device-group/entry[@name=\\'gr\\']/address/entry[@name=\\'Blah_19\\']' )"
|
6
6
|
l=client.log(query: query, log_type: 'config', nlogs: 50, show_detail: true, days: nil)
|
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
|
-
|