Commit 0c17ba49 authored by Marco Mariani's avatar Marco Mariani

disable root check; run scripts as user current user instead of zimbra

parent 59b5be37
...@@ -14,10 +14,11 @@ ...@@ -14,10 +14,11 @@
# ***** END LICENSE BLOCK ***** # ***** END LICENSE BLOCK *****
# #
if [ x`whoami` != "xroot" ]; then ## XXX SLAPOS need to run this as regular user
echo "$0 must be run as user root" #if [ x`whoami` != "xroot" ]; then
exit 1 # echo "$0 must be run as user root"
fi # exit 1
#fi
umask 027 umask 027
platform=$(/opt/zimbra/libexec/get_plat_tag.sh 2> /dev/null := UNKNOWN) platform=$(/opt/zimbra/libexec/get_plat_tag.sh 2> /dev/null := UNKNOWN)
...@@ -30,6 +31,7 @@ zmsetvars -f \ ...@@ -30,6 +31,7 @@ zmsetvars -f \
zimbra_java_home \ zimbra_java_home \
zimbra_uid \ zimbra_uid \
zimbra_gid \ zimbra_gid \
zimbra_user \
zimbra_zmcertmgr_expiration_threshold \ zimbra_zmcertmgr_expiration_threshold \
ldap_is_master \ ldap_is_master \
ldap_host \ ldap_host \
...@@ -40,7 +42,7 @@ zmsetvars -f \ ...@@ -40,7 +42,7 @@ zmsetvars -f \
mailboxd_truststore_password \ mailboxd_truststore_password \
postfix_smtpd_tls_cert_file \ postfix_smtpd_tls_cert_file \
postfix_smtpd_tls_key_file postfix_smtpd_tls_key_file
export JAVA_HOME=${zimbra_java_home} export JAVA_HOME=${zimbra_java_home}
java_version=$(${zimbra_java_home}/bin/java -version 2>&1 | grep "java version" | sed -e 's/"//g' | awk '{print $NF}' | awk -F_ '{print $1}') java_version=$(${zimbra_java_home}/bin/java -version 2>&1 | grep "java version" | sed -e 's/"//g' | awk '{print $NF}' | awk -F_ '{print $1}')
...@@ -181,7 +183,7 @@ getHostInfo() { ...@@ -181,7 +183,7 @@ getHostInfo() {
isLdapRunning() { isLdapRunning() {
su - zimbra -c "/opt/zimbra/bin/ldap status > /dev/null 2>&1" su - ${zimbra_user} -c "/opt/zimbra/bin/ldap status > /dev/null 2>&1"
LDAP_IS_RUNNING=$? LDAP_IS_RUNNING=$?
} }
...@@ -208,7 +210,7 @@ saveConfigKey() { ...@@ -208,7 +210,7 @@ saveConfigKey() {
#fi #fi
echo -n "** Saving $location config key $key..." echo -n "** Saving $location config key $key..."
su - zimbra -c "${zimbra_home}/bin/zmprov -m -l -- ${zmprov_opts} ${key} \"$content\" 2> /dev/null" su - ${zimbra_user} -c "${zimbra_home}/bin/zmprov -m -l -- ${zmprov_opts} ${key} \"$content\" 2> /dev/null"
if [ $? = 0 ]; then if [ $? = 0 ]; then
echo "done." echo "done."
else else
...@@ -237,7 +239,7 @@ loadConfigKey() { ...@@ -237,7 +239,7 @@ loadConfigKey() {
chown ${zimbra_uid} ${tmpfile} chown ${zimbra_uid} ${tmpfile}
if [ ! -s ${file} ]; then if [ ! -s ${file} ]; then
echo -n "** Retrieving $location config key $key..." echo -n "** Retrieving $location config key $key..."
su - zimbra -c "${zimbra_home}/bin/zmprov -m -l -- ${zmprov_opts} ${key} | sed -e 's/^${key}: //' > ${tmpfile} 2> /dev/null" 2>/dev/null && mv -f ${tmpfile} ${file} 2> /dev/null su - ${zimbra_user} -c "${zimbra_home}/bin/zmprov -m -l -- ${zmprov_opts} ${key} | sed -e 's/^${key}: //' > ${tmpfile} 2> /dev/null" 2>/dev/null && mv -f ${tmpfile} ${file} 2> /dev/null
if [ $? = 0 -a -s "${file}" ]; then if [ $? = 0 -a -s "${file}" ]; then
echo "done." echo "done."
else else
...@@ -1006,7 +1008,7 @@ createCert() { ...@@ -1006,7 +1008,7 @@ createCert() {
if [ x"${ALLSERVERS}" = "x-allserver" ]; then if [ x"${ALLSERVERS}" = "x-allserver" ]; then
# merge these with cli specified. -bp # merge these with cli specified. -bp
subject_alt_names=`su - zimbra -c "${zimbra_home}/bin/zmprov -m -l gas | xargs "` subject_alt_names=`su - ${zimbra_user} -c "${zimbra_home}/bin/zmprov -m -l gas | xargs "`
createCSR self -new -keysize ${KEYSIZE} createCSR self -new -keysize ${KEYSIZE}
shift shift
elif [ ! -s "${server_csr}" -o x"${IS_NEW_CRT}" = "x-new" ]; then elif [ ! -s "${server_csr}" -o x"${IS_NEW_CRT}" = "x-new" ]; then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment