浏览代码

Set profanity gpg key

Bob Mottram 8 年前
父节点
当前提交
57781ebcc0
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8
    1
      src/freedombone-app-xmpp

+ 8
- 1
src/freedombone-app-xmpp 查看文件

195
         mkdir -p /home/$new_username/.config/profanity
195
         mkdir -p /home/$new_username/.config/profanity
196
     fi
196
     fi
197
     XMPP_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_xmpp/hostname)
197
     XMPP_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_xmpp/hostname)
198
+    GPG_PUBLIC_KEY_ID=$(su -c "gpg --list-keys $new_username@$HOSTNAME | grep 'pub '" - $new_username | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
198
     echo "[${new_username}@${HOSTNAME}]" > $XMPP_CLIENT_ACCOUNTS
199
     echo "[${new_username}@${HOSTNAME}]" > $XMPP_CLIENT_ACCOUNTS
199
     echo 'enabled=true' >> $XMPP_CLIENT_ACCOUNTS
200
     echo 'enabled=true' >> $XMPP_CLIENT_ACCOUNTS
200
     echo "jid=${new_username}@${HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
201
     echo "jid=${new_username}@${HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
201
     echo "server=$XMPP_ONION_HOSTNAME" >> $XMPP_CLIENT_ACCOUNTS
202
     echo "server=$XMPP_ONION_HOSTNAME" >> $XMPP_CLIENT_ACCOUNTS
203
+    echo "pgp.keyid=$GPG_PUBLIC_KEY_ID" >> $XMPP_CLIENT_ACCOUNTS
202
     echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
204
     echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
203
     echo "muc.service=conference.${HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
205
     echo "muc.service=conference.${HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
204
     echo "muc.nick=${new_username}" >> $XMPP_CLIENT_ACCOUNTS
206
     echo "muc.nick=${new_username}" >> $XMPP_CLIENT_ACCOUNTS
993
         mkdir -p $XMPP_CLIENT_DIR
995
         mkdir -p $XMPP_CLIENT_DIR
994
     fi
996
     fi
995
 
997
 
998
+    XMPP_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_xmpp/hostname)
999
+    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}')
1000
+
996
     if [[ $ONION_ONLY == 'no' ]]; then
1001
     if [[ $ONION_ONLY == 'no' ]]; then
997
         echo "[${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}]" > $XMPP_CLIENT_ACCOUNTS
1002
         echo "[${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}]" > $XMPP_CLIENT_ACCOUNTS
998
         echo 'enabled=true' >> $XMPP_CLIENT_ACCOUNTS
1003
         echo 'enabled=true' >> $XMPP_CLIENT_ACCOUNTS
999
         echo "jid=${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}" >> $XMPP_CLIENT_ACCOUNTS
1004
         echo "jid=${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}" >> $XMPP_CLIENT_ACCOUNTS
1005
+        echo "server=$XMPP_ONION_HOSTNAME" >> $XMPP_CLIENT_ACCOUNTS
1006
+        echo "pgp.keyid=$MY_GPG_PUBLIC_KEY_ID" >> $XMPP_CLIENT_ACCOUNTS
1000
         echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
1007
         echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
1001
         echo "muc.service=chat.${DEFAULT_DOMAIN_NAME}" >> $XMPP_CLIENT_ACCOUNTS
1008
         echo "muc.service=chat.${DEFAULT_DOMAIN_NAME}" >> $XMPP_CLIENT_ACCOUNTS
1002
         echo "muc.nick=${MY_USERNAME}" >> $XMPP_CLIENT_ACCOUNTS
1009
         echo "muc.nick=${MY_USERNAME}" >> $XMPP_CLIENT_ACCOUNTS
1013
     fi
1020
     fi
1014
 
1021
 
1015
     if [ -f /var/lib/tor/hidden_service_xmpp/hostname ]; then
1022
     if [ -f /var/lib/tor/hidden_service_xmpp/hostname ]; then
1016
-        XMPP_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_xmpp/hostname)
1017
         echo "[${MY_USERNAME}@${XMPP_ONION_HOSTNAME}]" >> $XMPP_CLIENT_ACCOUNTS
1023
         echo "[${MY_USERNAME}@${XMPP_ONION_HOSTNAME}]" >> $XMPP_CLIENT_ACCOUNTS
1018
         if [[ $ONION_ONLY == 'no' ]]; then
1024
         if [[ $ONION_ONLY == 'no' ]]; then
1019
             echo 'enabled=false' >> $XMPP_CLIENT_ACCOUNTS
1025
             echo 'enabled=false' >> $XMPP_CLIENT_ACCOUNTS
1022
         fi
1028
         fi
1023
         echo "jid=${MY_USERNAME}@${XMPP_ONION_HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
1029
         echo "jid=${MY_USERNAME}@${XMPP_ONION_HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
1024
         echo "server=$XMPP_ONION_HOSTNAME" >> $XMPP_CLIENT_ACCOUNTS
1030
         echo "server=$XMPP_ONION_HOSTNAME" >> $XMPP_CLIENT_ACCOUNTS
1031
+        echo "pgp.keyid=$MY_GPG_PUBLIC_KEY_ID" >> $XMPP_CLIENT_ACCOUNTS
1025
         echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
1032
         echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
1026
         echo "muc.service=${XMPP_ONION_HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
1033
         echo "muc.service=${XMPP_ONION_HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
1027
         echo "muc.nick=${MY_USERNAME}" >> $XMPP_CLIENT_ACCOUNTS
1034
         echo "muc.nick=${MY_USERNAME}" >> $XMPP_CLIENT_ACCOUNTS