From 57781ebcc04005b7b4e85fd15c2c49fe7871c8fb Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 9 Feb 2017 18:17:54 +0000 Subject: [PATCH] Set profanity gpg key --- src/freedombone-app-xmpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/freedombone-app-xmpp b/src/freedombone-app-xmpp index 50a31369..fcb944f3 100755 --- a/src/freedombone-app-xmpp +++ b/src/freedombone-app-xmpp @@ -195,10 +195,12 @@ function add_user_xmpp { mkdir -p /home/$new_username/.config/profanity fi XMPP_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_xmpp/hostname) + GPG_PUBLIC_KEY_ID=$(su -c "gpg --list-keys $new_username@$HOSTNAME | grep 'pub '" - $new_username | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}') echo "[${new_username}@${HOSTNAME}]" > $XMPP_CLIENT_ACCOUNTS echo 'enabled=true' >> $XMPP_CLIENT_ACCOUNTS echo "jid=${new_username}@${HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS echo "server=$XMPP_ONION_HOSTNAME" >> $XMPP_CLIENT_ACCOUNTS + echo "pgp.keyid=$GPG_PUBLIC_KEY_ID" >> $XMPP_CLIENT_ACCOUNTS echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS echo "muc.service=conference.${HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS echo "muc.nick=${new_username}" >> $XMPP_CLIENT_ACCOUNTS @@ -993,10 +995,15 @@ function install_xmpp_client { mkdir -p $XMPP_CLIENT_DIR fi + XMPP_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_xmpp/hostname) + MY_GPG_PUBLIC_KEY_ID=$(su -c "gpg --list-keys $MY_USERNAME@$DEFAULT_DOMAIN_NAME | grep 'pub '" - $MY_USERNAME | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}') + if [[ $ONION_ONLY == 'no' ]]; then echo "[${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}]" > $XMPP_CLIENT_ACCOUNTS echo 'enabled=true' >> $XMPP_CLIENT_ACCOUNTS echo "jid=${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}" >> $XMPP_CLIENT_ACCOUNTS + echo "server=$XMPP_ONION_HOSTNAME" >> $XMPP_CLIENT_ACCOUNTS + echo "pgp.keyid=$MY_GPG_PUBLIC_KEY_ID" >> $XMPP_CLIENT_ACCOUNTS echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS echo "muc.service=chat.${DEFAULT_DOMAIN_NAME}" >> $XMPP_CLIENT_ACCOUNTS echo "muc.nick=${MY_USERNAME}" >> $XMPP_CLIENT_ACCOUNTS @@ -1013,7 +1020,6 @@ function install_xmpp_client { fi if [ -f /var/lib/tor/hidden_service_xmpp/hostname ]; then - XMPP_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_xmpp/hostname) echo "[${MY_USERNAME}@${XMPP_ONION_HOSTNAME}]" >> $XMPP_CLIENT_ACCOUNTS if [[ $ONION_ONLY == 'no' ]]; then echo 'enabled=false' >> $XMPP_CLIENT_ACCOUNTS @@ -1022,6 +1028,7 @@ function install_xmpp_client { fi echo "jid=${MY_USERNAME}@${XMPP_ONION_HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS echo "server=$XMPP_ONION_HOSTNAME" >> $XMPP_CLIENT_ACCOUNTS + echo "pgp.keyid=$MY_GPG_PUBLIC_KEY_ID" >> $XMPP_CLIENT_ACCOUNTS echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS echo "muc.service=${XMPP_ONION_HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS echo "muc.nick=${MY_USERNAME}" >> $XMPP_CLIENT_ACCOUNTS