/usr/bin/rsbac_group_menu is in rsbac-admin 1.4.0-repack-0ubuntu5.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | #!/bin/bash
#
# This script is used for Administration of RSBAC general group attributes
#
#
# Make sure we're really running bash.
#
[ -z "$BASH" ] && { echo "This menu requires bash" 1>&2; exit 1; }
#
# Cache function definitions, turn off posix compliance
#
set -h +o posix
# Set conf filename
RSBACCONF=/etc/rsbac.conf
# Read settings
if test -f $RSBACCONF
then . $RSBACCONF
fi
if test -f ~/.rsbacrc
then . ~/.rsbacrc
fi
if test -z "$RSBACMOD"
then RSBACMOD='GEN MAC PM DAZ FF RC AUTH ACL CAP JAIL RES PAX'
fi
for i in $RSBACMOD
do
export SHOW_${i}=yes
done
# The dir for tmp files
if test -z "$TMPDIR" ; then TMPDIR=/tmp ; fi
# This must be a unique temporary filename
if ! TMPFILE=`mktemp -q $TMPDIR/rsbac_dialog.XXXXXX`
then
TMPFILE=$TMPDIR/rsbac_dialog.$$
if test -e $TMPFILE
then rm $TMPFILE
fi
fi
if ! TMPFILETWO=`mktemp -q $TMPDIR/rsbac_dialog.XXXXXX`
then
TMPFILETWO=$TMPDIR/rsbac_dialog.$$.2
if test -e $TMPFILETWO
then rm $TMPFILETWO
fi
fi
# set this to rsbac bin dir, if not in path (trailing / is mandatory!)
#
#if test -z "$RSBACPATH" ; then RSBACPATH=./ ; fi
# set this to initial dir on script startup
LASTDIR='.'
# which dialog tool to use - dialog or kdialog or xdialog...
if test -z $DIALOG
then DIALOG=${RSBACPATH}dialog
fi
if ! $DIALOG --clear
then
echo $DIALOG menu program required! >&2
exit
fi
if ! $DIALOG --help 2>&1 | grep -q "help-button"
then
echo "Newer dialog menu version >= 0.9a-20020309a with '--help-button' option" >&2
echo "required, please use dialog from admin tools contrib dir or set" >&2
echo "\$DIALOG to another dialog program, e.g. with rsbac_settings_menu!" >&2
exit
fi
set_geometry ()
{
BL=${1:-24}
BC=${2:-80}
[ $BL = 0 ] && BL=24
[ $BC = 0 ] && BC=80
export LINES=$BL
export COLUMNS=$BC
BL=$((BL-4))
BC=$((BC-5))
MAXLINES=$((LINES-10))
}
set_geometry `stty size 2>/dev/null`
gl ()
{
if test $1 -gt $MAXLINES
then echo $MAXLINES
else echo $1
fi
}
if test -z "$LINES" ; then LINES=25 ; fi
if test -z "$COLUMNS" ; then COLUMNS=80 ; fi
export LINES
export COLUMNS
declare -i BL=$LINES-4
declare -i BC=$COLUMNS-4
declare -i MAXLINES=$LINES-10
if test -z "$BACKTITLE"
then BACKTITLE="RSBAC Administration Tools 1.4.0"
fi
TITLE="`whoami`@`hostname`: RSBAC Group Administration"
ERRTITLE="RSBAC Group Administration - ERROR"
ALL_GROUPS=4294967292
show_help () {
{
echo "$1"
echo ""
case "$1" in
Group:)
echo "Enter the group name or id."
;;
Grouplist:)
echo "Choose group from list."
;;
'RC Type:')
echo "RC model type for this group as an object."
echo ""
$RSBACPATH""attr_get_group -A rc_type
;;
'ACL Menu:')
echo "Go to ACL menu."
;;
'Reset Attributes:')
echo "Call attr_rm_group to get the attribute object for this group object"
echo "removed. As result, all attribute values will be reset to their"
echo "default values. Use with care!"
;;
Quit)
echo "Quit this menu."
;;
*)
echo "No help for $1 available!"
esac
} > $TMPFILE
$DIALOG --title "$HELPTITLE" \
--backtitle "$BACKTITLE" \
--textbox $TMPFILE $BL $BC
# sleep 1
}
get_attributes () {
if test "$1" != ""
then
if test "$SHOW_RC" = "yes"
then
RCTYPE=`$RSBACPATH""attr_get_group $1 rc_type`
fi
else
RCTYPE=
fi
}
onoff () {
if test "$1" = "$2"
then echo on
else echo off
fi
}
onoffb () {
if test "$1" = "1"
then echo on
else echo off
fi
}
get_value_name () {
case $1 in
onoff)
case $2 in
1) echo On
;;
*) echo Off
;;
esac
;;
esac
}
get_gid () {
if test "$GROUPID" = ""
then echo " "
else echo `$RSBACPATH""attr_get_group $1 group_nr`
fi
}
type_name () {
if test -z "$GROUPID" -o -z "$1"
then echo " "
else if ! $RSBACPATH""rc_get_item TYPE $1 type_group_name
then echo "(unknown)"
fi
fi
}
if test -n "$RSBACLOGFILE"
then
{
echo ""
echo "# $0 start `date`"
} >>"$RSBACLOGFILE"
fi
if test "$1" != ""
then GROUPID=$1
get_attributes $GROUPID
fi
{
echo 'group_menu ()'
echo ' {'
echo " $DIALOG --title \"$TITLE\" \\"
echo ' --backtitle "$BACKTITLE" \'
echo ' --help-button --default-item "$CHOICE" \'
echo ' --menu "Main Group Menu" $BL $BC `gl 7` \'
echo ' "Grouplist:" "Choose group from list" \'
echo ' "-------------------" " " \'
echo ' "Group:" "$GROUPID / `get_gid $GROUPID`" \'
if test "$SHOW_RC" = "yes"
then
echo ' "RC Type:" "$RCTYPE / `type_name $RCTYPE`" \'
fi
echo ' "----------------" " " \'
echo ' "Reset Attributes:" "Reset all values to default values" \'
echo ' "Quit" ""'
echo ' }'
} > $TMPFILE
. $TMPFILE
#cp $TMPFILE /tmp/menu
while true
do
if ! group_menu 2>$TMPFILE
then rm $TMPFILE ; exit
fi
CHOICE="`cat $TMPFILE`"
case "$CHOICE" in
HELP*)
show_help "${CHOICE:5}"
CHOICE="${CHOICE:5}"
;;
Group:)
if $DIALOG --title "$TITLE" \
--backtitle "$BACKTITLE" \
--inputbox "Groupname/ID" $BL $BC $GROUPID \
2>$TMPFILE
then TMP=`cat $TMPFILE`
if $RSBACPATH""attr_get_group $TMP group_name >$TMPFILE
then GROUPID=`cat $TMPFILE`
get_attributes $GROUPID
else \
$DIALOG --title "$ERRTITLE" \
--backtitle "$BACKTITLE" \
--msgbox "Group: Unknown group $TMP!" 5 $BC
fi
fi
;;
Grouplist:)
if $DIALOG --title "$TITLE" \
--backtitle "$BACKTITLE" \
--default-item "$GROUPID" \
--menu "Groupname/ID" $BL $BC $MAXLINES \
`${RSBACPATH}attr_get_group -bL` \
2>$TMPFILE
then TMP=`cat $TMPFILE`
if $RSBACPATH""attr_get_group $TMP group_name >$TMPFILE
then GROUPID=`cat $TMPFILE`
get_attributes $GROUPID
else \
$DIALOG --title "$ERRTITLE" \
--backtitle "$BACKTITLE" \
--msgbox "Group: Unknown group $TMP!" 5 $BC
fi
fi
;;
'RC Type:')
if test "$GROUPID" != ""
then \
if $RSBACPATH""rc_get_item list_group_types >$TMPFILETWO
then \
if $DIALOG --title "$TITLE" \
--backtitle "$BACKTITLE" \
--default-item "$RCTYPE" \
--menu "Choose RC Type for group $GROUPID" $BL $BC $MAXLINES \
`cat $TMPFILETWO` \
2>$TMPFILE
then TMP=`cat $TMPFILE`
if $RSBACPATH""attr_set_group $GROUPID rc_type $TMP &>$TMPFILE
then
RCTYPE=$TMP
if test -n "$RSBACLOGFILE"
then
echo $RSBACPATH""attr_set_group $GROUPID rc_type $TMP >>"$RSBACLOGFILE"
fi
else
$DIALOG --title "$ERRTITLE" \
--backtitle "$BACKTITLE" \
--msgbox "`head -n 1 $TMPFILE`" $BL $BC
fi
fi
rm $TMPFILETWO
else \
if $DIALOG --title "$TITLE" \
--backtitle "$BACKTITLE" \
--inputbox "RC Type for $GROUPID" $BL $BC "$RCTYPE" \
2>$TMPFILE
then TMP=`cat $TMPFILE`
if $RSBACPATH""attr_set_group $GROUPID rc_type $TMP &>$TMPFILE
then
RCTYPE=$TMP
if test -n "$RSBACLOGFILE"
then
echo $RSBACPATH""attr_set_group $GROUPID rc_type $TMP >>"$RSBACLOGFILE"
fi
else
$DIALOG --title "$ERRTITLE" \
--backtitle "$BACKTITLE" \
--msgbox "`head -n 1 $TMPFILE`" $BL $BC
fi
fi
fi
else
$DIALOG --title "$ERRTITLE" \
--backtitle "$BACKTITLE" \
--msgbox "RC Type: No group specified!" 5 $BC
fi
;;
'ACL Menu:')
$RSBACPATH""rsbac_acl_menu GROUP
;;
'Reset Attributes:')
if test "$TYPE" != "NONE"
then \
if $DIALOG --title "$TITLE" \
--backtitle "$BACKTITLE" \
--yesno "Reset all attributes to default values?" 5 $BC \
2>/dev/null
then
if $RSBACPATH""attr_rm_group $GROUPID &>$TMPFILE
then get_attributes $GROUPID
else \
$DIALOG --title "$ERRTITLE" \
--backtitle "$BACKTITLE" \
--msgbox "`head -n 1 $TMPFILE`" $BL $BC
fi
fi
else
$DIALOG --title "$ERRTITLE" \
--backtitle "$BACKTITLE" \
--msgbox "Reset Attributes: No group specified!" 5 $BC
fi
;;
Quit)
rm $TMPFILE ; rm $TMPFILETWO ; exit
;;
*)
$DIALOG --title "$ERRTITLE" \
--backtitle "$BACKTITLE" \
--msgbox "Main Menu: Selection Error!" 5 $BC
esac
# sleep 2
done
|