source: trunk/packs/maint/config_afs.sh @ 11129

Revision 11129, 1.8 KB checked in by jweiss, 26 years ago (diff)
cat may fail if CSDB.local doesn't exist. this is OK. one of the many backslashes I just removed was actually necessary.
  • Property svn:executable set to *
RevLine 
[5357]1#!/bin/sh -
2#
[11129]3# $Id: config_afs.sh,v 1.15 1998-02-17 06:18:45 jweiss Exp $
[5357]4#
5# This script configures the workstation's notion of AFS.
6# 1. It updates the cell location information from /usr/vice/etc/CellServDB
7# 2. It updates the cell setuid information from /usr/vice/etc/SuidCells
[7835]8PATH=/bin:/bin/athena:/usr/bin; export PATH
[5357]9
10VICEDIR=/usr/vice/etc
11CELLDB=${VICEDIR}/CellServDB
[6067]12SUIDDB=${VICEDIR}/SuidCells
[5357]13
14echo "Updating cell location information"
15rm -f ${VICEDIR}/Ctmp
[11113]16cp /afs/athena.mit.edu/service/CellServDB ${VICEDIR}/Ctmp &&
17        [ -s ${VICEDIR}/Ctmp ] &&
18        mv -f ${VICEDIR}/Ctmp ${CELLDB}.public &&
[11129]19        cat ${CELLDB}.public ${CELLDB}.local >${VICEDIR}/Ctmp 2>/dev/null
20[ -s ${VICEDIR}/Ctmp ] &&
[11113]21        rm -f ${CELLDB}.last &&
22        ln ${CELLDB} ${CELLDB}.last &&
23        mv -f ${VICEDIR}/Ctmp ${CELLDB} &&
24        chmod 644 ${CELLDB} && {
25                cmp -s ${CELLDB}.last ${CELLDB} ||
26                awk '
[11129]27                        /^>/ {printf("\nfs newcell %s", \
[11113]28                                substr($1,2,length($1)-1))};
29                        /^[0-9]/ {printf(" %s",$1)};
30                        END {printf("\n")}' ${CELLDB} | sh
31        }
[5359]32
[6067]33echo "Updating setuid cell information"
34rm -f ${VICEDIR}/Ctmp
[11113]35cp /afs/athena.mit.edu/service/SuidCells ${VICEDIR}/Ctmp &&
36        [ -s ${VICEDIR}/Ctmp ] &&
37        mv -f ${VICEDIR}/Ctmp ${SUIDDB}.public &&
[11129]38        cat ${SUIDDB}.public ${SUIDDB}.local >${VICEDIR}/Ctmp 2>/dev/null
39[ -s ${VICEDIR}/Ctmp ] &&
[11113]40        mv -f ${VICEDIR}/Ctmp ${SUIDDB} &&
41        chmod 644 ${SUIDDB}
[5357]42
[6067]43echo "Only allowing setuid/setgid programs from the following cells:"
[5394]44
[11048]45for cellname in `/etc/athena/listsuidcells`; do
46        fs setcell "$cellname" -nosuid
47done
[8230]48cat ${SUIDDB} | awk '
[8412]49        /^-/    { suid[substr($1,2,length($1)-1)] = 0; }
50        /^[^-]/ { suid[$1] = 1;
[8230]51                  cells[numcells++] = $1; }
52        END     { for (i = 0; i < numcells; i++) {
53                        if (suid[cells[i]]) {
54                                printf("fs setcell %s -suid\n", cells[i]);
55                                printf("echo %s\n", cells[i]); } } }' | sh
[5394]56
[11113]57rm -f ${VICEDIR}/Ctmp
[5357]58exit 0
Note: See TracBrowser for help on using the repository browser.