1 #!/bin/sh 2 # 3 # CDDL HEADER START 4 # 5 # The contents of this file are subject to the terms of the 6 # Common Development and Distribution License (the "License"). 7 # You may not use this file except in compliance with the License. 8 # 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 # or http://www.opensolaris.org/os/licensing. 11 # See the License for the specific language governing permissions 12 # and limitations under the License. 13 # 14 # When distributing Covered Code, include this CDDL HEADER in each 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 # If applicable, add the following below this CDDL HEADER, with the 17 # fields enclosed by brackets "[]" replaced with your own identifying 18 # information: Portions Copyright [yyyy] [name of copyright owner] 19 # 20 # CDDL HEADER END 21 # 22 # 23 # ident "%Z%%M% %I% %E% SMI" 24 # 25 # Copyright 2008 Sun Microsystems, Inc. All rights reserved. 26 # Use is subject to license terms. 27 # 28 29 PATH="/usr/bin:/usr/sbin:${PATH}" 30 export PATH 31 32 while read src dest 33 do 34 if [ ! -f $dest ] ; then 35 cp $src $dest 36 else 37 # 38 # 2.6 & earlier versions had an smtp entry; remove it. 39 # 40 # Some accounts used to be shipped with "NP" they are now 41 # shipped as "*LK*" since they shouldn't be able to run 42 # cron jobs or login. 43 sed ' /^smtp:/d; 44 /^nobody:/s/:NP:/:*LK*:/; 45 /^nobody4:/s/:NP:/:*LK*:/; 46 /^noaccess/s/:NP:/:*LK*:/;' $dest > /tmp/d.$$ 47 cp /tmp/d.$$ $dest 48 rm -f /tmp/d.$$ 49 50 # 51 # Add the 'nobody' user from 4.x so that people don't 52 # assign it to a regular user and confuse themselves 53 # 54 NOBODY4_LINE="nobody4:*LK*:6445::::::" 55 if grep "^nobody4:" $dest 2>&1 >/dev/null; then 56 : 57 else 58 printf '/^noaccess:*LK*\na\n%s\n.\nw\nq\n' \ 59 "$NOBODY4_LINE" | ed -s $dest > /dev/null 60 fi 61 62 # 63 # Add the 'smmsp' user for sendmail 8.12 64 # 65 SMMSP_LINE="smmsp:NP:6445::::::" 66 if grep "$SMMSP_LINE" $dest 2>&1 >/dev/null; then 67 : 68 else 69 printf '/^nobody4:*LK*\na\n%s\n.\nw\nq\n' \ 70 "$SMMSP_LINE" | ed -s $dest > /dev/null 71 fi 72 73 # 74 # Add the 'gdm' reserved user if it doesn't exist. 75 # 76 GDM_LINE="gdm:*LK*:::::::" 77 if grep "^gdm:" $dest 2>&1 >/dev/null; then 78 : 79 else 80 printf '/^listen:\*LK\*\na\n%s\n.\nw\nq\n' \ 81 "$GDM_LINE" | ed -s $dest > /dev/null 82 fi 83 84 # 85 # Add the 'webservd' reserved user if it doesn't exist. 86 # 87 WEBSERVD_LINE="webservd:*LK*:::::::" 88 if grep "^webservd:" $dest 2>&1 >/dev/null; then 89 : 90 else 91 printf '/^gdm:\*LK\*\na\n%s\n.\nw\nq\n' \ 92 "$WEBSERVD_LINE" | ed -s $dest > /dev/null 93 fi 94 95 # 96 # Add the 'postgres' reserved user if it doesn't exist. 97 # 98 POSTGRES_LINE="postgres:NP:::::::" 99 if grep "^postgres:" $dest 2>&1 >/dev/null; then 100 : 101 else 102 printf '/^webservd:\*LK\*\na\n%s\n.\nw\nq\n' \ 103 "$POSTGRES_LINE" | ed -s $dest > /dev/null 104 fi 105 106 107 108 # 109 # Add the 'mysql' reserved user if it doesn't exist. 110 # 111 MYSQL_LINE="mysql:NP:::::::" 112 if grep "^mysql:" $dest 2>&1 >/dev/null; then 113 : 114 else 115 printf '/^postgres:\*LK\*\na\n%s\n.\nw\nq\n' \ 116 "$MYSQL_LINE" | ed -s $dest > /dev/null 117 fi 118 119 120 121 # 122 # Add the 'svctag' reserved user if it doesn't exist. 123 # 124 SVCTAG_LINE="svctag:*LK*:6445::::::" 125 if grep "^svctag:" $dest 2>&1 >/dev/null; then 126 : 127 else 128 printf '/^postgres:NP\na\n%s\n.\nw\nq\n' \ 129 "$SVCTAG_LINE" | ed -s $dest > /dev/null 130 fi 131 132 # 133 # Add the 'dladm' reserved user if it doesn't exist. 134 # 135 DLADM_LINE="dladm:*LK*:::::::" 136 if grep "^dladm:" $dest 2>&1 >/dev/null; then 137 : 138 else 139 printf '/^nuucp:NP\na\n%s\n.\nw\nq\n' \ 140 "$DLADM_LINE" | ed -s $dest > /dev/null 141 fi 142 143 # 144 # Add the 'xvm' reserved user if it doesn't exist. 145 # 146 XVM_LINE="xvm:*LK*:::::::" 147 if grep "^xvm:" $dest 2>&1 >/dev/null; then 148 : 149 else 150 printf '/^gdm:\*LK\*\na\n%s\n.\nw\nq\n' \ 151 "$XVM_LINE" | ed -s $dest > /dev/null 152 fi 153 fi 154 done 155 156 exit 0 157