1 == setup/integrate a new machine ==
3 Note: this is partially obsolete now that we have [[puppet-setup|puppet]]. We should probably update/rework some parts.
5 ** Warning: This procedure has not been tested since being moved to the wiki. Beware. **
7 * install ssh if it isn't there already
14 echo 'Acquire::PDiffs "false";' > /etc/apt/apt.conf.d/local-pdiff
15 echo 'APT::Install-Recommends 0;' > /etc/apt/apt.conf.d/local-recommends
20 make sure there is _no_ locale defined in /etc/environment and /etc/default/locale
22 * make debconf the same on every host: - dialog, - high
24 dpkg-reconfigure debconf
27 * add db.d.o to sources.list:
29 cat > /etc/apt/sources.list.d/debian.org.list << EOF
30 deb http://db.debian.org/debian-admin lenny main
31 deb-src http://db.debian.org/debian-admin lenny main
35 -----BEGIN PGP PUBLIC KEY BLOCK-----
36 Version: GnuPG v1.4.6 (GNU/Linux)
38 mQGiBEf4BP0RBACfXnRhBb9HKiA3h5A1tDnluVwfkSuDX4ZXdVAuMZapdOm8r9ug
39 9zE/dDGWPWja+DArAPZ/i3BFvlMewmden/IFbQKtXluQVIC4GL1RBMwrtWsZzo0g
40 picl3CYWDAYjRdg4WppUc9FawwGw081FlLGDv7eYRO3+8uGUHfr+SD7CwwCgxJK6
41 SvDX6M2Ifuq8WmgWWrVFyakD/ipdxd3NPIcnl1JTO2NjbOJYKpZMl6v0g+1OofSq
42 CAKTO8ymc0z6SF1j/4mWe1W76wvTpOhOUgn2WO7SQHZaujb/3z+yAJedfbCDgq0S
43 H/T2qbQTzv+woAjyR/e2Zpsc2DRfqO/8aCw1Jx8N3UbH9MBPYlYlyCnSra1OAyXW
44 VvC0A/9nT/k6VIFBF0Oq2WwmzOLptOqg61WrnxBr3GIe503++p88tOwlCJlL0uZZ
45 k68m3m5t7WDtQK4fHQwLramb9AqtBPhiEaXU5bXk77RYE54EeEH9Z4H4YSMMkdYU
46 gLG5CZI2jprxAZew1mHKROv+15jxYd+BZCrORmpWn5g7N+TC5rQeZGIuZGViaWFu
47 Lm9yZyBhcmNoaXZlIGtleSAyMDA4iGYEExECACYFAkf4BP0CGwMFCQHhM4AGCwkI
48 BwMCBBUCCAMEFgIDAQIeAQIXgAAKCRC+p88QvSsO4JZLAJ4slp2uRZHtzMXK8oTB
49 DV1XiztTZwCfQD7Y2mKDaMsmE4AmwOOTw2fmcZo=
51 -----END PGP PUBLIC KEY BLOCK-----
55 * in /etc/ssh/sshd_config:
56 ** disable the DSA hostkey, so that it only does RSA
57 ** remove old host keys: <BR>{{{
58 cd /etc/ssh/ && rm ssh_host_dsa_key ssh_host_dsa_key.pub ssh_host_key ssh_host_key.pub
60 ** disable X11 forwarding
61 ** Tell it to use alternate authorized_keys locations
63 | HostKey /etc/ssh/ssh_host_rsa_key
65 | AuthorizedKeysFile /etc/ssh/userkeys/%u
66 | AuthorizedKeysFile2 /var/lib/misc/userkeys/%u
68 vi /etc/ssh/sshd_config
69 (cd / && env -i /etc/init.d/ssh restart)
72 * maybe link root's auth key there:
74 mkdir -p /etc/ssh/userkeys && ln -s /root/.ssh/authorized_keys /etc/ssh/userkeys/root
78 * install userdir-ldap
80 apt-get update && apt-get install userdir-ldap
84 * on samosa, add the host to /home/sshdist/.ssh/authorized_keys and generate.conf
85 (you want the host's rsa host key there: {{{cat /etc/ssh/ssh_host_rsa_key.pub}}})
87 : :: samosa :: && sudo vi /home/sshdist/.ssh/authorized_keys
88 : :: samosa :: && sudo vi /etc/userdir-ldap/generate.conf
90 * run generate, or wait until cron runs it for you
92 : :: samosa :: && sudo -u sshdist ud-generate
95 * fix nsswitch for ud fu.
97 sed -i -e 's/^passwd:\[[:space:]]\+compat$/passwd: compat db/;
98 s/^group:\[[:space:]]\+compat$/group: db compat/;
99 s/^shadow:\[[:space:]]\+compat$/shadow: compat db/' \
103 (you might have to restart sshd here:
105 (cd / && env -i /etc/init.d/ssh restart)
109 * on the host, run ud-replicate
111 mkdir -p /root/.ssh &&
112 echo db,db.debian.org,192.25.206.57 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAph3LozYmcwHwgnxfKia1lg1AXNuJiEroi/GpPztbcqxmFOYBZbMgYDj+kM+usoXF2diT9OQWqg1yx19CeEoghHYz4/yZa0PYdLgPj9Si4PScekVaE051GrLM63osfK0j3wIfpgLJv2/zs42NbXjkKPdjInEaWPn8W1fe88M3JDE= root@newsamosa >> /root/.ssh/known_hosts &&
116 * check if it worked:
121 * add pam_mkhomedir to common-session:
123 grep pam_mkhomedir /etc/pam.d/common-session || \
124 echo "session optional pam_mkhomedir.so skel=/etc/skel umask=0022" >> /etc/pam.d/common-session
127 * install debian.org which brings you shells and much other fun
129 apt-get install debian.org
132 * try to login using your user and ssh key. you should get a homedir.
134 * make ca-certificates sane: (choose to *not* trust new certs, and we only want the spi cert activated)
136 sed -i -e 's/^[^#!].*/!&/; s#^!spi-inc.org/spi-cacert-2008.crt#spi-inc.org/spi-cacert-2008.crt#' /etc/ca-certificates.conf
137 dpkg-reconfigure ca-certificates
142 : :: now obsolete :: &&
143 apt-get install git-core curl &&
144 ! [ -d /etc/exim4.bak ] &&
145 /etc/init.d/exim4 stop &&
146 mv /etc/exim4 /etc/exim4.bak &&
149 git clone https://db.debian.org/git/dsa-exim.git Git &&
151 (cd / && /etc/init.d/exim4 start)
153 * Add debian-admin@debian.org to root in /etc/aliases
155 * sane default editor
157 apt-get install vim && update-alternatives --set editor /usr/bin/vim.basic
162 grep '^%adm' /etc/sudoers || echo '%adm ALL=(ALL) ALL' >> /etc/sudoers
163 grep '^%adm.*apt-get' /etc/sudoers || echo '%adm ALL=(ALL) NOPASSWD: /usr/bin/apt-get update, /usr/bin/apt-get dist-upgrade, /usr/bin/apt-get clean, /usr/sbin/samhain -t check -i -p err -s none -l none -m none' >> /etc/sudoers
165 apt-get install libpam-pwdfile
166 cat > /etc/pam.d/sudo << EOF
169 auth [authinfo_unavail=ignore success=done ignore=ignore default=die] pam_pwdfile.so pwdfile=/var/lib/misc/thishost/sudo-passwd
170 auth required pam_unix.so nullok_secure try_first_pass
171 #@include common-auth
172 @include common-account
174 session required pam_permit.so
175 session required pam_limits.so
179 * OPEN A NEW SHELL - DO _NOT_ LOG OUT OF THIS ONE:<BR>
180 test that the dedicated sudo password works. if not, undo the pam sudo config.
181 (comment out the auth lines and include common-auth again)
185 grep '^URI.*db.debian.org' /etc/ldap/ldap.conf || cat >> /etc/ldap/ldap.conf << EOF
187 URI ldap://db.debian.org
188 BASE dc=debian,dc=org
190 TLS_CACERT /etc/ssl/certs/spi-cacert-2008.pem
196 * grant access to spohr
198 sed -i -e '/^allow/d; $ a \allow ^192\\\.25\\\.206\\\.57$\nallow ^192\\\.25\\\.206\\\.33$' /etc/munin/munin-node.conf
199 ( cd / && env -i /etc/init.d/munin-node restart )
201 * add to munin on spohr
203 : :: spohr :: && sudo vi /etc/munin/munin.conf
207 * add host to nagios config
209 * disable password auth with ssh, once you verified you can log in
210 and become root using keys.
212 vi /etc/ssh/sshd_config
213 | PasswordAuthentication no
214 (cd / && env -i /etc/init.d/ssh restart)
217 * if it is a HP Proliant, or has other management fu, read setup-oob
219 -- weasel, Wed, 04 Jun 2008 20:52:56 +0200