Merge pull request #12 from deric/passwd-aging

Passwd aging on CentOS
This commit is contained in:
Michael Adam 2016-04-28 10:52:50 +02:00
commit 4fc2ed880d
2 changed files with 7 additions and 1 deletions

View file

@ -39,7 +39,7 @@ elif [ ${DISTRIBUTION} = 'fedora' -a "${RELEASE}" = 'rawhide' ]; then
utils.lxc.create -t fedora --\ utils.lxc.create -t fedora --\
--release ${RELEASE} \ --release ${RELEASE} \
--arch ${ARCH} --arch ${ARCH}
elif [ ${DISTRIBUTION} = 'fedora' -a ${RELEASE} -ge 21 ]; then elif [[ ( ${DISTRIBUTION} = 'fedora' ) && ( ${RELEASE} -ge 21 ) ]]; then
ARCH=$(echo ${ARCH} | sed -e "s/38/68/" | sed -e "s/amd64/x86_64/") ARCH=$(echo ${ARCH} | sed -e "s/38/68/" | sed -e "s/amd64/x86_64/")
utils.lxc.create -t fedora --\ utils.lxc.create -t fedora --\
--release ${RELEASE} \ --release ${RELEASE} \

View file

@ -22,6 +22,12 @@ elif [ ${DISTRIBUTION} = 'centos' -o ${DISTRIBUTION} = 'fedora' ]; then
chroot ${ROOTFS} useradd --create-home -s /bin/bash -u 1000 vagrant &>> ${LOG} chroot ${ROOTFS} useradd --create-home -s /bin/bash -u 1000 vagrant &>> ${LOG}
echo -n 'vagrant:vagrant' | chroot ${ROOTFS} chpasswd echo -n 'vagrant:vagrant' | chroot ${ROOTFS} chpasswd
sed -i 's/^Defaults\s\+requiretty/# Defaults requiretty/' $ROOTFS/etc/sudoers sed -i 's/^Defaults\s\+requiretty/# Defaults requiretty/' $ROOTFS/etc/sudoers
if [ ${RELEASE} -eq 6 ]; then
info 'Disabling password aging for root...'
# disable password aging (required on Centos 6)
# pretend that password was changed today (won't fail during provisioning)
chroot ${ROOTFS} chage -I -1 -m 0 -M 99999 -E -1 -d `date +%Y-%m-%d` root
fi
else else
debug 'Creating vagrant user...' debug 'Creating vagrant user...'
chroot ${ROOTFS} useradd --create-home -s /bin/bash vagrant &>> ${LOG} chroot ${ROOTFS} useradd --create-home -s /bin/bash vagrant &>> ${LOG}