@@ -37,6 +37,7 @@ LB_NSG_OCID=""
3737FSS_NSG_OCID=" "
3838LPG_OCID=" "
3939ALL_IPS=" 0.0.0.0/0"
40+ LB_SOURCE_CIDR=" "
4041NETWORK_VALIDATION_MSG=" Fix the network validation script errors and re-run the script in the cloud shell"
4142
4243debug=false
@@ -240,6 +241,9 @@ function check_tcp_port_open_in_seclist_or_nsg() {
240241 else
241242 source_in_cidr_range=1
242243 fi
244+ elif [[ $source = " " ]]
245+ then
246+ source_in_cidr_range=0
243247 else
244248 source_in_cidr_range=$( in_cidr_range $ingress_source $source ; echo $? )
245249 fi
@@ -519,9 +523,10 @@ This script is used to validate existing subnets, and optionally network securit
519523 -g, --lpg OCID of the Local Peering Gateway (LPG) in the DB VCN
520524 -b, --bastionsubnet Bastion Subnet OCID
521525 -i, --bastionip Bastion Host IP. Provide this if using existing bastion
526+ -j, --lbsourcecidr Load Balance Source CIDR
522527 -u, --lbsubnet1 Load Balancer Subnet 1 OCID
523528 -v, --lbsubnet2 Load Balancer Subnet 2 OCID which is required only for AD subnet
524- -l, --externalport WebLogic Managed Server External Port
529+ -l, --externalport WebLogic Managed Server External Port
525530 -f, --fsssubnet File Storage Service (FSS) Mount Target Subnet OCID
526531 -a, --adminsrvnsg OCID of the Network Security Group (NSG) for the administration server (Required if using NSGs instead of security lists)
527532 -m, --managedsrvnsg OCID of the Network Security Group (NSG) for the managed servers (Required if using NSGs instead of security lists)
@@ -587,6 +592,7 @@ while [[ $1 = -?* ]]; do
587592 -g|--lpg) shift ; LPG_OCID=${1} ;;
588593 -b|--bastionsubnet) shift ; BASTION_SUBNET_OCID=${1} ;;
589594 -i|--bastionip) shift ; BASTION_HOST_IP=${1} ;;
595+ -j|--lbsourcecidr) shift ; LB_SOURCE_CIDR=${1} ;;
590596 -u|--lbsubnet1) shift ; LB_SUBNET_1_OCID=${1} ;;
591597 -v|--lbsubnet2) shift ; LB_SUBNET_2_OCID=${1} ;;
592598 -l|--externalport) shift ; WLS_LB_PORT=${1} ;;
@@ -963,20 +969,18 @@ if [[ -n ${LB_SUBNET_1_OCID} ]]
963969then
964970 if [[ -z ${LB_NSG_OCID} ]]
965971 then
966- res=$( validate_subnet_port_access " ${LB_SUBNET_1_OCID} " ${LB_PORT} " ${ALL_IPS } " )
972+ res=$( validate_subnet_port_access " ${LB_SUBNET_1_OCID} " ${LB_PORT} " ${LB_SOURCE_CIDR } " )
967973 if [[ $res -ne 0 ]]
968974 then
969- echo " ERROR: Port [$LB_PORT ] is not open for 0.0.0.0/0 in LB Subnet CIDR [${LB_SUBNET_1_OCID} ]. ${NETWORK_VALIDATION_MSG} "
970- validation_return_code=2
975+ echo " WARNING : Port [$LB_PORT ] is not open for ${LB_SOURCE_CIDR} in LB Subnet CIDR [${LB_SUBNET_1_OCID} ]. ${NETWORK_VALIDATION_MSG} "
971976 fi
972977 else
973978 if [[ -n ${ADMIN_SRV_NSG_OCID} && -n ${MANAGED_SRV_NSG_OCID} ]]
974979 then
975- res=$( check_tcp_port_open_in_seclist_or_nsg $LB_NSG_OCID " ${LB_PORT} " " $ALL_IPS " " nsg" )
980+ res=$( check_tcp_port_open_in_seclist_or_nsg $LB_NSG_OCID " ${LB_PORT} " " ${LB_SOURCE_CIDR} " " nsg" )
976981 if [[ $res -ne 0 ]]
977982 then
978- echo " ERROR: Port [$LB_PORT ] is not open for 0.0.0.0/0 in Load Balancer Server NSG [${LB_NSG_OCID} ]. ${NETWORK_VALIDATION_MSG} "
979- validation_return_code=2
983+ echo " WARNING : Port [$LB_PORT ] is not open for ${LB_SOURCE_CIDR} in Load Balancer Server NSG [${LB_NSG_OCID} ]. ${NETWORK_VALIDATION_MSG} "
980984 fi
981985 fi
982986 fi
@@ -1014,20 +1018,18 @@ if [[ -n ${LB_SUBNET_2_OCID} ]]
10141018then
10151019 if [[ -z ${LB_NSG_OCID} ]]
10161020 then
1017- res=$( validate_subnet_port_access " ${LB_SUBNET_2_OCID} " ${LB_PORT} " ${ALL_IPS } " )
1021+ res=$( validate_subnet_port_access " ${LB_SUBNET_2_OCID} " ${LB_PORT} " ${LB_SOURCE_CIDR } " )
10181022 if [[ $res -ne 0 ]]
10191023 then
1020- echo " ERROR: Port [$LB_PORT ] is not open for 0.0.0.0/0 in LB Subnet CIDR [${LB_SUBNET_2_OCID} ]. ${NETWORK_VALIDATION_MSG} "
1021- validation_return_code=2
1024+ echo " WARNING: Port [$LB_PORT ] is not open for ${LB_SOURCE_CIDR} in LB Subnet CIDR [${LB_SUBNET_2_OCID} ]. ${NETWORK_VALIDATION_MSG} "
10221025 fi
10231026 else
10241027 if [[ -n ${ADMIN_SRV_NSG_OCID} && -n ${MANAGED_SRV_NSG_OCID} ]]
10251028 then
1026- res=$( check_tcp_port_open_in_seclist_or_nsg $LB_NSG_OCID " ${LB_PORT} " " $ALL_IPS " " nsg" )
1029+ res=$( check_tcp_port_open_in_seclist_or_nsg $LB_NSG_OCID " ${LB_PORT} " " ${LB_SOURCE_CIDR} " " nsg" )
10271030 if [[ $res -ne 0 ]]
10281031 then
1029- echo " ERROR: Port [$LB_PORT ] is not open for 0.0.0.0/0 in Load Balancer Server NSG [${LB_NSG_OCID} ]. ${NETWORK_VALIDATION_MSG} "
1030- validation_return_code=2
1032+ echo " WARNING: Port [$LB_PORT ] is not open for ${LB_SOURCE_CIDR} in Load Balancer Server NSG [${LB_NSG_OCID} ]. ${NETWORK_VALIDATION_MSG} "
10311033 fi
10321034 fi
10331035 fi
0 commit comments