diff --git a/docker/pypi/wmagent/wmagent-docker-run.sh b/docker/pypi/wmagent/wmagent-docker-run.sh index 4da7868cb..d580fffc5 100755 --- a/docker/pypi/wmagent/wmagent-docker-run.sh +++ b/docker/pypi/wmagent/wmagent-docker-run.sh @@ -72,17 +72,22 @@ ln -s $HOST_MOUNT_DIR/srv/wmagent /data/srv/wmagent passwdEntry=$(getent passwd $wmaUser | awk -F : -v wmaHome="/home/$wmaUser" '{print $1 ":" $2 ":" $3 ":" $4 ":" $5 ":" wmaHome ":" $7}') groupEntry=$(getent group $wmaGroup) +# @TODO: Create needed unix accounts in container, rather than bind mounting files from the host # workaround case where Unix account is not in the local system (e.g. sssd) [[ -d $HOST_MOUNT_DIR/admin/etc/ ]] || (mkdir -p $HOST_MOUNT_DIR/admin/etc) || exit $? if ! [ -f $HOST_MOUNT_DIR/admin/etc/passwd ]; then echo "Creating passwd file" getent passwd > $HOST_MOUNT_DIR/admin/etc/passwd echo $passwdEntry >> $HOST_MOUNT_DIR/admin/etc/passwd + # add back apt related unix users + echo "uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin" >> $HOST_MOUNT_DIR/admin/etc/passwd + echo "_apt:x:100:65534::/nonexistent:/usr/sbin/nologin" >> $HOST_MOUNT_DIR/admin/etc/passwd fi if ! [ -f $HOST_MOUNT_DIR/admin/etc/group ]; then echo "Creating group file" getent group > $HOST_MOUNT_DIR/admin/etc/group echo $groupEntry >> $HOST_MOUNT_DIR/admin/etc/group + echo "uucp:x:10:" >> $HOST_MOUNT_DIR/admin/etc/group fi # create regular mount points at runtime @@ -110,13 +115,15 @@ $tnsMount \ --mount type=bind,source=$HOST_MOUNT_DIR/srv/wmagent/$WMA_VER_RELEASE/config,target=/data/srv/wmagent/current/config \ --mount type=bind,source=$HOST_MOUNT_DIR/srv/wmagent/$WMA_VER_RELEASE/logs,target=/data/srv/wmagent/current/logs \ --mount type=bind,source=$HOST_MOUNT_DIR/admin/wmagent,target=/data/admin/wmagent \ ---mount type=bind,source=$HOST_MOUNT_DIR/admin/etc/passwd,target=/etc/passwd,readonly \ ---mount type=bind,source=$HOST_MOUNT_DIR/admin/etc/group,target=/etc/group,readonly \ --mount type=bind,source=/etc/sudoers,target=/etc/sudoers,readonly \ --mount type=bind,source=/etc/sudoers.d,target=/etc/sudoers.d,readonly \ --mount type=bind,source=/etc/grid-security,target=/etc/grid-security,readonly \ --mount type=bind,source=/etc/vomses,target=/etc/vomses,readonly \ +--mount type=bind,source=/etc/s-nail.rc,target=/etc/s-nail_host.rc,readonly \ " +#--mount type=bind,source=/usr/bin/s-nail,target=/usr/bin/s-nail,readonly \ +#--mount type=bind,source=$HOST_MOUNT_DIR/admin/etc/passwd,target=/etc/passwd,readonly \ +#--mount type=bind,source=$HOST_MOUNT_DIR/admin/etc/group,target=/etc/group,readonly \ registry=local repository=wmagent @@ -148,3 +155,13 @@ userStatus="$(docker exec -u root -it wmagent sh -c "passwd -S $wmaUser" | awk ' if [ "${userStatus:0:1}" == "P" ]; then docker exec -u root -it wmagent sh -c "echo $wmaUser:$wmaUser | chpasswd" fi + +# Install s-nail +# TODO: Do this in the Dockerfile base image +docker exec -u root -it wmagent apt-get -y install s-nail +# Configure s-nail to use the host s-nail mail server +docker exec -u root -it wmagent cp /etc/s-nail_host.rc /etc/s-nail.rc +docker exec -u root -it wmagent sh -c "printf 'set v15-compat\nset smtp-auth=none\nset mta=smtp://127.0.0.1:25' >> /etc/s-nail.rc" +# Change mail to use s-nail +docker exec -u root -it wmagent update-alternatives --install /usr/bin/mailx mailx /usr/bin/s-nail 50 --slave /usr/bin/mail mail /usr/bin/s-nail +