Monkeysphere ids
This commit is contained in:
parent
af1c64912d
commit
afb9db2d39
17602
src/freedombone
17602
src/freedombone
File diff suppressed because it is too large
Load Diff
|
@ -46,19 +46,19 @@ FULLBLOG_DOMAIN_NAME=
|
||||||
DEFAULT_DOMAIN_NAME=
|
DEFAULT_DOMAIN_NAME=
|
||||||
|
|
||||||
if [ ! $MY_USERNAME ]; then
|
if [ ! $MY_USERNAME ]; then
|
||||||
echo $'No username was given'
|
echo $'No username was given'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d /home/$MY_USERNAME ]; then
|
if [ -d /home/$MY_USERNAME ]; then
|
||||||
echo $"The user $MY_USERNAME already exists"
|
echo $"The user $MY_USERNAME already exists"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $COMPLETION_FILE ]; then
|
if [ ! -f $COMPLETION_FILE ]; then
|
||||||
echo $"$COMPLETION_FILE not found"
|
echo $"$COMPLETION_FILE not found"
|
||||||
userdel -r $MY_USERNAME
|
userdel -r $MY_USERNAME
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NEW_USER_PASSWORD="$(openssl rand -base64 10 | cut -c1-8)"
|
NEW_USER_PASSWORD="$(openssl rand -base64 10 | cut -c1-8)"
|
||||||
|
@ -66,40 +66,40 @@ useradd -m -p "$NEW_USER_PASSWORD" -s /bin/bash $MY_USERNAME
|
||||||
adduser $MY_USERNAME sasl
|
adduser $MY_USERNAME sasl
|
||||||
|
|
||||||
if [ ! -d /home/$MY_USERNAME ]; then
|
if [ ! -d /home/$MY_USERNAME ]; then
|
||||||
echo $'Home directory was not created'
|
echo $'Home directory was not created'
|
||||||
exit 4
|
exit 4
|
||||||
fi
|
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@'
|
||||||
sed -i "s|$USERN|$MY_USERNAME@|g" /home/$MY_USERNAME/.procmailrc
|
sed -i "s|$USERN|$MY_USERNAME@|g" /home/$MY_USERNAME/.procmailrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# generate a gpg key
|
# generate a gpg key
|
||||||
|
@ -133,56 +133,61 @@ MY_GPG_PUBLIC_KEY=/home/$MY_USERNAME/public_key.gpg
|
||||||
su -c "gpg --output $MY_GPG_PUBLIC_KEY --armor --export $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
|
su -c "gpg --output $MY_GPG_PUBLIC_KEY --armor --export $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
|
||||||
|
|
||||||
if [ ! -f $MY_GPG_PUBLIC_KEY ]; then
|
if [ ! -f $MY_GPG_PUBLIC_KEY ]; then
|
||||||
echo "GPG public key was not generated for $MY_USERNAME@$HOSTNAME $MY_GPG_PUBLIC_KEY_ID"
|
echo "GPG public key was not generated for $MY_USERNAME@$HOSTNAME $MY_GPG_PUBLIC_KEY_ID"
|
||||||
userdel -r $MY_USERNAME
|
userdel -r $MY_USERNAME
|
||||||
exit 7
|
exit 7
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# add a monkeysphere subkey
|
# add a monkeysphere subkey
|
||||||
su -c "monkeysphere gen-subkey $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
|
su -c "monkeysphere gen-subkey $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
|
||||||
|
# add authorized GPG email address
|
||||||
|
mkdir /home/$MY_USERNAME/.monkeysphere
|
||||||
|
chmod 755 /home/$MY_USERNAME/.monkeysphere
|
||||||
|
echo "$MY_USERNAME <${$MY_USERNAME@$HOSTNAME}>" > /home/$MY_USERNAME/.monkeysphere/authorized_user_ids
|
||||||
|
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.monkeysphere
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
if ! grep -q "Change your GPG password" /home/$MY_USERNAME/README; then
|
if ! grep -q "Change your GPG password" /home/$MY_USERNAME/README; then
|
||||||
echo '' >> /home/$MY_USERNAME/README
|
echo '' >> /home/$MY_USERNAME/README
|
||||||
echo '' >> /home/$MY_USERNAME/README
|
echo '' >> /home/$MY_USERNAME/README
|
||||||
echo $'Change your GPG password' >> /home/$MY_USERNAME/README
|
echo $'Change your GPG password' >> /home/$MY_USERNAME/README
|
||||||
echo '========================' >> /home/$MY_USERNAME/README
|
echo '========================' >> /home/$MY_USERNAME/README
|
||||||
echo $"It's very important to add a password to your GPG key so that" >> /home/$MY_USERNAME/README
|
echo $"It's very important to add a password to your GPG key so that" >> /home/$MY_USERNAME/README
|
||||||
echo $"if anyone does get access to your email they still won't be able" >> /home/$MY_USERNAME/README
|
echo $"if anyone does get access to your email they still won't be able" >> /home/$MY_USERNAME/README
|
||||||
echo $'to read them without knowning the GPG password.' >> /home/$MY_USERNAME/README
|
echo $'to read them without knowning the GPG password.' >> /home/$MY_USERNAME/README
|
||||||
echo $'You can change the it with:' >> /home/$MY_USERNAME/README
|
echo $'You can change the it with:' >> /home/$MY_USERNAME/README
|
||||||
echo '' >> /home/$MY_USERNAME/README
|
echo '' >> /home/$MY_USERNAME/README
|
||||||
echo " gpg --edit-key $MY_GPG_PUBLIC_KEY_ID" >> /home/$MY_USERNAME/README
|
echo " gpg --edit-key $MY_GPG_PUBLIC_KEY_ID" >> /home/$MY_USERNAME/README
|
||||||
echo ' passwd' >> /home/$MY_USERNAME/README
|
echo ' passwd' >> /home/$MY_USERNAME/README
|
||||||
echo ' save' >> /home/$MY_USERNAME/README
|
echo ' save' >> /home/$MY_USERNAME/README
|
||||||
echo ' quit' >> /home/$MY_USERNAME/README
|
echo ' quit' >> /home/$MY_USERNAME/README
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep -q "Publish your GPG public key" /home/$MY_USERNAME/README; then
|
if ! grep -q "Publish your GPG public key" /home/$MY_USERNAME/README; then
|
||||||
echo '' >> /home/$MY_USERNAME/README
|
echo '' >> /home/$MY_USERNAME/README
|
||||||
echo '' >> /home/$MY_USERNAME/README
|
echo '' >> /home/$MY_USERNAME/README
|
||||||
echo $'Publish your GPG public key' >> /home/$MY_USERNAME/README
|
echo $'Publish your GPG public key' >> /home/$MY_USERNAME/README
|
||||||
echo '===========================' >> /home/$MY_USERNAME/README
|
echo '===========================' >> /home/$MY_USERNAME/README
|
||||||
echo $'So that others can send emails to you securely you should' >> /home/$MY_USERNAME/README
|
echo $'So that others can send emails to you securely you should' >> /home/$MY_USERNAME/README
|
||||||
echo $'publish your GPG public key with the command:' >> /home/$MY_USERNAME/README
|
echo $'publish your GPG public key with the command:' >> /home/$MY_USERNAME/README
|
||||||
echo '' >> /home/$MY_USERNAME/README
|
echo '' >> /home/$MY_USERNAME/README
|
||||||
echo " gpg --send-keys $MY_GPG_PUBLIC_KEY_ID" >> /home/$MY_USERNAME/README
|
echo " gpg --send-keys $MY_GPG_PUBLIC_KEY_ID" >> /home/$MY_USERNAME/README
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
|
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
|
||||||
|
@ -190,196 +195,196 @@ chown $MY_USERNAME:$MY_USERNAME $MY_GPG_PUBLIC_KEY
|
||||||
chmod 600 /home/$MY_USERNAME/README
|
chmod 600 /home/$MY_USERNAME/README
|
||||||
|
|
||||||
if grep -q "install_xmpp" $COMPLETION_FILE; then
|
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
|
||||||
|
|
||||||
if grep -q "install_xmpp_client" $COMPLETION_FILE; then
|
if grep -q "install_xmpp_client" $COMPLETION_FILE; then
|
||||||
echo $"Adding XMPP client setup"
|
echo $"Adding XMPP client setup"
|
||||||
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 /home/$MY_USERNAME/.config/profanity
|
mkdir /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
|
||||||
echo "jid=${MY_USERNAME}@${HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
|
echo "jid=${MY_USERNAME}@${HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
|
echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
|
||||||
echo "muc.service=conference.${HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
|
echo "muc.service=conference.${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
|
||||||
|
|
||||||
echo '[connection]' > /home/$MY_USERNAME/.config/profanity/profrc
|
echo '[connection]' > /home/$MY_USERNAME/.config/profanity/profrc
|
||||||
echo "account=${MY_USERNAME}@${HOSTNAME}" >> /home/$MY_USERNAME/.config/profanity/profrc
|
echo "account=${MY_USERNAME}@${HOSTNAME}" >> /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
|
||||||
fi
|
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
|
||||||
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'" >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
|
echo "password = '$NEW_USER_PASSWORD'" >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
|
||||||
echo 'encryption = clear' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
|
echo 'encryption = clear' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
|
||||||
echo ';Role' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
|
echo ';Role' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
|
||||||
echo 'role = admin' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
|
echo 'role = admin' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
|
||||||
echo "$MY_USERNAME added as a blog user"
|
echo "$MY_USERNAME added as a blog user"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -q "install_sip" $COMPLETION_FILE; then
|
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_gnu_social" $COMPLETION_FILE; then
|
if grep -q "install_gnu_social" $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"
|
||||||
freedombone-addemail -u $MY_USERNAME -e "noreply@$MICROBLOG_DOMAIN_NAME" -g gnusocial --public no
|
freedombone-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
|
|
||||||
mkdir /home/$MY_USERNAME/.irssi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo 'servers = (' > /home/$MY_USERNAME/.irssi/config
|
if [ ! -d /home/$MY_USERNAME/.irssi ]; then
|
||||||
echo ' {' >> /home/$MY_USERNAME/.irssi/config
|
mkdir /home/$MY_USERNAME/.irssi
|
||||||
echo ' address = "chat.freenode.net";' >> /home/$MY_USERNAME/.irssi/config
|
fi
|
||||||
echo ' chatnet = "Freenode";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' port = "6667";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' autoconnect = "no";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' },' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' {' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' address = "irc.oftc.net";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' chatnet = "OFTC";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' port = "6667";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' autoconnect = "yes";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' },' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' {' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo " address = \"${HOSTNAME}\";" >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' chatnet = "Freedombone";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo " port = \"${IRC_PORT}\";" >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' use_ssl = "yes";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' ssl_verify = "no";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' autoconnect = "yes";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
|
|
||||||
echo ' }' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ');' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo '' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo 'chatnets = {' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' Freedombone = {' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' max_msgs = "4";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' };' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' Freenode = {' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' max_msgs = "4";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' };' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' OFTC = {' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' max_msgs = "1";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' };' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo '};' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo '' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo 'channels = (' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' { name = "#freedombone"; chatnet = "Freedombone"; autojoin = "Yes"; },' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ');' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo '' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo 'settings = {' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo " core = { real_name = \"$MY_NAME\"; user_name = \"$MY_USERNAME\"; nick = \"$MY_USERNAME\"; };" >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo ' "fe-text" = { actlist_sort = "refnum"; };' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo '};' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
echo 'ignores = ( { level = "CTCPS"; } );' >> /home/$MY_USERNAME/.irssi/config
|
|
||||||
|
|
||||||
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.irssi
|
echo 'servers = (' > /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' {' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' address = "chat.freenode.net";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' chatnet = "Freenode";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' port = "6667";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' autoconnect = "no";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' },' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' {' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' address = "irc.oftc.net";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' chatnet = "OFTC";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' port = "6667";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' autoconnect = "yes";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' },' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' {' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo " address = \"${HOSTNAME}\";" >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' chatnet = "Freedombone";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo " port = \"${IRC_PORT}\";" >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' use_ssl = "yes";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' ssl_verify = "no";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' autoconnect = "yes";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
|
||||||
|
echo ' }' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ');' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo '' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo 'chatnets = {' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' Freedombone = {' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' max_msgs = "4";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' };' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' Freenode = {' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' max_msgs = "4";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' };' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' OFTC = {' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' max_msgs = "1";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' };' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo '};' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo '' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo 'channels = (' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' { name = "#freedombone"; chatnet = "Freedombone"; autojoin = "Yes"; },' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ');' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo '' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo 'settings = {' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo " core = { real_name = \"$MY_NAME\"; user_name = \"$MY_USERNAME\"; nick = \"$MY_USERNAME\"; };" >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo ' "fe-text" = { actlist_sort = "refnum"; };' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo '};' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
echo 'ignores = ( { level = "CTCPS"; } );' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
|
||||||
|
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.irssi
|
||||||
fi
|
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
|
||||||
|
|
||||||
# add user to the sipwitch group
|
# add user to the sipwitch group
|
||||||
if [ -f /etc/sipwitch.conf ]; then
|
if [ -f /etc/sipwitch.conf ]; then
|
||||||
usermod -aG sipwitch $MY_USERNAME
|
usermod -aG sipwitch $MY_USERNAME
|
||||||
fi
|
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
|
||||||
|
|
||||||
# add user menu on ssh login
|
# add user menu on ssh login
|
||||||
if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then
|
if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then
|
||||||
echo 'control' >> /home/$MY_USERNAME/.bashrc
|
echo 'control' >> /home/$MY_USERNAME/.bashrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clear
|
clear
|
||||||
echo $"New user $MY_USERNAME was created"
|
echo $"New user $MY_USERNAME was created"
|
||||||
if [ $SIP_EXTENSION ]; then
|
if [ $SIP_EXTENSION ]; then
|
||||||
echo $"Their SIP phone extension is $SIP_EXTENSION"
|
echo $"Their SIP phone extension is $SIP_EXTENSION"
|
||||||
fi
|
fi
|
||||||
echo $"Their login password is $NEW_USER_PASSWORD"
|
echo $"Their login password is $NEW_USER_PASSWORD"
|
||||||
echo ''
|
echo ''
|
||||||
|
|
Loading…
Reference in New Issue