The Trusted Extensions txzonemgr command uses the tgnome-selectlabel utility to create label builder GUIs that help the user specify labels for the following:
Labeled zones
Multilevel ports
The following examples show how the tgnome-selectlabel utility is used in the txzonemgr command.
Example 6-1 selectLabel() FunctionThe selectLabel() function uses the tgnome-selectlabel utility to create a label builder GUI that helps the user select the label for a new labeled zone.
title="Labeled Zone Manager 2.2"
msg_getlabel=${gettext "Select a label for the")
...
selectLabel() {
hexlabel=$(tgnome-selectlabel \
--title="$title" \
--text="$msg_getlabel $zonename zone:" \
--min="${DEFAULTLABEL}" \
--default="${DEFAULTLABEL}" \
--max=$(chk_encodings -X) \
--accredcheck=yes \
--mode=sensitivity \
--format=internal \
2>/dev/null)
if [ $? = 0 ] ; then
setTNdata
if [ $? -ne 0 ] ; then
return 1
fi
fi
}
Example 6-2 getLabelRange() FunctionThe getLabelRange() function uses the tgnome-selectlabel utility to select the minimum and maximum labels for a multilevel port.
title="Labeled Zone Manager 2.2"
msg_getmin=$(gettext "Select the minimum network label for the")
msg_getmax=$(gettext "Select the maximum network label for the")
...
getLabelRange() {
deflabel=$(tncfg -t $cipso_template info min_label|cut -d= -f2)
minlabel=$(tgnome-selectlabel \
--title="$title" \
--text="$msg_getmin $zonename zone:" \
--min="admin_low" \
--max="$hexlabel" \
--default="$deflabel" \
--accredcheck=no \
--mode=sensitivity \
--format=internal \
2>/dev/null)
[ $? != 0 ] && return
deflabel=$(tncfg -t $cipso_template info max_label|cut -d= -f2)
maxlabel=$(tgnome-selectlabel \
--title="$title" \
--text="$msg_getmax $zonename zone:" \
--min="${minlabel}" \
--max="admin_high" \
--default="$deflabel" \
--accredcheck=no \
--mode=sensitivity \
--format=internal \
2>/dev/null)
[ $? != 0 ] && return
hostType=cipso
updateTemplate
}