freedomboneeee/src/freedombone-adduser

392 lines
18 KiB
Plaintext
Raw Normal View History

2015-10-26 15:25:58 +01:00
#!/bin/bash
2015-11-02 09:13:11 +01:00
#
# .---. . .
# | | |
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
#
# Freedom in the Cloud
#
# Adds an user to the system
# License
# =======
#
2016-01-02 22:58:27 +01:00
# Copyright (C) 2015-2016 Bob Mottram <bob@robotics.uk.to>
2015-11-02 09:13:11 +01:00
#
# This program is free software: you can redistribute it and/or modify
2016-02-13 23:09:27 +01:00
# it under the terms of the GNU Affero General Public License as published by
2015-11-02 09:13:11 +01:00
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
2016-02-13 23:09:27 +01:00
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
2015-11-02 09:13:11 +01:00
#
2016-02-13 23:09:27 +01:00
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2015-11-02 09:13:11 +01:00
2015-11-27 12:42:16 +01:00
PROJECT_NAME='freedombone'
2015-11-27 17:52:23 +01:00
export TEXTDOMAIN=${PROJECT_NAME}-adduser
2015-11-27 12:42:16 +01:00
export TEXTDOMAINDIR="/usr/share/locale"
CONFIGURATION_FILE=/root/${PROJECT_NAME}.cfg
2015-10-26 15:25:58 +01:00
MY_USERNAME=$1
2015-10-31 21:26:00 +01:00
SSH_PUBLIC_KEY="$2"
2015-10-26 15:25:58 +01:00
GPG_KEYSERVER='hkp://keys.gnupg.net'
SSH_PORT=2222
2015-12-08 17:22:48 +01:00
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
2015-11-02 11:56:02 +01:00
SIP_EXTENSION=
FULLBLOG_DOMAIN_NAME=
2015-10-26 15:25:58 +01:00
if [ ! $MY_USERNAME ]; then
2015-11-27 16:29:43 +01:00
echo $'No username was given'
2015-10-26 18:21:38 +01:00
exit 1
2015-10-26 15:25:58 +01:00
fi
if [ -d /home/$MY_USERNAME ]; then
2015-11-27 16:29:43 +01:00
echo $"The user $MY_USERNAME already exists"
2015-10-26 18:21:38 +01:00
exit 2
2015-10-26 15:25:58 +01:00
fi
2015-10-27 11:50:41 +01:00
if [ ! -f $COMPLETION_FILE ]; then
2015-11-27 16:29:43 +01:00
echo $"$COMPLETION_FILE not found"
2015-10-27 11:50:41 +01:00
userdel -r $MY_USERNAME
exit 3
fi
2015-10-26 15:25:58 +01:00
NEW_USER_PASSWORD="$(openssl rand -base64 10 | cut -c1-8)"
useradd -m -p "$NEW_USER_PASSWORD" -s /bin/bash $MY_USERNAME
adduser $MY_USERNAME sasl
if [ ! -d /home/$MY_USERNAME ]; then
2015-11-27 16:29:43 +01:00
echo $'Home directory was not created'
2015-10-27 11:50:41 +01:00
exit 4
2015-10-26 15:25:58 +01:00
fi
2015-10-31 21:26:00 +01:00
if [ "$SSH_PUBLIC_KEY" ]; then
if [ ${#SSH_PUBLIC_KEY} -gt 5 ]; then
2015-10-31 21:28:03 +01:00
if [ -f "$SSH_PUBLIC_KEY" ]; then
mkdir /home/$MY_USERNAME/.ssh
2015-10-31 21:26:00 +01:00
cp $SSH_PUBLIC_KEY /home/$MY_USERNAME/.ssh/authorized_keys
2015-11-01 11:03:26 +01:00
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
2015-11-27 16:29:43 +01:00
echo $'ssh public key installed'
else
2015-10-31 21:28:03 +01:00
if [[ "$SSH_PUBLIC_KEY" == "ssh-"* ]]; then
2015-10-31 21:26:00 +01:00
mkdir /home/$MY_USERNAME/.ssh
2015-10-31 21:28:03 +01:00
echo "$SSH_PUBLIC_KEY" > /home/$MY_USERNAME/.ssh/authorized_keys
2015-11-01 11:03:26 +01:00
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
2015-11-27 16:29:43 +01:00
echo $'ssh public key installed'
2015-10-31 21:26:00 +01:00
else
2015-11-27 16:29:43 +01:00
echo $'The second parameter does not look like an ssh key'
2015-10-31 21:26:00 +01:00
exit 5
fi
fi
fi
fi
2015-12-22 21:06:02 +01:00
if [ -d /home/$MY_USERNAME/Maildir ]; 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
else
echo "set from='$MY_USERNAME <$MY_USERNAME@$HOSTNAME>'" >> /home/$MY_USERNAME/.muttrc
fi
2015-10-26 15:25:58 +01:00
2015-12-22 21:06:02 +01:00
USERN='$USER@'
sed -i "s|$USERN|$MY_USERNAME@|g" /home/$MY_USERNAME/.procmailrc
2015-10-26 20:16:26 +01:00
fi
2015-10-26 15:25:58 +01:00
# generate a gpg key
echo "Making a GPG key for $MY_USERNAME@$HOSTNAME"
mkdir /home/$MY_USERNAME/.gnupg
echo "keyserver $GPG_KEYSERVER" >> /home/$MY_USERNAME/.gnupg/gpg.conf
echo 'keyserver-options auto-key-retrieve' >> /home/$MY_USERNAME/.gnupg/gpg.conf
echo '' >> /home/$MY_USERNAME/.gnupg/gpg.conf
echo '# default preferences' >> /home/$MY_USERNAME/.gnupg/gpg.conf
echo 'personal-digest-preferences SHA256' >> /home/$MY_USERNAME/.gnupg/gpg.conf
echo 'cert-digest-algo SHA256' >> /home/$MY_USERNAME/.gnupg/gpg.conf
echo 'default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed' >> /home/$MY_USERNAME/.gnupg/gpg.conf
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg
chmod 700 /home/$MY_USERNAME/.gnupg
chmod 600 /home/$MY_USERNAME/.gnupg/*
# Generate a GPG key
echo 'Key-Type: 1' > /home/$MY_USERNAME/gpg-genkey.conf
echo 'Key-Length: 4096' >> /home/$MY_USERNAME/gpg-genkey.conf
echo 'Subkey-Type: 1' >> /home/$MY_USERNAME/gpg-genkey.conf
echo 'Subkey-Length: 4096' >> /home/$MY_USERNAME/gpg-genkey.conf
echo "Name-Real: $MY_USERNAME" >> /home/$MY_USERNAME/gpg-genkey.conf
echo "Name-Email: $MY_USERNAME@$HOSTNAME" >> /home/$MY_USERNAME/gpg-genkey.conf
echo 'Expire-Date: 0' >> /home/$MY_USERNAME/gpg-genkey.conf
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf
su -c "gpg --batch --gen-key /home/$MY_USERNAME/gpg-genkey.conf" - $MY_USERNAME
shred -zu /home/$MY_USERNAME/gpg-genkey.conf
MY_GPG_PUBLIC_KEY_ID=$(su -c "gpg --list-keys $MY_USERNAME@$HOSTNAME | grep 'pub '" - $MY_USERNAME | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
2015-10-26 18:21:38 +01:00
MY_GPG_PUBLIC_KEY=/home/$MY_USERNAME/public_key.gpg
2015-10-26 15:25:58 +01:00
su -c "gpg --output $MY_GPG_PUBLIC_KEY --armor --export $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
2015-10-26 18:21:38 +01:00
if [ ! -f $MY_GPG_PUBLIC_KEY ]; then
echo "GPG public key was not generated for $MY_USERNAME@$HOSTNAME $MY_GPG_PUBLIC_KEY_ID"
userdel -r $MY_USERNAME
exit 7
2015-10-26 18:21:38 +01:00
fi
2015-12-22 21:06:02 +01:00
if [ -f /home/$MY_USERNAME/.muttrc ]; then
# encrypt outgoing mail to the "sent" folder
if ! grep -q "pgp_encrypt_only_command" /home/$MY_USERNAME/.muttrc; then
echo '' >> /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
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
fi
2015-10-26 20:16:26 +01:00
2015-12-22 21:06:02 +01:00
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
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
fi
2015-10-26 20:16:26 +01:00
fi
2015-10-26 15:25:58 +01:00
if ! grep -q "Change your GPG password" /home/$MY_USERNAME/README; then
echo '' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
2015-11-27 16:29:43 +01:00
echo $'Change your GPG password' >> /home/$MY_USERNAME/README
2015-10-26 15:25:58 +01:00
echo '========================' >> /home/$MY_USERNAME/README
2015-11-27 16:29:43 +01:00
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 $'to read them without knowning the GPG password.' >> /home/$MY_USERNAME/README
echo $'You can change the it with:' >> /home/$MY_USERNAME/README
2015-10-26 15:25:58 +01:00
echo '' >> /home/$MY_USERNAME/README
echo " gpg --edit-key $MY_GPG_PUBLIC_KEY_ID" >> /home/$MY_USERNAME/README
echo ' passwd' >> /home/$MY_USERNAME/README
echo ' save' >> /home/$MY_USERNAME/README
echo ' quit' >> /home/$MY_USERNAME/README
fi
if ! grep -q "Publish your GPG public key" /home/$MY_USERNAME/README; then
echo '' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
2015-11-27 16:29:43 +01:00
echo $'Publish your GPG public key' >> /home/$MY_USERNAME/README
2015-10-26 15:25:58 +01:00
echo '===========================' >> /home/$MY_USERNAME/README
2015-11-27 16:29:43 +01:00
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
2015-10-26 15:25:58 +01:00
echo '' >> /home/$MY_USERNAME/README
echo " gpg --send-keys $MY_GPG_PUBLIC_KEY_ID" >> /home/$MY_USERNAME/README
fi
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
2015-10-26 18:21:38 +01:00
chown $MY_USERNAME:$MY_USERNAME $MY_GPG_PUBLIC_KEY
2015-10-26 15:25:58 +01:00
chmod 600 /home/$MY_USERNAME/README
if grep -q "install_xmpp" $COMPLETION_FILE; then
2015-11-27 16:29:43 +01:00
echo $"Adding an XMPP account for $MY_USERNAME"
2015-12-08 17:22:48 +01:00
${PROJECT_NAME}-addxmpp -e "$MY_USERNAME@$HOSTNAME" -p "$NEW_USER_PASSWORD"
if [ ! "$?" = "0" ]; then
2015-11-27 16:29:43 +01:00
echo $"XMPP account not created"
userdel -r $MY_USERNAME
exit 8
fi
2015-10-27 11:50:41 +01:00
fi
2016-02-27 15:27:47 +01:00
if grep -q "install_xmpp_client" $COMPLETION_FILE; then
echo $"Adding XMPP client setup"
XMPP_CLIENT_DIR=/home/$MY_USERNAME/.local/share/profanity
XMPP_CLIENT_ACCOUNTS=$XMPP_CLIENT_DIR/accounts
if [ ! -d $XMPP_CLIENT_DIR ]; then
mkdir -p $XMPP_CLIENT_DIR
fi
if [ ! -d /home/$MY_USERNAME/.config/profanity ]; then
mkdir /home/$MY_USERNAME/.config/profanity
fi
echo "[${MY_USERNAME}@${HOSTNAME}]" > $XMPP_CLIENT_ACCOUNTS
echo 'enabled=true' >> $XMPP_CLIENT_ACCOUNTS
echo "jid=${MY_USERNAME}@${HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
echo 'resource=profanity' >> $XMPP_CLIENT_ACCOUNTS
echo "muc.service=conference.${HOSTNAME}" >> $XMPP_CLIENT_ACCOUNTS
echo "muc.nick=${MY_USERNAME}" >> $XMPP_CLIENT_ACCOUNTS
echo 'presence.last=online' >> $XMPP_CLIENT_ACCOUNTS
echo 'presence.login=online' >> $XMPP_CLIENT_ACCOUNTS
echo 'priority.online=0' >> $XMPP_CLIENT_ACCOUNTS
echo 'priority.chat=0' >> $XMPP_CLIENT_ACCOUNTS
echo 'priority.away=0' >> $XMPP_CLIENT_ACCOUNTS
echo 'priority.xa=0' >> $XMPP_CLIENT_ACCOUNTS
echo 'priority.dnd=0' >> $XMPP_CLIENT_ACCOUNTS
echo '[connection]' > /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/.config
fi
2015-10-27 11:50:41 +01:00
if grep -q "Blog domain" $COMPLETION_FILE; then
FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
if [ ! -d /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users ]; then
2015-11-27 16:29:43 +01:00
echo $'Blog users directory not found'
if grep -q "install_xmpp" $COMPLETION_FILE; then
2015-12-08 17:22:48 +01:00
${PROJECT_NAME}-rmxmpp -e "$MY_USERNAME@$HOSTNAME"
fi
2015-10-27 11:50:41 +01:00
userdel -r $MY_USERNAME
exit 9
2015-10-27 11:50:41 +01:00
fi
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 '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 = admin' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
echo "$MY_USERNAME added as a blog user"
2015-10-26 18:25:59 +01:00
fi
2015-10-26 15:25:58 +01:00
2015-11-02 11:31:49 +01:00
if grep -q "install_sip" $COMPLETION_FILE; then
2015-12-08 17:22:48 +01:00
SIP_EXTENSION=$(${PROJECT_NAME}-sipfreeext)
${PROJECT_NAME}-addsipuser -u $MY_USERNAME -e $SIP_EXTENSION -p "$NEW_USER_PASSWORD"
2015-11-02 11:31:49 +01:00
if [ ! "$?" = "0" ]; then
2015-11-27 16:29:43 +01:00
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
2015-12-08 17:22:48 +01:00
${PROJECT_NAME}-rmxmpp -e "$MY_USERNAME@$HOSTNAME"
fi
if grep -q "Blog domain" $COMPLETION_FILE; 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
fi
fi
2015-11-02 11:31:49 +01:00
userdel -r $MY_USERNAME
exit 10
fi
fi
2016-02-12 20:37:39 +01:00
if grep -q "install_gnu_social" $COMPLETION_FILE; then
MICROBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "GNU Social domain" | awk -F ':' '{print $2}')
if [ -d /var/www/$MICROBLOG_DOMAIN_NAME ]; then
cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs
php scripts/registeruser.php -n $MY_USERNAME -w "$NEW_USER_PASSWORD" -e "$MY_USERNAME@$HOSTNAME"
echo $'Created GNU Social user'
else
echo $"Unable to find GNU Social installation at /var/www/$MICROBLOG_DOMAIN_NAME/htdocs"
userdel -r $MY_USERNAME
exit 11
fi
fi
#if grep -q "install_owncloud" $COMPLETION_FILE; then
# export OC_PASS="$NEW_USER_PASSWORD"
# occ user:add --password-from-env --display-name="$MY_USERNAME" --group="users" $MY_USERNAME
# if [ ! "$?" = "0" ]; then
# echo 'Owncloud user could not be added'
# if grep -q "install_xmpp" $COMPLETION_FILE; then
2015-12-08 17:22:48 +01:00
# ${PROJECT_NAME}-rmxmpp -e "$MY_USERNAME@$HOSTNAME"
# fi
# if grep -q "Blog domain" $COMPLETION_FILE; 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
# fi
# fi
# if grep -q "install_sip" $COMPLETION_FILE; then
2015-12-08 17:22:48 +01:00
# ${PROJECT_NAME}-rmsipuser $MY_USERNAME
# fi
# userdel -r $MY_USERNAME
# export OC_PASS=""
# exit 11
# fi
# export OC_PASS=""
#fi
2015-11-10 13:29:43 +01:00
if grep -q "install_irc_client" $COMPLETION_FILE; then
IRC_PORT=6697
if grep -q "IRC_PORT" $CONFIGURATION_FILE; then
IRC_PORT=$(grep "IRC_PORT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if [ ! -d /home/$MY_USERNAME/.irssi ]; then
mkdir /home/$MY_USERNAME/.irssi
fi
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
2016-02-27 21:48:37 +01:00
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
2016-02-27 21:48:37 +01:00
echo 'ignores = ( { level = "CTCPS"; } );' >> /home/$MY_USERNAME/.irssi/config
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.irssi
fi
2016-02-25 15:21:07 +01:00
# add user menu on ssh login
2016-02-25 15:24:08 +01:00
if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then
echo 'control' >> /home/$MY_USERNAME/.bashrc
2016-02-25 15:21:07 +01:00
fi
2015-10-26 15:25:58 +01:00
clear
2015-11-27 16:29:43 +01:00
echo $"New user $MY_USERNAME was created"
2015-11-02 11:56:02 +01:00
if [ $SIP_EXTENSION ]; then
2015-11-27 16:29:43 +01:00
echo $"Their SIP phone extension is $SIP_EXTENSION"
2015-11-02 11:56:02 +01:00
fi
2015-11-27 16:29:43 +01:00
echo $"Their login password is $NEW_USER_PASSWORD"
2015-10-26 15:25:58 +01:00
echo ''
2015-11-27 16:29:43 +01:00
echo $'IMPORTANT: Make a note of the password, because it will not be saved'
echo $'anywhere else. Preferably give it to them in person on paper or via'
echo $'a secure channel, not in an unencrypted email.'
2015-10-26 15:25:58 +01:00
echo ''
2015-11-27 16:29:43 +01:00
echo $"They can download their GPG keys with:"
2015-10-26 15:25:58 +01:00
echo ''
echo " scp -P $SSH_PORT -r $MY_USERNAME@$HOSTNAME:/home/$MY_USERNAME/.gnupg ~/"
echo ''
2015-12-08 17:22:48 +01:00
echo $"They should also run ${PROJECT_NAME}-client on their system to ensure"
2015-11-27 16:29:43 +01:00
echo $'the best security.'
2015-10-26 15:25:58 +01:00
exit 0