onion only xmpp install

This commit is contained in:
Bob Mottram 2017-03-24 19:57:14 +00:00
parent f51c1c874f
commit 2487997a4c
1 changed files with 27 additions and 6 deletions

View File

@ -171,16 +171,26 @@ function configure_interactive_xmpp {
function remove_user_xmpp {
remove_username="$1"
${PROJECT_NAME}-pass -u $remove_username --rmapp xmpp
${PROJECT_NAME}-rmxmpp -e "${remove_username}@$HOSTNAME"
XMPP_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_xmpp/hostname)
if [[ $ONION_ONLY != "no" ]]; then
${PROJECT_NAME}-rmxmpp -e "${remove_username}@${XMPP_ONION_HOSTNAME}"
else
${PROJECT_NAME}-rmxmpp -e "${remove_username}@${HOSTNAME}"
fi
}
function add_user_xmpp {
new_username="$1"
new_user_password="$2"
XMPP_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_xmpp/hostname)
${PROJECT_NAME}-pass -u $new_username -a xmpp -p "$new_user_password"
if [[ $ONION_ONLY != "no" ]]; then
${PROJECT_NAME}-addxmpp -e "$new_username@$XMPP_ONION_HOSTNAME" -p "$new_user_password"
else
${PROJECT_NAME}-addxmpp -e "$new_username@$HOSTNAME" -p "$new_user_password"
fi
if [ ! "$?" = "0" ]; then
echo '1'
return
@ -194,7 +204,6 @@ function add_user_xmpp {
if [ ! -d /home/$new_username/.config/profanity ]; then
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
@ -213,7 +222,11 @@ function add_user_xmpp {
echo 'priority.dnd=0' >> $XMPP_CLIENT_ACCOUNTS
echo '[connection]' > /home/$new_username/.config/profanity/profrc
if [[ $ONION_ONLY != "no" ]]; then
echo "account=${new_username}@${XMPP_ONION_HOSTNAME}" >> /home/$new_username/.config/profanity/profrc
else
echo "account=${new_username}@${HOSTNAME}" >> /home/$new_username/.config/profanity/profrc
fi
echo '' >> /home/$new_username/.config/profanity/profrc
echo '[plugins]' >> /home/$new_username/.config/profanity/profrc
echo 'load=prof_omemo_plugin.py;' >> /home/$new_username/.config/profanity/profrc
@ -958,7 +971,11 @@ function install_xmpp_main {
systemctl restart prosody
cd
if [[ $ONION_ONLY != 'no' ]]; then
prosodyctl register $MY_USERNAME $XMPP_ONION_HOSTNAME "$XMPP_PASSWORD"
else
prosodyctl register $MY_USERNAME $DEFAULT_DOMAIN_NAME "$XMPP_PASSWORD"
fi
if [ ! "$?" = "0" ]; then
echo ''
echo ''
@ -1098,7 +1115,11 @@ function install_xmpp_client {
mkdir -p /home/$MY_USERNAME/.config/profanity
fi
echo '[connection]' > /home/$MY_USERNAME/.config/profanity/profrc
if [[ $ONION_ONLY == 'no' ]]; then
echo "account=${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}" >> /home/$MY_USERNAME/.config/profanity/profrc
else
echo "account=${MY_USERNAME}@${XMPP_ONION_HOSTNAME}" >> /home/$MY_USERNAME/.config/profanity/profrc
fi
echo '' >> /home/$MY_USERNAME/.config/profanity/profrc
echo '[plugins]' >> /home/$MY_USERNAME/.config/profanity/profrc
echo 'load=prof_omemo_plugin.py;' >> /home/$MY_USERNAME/.config/profanity/profrc