$mailServerRule->source->addObject($objectMailServer2); // now we rename object 'mail-server2' into mail 'mail-server3' $objectMailServer2->setName('mail-server3'); // create a Tag called 'MAIL RULES' $tagMailRules = $vsys1->tagStore->findOrCreate('MAIL RULES'); // add this tag to the rule 'Mail Server incoming mails' $mailServerRule->tags->addTag($tagMailRules); // set Security Group Profile 'SecProf2' on that rule $mailServerRule->setSecurityProfileGroup('SecProf2'); // disable a rule $mailServerRule->setDisabled(true); // rename it $mailServerRule->setName('Incoming SMTP'); // move it before 'WebFarm access' $vsys1->securityRules->moveRuleBefore($mailServerRule, 'WebFarm access'); // change action to deny $vsys1->securityRules->find('WebFarm access')->setAction('deny'); // remove DNAT from a rule $vsys1->natRules->find('rule7 - dnat with port')->setNoDNAT(); // add DNAT to a rule $vsys1->natRules->find('rule5 - dynamicIP interface spe')->setDNAT($vsys1->addressStore->find('client-2-address')); //remove Source NAT froma rule $vsys1->natRules->find('rule2 - static')->setNoSNAT(); // add an IP to a dynamic IP pool $vsys1->natRules->find('rule3 - dynamic IP address')->snathosts->addObject($vsys1->addressStore->find('client-2-address')); print "\n\n************ Security Rules after changes *********\n\n"; $vsys1->securityRules->display(); print "\n***********************************************\n"; $panc->save_to_file($outputfile); //display some statistics $vsys1->display_statistics();
if ($i % $splitCount == 0) { if (isset($newGroup)) { // now we can rewrite XML $newGroup->rewriteXML(); } // create a new sub-group with name 'original--1' $newGroup = $sub->addressStore->newAddressGroup($group->name() . '--' . $i / $splitCount); print " New AddressGroup object created with name: " . $newGroup->name() . "\n"; // add this new sub-group to the original one. Don't rewrite XML for performance reasons. $group->add($newGroup, false); } // remove current group member from old group, don't rewrite XML yet for performance savings $group->remove($member, false); // we add current group member to new subgroup $newGroup->add($member, false); $i++; } if (isset($newGroup)) { // now we can rewrite XML $newGroup->rewriteXML(); } // Now we can rewrite XML $group->rewriteXML(); print " AddressGroup count after split: " . $group->count() . " \n"; print "\n"; } } } print "\n\n"; $p->save_to_file($outputfile);