#!/bin/bash -ex
# MUST be executed:
-# - on deleuze
+# - on fritz
# - as a user with an /etc/sudoers line
-# - member of "wheel" unix group on deleuze
+# - member of "wheel" unix group on deleuze (FIXME: TRUE?)
# - while holding tickets for a user who can 'ssh -K' to mire
# - and is a member of "wheel" on mire
# - while holding tokens for a user who is:
# - a member of system:administrator
-# - listed in 'bos listusers deleuze'
+# - listed in 'bos listusers fritz'
# - and who has been set up with Domtool admin privileges by:
# - running 'domtool-adduser $USER' while holding AFS admin tokens as
# someone who is already a Domtool admin
# Run a command on both mire and deleuze; assumes that no escaping is
# needed.
function mire_and_deleuze() {
- $*
- ssh -K mire.hcoop.net $*
+ execute_on_deleuze $*
+ execute_on_mire $*
}
-function execute_on_fritz () {
- ssh -K fritz.hcoop.net $*
+function execute_on_deleuze () {
+ ssh -K deleuze.hcoop.net $*
+}
+
+function execute_on_mire () {
+ ssh -K mire.hcoop.net $*
}
function execute_on_all_machines () {
$*
ssh -K mire.hcoop.net $*
ssh -K hopper.hcoop.net $*
- ssh -K fritz.hcoop.net $*
+ ssh -K deleuze.hcoop.net $*
}
#
HOMEPATH=/afs/hcoop.net/user/$PATHBITS
MAILPATH=/afs/hcoop.net/common/email/$PATHBITS
-#
-# Create LDAP entries. (With the whole libnss-ptdb, I kind of
-# lost the idea of what I want to do with LDAP, but we'll
-# see with time how well it integrates...)
-# The ID returned from AFS is important here, we want to make
-# sure those IDs match.
-#
-
-# USER entry
-echo "
-dn: uid=$USER,ou=People,dc=hcoop,dc=net
-objectClass: top
-objectClass: person
-objectClass: posixAccount
-cn: $USER
-uid: $USER
-gidNumber: $ID
-sn: $USER
-host: abulafia
-host: mire
-
-dn: cn=$USER,ou=Group,dc=hcoop,dc=net
-objectClass: top
-objectClass: posixGroup
-cn: $USER
-gidNumber: $ID
-memberUid: $USER
-" | sudo ldapadd -x -D cn=admin,dc=hcoop,dc=net -y /etc/ldap.secret || true
-
-# USER.daemon entry
-echo "
-dn: uid=$USER.daemon,ou=People,dc=hcoop,dc=net
-objectClass: top
-objectClass: person
-objectClass: posixAccount
-cn: $USER.daemon
-uid: $USER.daemon
-gidNumber: $ID_DAEMON
-sn: $USER.daemon
-
-dn: cn=$USER.daemon,ou=Group,dc=hcoop,dc=net
-objectClass: top
-objectClass: posixGroup
-cn: $USER.daemon
-gidNumber: $ID_DAEMON
-memberUid: $USER.daemon
-" | sudo ldapadd -x -D cn=admin,dc=hcoop,dc=net -y /etc/ldap.secret || true
+# LDAP bit excised (see git history...)
#
# Export .mailfilter and .cgi keys to a keytab file
ssh hopper.hcoop.net cd /etc/keytabs\; sudo tar xlpf -)
(cd /etc/keytabs
sudo tar clpf - user.daemon/$USER | \
- ssh fritz.hcoop.net cd /etc/keytabs\; sudo tar xlpf -)
+ ssh deleuze.hcoop.net cd /etc/keytabs\; sudo tar xlpf -)
+(cd /etc/keytabs
+ sudo tar clpf - user.daemon/$USER | \
+ ssh navajos.hcoop.net cd /etc/keytabs\; sudo tar xlpf -)
#
# Create/mount/set-perms on user's volumes (home, mail, databases, logs)
chown $USER:nogroup $HOMEPATH/.public/.domtool
test -e $HOMEPATH/.domtool || \
test -L $HOMEPATH/.domtool || \
- sudo -u $USER ln -s $HOMEPATH/.public/.domtool $HOMEPATH/.domtool
+ execute_on_deleuze sudo -u $USER ln -s $HOMEPATH/.public/.domtool $HOMEPATH/.domtool
+ # ^^ work around sudo env_reset crap without having to
+ # actually figure out how to make it work cleanly -- clinton,
+ # 2011-11-30
# Gitweb hosting
test -L /var/cache/git/$USER || \
fi
# Create database tablespaces
-execute_on_fritz /afs/hcoop.net/common/etc/scripts/create-user-database $USER
+sudo /afs/hcoop.net/common/etc/scripts/create-user-database $USER
#
# Mount points for backup volumes
# Domtool integration
#
-domtool-adduser $USER
+execute_on_deleuze domtool-adduser $USER
#
# Subscribe user to our mailing lists.
#
-echo $USER@hcoop.net | sudo -u list \
+echo $USER@hcoop.net | execute_on_deleuze sudo -u list \
/var/lib/mailman/bin/add_members -r - hcoop-announce