Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pprint
- class rule():
- def __init__(self, name, match_clause, then_clause):
- self.name = name
- self.match_clause = match_clause
- self.then_clause = then_clause
- def __repr__(self):
- # This next line causes the print() function to render something useful.
- # Comment out the def line and the line below to see the difference
- return(", ".join(["%s=%s" % (key, value) for key, value in sorted(self.__dict__.items())]))
- class rule_set():
- def __init__(self, name, from_zone, rule_list):
- self.name = name
- self.from_zone = from_zone
- self.rule_list = rule_list
- def __repr__(self):
- return(", ".join(["%s=%s" % (key, value) for key, value in sorted(self.__dict__.items())]))
- if __name__ == "__main__":
- my_rule = rule("rule-1", "destination-address 194.1.1.10/32", "static-nat prefix 10.17.10.10/32")
- my_rule_list = [my_rule]
- my_rule_set = rule_set("static-nat-Untrust", "Untrust", my_rule_list)
- print(my_rule_set)
- """
- Juniper SRX
- ----------
- interfaces {
- ge-0/0/0 {
- unit 0 {
- family inet {
- address 194.1.1.1/24;
- }
- }
- }
- ge-2/0/5 {
- unit 0 {
- family inet {
- address 10.17.10.1/24;
- }
- }
- }
- }
- security {
- nat {
- static {
- rule-set static-nat-"Untrust" {
- from zone "Untrust";
- rule rule-1 {
- match {
- destination-address 194.1.1.10/32;
- }
- then {
- static-nat prefix 10.17.10.10/32;
- }
- }
- rule rule-2 {
- match {
- destination-address 194.1.1.20/32;
- }
- then {
- static-nat prefix 10.17.10.20/32;
- }
- }
- }
- }
- proxy-arp {
- interface ge-0/0/0.0 {
- address {
- 194.1.1.10/32;
- 194.1.1.20/32;
- }
- }
- }
- }
- zones {
- security-zone Untrust {
- interfaces {
- ge-0/0/0.0;
- }
- }
- security-zone DMZ {
- address-book {
- address mx1.union.com 10.17.10.10/32;
- address mx2.union.com 10.17.10.20/32;
- }
- interfaces {
- ge-2/0/5.0;
- }
- }
- }
- policies {
- from-zone Untrust to-zone DMZ {
- /* "CR4444567" */
- policy 100 {
- match {
- source-address any;
- destination-address [ mx1.union.com mx2.union.com ];
- application junos-smtp;
- }
- then {
- permit;
- log {
- session-init;
- }
- }
- }
- }
- }
- }
- """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement