mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
This PR partially fixes the logic around port forwarding rules on the Juniper SRX plugin. The code in the plugin is based on JunOS 10, which is very old. The changes here should not break compatibility, but should enable the plugin to be used on newer devices. Note that an additional change to a script file is required to be able to add port forwarding rules, but as this PR was targetted for 4.11.3, I thought it best not to include this change as it might break compatibility for anyone still using JunOS 10. I've made the logic better and consistent for adding/removing static nat and port forwarding rules - these were multi-step processes which did not check each individual step. This would aid in manually fixing rules in case of further problems. I've also improved the logging for communication with the SRX by stripping out the Apache header before sending it, and indicating the name of the template filename in use. To be able to add port forwarding rules, the <dst-port> tags in dest-nat-rule-add.xml must be changed to <low>. Fixes: #3379
57 lines
1.4 KiB
XML
57 lines
1.4 KiB
XML
<!--
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
or more contributor license agreements. See the NOTICE file
|
|
distributed with this work for additional information
|
|
regarding copyright ownership. The ASF licenses this file
|
|
to you under the Apache License, Version 2.0 (the
|
|
"License"); you may not use this file except in compliance
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
software distributed under the License is distributed on an
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
KIND, either express or implied. See the License for the
|
|
specific language governing permissions and limitations
|
|
under the License.
|
|
-->
|
|
<rpc>
|
|
<load-configuration>
|
|
<configuration>
|
|
<security>
|
|
<nat>
|
|
<destination>
|
|
<rule-set>
|
|
<name>%rule-set%</name>
|
|
<from><zone>%from-zone%</zone></from>
|
|
<rule>
|
|
<name>%rule-name%</name>
|
|
<dest-nat-rule-match>
|
|
<destination-address>
|
|
<dst-addr>%public-address%</dst-addr>
|
|
</destination-address>
|
|
<destination-port>
|
|
<low>%src-port%</low>
|
|
</destination-port>
|
|
</dest-nat-rule-match>
|
|
<then>
|
|
<destination-nat>
|
|
<pool>
|
|
<pool-name>%pool-name%</pool-name>
|
|
</pool>
|
|
</destination-nat>
|
|
</then>
|
|
</rule>
|
|
</rule-set>
|
|
</destination>
|
|
</nat>
|
|
</security>
|
|
</configuration>
|
|
</load-configuration>
|
|
</rpc>
|
|
|
|
|
|
|
|
|