File: SoftLayer_Network_Vlan_Firewall.py

package info (click to toggle)
python-softlayer 6.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,508 kB
  • sloc: python: 57,195; makefile: 133; xml: 97; sh: 59
file content (272 lines) | stat: -rw-r--r-- 8,928 bytes parent folder | download | duplicates (2)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
createCancelServerTicket = {'id': 1234, 'title': 'Server Cancellation Request'}
getObject = {
    "administrativeBypassFlag": "",
    "customerManagedFlag": False,
    "billingItem": {
        "id": 21370815
    },
    "id": 3130,
    "primaryIpAddress": "192.155.239.146",
    "datacenter": {
        "id": 265592,
        "longName": "Amsterdam 1",
        "name": "ams01",
        "statusId": 2
    },
    "networkVlan": {
        "accountId": 307608,
        "id": 371028,
        "primarySubnetId": 536252,
        "name": 'testvlan',
        "vlanNumber": 1489,
        "firewallInterfaces": [
            {
                "id": 6254,
                "name": "inside",
                "firewallContextAccessControlLists": [
                    {
                        "direction": "out",
                        "firewallContextInterfaceId": 6257,
                        "id": 3143
                    }
                ]
            },
            {
                "id": 6256,
                "name": "outside",
                "firewallContextAccessControlLists": [
                    {
                        "direction": "out",
                        "firewallContextInterfaceId": 6257,
                        "id": 3143
                    },
                    {
                        "direction": "in",
                        "firewallContextInterfaceId": 6256,
                        "id": 3142
                    }
                ]
            }
        ]
    },
    "firewallType": "fortigate-security-appliance-10gb",
    "managementCredentials": {
        "createDate": "2022-05-17T13:59:17-06:00",
        "id": 74604882,
        "modifyDate": "2022-05-17T13:59:17-06:00",
        "password": "test1234",
        "port": 23,
        "softwareId": 67804284,
        "username": "myusername"
    },
    "networkGateway": {
        "accountId": 307608,
        "groupNumber": 1,
        "id": 615448,
        "name": "testFirewall",
        "networkSpace": "BOTH",
        "privateIpAddressId": 188996652,
        "privateVlanId": 3228724,
        "publicIpAddressId": 188996794,
        "publicIpv6AddressId": 188996808,
        "publicVlanId": 3228726,
        "statusId": 1,
        "insideVlans": [],
        "members": [
            {
                "hardwareId": 3222842,
                "id": 687820,
                "networkGatewayId": 615448,
                "priority": 254,
                "networkGateway": None
            }
        ],
        "privateIpAddress": {
            "id": 188996652,
            "ipAddress": "10.37.115.70",
            "isBroadcast": False,
            "isGateway": False,
            "isNetwork": False,
            "isReserved": True,
            "subnetId": 2552734,
            "subnet": {
                "broadcastAddress": "10.37.115.127",
                "cidr": 26,
                "gateway": "10.37.115.65",
                "id": 2552734,
                "isCustomerOwned": False,
                "isCustomerRoutable": False,
                "modifyDate": "2022-05-17T13:59:16-06:00",
                "netmask": "255.255.255.192",
                "networkIdentifier": "10.37.115.64",
                "networkVlanId": 3228724,
                "sortOrder": "1",
                "subnetType": "ADDITIONAL_PRIMARY",
                "totalIpAddresses": "64",
                "usableIpAddressCount": "61",
                "version": 4
            }
        },
        "privateVlan": {
            "accountId": 307608,
            "fullyQualifiedName": "dal13.bcr03.1330",
            "id": 3228724,
            "modifyDate": "2022-05-17T14:01:14-06:00",
            "primarySubnetId": 2625456,
            "vlanNumber": 1330
        },
        "publicIpAddress": {
            "id": 188996794,
            "ipAddress": "67.228.206.245",
            "isBroadcast": False,
            "isGateway": False,
            "isNetwork": False,
            "isReserved": True,
            "subnetId": 66444,
            "subnet": {
                "broadcastAddress": "67.228.206.247",
                "cidr": 29,
                "gateway": "67.228.206.241",
                "id": 66444,
                "isCustomerOwned": False,
                "isCustomerRoutable": False,
                "modifyDate": "2022-05-17T13:59:16-06:00",
                "netmask": "255.255.255.248",
                "networkIdentifier": "67.228.206.240",
                "networkVlanId": 3228726,
                "sortOrder": "1",
                "subnetType": "ADDITIONAL_PRIMARY",
                "totalIpAddresses": "8",
                "usableIpAddressCount": "5",
                "version": 4
            }
        },
        "publicIpv6Address": {
            "id": 188996808,
            "ipAddress": "2607:f0d0:2703:0039:0000:0000:0000:0004",
            "isBroadcast": False,
            "isGateway": False,
            "isNetwork": False,
            "isReserved": True,
            "subnetId": 2547678,
            "subnet": {
                "broadcastAddress": "",
                "cidr": 64,
                "gateway": "2607:f0d0:2703:0039:0000:0000:0000:0001",
                "id": 2547678,
                "isCustomerOwned": False,
                "isCustomerRoutable": False,
                "modifyDate": "2022-05-17T13:59:16-06:00",
                "netmask": "ffff:ffff:ffff:ffff:0000:0000:0000:0000",
                "networkIdentifier": "2607:f0d0:2703:0039:0000:0000:0000:0000",
                "networkVlanId": 3228726,
                "sortOrder": "4",
                "subnetType": "PRIMARY_6",
                "totalIpAddresses": "18446744073709551616",
                "usableIpAddressCount": "18446744073709551614",
                "version": 6
            }
        },
        "publicVlan": {
            "accountId": 307608,
            "fullyQualifiedName": "dal13.fcr03.1255",
            "id": 3228726,
            "modifyDate": "2022-05-17T14:00:42-06:00",
            "primarySubnetId": 2623338,
            "vlanNumber": 1255
        },
        "status": {
            "description": "Gateway is ready to accept commands and actions",
            "id": 1,
            "keyName": "ACTIVE",
            "name": "Active"
        }
    },
    "rules": [
        {'destinationIpAddress': 'any on server',
         'protocol': 'tcp',
         'orderValue': 1,
         'destinationIpSubnetMask': '255.255.255.255',
         'destinationPortRangeStart': 80,
         'sourceIpSubnetMask': '0.0.0.0',
         'destinationPortRangeEnd': 80,
         'version': 4,
         'action': 'permit',
         'sourceIpAddress': '0.0.0.0'
         },
        {
            'destinationIpAddress': 'any on server',
            'protocol': 'tcp',
            'orderValue': 2,
            'destinationIpSubnetMask': '255.255.255.255',
            'destinationPortRangeStart': 1,
            'sourceIpSubnetMask': '255.255.255.255',
            'destinationPortRangeEnd': 65535,
            'version': 4,
            'action': 'permit',
            'sourceIpAddress': '193.212.1.10'
        },
        {
            'destinationIpAddress': 'any on server',
            'protocol': 'tcp',
            'orderValue': 3,
            'destinationIpSubnetMask': '255.255.255.255',
            'destinationPortRangeStart': 80,
            'sourceIpSubnetMask': '0.0.0.0',
            'destinationPortRangeEnd': 800,
            'version': 4,
            'action': 'permit',
            'sourceIpAddress': '0.0.0.0'
        }
    ],
    "metricTrackingObject": {
        "id": 147258369,
        "resourceTableId": 17438,
        "startDate": "2022-05-17T14:01:48-06:00",
        "type": {
            "keyname": "FIREWALL_CONTEXT",
            "name": "Firewall Module Context"
        }
    }

}

getRules = [
    {
        'destinationIpAddress': 'any on server',
        'protocol': 'tcp',
        'orderValue': 1,
        'destinationIpSubnetMask': '255.255.255.255',
        'destinationPortRangeStart': 80,
        'sourceIpSubnetMask': '0.0.0.0',
        'destinationPortRangeEnd': 80,
        'version': 4,
        'action': 'permit',
        'sourceIpAddress': '0.0.0.0'
    },
    {
        'destinationIpAddress': 'any on server',
        'protocol': 'tmp',
        'orderValue': 2,
        'destinationIpSubnetMask': '255.255.255.255',
        'destinationPortRangeStart': 1,
        'sourceIpSubnetMask': '255.255.255.255',
        'destinationPortRangeEnd': 65535,
        'version': 4,
        'action': 'permit',
        'sourceIpAddress': '193.212.1.10'
    },
    {
        'destinationIpAddress': 'any on server',
        'protocol': 'tcp',
        'orderValue': 3,
        'destinationIpSubnetMask': '255.255.255.255',
        'destinationPortRangeStart': 80,
        'sourceIpSubnetMask': '0.0.0.0',
        'destinationPortRangeEnd': 800,
        'version': 4,
        'action': 'permit',
        'sourceIpAddress': '0.0.0.0'
    }
]
edit = True