#!/bin/sh

# script to initialize the ground state of the 'vars' database
# invoked by installation scripts

# @(#)init_vars.sh	3.8 00/02/24 Sun Microsystems

read SUNSCREEN_BASE <${SUNSCREEN_ETC:-/etc/opt/SUNWicg/SunScreen}/location
. $SUNSCREEN_BASE/bin/.ssenv.profile

set -e 99	# exit if anything exits

T=/tmp/init_vars.log.sh
cp /dev/null $T ; chmod 600 $T

CMDO="echo vars"
STR=$LIB_DIR/strs

DESC=`$STR 1 750 "global log daemon UDP port"`
$CMDO >>$T add prg=log name=LogPort \
	value=3853 \
	description=\""$DESC"\"

DESC=`$STR 1 760 "global log severity limit"`
$CMDO >>$T add name=LogSeverity \
	value=\"INFO\" \
	description=\""$DESC"\"

DESC=`$STR 1 740 "global log capacity (MB)"`
$CMDO >>$T add prg=log name=LogSize \
	value=100 \
	description=\""$DESC"\"

DESC=`$STR 1 2170 "map user from immediate to domain"`
$CMDO >>$T add prg=auth name=userImmediateDomain \
	value=\"default\" \
	description=\""$DESC"\" \
	other=\'_value_default:ascii=\"default\"\;\'

DESC=`$STR 1 762 "global log severity limit, authentication"`
$CMDO >>$T add prg=auth name=LogSeverity \
	value=\"INFO\" \
	description=\""$DESC"\"

DESC=`$STR 1 764 "global log severity limit, editor"`
$CMDO >>$T add prg=edit name=LogSeverity \
	value=\"INFO\" \
	description=\""$DESC"\"

DESC=`$STR 1 766 "global log severity limit, FTP proxy"`
$CMDO >>$T add prg=ftpp name=LogSeverity \
	value=\"INFO\" \
	description=\""$DESC"\"

DESC=`$STR 1 767 "global log severity limit, HTTP proxy"`
$CMDO >>$T add prg=httpp name=LogSeverity \
	value=\"INFO\" \
	description=\""$DESC"\"

DESC=`$STR 1 768 "global log severity limit, SMTP proxy"`
$CMDO >>$T add prg=smtpp name=LogSeverity \
	value=\"INFO\" \
	description=\""$DESC"\"

DESC=`$STR 1 769 "global log severity limit, Telnet proxy"`
$CMDO >>$T add prg=telnetp name=LogSeverity \
	value=\"INFO\" \
	description=\""$DESC"\"

DESC=`$STR 1 770 "limit on # of concurrent proxy sessions"`
$CMDO >>$T add prg=ftpp name=N_Sessions \
	value=100 \
	description=\""$DESC"\"

# msd note: # of sessions here is *roughly* the maximum number possible,
#	given a 32-bit architecture w/ default OPEN_MAX of 1024; on a
#	64-bit architecture, default OPEN_MAX is 65536, which would
#	allow roughly 21840 sessions
DESC=`$STR 1 770 "limit on # of concurrent proxy sessions"`
$CMDO >>$T add prg=httpp name=N_Sessions \
	value=333 \
	description=\""$DESC"\"

DESC=`$STR 1 1856 "restriction on TCP port #s URIs can target"`
$CMDO >>$T add prg=httpp name=TargetSvcs \
	values={ \
		svc=\"www\" \
	} \
	description=\""$DESC"\"

# msd note: for now, these extension and MIME-type matchers are provisional
#	and hence marked as *reserved* - they will not be documented as
#	approved interfaces, pending revision to a forthcoming scheme
DESC=`$STR 1 1020 "Java extensions, HTTP proxy - *reserved*"`
$CMDO >>$T add prg=httpp name=JavaExtensions \
	values={ \
		suffix=\".jar\" \
	} \
	description=\""$DESC"\"

DESC=`$STR 1 1022 "Java *magic* extensions, HTTP proxy - *reserved*"`
$CMDO >>$T add prg=httpp name=JavaMagicExtensions \
	values={ \
		suffix=\".class\" \
	} \
	description=\""$DESC"\"

DESC=`$STR 1 1024 "Java *magic* MIME types, HTTP proxy - *reserved*"`
$CMDO >>$T add prg=httpp name=JavaMagicMIMETypes \
	values={ \
		name=\"application/octet-stream\" \
	} \
	description=\""$DESC"\"

DESC=`$STR 1 1026 "Java MIME types, HTTP proxy - *reserved*"`
$CMDO >>$T add prg=httpp name=JavaMIMETypes \
	values={ \
		prefix=\"application/x-java-\" \
	} \
	description=\""$DESC"\"

DESC=`$STR 1 1560 "Other-X extensions, HTTP proxy - *reserved*"`
$CMDO >>$T add prg=httpp name=OtherXExtensions \
	disabled \
	values={ \
		suffix=\".cab\" \
		suffix=\".dll\" \
		suffix=\".js\" \
		suffix=\".scf\" \
		suffix=\".vbr\" \
		suffix=\".vbs\" \
	} \
	description=\""$DESC"\"

DESC=`$STR 1 1566 "Other-X MIME types, HTTP proxy - *reserved*"`
$CMDO >>$T add prg=httpp name=OtherXMIMETypes \
	values={ \
		name=\"application/octet-stream\" \
		prefix=\"application/ole\" \
		prefix=\"application/scriptlet\" \
		name=\"application/x-msdownload\" \
		prefix=\"application/x-ole\" \
		prefix=\"application/x-scriptlet\" \
	} \
	description=\""$DESC"\"

DESC=`$STR 1 1852 "response body save silo (MB), HTTP proxy"`
$CMDO >>$T add prg=httpp name=RspBodySave \
	value=0 \
	description=\""$DESC"\"

DESC=`$STR 1 420 "default domain in ftp method anonymous password"`
$CMDO >>$T add prg=httpp name=FtpPwdDomain \
	disabled \
	value="UNCONFIGURED-DOMAIN" \
	description=\""$DESC"\"

DESC=`$STR 1 421 "default user in ftp method anonymous password"`
$CMDO >>$T add prg=httpp name=FtpPwdUser \
	value="anonymous" \
	description=\""$DESC"\"

DESC=`$STR 1 422 "default user in ftp method"`
$CMDO >>$T add prg=httpp name=FtpUser \
	value="webproxy" \
	description=\""$DESC"\"

DESC=`$STR 1 1811 "seconds to ignore a non-responsive RADIUS server"`
$CMDO >>$T add prg=auth name=RADIUSHolddown \
	value=300 \
	description=\""$DESC"\"

DESC=`$STR 1 1812 "shared secret for (this) RADIUS client"`
$CMDO >>$T add prg=auth name=RADIUSNodeSecret \
	disabled \
	value=\"....-....1....-....2....-....3..\" \
	description=\""$DESC"\"

DESC=`$STR 1 1813 "how many times to try each RADIUS server"`
$CMDO >>$T add prg=auth name=RADIUSRetryPasses \
	value=3 \
	description=\""$DESC"\"

DESC=`$STR 1 1814 "RADIUS server name(s) / address(es) to query"`
$CMDO >>$T add prg=auth name=RADIUSServers \
	disabled \
	values={ \
		host=server1 \
		host=server2 \
		host=1.2.3.4 \
	} \
	description=\""$DESC"\"

DESC=`$STR 1 1815 "RADIUS service / port # at which to query server(s)"`
$CMDO >>$T add prg=auth name=RADIUSService \
	value=radius \
	description=\""$DESC"\"

DESC=`$STR 1 1816 "seconds to await each RADIUS server response"`
$CMDO >>$T add prg=auth name=RADIUSTimeout \
	value=5 \
	description=\""$DESC"\"

DESC=`$STR 1 770 "limit on # of concurrent proxy sessions"`
$CMDO >>$T add name=..N_Sessions \
	value=100 \
	description=\""$DESC"\"

DESC=`$STR 1 1260 "log severity limit"`
$CMDO >>$T add name=..LogSeverity \
	value=\"WARN\" \
	other=\'_value_enum:ascii=\"NONE\"\;\' \
	other=\'_value_enum:ascii=\"ALERT\"\;\' \
	other=\'_value_enum:ascii=\"CRIT\"\;\' \
	other=\'_value_enum:ascii=\"ERR\"\;\' \
	other=\'_value_enum:ascii=\"WARN\"\;\' \
	other=\'_value_enum:ascii=\"NOTE\"\;\' \
	other=\'_value_enum:ascii=\"INFO\"\;\' \
	other=\'_value_enum:ascii=\"DEBUG\"\;\' \
	description=\""$DESC"\"

#echo save >>$T
echo quit >>$T

$BIN_DIR/ssadm edit Registry <$T

rm $T

# eof
