forked from shaniacht1/content
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautomation-BlockIP.yml
67 lines (62 loc) · 1.47 KB
/
automation-BlockIP.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
args:
- default: true
description: IP to block
name: ip
required: true
- description: Rule name
name: rulename
- auto: PREDEFINED
description: Direction to block (to, from or both - default)
name: direction
predefined:
- to
- from
- both
required: true
- description: Base name for added ip/hosts inside checkpoint db
name: ipname
comment: Blocks IP in configured firewall
commonfields:
id: BlockIP
version: -1
dependson:
should:
- panorama
- checkpoint
enabled: true
name: BlockIP
runonce: false
script: |-
var blockPanorama = !!executeCommand('IsIntegrationAvailable',{'brandname': 'panorama'})[0].Contents;
var blockCP = !!executeCommand('IsIntegrationAvailable',{'brandname': 'check point'})[0].Contents;
if (args['using-brand']) {
switch (args['using-brand'].toLowerCase()) {
case 'panorama':
blockCP = false;
break;
case 'check point':
blockPanorama = false;
break;
}
}
if (!args.rulename) {
args.rulename = 'ip' + args.ip + ' blocked in direction ' + args.direction;
}
var entries = [];
if (blockPanorama) {
entries.push(executeCommand('PanoramaBlockIP', args));
}
if (blockCP) {
if (!args.ipname) {
args.ipname = + args.ip + ' . ' + args.direction;
}
entries.push(executeCommand('CPBlockIP', args));
}
return entries;
scripttarget: 0
system: true
tags:
- firewall
- checkpoint
- panorama
type: javascript