su - zimbra
source ~/bin/zmshutil; zmsetvars
- Get the current zimbraAuthTokenKey
CURRENTKEY=`zmprov gcf zimbraAuthTokenKey`
echo $CURRENTKEY
- Bump the version number for the new key
CURRENTVER=`echo $CURRENTKEY | sed 's/^zimbraAuthTokenKey: \([0-9]\{1,\}\):.*$/\1/'`
NEWVER=$(( $CURRENTVER + 1 ))
NEWKEY="$NEWVER:$(date +%s%3N):$(openssl rand -hex 32)"
echo "$NEWKEY"
- zimbraAuthTokenKey is immutable, we need to make it mutable
sed -i.bak0 '/zimbraAuthTokenKey/s/immutable="1"/immutable="0"/' /opt/zimbra/conf/attrs/zimbra-attrs.xml
zmmailboxdctl restart
- Now we can modify it. We add the new zimbraAuthTokenKey value (there will be two zimbraAuthTokenKey values for a while)
zmprov mcf +zimbraAuthTokenKey "$NEWKEY"
- If you’re feeling adventurous you can delete the old value before restarting zmmailboxd by skipping the following restart command
zmmailboxdctl restart
- Check everything works as expected — not that it shouldn’t. If you are confident nothing is broken (nothing will be broken) remove the old key and make zimbraAuthTokenKey immutable again
zmprov mcf -zimbraAuthTokenKey "$CURRENTKEY"
sed -i.bak1 '/zimbraAuthTokenKey/s/immutable="0"/immutable="1"/' /opt/zimbra/conf/attrs/zimbra-attrs.xml
zmmailboxdctl restart
- That’s all folks. As a last step, you can remove the two files we created and clean up the variables
rm /opt/zimbra/conf/attrs/zimbra-attrs.xml.bak0 /opt/zimbra/conf/attrs/zimbra-attrs.xml.bak1
unset CURRENTKEY CURRENTVER NEWKEY NEWVER
exit