Add xmpp address to email headers
This commit is contained in:
parent
71abe7cb5b
commit
0df2c9ca7a
|
@ -75,30 +75,30 @@ fi
|
||||||
|
|
||||||
if [ "$SSH_PUBLIC_KEY" ]; then
|
if [ "$SSH_PUBLIC_KEY" ]; then
|
||||||
if [ ${#SSH_PUBLIC_KEY} -gt 5 ]; then
|
if [ ${#SSH_PUBLIC_KEY} -gt 5 ]; then
|
||||||
if [ -f "$SSH_PUBLIC_KEY" ]; then
|
if [ -f "$SSH_PUBLIC_KEY" ]; then
|
||||||
mkdir /home/$MY_USERNAME/.ssh
|
mkdir /home/$MY_USERNAME/.ssh
|
||||||
cp $SSH_PUBLIC_KEY /home/$MY_USERNAME/.ssh/authorized_keys
|
cp $SSH_PUBLIC_KEY /home/$MY_USERNAME/.ssh/authorized_keys
|
||||||
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
|
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
|
||||||
echo $'ssh public key installed'
|
echo $'ssh public key installed'
|
||||||
else
|
else
|
||||||
if [[ "$SSH_PUBLIC_KEY" == "ssh-"* ]]; then
|
if [[ "$SSH_PUBLIC_KEY" == "ssh-"* ]]; then
|
||||||
mkdir /home/$MY_USERNAME/.ssh
|
mkdir /home/$MY_USERNAME/.ssh
|
||||||
echo "$SSH_PUBLIC_KEY" > /home/$MY_USERNAME/.ssh/authorized_keys
|
echo "$SSH_PUBLIC_KEY" > /home/$MY_USERNAME/.ssh/authorized_keys
|
||||||
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
|
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
|
||||||
echo $'ssh public key installed'
|
echo $'ssh public key installed'
|
||||||
else
|
else
|
||||||
echo $'The second parameter does not look like an ssh key'
|
echo $'The second parameter does not look like an ssh key'
|
||||||
exit 5
|
exit 5
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d /home/$MY_USERNAME/Maildir ]; then
|
if [ -d /home/$MY_USERNAME/Maildir ]; then
|
||||||
if grep -q "set from=" /home/$MY_USERNAME/.muttrc; then
|
if grep -q "set from=" /home/$MY_USERNAME/.muttrc; then
|
||||||
sed -i "s|set from=.*|set from='$MY_USERNAME <$MY_USERNAME@$HOSTNAME>'|g" /home/$MY_USERNAME/.muttrc
|
sed -i "s|set from=.*|set from='$MY_USERNAME <$MY_USERNAME@$HOSTNAME>'|g" /home/$MY_USERNAME/.muttrc
|
||||||
else
|
else
|
||||||
echo "set from='$MY_USERNAME <$MY_USERNAME@$HOSTNAME>'" >> /home/$MY_USERNAME/.muttrc
|
echo "set from='$MY_USERNAME <$MY_USERNAME@$HOSTNAME>'" >> /home/$MY_USERNAME/.muttrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
USERN='$USER@'
|
USERN='$USER@'
|
||||||
|
@ -154,17 +154,17 @@ monkeysphere-authentication update-users
|
||||||
if [ -f /home/$MY_USERNAME/.muttrc ]; then
|
if [ -f /home/$MY_USERNAME/.muttrc ]; then
|
||||||
# encrypt outgoing mail to the "sent" folder
|
# encrypt outgoing mail to the "sent" folder
|
||||||
if ! grep -q "pgp_encrypt_only_command" /home/$MY_USERNAME/.muttrc; then
|
if ! grep -q "pgp_encrypt_only_command" /home/$MY_USERNAME/.muttrc; then
|
||||||
echo '' >> /home/$MY_USERNAME/.muttrc
|
echo '' >> /home/$MY_USERNAME/.muttrc
|
||||||
echo $'# Encrypt items in the Sent folder' >> /home/$MY_USERNAME/.muttrc
|
echo $'# Encrypt items in the Sent folder' >> /home/$MY_USERNAME/.muttrc
|
||||||
echo "set pgp_encrypt_only_command=\"/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"" >> /home/$MY_USERNAME/.muttrc
|
echo "set pgp_encrypt_only_command=\"/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"" >> /home/$MY_USERNAME/.muttrc
|
||||||
else
|
else
|
||||||
sed -i "s|set pgp_encrypt_only_command.*|set pgp_encrypt_only_command=\"/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$MY_USERNAME/.muttrc
|
sed -i "s|set pgp_encrypt_only_command.*|set pgp_encrypt_only_command=\"/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$MY_USERNAME/.muttrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep -q "pgp_encrypt_sign_command" /home/$MY_USERNAME/.muttrc; then
|
if ! grep -q "pgp_encrypt_sign_command" /home/$MY_USERNAME/.muttrc; then
|
||||||
echo "set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"" >> /home/$MY_USERNAME/.muttrc
|
echo "set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"" >> /home/$MY_USERNAME/.muttrc
|
||||||
else
|
else
|
||||||
sed -i "s|set pgp_encrypt_sign_command.*|set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$MY_USERNAME/.muttrc
|
sed -i "s|set pgp_encrypt_sign_command.*|set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$MY_USERNAME/.muttrc
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -203,9 +203,9 @@ if grep -q "install_xmpp" $COMPLETION_FILE; then
|
||||||
echo $"Adding an XMPP account for $MY_USERNAME"
|
echo $"Adding an XMPP account for $MY_USERNAME"
|
||||||
${PROJECT_NAME}-addxmpp -e "$MY_USERNAME@$HOSTNAME" -p "$NEW_USER_PASSWORD"
|
${PROJECT_NAME}-addxmpp -e "$MY_USERNAME@$HOSTNAME" -p "$NEW_USER_PASSWORD"
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
echo $"XMPP account not created"
|
echo $"XMPP account not created"
|
||||||
userdel -r $MY_USERNAME
|
userdel -r $MY_USERNAME
|
||||||
exit 8
|
exit 8
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -214,10 +214,10 @@ if grep -q "install_xmpp_client" $COMPLETION_FILE; then
|
||||||
XMPP_CLIENT_DIR=/home/$MY_USERNAME/.local/share/profanity
|
XMPP_CLIENT_DIR=/home/$MY_USERNAME/.local/share/profanity
|
||||||
XMPP_CLIENT_ACCOUNTS=$XMPP_CLIENT_DIR/accounts
|
XMPP_CLIENT_ACCOUNTS=$XMPP_CLIENT_DIR/accounts
|
||||||
if [ ! -d $XMPP_CLIENT_DIR ]; then
|
if [ ! -d $XMPP_CLIENT_DIR ]; then
|
||||||
mkdir -p $XMPP_CLIENT_DIR
|
mkdir -p $XMPP_CLIENT_DIR
|
||||||
fi
|
fi
|
||||||
if [ ! -d /home/$MY_USERNAME/.config/profanity ]; then
|
if [ ! -d /home/$MY_USERNAME/.config/profanity ]; then
|
||||||
mkdir -p /home/$MY_USERNAME/.config/profanity
|
mkdir -p /home/$MY_USERNAME/.config/profanity
|
||||||
fi
|
fi
|
||||||
echo "[${MY_USERNAME}@${HOSTNAME}]" > $XMPP_CLIENT_ACCOUNTS
|
echo "[${MY_USERNAME}@${HOSTNAME}]" > $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'enabled=true' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'enabled=true' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
|
@ -243,17 +243,17 @@ fi
|
||||||
if grep -q "Blog domain" $COMPLETION_FILE; then
|
if grep -q "Blog domain" $COMPLETION_FILE; then
|
||||||
FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
|
FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
|
||||||
if [ ! -d /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users ]; then
|
if [ ! -d /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users ]; then
|
||||||
echo $'Blog users directory not found'
|
echo $'Blog users directory not found'
|
||||||
if grep -q "install_xmpp" $COMPLETION_FILE; then
|
if grep -q "install_xmpp" $COMPLETION_FILE; then
|
||||||
${PROJECT_NAME}-rmxmpp -e "$MY_USERNAME@$HOSTNAME"
|
${PROJECT_NAME}-rmxmpp -e "$MY_USERNAME@$HOSTNAME"
|
||||||
fi
|
fi
|
||||||
userdel -r $MY_USERNAME
|
userdel -r $MY_USERNAME
|
||||||
exit 9
|
exit 9
|
||||||
fi
|
fi
|
||||||
NEW_USER_PASSWORD_HASH=$(${PROJECT_NAME}-sec --bloghash "$NEW_USER_PASSWORD")
|
NEW_USER_PASSWORD_HASH=$(${PROJECT_NAME}-sec --bloghash "$NEW_USER_PASSWORD")
|
||||||
if [ ${#NEW_USER_PASSWORD_HASH} -lt 8 ]; then
|
if [ ${#NEW_USER_PASSWORD_HASH} -lt 8 ]; then
|
||||||
echo $'Blog admin password could not be hashed'
|
echo $'Blog admin password could not be hashed'
|
||||||
exit 783528
|
exit 783528
|
||||||
fi
|
fi
|
||||||
echo ';Password' > /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
|
echo ';Password' > /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
|
||||||
echo "password = $NEW_USER_PASSWORD_HASH" >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
|
echo "password = $NEW_USER_PASSWORD_HASH" >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
|
||||||
|
@ -267,46 +267,46 @@ if grep -q "install_sip" $COMPLETION_FILE; then
|
||||||
SIP_EXTENSION=$(${PROJECT_NAME}-sipfreeext)
|
SIP_EXTENSION=$(${PROJECT_NAME}-sipfreeext)
|
||||||
${PROJECT_NAME}-addsipuser -u $MY_USERNAME -e $SIP_EXTENSION -p "$NEW_USER_PASSWORD"
|
${PROJECT_NAME}-addsipuser -u $MY_USERNAME -e $SIP_EXTENSION -p "$NEW_USER_PASSWORD"
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
echo $'SIP user could not be added. Ensure that extension numbers are in order and do no exceed 299'
|
echo $'SIP user could not be added. Ensure that extension numbers are in order and do no exceed 299'
|
||||||
if grep -q "install_xmpp" $COMPLETION_FILE; then
|
if grep -q "install_xmpp" $COMPLETION_FILE; then
|
||||||
${PROJECT_NAME}-rmxmpp -e "$MY_USERNAME@$HOSTNAME"
|
${PROJECT_NAME}-rmxmpp -e "$MY_USERNAME@$HOSTNAME"
|
||||||
fi
|
fi
|
||||||
if grep -q "Blog domain" $COMPLETION_FILE; then
|
if grep -q "Blog domain" $COMPLETION_FILE; then
|
||||||
if [ -f /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini ]; then
|
if [ -f /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini ]; then
|
||||||
rm /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
|
rm /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
userdel -r $MY_USERNAME
|
userdel -r $MY_USERNAME
|
||||||
exit 10
|
exit 10
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -q "install_gnusocial" $COMPLETION_FILE; then
|
if grep -q "install_gnusocial" $COMPLETION_FILE; then
|
||||||
MICROBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "GNU Social domain" | awk -F ':' '{print $2}')
|
MICROBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "GNU Social domain" | awk -F ':' '{print $2}')
|
||||||
if [ -d /var/www/$MICROBLOG_DOMAIN_NAME ]; then
|
if [ -d /var/www/$MICROBLOG_DOMAIN_NAME ]; then
|
||||||
cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs
|
cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs
|
||||||
php scripts/registeruser.php -n $MY_USERNAME -w "$NEW_USER_PASSWORD" -e "$MY_USERNAME@$HOSTNAME"
|
php scripts/registeruser.php -n $MY_USERNAME -w "$NEW_USER_PASSWORD" -e "$MY_USERNAME@$HOSTNAME"
|
||||||
${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$MICROBLOG_DOMAIN_NAME" -g gnusocial --public no
|
${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$MICROBLOG_DOMAIN_NAME" -g gnusocial --public no
|
||||||
echo $'Created GNU Social user'
|
echo $'Created GNU Social user'
|
||||||
else
|
else
|
||||||
echo $"Unable to find GNU Social installation at /var/www/$MICROBLOG_DOMAIN_NAME/htdocs"
|
echo $"Unable to find GNU Social installation at /var/www/$MICROBLOG_DOMAIN_NAME/htdocs"
|
||||||
userdel -r $MY_USERNAME
|
userdel -r $MY_USERNAME
|
||||||
exit 11
|
exit 11
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -q "install_irc_client" $COMPLETION_FILE; then
|
if grep -q "install_irc_client" $COMPLETION_FILE; then
|
||||||
IRC_PORT=6697
|
IRC_PORT=6697
|
||||||
if grep -q "IRC_PORT" $CONFIGURATION_FILE; then
|
if grep -q "IRC_PORT" $CONFIGURATION_FILE; then
|
||||||
IRC_PORT=$(grep "IRC_PORT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
IRC_PORT=$(grep "IRC_PORT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
fi
|
fi
|
||||||
IRC_PASSWORD=$(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
|
IRC_PASSWORD=$(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
|
||||||
if [ ${#IRC_PASSWORD} -lt 2 ]; then
|
if [ ${#IRC_PASSWORD} -lt 2 ]; then
|
||||||
IRC_PASSWORD=
|
IRC_PASSWORD=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d /home/$MY_USERNAME/.irssi ]; then
|
if [ ! -d /home/$MY_USERNAME/.irssi ]; then
|
||||||
mkdir /home/$MY_USERNAME/.irssi
|
mkdir /home/$MY_USERNAME/.irssi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo 'servers = (' > /home/$MY_USERNAME/.irssi/config
|
echo 'servers = (' > /home/$MY_USERNAME/.irssi/config
|
||||||
|
@ -369,7 +369,7 @@ fi
|
||||||
|
|
||||||
if [ -f /etc/nginx/.htpasswd ]; then
|
if [ -f /etc/nginx/.htpasswd ]; then
|
||||||
if ! grep "${MY_USERNAME}:" /etc/nginx/.htpasswd; then
|
if ! grep "${MY_USERNAME}:" /etc/nginx/.htpasswd; then
|
||||||
echo "$NEW_USER_PASSWORD" | htpasswd -i -s /etc/nginx/.htpasswd $MY_USERNAME
|
echo "$NEW_USER_PASSWORD" | htpasswd -i -s /etc/nginx/.htpasswd $MY_USERNAME
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -381,8 +381,8 @@ fi
|
||||||
# add user for SIP STUN/TURN
|
# add user for SIP STUN/TURN
|
||||||
if [ -d /etc/turnserver ]; then
|
if [ -d /etc/turnserver ]; then
|
||||||
if grep -q "DEFAULT_DOMAIN_NAME" $CONFIGURATION_FILE; then
|
if grep -q "DEFAULT_DOMAIN_NAME" $CONFIGURATION_FILE; then
|
||||||
DEFAULT_DOMAIN_NAME=$(grep "DEFAULT_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
DEFAULT_DOMAIN_NAME=$(grep "DEFAULT_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
echo "${MY_USERNAME}:${NEW_USER_PASSWORD}:${DEFAULT_DOMAIN_NAME}:authorized" >> /etc/turnserver/turnusers.txt
|
echo "${MY_USERNAME}:${NEW_USER_PASSWORD}:${DEFAULT_DOMAIN_NAME}:authorized" >> /etc/turnserver/turnusers.txt
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -49,20 +49,20 @@ do
|
||||||
key="$1"
|
key="$1"
|
||||||
|
|
||||||
case $key in
|
case $key in
|
||||||
-h|--help)
|
-h|--help)
|
||||||
show_help
|
show_help
|
||||||
;;
|
;;
|
||||||
-e|--email)
|
-e|--email)
|
||||||
shift
|
shift
|
||||||
EMAIL_ADDRESS="$1"
|
EMAIL_ADDRESS="$1"
|
||||||
;;
|
;;
|
||||||
-p|--password|--passphrase)
|
-p|--password|--passphrase)
|
||||||
shift
|
shift
|
||||||
NEW_USER_PASSWORD="$1"
|
NEW_USER_PASSWORD="$1"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# unknown option
|
# unknown option
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
@ -84,7 +84,14 @@ else
|
||||||
DOMAIN_NAME=$(echo $EMAIL_ADDRESS | awk -F '@' '{print $2}')
|
DOMAIN_NAME=$(echo $EMAIL_ADDRESS | awk -F '@' '{print $2}')
|
||||||
prosodyctl register $USERNAME $DOMAIN_NAME "$NEW_USER_PASSWORD"
|
prosodyctl register $USERNAME $DOMAIN_NAME "$NEW_USER_PASSWORD"
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 2
|
exit 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# add the xmpp address to email headers
|
||||||
|
if [ -f /home/$USERNAME/.muttrc ]; then
|
||||||
|
if ! grep -q "Jabber-ID" /home/$USERNAME/.muttrc; then
|
||||||
|
echo "my_hdr Jabber-ID: ${USERNAME}@${HOSTNAME}" >> /home/$USERNAME/.muttrc
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -38,444 +38,458 @@ XMPP_CIPHERS='"EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA256:EECDH:+
|
||||||
XMPP_ECC_CURVE='"secp384r1"'
|
XMPP_ECC_CURVE='"secp384r1"'
|
||||||
|
|
||||||
function reconfigure_xmpp {
|
function reconfigure_xmpp {
|
||||||
echo -n ''
|
echo -n ''
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_prosody_modules {
|
function update_prosody_modules {
|
||||||
if [ ! -d $INSTALL_DIR/prosody-modules ]; then
|
if [ ! -d $INSTALL_DIR/prosody-modules ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ ! -d /usr/lib/prosody ]; then
|
if [ ! -d /usr/lib/prosody ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $INSTALL_DIR/prosody-modules
|
cd $INSTALL_DIR/prosody-modules
|
||||||
hg pull
|
hg pull
|
||||||
hg update
|
hg update
|
||||||
|
|
||||||
# support onion addresses
|
# support onion addresses
|
||||||
if [ -f $INSTALL_DIR/prosody-modules/mod_onions/mod_onions.lua ]; then
|
if [ -f $INSTALL_DIR/prosody-modules/mod_onions/mod_onions.lua ]; then
|
||||||
cp $INSTALL_DIR/prosody-modules/mod_onions/mod_onions.lua /usr/lib/prosody/modules/mod_onions.lua
|
cp $INSTALL_DIR/prosody-modules/mod_onions/mod_onions.lua /usr/lib/prosody/modules/mod_onions.lua
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# XEP-0313 message archive management
|
# XEP-0313 message archive management
|
||||||
# https://modules.prosody.im/mod_mam.html
|
# https://modules.prosody.im/mod_mam.html
|
||||||
# Allows you to download your previous messages onto a new client
|
# Allows you to download your previous messages onto a new client
|
||||||
# This only applies if you are not using forward secret crypto
|
# This only applies if you are not using forward secret crypto
|
||||||
# such as OTR or OMEMO (eg. OpenPGP)
|
# such as OTR or OMEMO (eg. OpenPGP)
|
||||||
if [ -d $INSTALL_DIR/prosody-modules/mod_mam ]; then
|
if [ -d $INSTALL_DIR/prosody-modules/mod_mam ]; then
|
||||||
cp $INSTALL_DIR/prosody-modules/mod_mam/*.lua /usr/lib/prosody/modules
|
cp $INSTALL_DIR/prosody-modules/mod_mam/*.lua /usr/lib/prosody/modules
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# XEP-0352 Client State Indication
|
# XEP-0352 Client State Indication
|
||||||
# Notifies the server if the app is in the background or not
|
# Notifies the server if the app is in the background or not
|
||||||
if [ -d $INSTALL_DIR/prosody-modules/mod_csi ]; then
|
if [ -d $INSTALL_DIR/prosody-modules/mod_csi ]; then
|
||||||
cp $INSTALL_DIR/prosody-modules/mod_csi/*.lua /usr/lib/prosody/modules
|
cp $INSTALL_DIR/prosody-modules/mod_csi/*.lua /usr/lib/prosody/modules
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# XEP-0280 Message Carbons
|
# XEP-0280 Message Carbons
|
||||||
# Ensures all messages get delivered to all clients (if you have a mobile and desktop client)
|
# Ensures all messages get delivered to all clients (if you have a mobile and desktop client)
|
||||||
if [ -d $INSTALL_DIR/prosody-modules/mod_carbons ]; then
|
if [ -d $INSTALL_DIR/prosody-modules/mod_carbons ]; then
|
||||||
cp $INSTALL_DIR/prosody-modules/mod_carbons/*.lua /usr/lib/prosody/modules
|
cp $INSTALL_DIR/prosody-modules/mod_carbons/*.lua /usr/lib/prosody/modules
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# XEP-0198 Stream management
|
# XEP-0198 Stream management
|
||||||
# Helps mobile apps recover when a device switches networks.
|
# Helps mobile apps recover when a device switches networks.
|
||||||
if [ -d $INSTALL_DIR/prosody-modules/mod_smacks ]; then
|
if [ -d $INSTALL_DIR/prosody-modules/mod_smacks ]; then
|
||||||
cp $INSTALL_DIR/prosody-modules/mod_smacks/*.lua /usr/lib/prosody/modules
|
cp $INSTALL_DIR/prosody-modules/mod_smacks/*.lua /usr/lib/prosody/modules
|
||||||
fi
|
fi
|
||||||
if [ -d $INSTALL_DIR/prosody-modules/mod_smacks_offline ]; then
|
if [ -d $INSTALL_DIR/prosody-modules/mod_smacks_offline ]; then
|
||||||
cp $INSTALL_DIR/prosody-modules/mod_smacks_offline/*.lua /usr/lib/prosody/modules
|
cp $INSTALL_DIR/prosody-modules/mod_smacks_offline/*.lua /usr/lib/prosody/modules
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# XEP-0191: blocking
|
# XEP-0191: blocking
|
||||||
if [ -d $INSTALL_DIR/prosody-modules/mod_blocking ]; then
|
if [ -d $INSTALL_DIR/prosody-modules/mod_blocking ]; then
|
||||||
cp $INSTALL_DIR/prosody-modules/mod_blocking/*.lua /usr/lib/prosody/modules
|
cp $INSTALL_DIR/prosody-modules/mod_blocking/*.lua /usr/lib/prosody/modules
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# XEP-0016 Privacy lists
|
# XEP-0016 Privacy lists
|
||||||
if [ -d $INSTALL_DIR/prosody-modules/mod_privacy_lists ]; then
|
if [ -d $INSTALL_DIR/prosody-modules/mod_privacy_lists ]; then
|
||||||
cp $INSTALL_DIR/prosody-modules/mod_privacy_lists/*.lua /usr/lib/prosody/modules
|
cp $INSTALL_DIR/prosody-modules/mod_privacy_lists/*.lua /usr/lib/prosody/modules
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function upgrade_xmpp {
|
function upgrade_xmpp {
|
||||||
if ! grep -Fxq "install_xmpp_main" $COMPLETION_FILE; then
|
if ! grep -Fxq "install_xmpp_main" $COMPLETION_FILE; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
function_check update_prosody_modules
|
function_check update_prosody_modules
|
||||||
update_prosody_modules
|
update_prosody_modules
|
||||||
}
|
}
|
||||||
|
|
||||||
function backup_local_xmpp {
|
function backup_local_xmpp {
|
||||||
source_directory=/var/lib/prosody xmpp
|
source_directory=/var/lib/prosody xmpp
|
||||||
if [ -d $source_directory ]; then
|
if [ -d $source_directory ]; then
|
||||||
dest_directory=xmpp
|
dest_directory=xmpp
|
||||||
echo $"Backing up $source_directory to $dest_directory"
|
echo $"Backing up $source_directory to $dest_directory"
|
||||||
|
|
||||||
function_check backup_directory_to_usb
|
function_check backup_directory_to_usb
|
||||||
backup_directory_to_usb $source_directory $dest_directory
|
backup_directory_to_usb $source_directory $dest_directory
|
||||||
|
|
||||||
echo $"Backup to $dest_directory complete"
|
echo $"Backup to $dest_directory complete"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_local_xmpp {
|
function restore_local_xmpp {
|
||||||
if [ -d /var/lib/prosody ]; then
|
if [ -d /var/lib/prosody ]; then
|
||||||
echo $"Restoring XMPP settings"
|
echo $"Restoring XMPP settings"
|
||||||
temp_restore_dir=/root/tempxmpp
|
temp_restore_dir=/root/tempxmpp
|
||||||
function_check restore_directory_from_usb
|
function_check restore_directory_from_usb
|
||||||
restore_directory_from_usb $temp_restore_dir xmpp
|
restore_directory_from_usb $temp_restore_dir xmpp
|
||||||
cp -r $temp_restore_dir/var/lib/prosody/* /var/lib/prosody
|
cp -r $temp_restore_dir/var/lib/prosody/* /var/lib/prosody
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
function_check set_user_permissions
|
function_check set_user_permissions
|
||||||
set_user_permissions
|
set_user_permissions
|
||||||
function_check backup_unmount_drive
|
function_check backup_unmount_drive
|
||||||
backup_unmount_drive
|
backup_unmount_drive
|
||||||
exit 725
|
exit 725
|
||||||
fi
|
fi
|
||||||
rm -rf $temp_restore_dir
|
rm -rf $temp_restore_dir
|
||||||
service prosody restart
|
service prosody restart
|
||||||
chown -R prosody:prosody /var/lib/prosody/*
|
chown -R prosody:prosody /var/lib/prosody/*
|
||||||
echo $"Restore of XMPP settings complete"
|
echo $"Restore of XMPP settings complete"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function backup_remote_xmpp {
|
function backup_remote_xmpp {
|
||||||
if [ -d /var/lib/prosody ]; then
|
if [ -d /var/lib/prosody ]; then
|
||||||
echo $"Backing up the XMPP settings"
|
echo $"Backing up the XMPP settings"
|
||||||
backup_directory_to_friend /var/lib/prosody xmpp
|
backup_directory_to_friend /var/lib/prosody xmpp
|
||||||
echo $"Backup of XMPP settings complete"
|
echo $"Backup of XMPP settings complete"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_remote_xmpp {
|
function restore_remote_xmpp {
|
||||||
if [ -d /var/lib/prosody ]; then
|
if [ -d /var/lib/prosody ]; then
|
||||||
echo $"Restoring XMPP settings"
|
echo $"Restoring XMPP settings"
|
||||||
temp_restore_dir=/root/tempxmpp
|
temp_restore_dir=/root/tempxmpp
|
||||||
function_check restore_directory_from_friend
|
function_check restore_directory_from_friend
|
||||||
restore_directory_from_friend $temp_restore_dir xmpp
|
restore_directory_from_friend $temp_restore_dir xmpp
|
||||||
cp -r $temp_restore_dir/var/lib/prosody/* /var/lib/prosody
|
cp -r $temp_restore_dir/var/lib/prosody/* /var/lib/prosody
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 725
|
exit 725
|
||||||
fi
|
fi
|
||||||
rm -rf $temp_restore_dir
|
rm -rf $temp_restore_dir
|
||||||
service prosody restart
|
service prosody restart
|
||||||
chown -R prosody:prosody /var/lib/prosody/*
|
chown -R prosody:prosody /var/lib/prosody/*
|
||||||
echo $"Restore of XMPP settings complete"
|
echo $"Restore of XMPP settings complete"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function configure_firewall_for_xmpp {
|
function configure_firewall_for_xmpp {
|
||||||
if [ ! -d /etc/prosody ]; then
|
if [ ! -d /etc/prosody ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if grep -Fxq "configure_firewall_for_xmpp" $COMPLETION_FILE; then
|
if grep -Fxq "configure_firewall_for_xmpp" $COMPLETION_FILE; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
|
if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
|
||||||
# docker does its own firewalling
|
# docker does its own firewalling
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ $ONION_ONLY != "no" ]]; then
|
if [[ $ONION_ONLY != "no" ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
iptables -A INPUT -p tcp --dport 5222:5223 -j ACCEPT
|
iptables -A INPUT -p tcp --dport 5222:5223 -j ACCEPT
|
||||||
iptables -A INPUT -p tcp --dport 5269 -j ACCEPT
|
iptables -A INPUT -p tcp --dport 5269 -j ACCEPT
|
||||||
iptables -A INPUT -p tcp --dport 5280:5281 -j ACCEPT
|
iptables -A INPUT -p tcp --dport 5280:5281 -j ACCEPT
|
||||||
function_check save_firewall_settings
|
function_check save_firewall_settings
|
||||||
save_firewall_settings
|
save_firewall_settings
|
||||||
|
|
||||||
OPEN_PORTS+=('XMPP 5222-5223')
|
OPEN_PORTS+=('XMPP 5222-5223')
|
||||||
OPEN_PORTS+=('XMPP 5269')
|
OPEN_PORTS+=('XMPP 5269')
|
||||||
OPEN_PORTS+=('XMPP 5280-5281')
|
OPEN_PORTS+=('XMPP 5280-5281')
|
||||||
echo 'configure_firewall_for_xmpp' >> $COMPLETION_FILE
|
echo 'configure_firewall_for_xmpp' >> $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_xmpp_client {
|
function remove_xmpp_client {
|
||||||
if ! grep -Fxq "install_xmpp_client" $COMPLETION_FILE; then
|
if ! grep -Fxq "install_xmpp_client" $COMPLETION_FILE; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
apt-get -y remove --purge profanity
|
apt-get -y remove --purge profanity
|
||||||
sed '/install_xmpp_client/d' $COMPLETION_FILE
|
sed '/install_xmpp_client/d' $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_xmpp {
|
function remove_xmpp {
|
||||||
remove_xmpp_client
|
remove_xmpp_client
|
||||||
if ! grep -Fxq "install_xmpp" $COMPLETION_FILE; then
|
if ! grep -Fxq "install_xmpp" $COMPLETION_FILE; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
iptables -D INPUT -p tcp --dport 5222:5223 -j ACCEPT
|
iptables -D INPUT -p tcp --dport 5222:5223 -j ACCEPT
|
||||||
iptables -D INPUT -p tcp --dport 5269 -j ACCEPT
|
iptables -D INPUT -p tcp --dport 5269 -j ACCEPT
|
||||||
iptables -D INPUT -p tcp --dport 5280:5281 -j ACCEPT
|
iptables -D INPUT -p tcp --dport 5280:5281 -j ACCEPT
|
||||||
function_check save_firewall_settings
|
function_check save_firewall_settings
|
||||||
save_firewall_settings
|
save_firewall_settings
|
||||||
|
|
||||||
function_check remove_onion_service
|
function_check remove_onion_service
|
||||||
remove_onion_service xmpp 5222 5223 5269
|
remove_onion_service xmpp 5222 5223 5269
|
||||||
|
|
||||||
apt-get -y remove --purge prosody prosody-modules
|
apt-get -y remove --purge prosody prosody-modules
|
||||||
if [ -d $INSTALL_DIR/prosody-modules ]; then
|
if [ -d $INSTALL_DIR/prosody-modules ]; then
|
||||||
rm -rf $INSTALL_DIR/prosody-modules
|
rm -rf $INSTALL_DIR/prosody-modules
|
||||||
fi
|
fi
|
||||||
if [ -d /etc/prosody ]; then
|
if [ -d /etc/prosody ]; then
|
||||||
rm -rf /etc/prosody
|
rm -rf /etc/prosody
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed '/install_xmpp/d' $COMPLETION_FILE
|
sed '/install_xmpp/d' $COMPLETION_FILE
|
||||||
sed '/XMPP /d' $COMPLETION_FILE
|
sed '/XMPP /d' $COMPLETION_FILE
|
||||||
|
}
|
||||||
|
|
||||||
|
function xmpp_email_headers {
|
||||||
|
for d in /home/*/ ; do
|
||||||
|
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
|
||||||
|
if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
|
||||||
|
if [ -f /home/$USERNAME/.muttrc ]; then
|
||||||
|
if ! grep -q "Jabber-ID" /home/$USERNAME/.muttrc; then
|
||||||
|
echo "my_hdr Jabber-ID: ${USERNAME}@${HOSTNAME}" >> /home/$USERNAME/.muttrc
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_xmpp_main {
|
function install_xmpp_main {
|
||||||
update_prosody_modules
|
update_prosody_modules
|
||||||
|
|
||||||
if grep -Fxq "install_xmpp_main" $COMPLETION_FILE; then
|
if grep -Fxq "install_xmpp_main" $COMPLETION_FILE; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
apt-get -y install lua-sec lua-bitop
|
apt-get -y install lua-sec lua-bitop
|
||||||
apt-get -y install prosody prosody-modules mercurial
|
apt-get -y install prosody prosody-modules mercurial
|
||||||
|
|
||||||
if [ ! -d /etc/prosody ]; then
|
if [ ! -d /etc/prosody ]; then
|
||||||
echo $"ERROR: prosody does not appear to have installed. $CHECK_MESSAGE"
|
echo $"ERROR: prosody does not appear to have installed. $CHECK_MESSAGE"
|
||||||
exit 52
|
exit 52
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# obtain the prosody modules
|
# obtain the prosody modules
|
||||||
cd $INSTALL_DIR
|
cd $INSTALL_DIR
|
||||||
hg clone https://hg.prosody.im/prosody-modules/ prosody-modules
|
hg clone https://hg.prosody.im/prosody-modules/ prosody-modules
|
||||||
if [ ! -d $INSTALL_DIR/prosody-modules/mod_onions ]; then
|
if [ ! -d $INSTALL_DIR/prosody-modules/mod_onions ]; then
|
||||||
echo $'mod_onions prosody module could not be found'
|
echo $'mod_onions prosody module could not be found'
|
||||||
exit 73254
|
exit 73254
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# install the onions module
|
# install the onions module
|
||||||
update_prosody_modules
|
update_prosody_modules
|
||||||
if [ ! -f /usr/lib/prosody/modules/mod_onions.lua ]; then
|
if [ ! -f /usr/lib/prosody/modules/mod_onions.lua ]; then
|
||||||
echo $'mod_onions.lua could not be copied to the prosody modules directory'
|
echo $'mod_onions.lua could not be copied to the prosody modules directory'
|
||||||
exit 63952
|
exit 63952
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create a certificate
|
# create a certificate
|
||||||
if [ ! -f /etc/ssl/certs/xmpp.dhparam ]; then
|
if [ ! -f /etc/ssl/certs/xmpp.dhparam ]; then
|
||||||
${PROJECT_NAME}-addcert -h xmpp --dhkey $DH_KEYLENGTH
|
${PROJECT_NAME}-addcert -h xmpp --dhkey $DH_KEYLENGTH
|
||||||
check_certificates xmpp
|
check_certificates xmpp
|
||||||
fi
|
fi
|
||||||
chown prosody:prosody /etc/ssl/private/xmpp.key
|
chown prosody:prosody /etc/ssl/private/xmpp.key
|
||||||
chown prosody:prosody /etc/ssl/certs/xmpp.*
|
chown prosody:prosody /etc/ssl/certs/xmpp.*
|
||||||
cp -a /etc/prosody/conf.avail/example.com.cfg.lua /etc/prosody/conf.avail/xmpp.cfg.lua
|
cp -a /etc/prosody/conf.avail/example.com.cfg.lua /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
|
|
||||||
sed -i 's|/etc/prosody/certs/example.com.key|/etc/ssl/private/xmpp.key|g' /etc/prosody/conf.avail/xmpp.cfg.lua
|
sed -i 's|/etc/prosody/certs/example.com.key|/etc/ssl/private/xmpp.key|g' /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
sed -i 's|/etc/prosody/certs/example.com.crt|/etc/ssl/certs/xmpp.crt|g' /etc/prosody/conf.avail/xmpp.cfg.lua
|
sed -i 's|/etc/prosody/certs/example.com.crt|/etc/ssl/certs/xmpp.crt|g' /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
if ! grep -q "xmpp.dhparam" /etc/prosody/conf.avail/xmpp.cfg.lua; then
|
if ! grep -q "xmpp.dhparam" /etc/prosody/conf.avail/xmpp.cfg.lua; then
|
||||||
sed -i '/certificate =/a\ dhparam = "/etc/ssl/certs/xmpp.dhparam";' /etc/prosody/conf.avail/xmpp.cfg.lua
|
sed -i '/certificate =/a\ dhparam = "/etc/ssl/certs/xmpp.dhparam";' /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
fi
|
fi
|
||||||
if ! grep -q 'options = {"no_sslv2", "no_sslv3" }' /etc/prosody/conf.avail/xmpp.cfg.lua; then
|
if ! grep -q 'options = {"no_sslv2", "no_sslv3" }' /etc/prosody/conf.avail/xmpp.cfg.lua; then
|
||||||
sed -i '/certificate =/a\ options = {"no_sslv2", "no_sslv3" };' /etc/prosody/conf.avail/xmpp.cfg.lua
|
sed -i '/certificate =/a\ options = {"no_sslv2", "no_sslv3" };' /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
fi
|
fi
|
||||||
if ! grep -q 'ciphers =' /etc/prosody/conf.avail/xmpp.cfg.lua; then
|
if ! grep -q 'ciphers =' /etc/prosody/conf.avail/xmpp.cfg.lua; then
|
||||||
sed -i "/certificate =/a\ ciphers = $XMPP_CIPHERS;" /etc/prosody/conf.avail/xmpp.cfg.lua
|
sed -i "/certificate =/a\ ciphers = $XMPP_CIPHERS;" /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
fi
|
fi
|
||||||
if ! grep -q 'depth = "1";' /etc/prosody/conf.avail/xmpp.cfg.lua; then
|
if ! grep -q 'depth = "1";' /etc/prosody/conf.avail/xmpp.cfg.lua; then
|
||||||
sed -i '/certificate =/a\ depth = "1";' /etc/prosody/conf.avail/xmpp.cfg.lua
|
sed -i '/certificate =/a\ depth = "1";' /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
fi
|
fi
|
||||||
if ! grep -q 'curve =' /etc/prosody/conf.avail/xmpp.cfg.lua; then
|
if ! grep -q 'curve =' /etc/prosody/conf.avail/xmpp.cfg.lua; then
|
||||||
sed -i "/certificate =/a\ curve = $XMPP_ECC_CURVE;" /etc/prosody/conf.avail/xmpp.cfg.lua
|
sed -i "/certificate =/a\ curve = $XMPP_ECC_CURVE;" /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i "s/example.com/$DEFAULT_DOMAIN_NAME/g" /etc/prosody/conf.avail/xmpp.cfg.lua
|
sed -i "s/example.com/$DEFAULT_DOMAIN_NAME/g" /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
sed -i 's/enabled = false -- Remove this line to enable this host//g' /etc/prosody/conf.avail/xmpp.cfg.lua
|
sed -i 's/enabled = false -- Remove this line to enable this host//g' /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
|
|
||||||
if ! grep -q "modules_enabled" /etc/prosody/conf.avail/xmpp.cfg.lua; then
|
if ! grep -q "modules_enabled" /etc/prosody/conf.avail/xmpp.cfg.lua; then
|
||||||
echo '' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo '' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo 'modules_enabled = {' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo 'modules_enabled = {' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' "bosh"; -- Enable mod_bosh' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' "bosh"; -- Enable mod_bosh' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' "tls"; -- Enable mod_tls' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' "tls"; -- Enable mod_tls' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' "saslauth"; -- Enable mod_saslauth' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' "saslauth"; -- Enable mod_saslauth' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' "onions"; -- Enable chat via onion service' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' "onions"; -- Enable chat via onion service' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' "mam"; -- Message archive management' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' "mam"; -- Message archive management' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' "csi"; -- Client state indication' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' "csi"; -- Client state indication' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' "carbons"; -- Message carbons' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' "carbons"; -- Message carbons' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' "smacks"; -- Stream management' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' "smacks"; -- Stream management' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' "smacks_offline"; -- Stream management' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' "smacks_offline"; -- Stream management' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' "pep"; -- Personal Eventing Protocol (to support OMEMO)' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' "pep"; -- Personal Eventing Protocol (to support OMEMO)' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' "privacy"; -- Privacy lists' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' "privacy"; -- Privacy lists' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' "privacy_lists"; -- Privacy lists' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' "privacy_lists"; -- Privacy lists' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' "blocking"; -- Blocking command' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' "blocking"; -- Blocking command' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' "roster"; -- Roster versioning' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' "roster"; -- Roster versioning' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo '}' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo '}' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo '' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo '' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo 'c2s_require_encryption = true' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo 'c2s_require_encryption = true' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo 's2s_require_encryption = true' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo 's2s_require_encryption = true' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo 'allow_unencrypted_plain_auth = false' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo 'allow_unencrypted_plain_auth = false' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
fi
|
fi
|
||||||
ln -sf /etc/prosody/conf.avail/xmpp.cfg.lua /etc/prosody/conf.d/xmpp.cfg.lua
|
ln -sf /etc/prosody/conf.avail/xmpp.cfg.lua /etc/prosody/conf.d/xmpp.cfg.lua
|
||||||
|
|
||||||
sed -i 's|/etc/prosody/certs/localhost.key|/etc/ssl/private/xmpp.key|g' /etc/prosody/prosody.cfg.lua
|
sed -i 's|/etc/prosody/certs/localhost.key|/etc/ssl/private/xmpp.key|g' /etc/prosody/prosody.cfg.lua
|
||||||
sed -i 's|/etc/prosody/certs/localhost.crt|/etc/ssl/certs/xmpp.crt|g' /etc/prosody/prosody.cfg.lua
|
sed -i 's|/etc/prosody/certs/localhost.crt|/etc/ssl/certs/xmpp.crt|g' /etc/prosody/prosody.cfg.lua
|
||||||
if ! grep -q "xmpp.dhparam" /etc/prosody/prosody.cfg.lua; then
|
if ! grep -q "xmpp.dhparam" /etc/prosody/prosody.cfg.lua; then
|
||||||
sed -i '/certificate =/a\ dhparam = "/etc/ssl/certs/xmpp.dhparam";' /etc/prosody/prosody.cfg.lua
|
sed -i '/certificate =/a\ dhparam = "/etc/ssl/certs/xmpp.dhparam";' /etc/prosody/prosody.cfg.lua
|
||||||
fi
|
fi
|
||||||
if ! grep -q 'options = {"no_sslv2", "no_sslv3" }' /etc/prosody/prosody.cfg.lua; then
|
if ! grep -q 'options = {"no_sslv2", "no_sslv3" }' /etc/prosody/prosody.cfg.lua; then
|
||||||
sed -i '/certificate =/a\ options = {"no_sslv2", "no_sslv3" };' /etc/prosody/prosody.cfg.lua
|
sed -i '/certificate =/a\ options = {"no_sslv2", "no_sslv3" };' /etc/prosody/prosody.cfg.lua
|
||||||
fi
|
fi
|
||||||
if ! grep -q 'ciphers =' /etc/prosody/prosody.cfg.lua; then
|
if ! grep -q 'ciphers =' /etc/prosody/prosody.cfg.lua; then
|
||||||
sed -i "/certificate =/a\ ciphers = $XMPP_CIPHERS;" /etc/prosody/prosody.cfg.lua
|
sed -i "/certificate =/a\ ciphers = $XMPP_CIPHERS;" /etc/prosody/prosody.cfg.lua
|
||||||
fi
|
fi
|
||||||
if ! grep -q 'depth = "1";' /etc/prosody/prosody.cfg.lua; then
|
if ! grep -q 'depth = "1";' /etc/prosody/prosody.cfg.lua; then
|
||||||
sed -i '/certificate =/a\ depth = "1";' /etc/prosody/prosody.cfg.lua
|
sed -i '/certificate =/a\ depth = "1";' /etc/prosody/prosody.cfg.lua
|
||||||
fi
|
fi
|
||||||
if ! grep -q 'curve =' /etc/prosody/prosody.cfg.lua; then
|
if ! grep -q 'curve =' /etc/prosody/prosody.cfg.lua; then
|
||||||
sed -i "/certificate =/a\ curve = $XMPP_ECC_CURVE;" /etc/prosody/prosody.cfg.lua
|
sed -i "/certificate =/a\ curve = $XMPP_ECC_CURVE;" /etc/prosody/prosody.cfg.lua
|
||||||
fi
|
fi
|
||||||
sed -i 's/c2s_require_encryption = false/c2s_require_encryption = true/g' /etc/prosody/prosody.cfg.lua
|
sed -i 's/c2s_require_encryption = false/c2s_require_encryption = true/g' /etc/prosody/prosody.cfg.lua
|
||||||
if ! grep -q "s2s_require_encryption" /etc/prosody/prosody.cfg.lua; then
|
if ! grep -q "s2s_require_encryption" /etc/prosody/prosody.cfg.lua; then
|
||||||
sed -i '/c2s_require_encryption/a\s2s_require_encryption = true' /etc/prosody/prosody.cfg.lua
|
sed -i '/c2s_require_encryption/a\s2s_require_encryption = true' /etc/prosody/prosody.cfg.lua
|
||||||
fi
|
fi
|
||||||
if ! grep -q "allow_unencrypted_plain_auth" /etc/prosody/prosody.cfg.lua; then
|
if ! grep -q "allow_unencrypted_plain_auth" /etc/prosody/prosody.cfg.lua; then
|
||||||
echo 'allow_unencrypted_plain_auth = false' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo 'allow_unencrypted_plain_auth = false' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
fi
|
fi
|
||||||
sed -i 's/--"bosh";/"bosh";/g' /etc/prosody/prosody.cfg.lua
|
sed -i 's/--"bosh";/"bosh";/g' /etc/prosody/prosody.cfg.lua
|
||||||
sed -i 's/authentication = "internal_plain"/authentication = "internal_hashed"/g' /etc/prosody/prosody.cfg.lua
|
sed -i 's/authentication = "internal_plain"/authentication = "internal_hashed"/g' /etc/prosody/prosody.cfg.lua
|
||||||
sed -i 's/enabled = false -- Remove this line to enable this host//g' /etc/prosody/prosody.cfg.lua
|
sed -i 's/enabled = false -- Remove this line to enable this host//g' /etc/prosody/prosody.cfg.lua
|
||||||
sed -i 's|key = "/etc/prosody/certs/example.com.key"|key = "/etc/ssl/private/xmpp.key"|g' /etc/prosody/prosody.cfg.lua
|
sed -i 's|key = "/etc/prosody/certs/example.com.key"|key = "/etc/ssl/private/xmpp.key"|g' /etc/prosody/prosody.cfg.lua
|
||||||
sed -i 's|certificate = "/etc/prosody/certs/example.com.crt"|certificate = "/etc/ssl/certs/xmpp.crt"|g' /etc/prosody/prosody.cfg.lua
|
sed -i 's|certificate = "/etc/prosody/certs/example.com.crt"|certificate = "/etc/ssl/certs/xmpp.crt"|g' /etc/prosody/prosody.cfg.lua
|
||||||
sed -i "s/example.com/$DEFAULT_DOMAIN_NAME/g" /etc/prosody/prosody.cfg.lua
|
sed -i "s/example.com/$DEFAULT_DOMAIN_NAME/g" /etc/prosody/prosody.cfg.lua
|
||||||
|
|
||||||
systemctl restart prosody
|
systemctl restart prosody
|
||||||
touch /home/$MY_USERNAME/README
|
touch /home/$MY_USERNAME/README
|
||||||
|
|
||||||
if [ ! -d /var/lib/tor ]; then
|
if [ ! -d /var/lib/tor ]; then
|
||||||
echo $'No Tor installation found. XMPP onion site cannot be configured.'
|
echo $'No Tor installation found. XMPP onion site cannot be configured.'
|
||||||
exit 877367
|
exit 877367
|
||||||
fi
|
fi
|
||||||
if ! grep -q "hidden_service_xmpp" /etc/tor/torrc; then
|
if ! grep -q "hidden_service_xmpp" /etc/tor/torrc; then
|
||||||
echo 'HiddenServiceDir /var/lib/tor/hidden_service_xmpp/' >> /etc/tor/torrc
|
echo 'HiddenServiceDir /var/lib/tor/hidden_service_xmpp/' >> /etc/tor/torrc
|
||||||
echo "HiddenServicePort 5222 127.0.0.1:5222" >> /etc/tor/torrc
|
echo "HiddenServicePort 5222 127.0.0.1:5222" >> /etc/tor/torrc
|
||||||
echo "HiddenServicePort 5269 127.0.0.1:5269" >> /etc/tor/torrc
|
echo "HiddenServicePort 5269 127.0.0.1:5269" >> /etc/tor/torrc
|
||||||
echo $'Added onion site for XMPP chat'
|
echo $'Added onion site for XMPP chat'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl restart tor
|
systemctl restart tor
|
||||||
wait_for_onion_service 'xmpp'
|
wait_for_onion_service 'xmpp'
|
||||||
|
|
||||||
if [ ! -f /var/lib/tor/hidden_service_xmpp/hostname ]; then
|
if [ ! -f /var/lib/tor/hidden_service_xmpp/hostname ]; then
|
||||||
echo $'XMPP onion site hostname not found'
|
echo $'XMPP onion site hostname not found'
|
||||||
exit 65349
|
exit 65349
|
||||||
fi
|
fi
|
||||||
XMPP_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_xmpp/hostname)
|
XMPP_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_xmpp/hostname)
|
||||||
if ! grep -q "${XMPP_ONION_HOSTNAME}" /etc/prosody/conf.avail/xmpp.cfg.lua; then
|
if ! grep -q "${XMPP_ONION_HOSTNAME}" /etc/prosody/conf.avail/xmpp.cfg.lua; then
|
||||||
echo '' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo '' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo "VirtualHost \"${XMPP_ONION_HOSTNAME}\"" >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo "VirtualHost \"${XMPP_ONION_HOSTNAME}\"" >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
echo ' modules_enabled = { "onions" };' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
echo ' modules_enabled = { "onions" };' >> /etc/prosody/conf.avail/xmpp.cfg.lua
|
||||||
fi
|
fi
|
||||||
if ! grep -q "XMPP onion domain" $COMPLETION_FILE; then
|
if ! grep -q "XMPP onion domain" $COMPLETION_FILE; then
|
||||||
echo "XMPP onion domain:${XMPP_ONION_HOSTNAME}" >> $COMPLETION_FILE
|
echo "XMPP onion domain:${XMPP_ONION_HOSTNAME}" >> $COMPLETION_FILE
|
||||||
else
|
else
|
||||||
sed -i "s|XMPP onion domain.*|XMPP onion domain:${XMPP_ONION_HOSTNAME}|g" $COMPLETION_FILE
|
sed -i "s|XMPP onion domain.*|XMPP onion domain:${XMPP_ONION_HOSTNAME}|g" $COMPLETION_FILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep -q "Your XMPP password is" /home/$MY_USERNAME/README; then
|
if ! grep -q "Your XMPP password is" /home/$MY_USERNAME/README; then
|
||||||
if [ ${#XMPP_PASSWORD} -lt 8 ]; then
|
if [ ${#XMPP_PASSWORD} -lt 8 ]; then
|
||||||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||||
XMPP_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
XMPP_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||||
else
|
else
|
||||||
XMPP_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
|
XMPP_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
prosodyctl register $MY_USERNAME $DEFAULT_DOMAIN_NAME $XMPP_PASSWORD
|
prosodyctl register $MY_USERNAME $DEFAULT_DOMAIN_NAME $XMPP_PASSWORD
|
||||||
echo '' >> /home/$MY_USERNAME/README
|
echo '' >> /home/$MY_USERNAME/README
|
||||||
echo '' >> /home/$MY_USERNAME/README
|
echo '' >> /home/$MY_USERNAME/README
|
||||||
echo $'XMPP' >> /home/$MY_USERNAME/README
|
echo $'XMPP' >> /home/$MY_USERNAME/README
|
||||||
echo '====' >> /home/$MY_USERNAME/README
|
echo '====' >> /home/$MY_USERNAME/README
|
||||||
echo $"XMPP onion domain: ${XMPP_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
|
echo $"XMPP onion domain: ${XMPP_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
|
||||||
echo $"Your XMPP password is: $XMPP_PASSWORD" >> /home/$MY_USERNAME/README
|
echo $"Your XMPP password is: $XMPP_PASSWORD" >> /home/$MY_USERNAME/README
|
||||||
echo $'You can change it with: ' >> /home/$MY_USERNAME/README
|
echo $'You can change it with: ' >> /home/$MY_USERNAME/README
|
||||||
echo '' >> /home/$MY_USERNAME/README
|
echo '' >> /home/$MY_USERNAME/README
|
||||||
echo " prosodyctl passwd $MY_EMAIL_ADDRESS" >> /home/$MY_USERNAME/README
|
echo " prosodyctl passwd $MY_EMAIL_ADDRESS" >> /home/$MY_USERNAME/README
|
||||||
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
|
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
|
||||||
chmod 600 /home/$MY_USERNAME/README
|
chmod 600 /home/$MY_USERNAME/README
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function_check configure_firewall_for_xmpp
|
function_check configure_firewall_for_xmpp
|
||||||
configure_firewall_for_xmpp
|
configure_firewall_for_xmpp
|
||||||
|
xmpp_email_headers
|
||||||
|
|
||||||
echo 'install_xmpp_main' >> $COMPLETION_FILE
|
echo 'install_xmpp_main' >> $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_xmpp_client {
|
function install_xmpp_client {
|
||||||
if grep -Fxq "install_xmpp_client" $COMPLETION_FILE; then
|
if grep -Fxq "install_xmpp_client" $COMPLETION_FILE; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
apt-get -y install profanity
|
apt-get -y install profanity
|
||||||
|
|
||||||
XMPP_CLIENT_DIR=/home/$MY_USERNAME/.local/share/profanity
|
XMPP_CLIENT_DIR=/home/$MY_USERNAME/.local/share/profanity
|
||||||
XMPP_CLIENT_ACCOUNTS=$XMPP_CLIENT_DIR/accounts
|
XMPP_CLIENT_ACCOUNTS=$XMPP_CLIENT_DIR/accounts
|
||||||
if [ ! -d $XMPP_CLIENT_DIR ]; then
|
if [ ! -d $XMPP_CLIENT_DIR ]; then
|
||||||
mkdir -p $XMPP_CLIENT_DIR
|
mkdir -p $XMPP_CLIENT_DIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $ONION_ONLY == 'no' ]]; then
|
if [[ $ONION_ONLY == 'no' ]]; then
|
||||||
echo "[${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}]" > $XMPP_CLIENT_ACCOUNTS
|
echo "[${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}]" > $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'enabled=true' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'enabled=true' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo "jid=${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}" >> $XMPP_CLIENT_ACCOUNTS
|
echo "jid=${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}" >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo "muc.service=conference.${DEFAULT_DOMAIN_NAME}" >> $XMPP_CLIENT_ACCOUNTS
|
echo "muc.service=conference.${DEFAULT_DOMAIN_NAME}" >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo "muc.nick=${MY_USERNAME}" >> $XMPP_CLIENT_ACCOUNTS
|
echo "muc.nick=${MY_USERNAME}" >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'presence.last=online' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'presence.last=online' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'presence.login=online' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'presence.login=online' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'priority.online=0' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'priority.online=0' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'priority.chat=0' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'priority.chat=0' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'priority.away=0' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'priority.away=0' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'priority.xa=0' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'priority.xa=0' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'priority.dnd=0' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'priority.dnd=0' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
if [ ${#XMPP_PASSWORD} -gt 2 ]; then
|
if [ ${#XMPP_PASSWORD} -gt 2 ]; then
|
||||||
echo "password=$XMPP_PASSWORD" >> $XMPP_CLIENT_ACCOUNTS
|
echo "password=$XMPP_PASSWORD" >> $XMPP_CLIENT_ACCOUNTS
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /var/lib/tor/hidden_service_xmpp/hostname ]; then
|
if [ -f /var/lib/tor/hidden_service_xmpp/hostname ]; then
|
||||||
XMPP_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_xmpp/hostname)
|
XMPP_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_xmpp/hostname)
|
||||||
echo "[${MY_USERNAME}@${XMPP_ONION_HOSTNAME}]" >> $XMPP_CLIENT_ACCOUNTS
|
echo "[${MY_USERNAME}@${XMPP_ONION_HOSTNAME}]" >> $XMPP_CLIENT_ACCOUNTS
|
||||||
if [[ $ONION_ONLY == 'no' ]]; then
|
if [[ $ONION_ONLY == 'no' ]]; then
|
||||||
echo 'enabled=false' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'enabled=false' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
else
|
else
|
||||||
echo 'enabled=true' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'enabled=true' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
fi
|
fi
|
||||||
echo "jid=${MY_USERNAME}@${XMPP_ONION_HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
|
echo "jid=${MY_USERNAME}@${XMPP_ONION_HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo "muc.service=conference.${XMPP_ONION_HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
|
echo "muc.service=conference.${XMPP_ONION_HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo "muc.nick=${MY_USERNAME}" >> $XMPP_CLIENT_ACCOUNTS
|
echo "muc.nick=${MY_USERNAME}" >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'presence.last=online' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'presence.last=online' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'presence.login=online' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'presence.login=online' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'priority.online=0' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'priority.online=0' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'priority.chat=0' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'priority.chat=0' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'priority.away=0' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'priority.away=0' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'priority.xa=0' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'priority.xa=0' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'priority.dnd=0' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'priority.dnd=0' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
if [ ${#XMPP_PASSWORD} -gt 2 ]; then
|
if [ ${#XMPP_PASSWORD} -gt 2 ]; then
|
||||||
echo "password=$XMPP_PASSWORD" >> $XMPP_CLIENT_ACCOUNTS
|
echo "password=$XMPP_PASSWORD" >> $XMPP_CLIENT_ACCOUNTS
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d /home/$MY_USERNAME/.config/profanity ]; then
|
if [ ! -d /home/$MY_USERNAME/.config/profanity ]; then
|
||||||
mkdir /home/$MY_USERNAME/.config/profanity
|
mkdir /home/$MY_USERNAME/.config/profanity
|
||||||
fi
|
fi
|
||||||
echo '[connection]' > /home/$MY_USERNAME/.config/profanity/profrc
|
echo '[connection]' > /home/$MY_USERNAME/.config/profanity/profrc
|
||||||
echo "account=${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}" >> /home/$MY_USERNAME/.config/profanity/profrc
|
echo "account=${MY_USERNAME}@${DEFAULT_DOMAIN_NAME}" >> /home/$MY_USERNAME/.config/profanity/profrc
|
||||||
|
|
||||||
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.local
|
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.local
|
||||||
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.config
|
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.config
|
||||||
|
|
||||||
echo 'install_xmpp_client' >> $COMPLETION_FILE
|
echo 'install_xmpp_client' >> $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_xmpp {
|
function install_xmpp {
|
||||||
if grep -Fxq "install_xmpp" $COMPLETION_FILE; then
|
if grep -Fxq "install_xmpp" $COMPLETION_FILE; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
install_xmpp_main
|
install_xmpp_main
|
||||||
install_xmpp_client
|
install_xmpp_client
|
||||||
echo 'install_xmpp' >> $COMPLETION_FILE
|
echo 'install_xmpp' >> $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
# NOTE: deliberately no exit 0
|
# NOTE: deliberately no exit 0
|
||||||
|
|
Loading…
Reference in New Issue