[5357] | 1 | #!/bin/sh - |
---|
| 2 | # |
---|
[8412] | 3 | # $Id: config_afs.sh,v 1.12 1996-05-15 19:02:22 ghudson 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] | 8 | PATH=/bin:/bin/athena:/usr/bin; export PATH |
---|
[5357] | 9 | |
---|
| 10 | VICEDIR=/usr/vice/etc |
---|
| 11 | CELLDB=${VICEDIR}/CellServDB |
---|
[6067] | 12 | SUIDDB=${VICEDIR}/SuidCells |
---|
[5357] | 13 | |
---|
| 14 | echo "Updating cell location information" |
---|
| 15 | rm -f ${VICEDIR}/Ctmp |
---|
| 16 | cp /afs/athena.mit.edu/service/CellServDB ${VICEDIR}/Ctmp && \ |
---|
[6067] | 17 | [ -s ${VICEDIR}/Ctmp ] && \ |
---|
[5357] | 18 | mv -f ${VICEDIR}/Ctmp ${CELLDB}.public && \ |
---|
| 19 | cat ${CELLDB}.public ${CELLDB}.local >${VICEDIR}/Ctmp 2>/dev/null |
---|
[7835] | 20 | rm -f ${CELLDB}.last |
---|
| 21 | ln ${CELLDB} ${CELLDB}.last |
---|
[5357] | 22 | mv -f ${VICEDIR}/Ctmp ${CELLDB} |
---|
[7835] | 23 | chmod 644 ${CELLDB} |
---|
[5359] | 24 | |
---|
[7835] | 25 | cmp -s ${CELLDB}.last ${CELLDB} || \ |
---|
| 26 | awk ' \ |
---|
[5359] | 27 | /^>/ {printf("\nfs newcell %s", substr($1,2,length($1)-1))}; \ |
---|
| 28 | /^[0-9]/ {printf(" %s",$1)}; \ |
---|
[7835] | 29 | END {printf("\n")}' ${CELLDB} | sh |
---|
[5357] | 30 | |
---|
[6067] | 31 | echo "Updating setuid cell information" |
---|
| 32 | rm -f ${VICEDIR}/Ctmp |
---|
| 33 | cp /afs/athena.mit.edu/service/SuidCells ${VICEDIR}/Ctmp && \ |
---|
| 34 | [ -s ${VICEDIR}/Ctmp ] && \ |
---|
| 35 | mv -f ${VICEDIR}/Ctmp ${SUIDDB}.public && \ |
---|
| 36 | cat ${SUIDDB}.public ${SUIDDB}.local >${VICEDIR}/Ctmp 2>/dev/null |
---|
| 37 | mv -f ${VICEDIR}/Ctmp ${SUIDDB} |
---|
[7835] | 38 | chmod 644 ${SUIDDB} |
---|
[5357] | 39 | |
---|
[6067] | 40 | echo "Only allowing setuid/setgid programs from the following cells:" |
---|
[5394] | 41 | |
---|
[8230] | 42 | /etc/athena/listsuidcells | xargs -icellname fs setcell cellname -nosuid |
---|
| 43 | cat ${SUIDDB} | awk ' |
---|
[8412] | 44 | /^-/ { suid[substr($1,2,length($1)-1)] = 0; } |
---|
| 45 | /^[^-]/ { suid[$1] = 1; |
---|
[8230] | 46 | cells[numcells++] = $1; } |
---|
| 47 | END { for (i = 0; i < numcells; i++) { |
---|
| 48 | if (suid[cells[i]]) { |
---|
| 49 | printf("fs setcell %s -suid\n", cells[i]); |
---|
| 50 | printf("echo %s\n", cells[i]); } } }' | sh |
---|
[5394] | 51 | |
---|
[5357] | 52 | exit 0 |
---|