| 1 |
#! /usr/bin/cfengine
|
| 2 |
|
| 3 |
control:
|
| 4 |
OutputPrefix = ("cfengine")
|
| 5 |
actionsequence = ( files directories links editfiles )
|
| 6 |
EditFileSize = ( 30000 )
|
| 7 |
|
| 8 |
files:
|
| 9 |
any::
|
| 10 |
# suppress emacs errors
|
| 11 |
${target}/etc/mailname mode=644 owner=0 group=0 action=touch
|
| 12 |
|
| 13 |
# floppy and cdroms are accessible for all
|
| 14 |
${target}/dev include=fd* mode=666 action=fixall r=1
|
| 15 |
${target}/dev include=sr* mode=444 action=fixall r=1
|
| 16 |
|
| 17 |
directories:
|
| 18 |
any::
|
| 19 |
${target}/tmp mode=1777 owner=0 group=0
|
| 20 |
|
| 21 |
BSDAMD::
|
| 22 |
${target}/scratch/. mode=755 owner=0 group=0
|
| 23 |
|
| 24 |
FILES_SCRATCH::
|
| 25 |
${target}/files/scratch/. mode=1777 owner=0 group=0
|
| 26 |
|
| 27 |
SCRATCH::
|
| 28 |
${target}/scratch mode=1777 owner=0 group=0
|
| 29 |
|
| 30 |
editfiles:
|
| 31 |
any::
|
| 32 |
{ ${target}/etc/default/rcS
|
| 33 |
ReplaceAll "^UTC=.*" With "UTC=${UTC}"
|
| 34 |
}
|
| 35 |
|
| 36 |
{ ${target}/etc/init.d/sysklogd
|
| 37 |
ReplaceAll "^SYSLOGD=.*" With "SYSLOGD=${dblquote}-m 360${dblquote}"
|
| 38 |
}
|
| 39 |
|
| 40 |
{ ${target}/etc/fstab
|
| 41 |
AppendIfNoSuchLine "none /proc/bus/usb usbdevfs defaults"
|
| 42 |
AppendIfNoSuchLine "/dev/fd0 /floppy auto users,noauto 0 0"
|
| 43 |
}
|
| 44 |
|
| 45 |
{ ${target}/etc/locale.gen
|
| 46 |
AutoCreate
|
| 47 |
AppendIfNoSuchLine "en_US ISO-8859-1"
|
| 48 |
}
|
| 49 |
|
| 50 |
{ ${target}/etc/hosts
|
| 51 |
AppendIfNoSuchLine "127.0.0.1 localhost"
|
| 52 |
}
|
| 53 |
|
| 54 |
# add second root account using tcsh
|
| 55 |
# insert encrypted root password
|
| 56 |
{ ${target}/etc/passwd
|
| 57 |
LocateLineMatching "^root:.*"
|
| 58 |
InsertLine "roott::0:0:root:/root:/usr/bin/tcsh"
|
| 59 |
ReplaceAll "^root::" With "root:${rootpw}:"
|
| 60 |
ReplaceAll "^roott::" With "roott:${rootpw}:"
|
| 61 |
}
|
| 62 |
|
| 63 |
{ ${target}/etc/syslog.conf
|
| 64 |
ReplaceAll "daemon.*/var/log/daemon.log"
|
| 65 |
With "daemon.warn${tab}${tab}${tab}-/var/log/daemon.log"
|
| 66 |
ReplaceAll "kern.*/var/log/kern.log"
|
| 67 |
With "kern.warn${tab}${tab}${tab}-/var/log/kern.log"
|
| 68 |
AppendIfNoSuchLine "local6.debug${tab}${tab}${tab}/var/log/daemon.log"
|
| 69 |
}
|
| 70 |
|
| 71 |
DEMO::
|
| 72 |
{ ${target}/etc/passwd
|
| 73 |
ReplaceAll "^demo:!:" With "demo:${rootpw}:"
|
| 74 |
}
|
| 75 |
|
| 76 |
GERMAN::
|
| 77 |
{ ${target}/etc/locale.gen
|
| 78 |
AutoCreate
|
| 79 |
AppendIfNoSuchLine "de_DE ISO-8859-1"
|
| 80 |
AppendIfNoSuchLine "de_DE@euro ISO-8859-15"
|
| 81 |
}
|
| 82 |
|
| 83 |
HOME_CLIENT::
|
| 84 |
{ ${target}/etc/fstab
|
| 85 |
HashCommentLinesContaining "/home "
|
| 86 |
AppendIfNoSuchLine "${hserver}:/home /home nfs rw,nosuid 0 0"
|
| 87 |
}
|
| 88 |
|
| 89 |
DATALESS::
|
| 90 |
{ ${target}/etc/fstab
|
| 91 |
HashCommentLinesContaining "/usr "
|
| 92 |
AppendIfNoSuchLine "${bserver}:/usr /usr nfs ro 0 0"
|
| 93 |
}
|
| 94 |
|
| 95 |
USR_LOCAL_MOUNT::
|
| 96 |
{ ${target}/etc/fstab
|
| 97 |
HashCommentLinesContaining "/usr/local "
|
| 98 |
AppendIfNoSuchLine "${bserver}:/usr/local /usr/local nfs ro 0 0"
|
| 99 |
}
|
| 100 |
|
| 101 |
SCRATCH::
|
| 102 |
{ ${target}/etc/exports
|
| 103 |
AutoCreate
|
| 104 |
AppendIfNoSuchLine "/scratch${tab}${tab} @faiclients(rw,no_root_squash)"
|
| 105 |
}
|
| 106 |
|
| 107 |
FILES_SCRATCH.!NIS::
|
| 108 |
{ ${target}/etc/exports
|
| 109 |
AutoCreate
|
| 110 |
AppendIfNoSuchLine "/files/scratch${tab}${tab} @faiclients(rw,no_root_squash)"
|
| 111 |
}
|
| 112 |
|
| 113 |
# if system is NET_9 and NIS member enable access for sundomain too.
|
| 114 |
FILES_SCRATCH.NET_9.NIS::
|
| 115 |
{ ${target}/etc/exports
|
| 116 |
HashCommentLinesContaining "/files/scratch"
|
| 117 |
AppendIfNoSuchLine "/files/scratch${tab}${tab} @faiclients(rw,no_root_squash) @sundomain(rw,no_root_squash)"
|
| 118 |
}
|
| 119 |
|
| 120 |
HOME_SERVER::
|
| 121 |
{ ${target}/etc/exports
|
| 122 |
AppendIfNoSuchLine "/usr${tab}${tab}@faiclients(ro,no_root_squash)"
|
| 123 |
AppendIfNoSuchLine "/home${tab}${tab}@sundomain(rw,no_root_squash) @faiclients(rw,no_root_squash)"
|
| 124 |
}
|
| 125 |
|
| 126 |
SERVER::
|
| 127 |
{ ${target}/etc/shells
|
| 128 |
AppendIfNoSuchLine "/usr/local/bin/tcsh"
|
| 129 |
}
|
| 130 |
|
| 131 |
NOGETTY::
|
| 132 |
{ ${target}/etc/inittab
|
| 133 |
HashCommentLinesContaining "respawn:/sbin/getty "
|
| 134 |
}
|
| 135 |
|
| 136 |
# add scratch.map
|
| 137 |
BSDAMD::
|
| 138 |
{ ${target}/etc/am-utils/amd.conf
|
| 139 |
AppendIfNoSuchLine "[ /scratch ]"
|
| 140 |
AppendIfNoSuchLine "map_name = amd.scratch"
|
| 141 |
}
|
| 142 |
|
| 143 |
{ ${target}/etc/default/am-utils
|
| 144 |
ReplaceAll "AM_UTILS_MAP_NET='true'"
|
| 145 |
With "AM_UTILS_MAP_NET='false'"
|
| 146 |
}
|
| 147 |
|
| 148 |
# add netgroup to passwd if client is in NIS and NET_9 and LINUX
|
| 149 |
NIS.LINUX.NET_9::
|
| 150 |
{ ${target}/etc/passwd
|
| 151 |
AppendIfNoSuchLine "+@linuxusers::0:0:::"
|
| 152 |
}
|