Skip to content

Commit 54e271b

Browse files
CP-40754 The firewall-port script returns true if port 80 is blocked and false if it is closed, this is captured in set_https_only to update the DB based on the tate of the network not the requested setting should there be a failure
Signed-off-by: jameshensmancitrix <james.hensman@citrix.com>
1 parent 0ac90b0 commit 54e271b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

ocaml/xapi/dbsync_slave.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,12 @@ let refresh_localhost_info ~__context info =
122122
~key:Xapi_globs.host_no_local_storage ~value:"true"
123123
) else
124124
Db.Host.remove_from_other_config ~__context ~self:host
125-
~key:Xapi_globs.host_no_local_storage
125+
~key:Xapi_globs.host_no_local_storage ;
126+
let network_state =
127+
Helpers.call_script !Xapi_globs.firewall_port_config_script ["check"; "80"]
128+
in
129+
Db.Host.set_https_only ~__context ~self:host
130+
~value:(bool_of_string network_state)
126131

127132
(*************** update database tools ******************)
128133

scripts/plugins/firewall-port

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,19 @@ case "${OP}" in
4747
service iptables save
4848
fi
4949
;;
50+
check)
51+
if [[ -z `iptables -S $CHAIN | grep " $PORT "` ]]
52+
then
53+
echo true
54+
else
55+
echo false
56+
fi
57+
;;
5058
*)
5159
echo $"Usage: $0 {open|close} {port} {protocol}" 1>&2
5260
exit 1
5361
;;
5462
esac
63+
5564
exit 0
5665

0 commit comments

Comments
 (0)