Beginning of webmail

This commit is contained in:
Bob Mottram 2016-04-25 17:48:10 +01:00
parent a2a5d39608
commit 3c13cefa51
No known key found for this signature in database
GPG Key ID: BA68F26108DC9F87
2 changed files with 353 additions and 247 deletions

View File

@ -217,6 +217,13 @@ HUBZILLA_ADMIN_PASSWORD=
HUBZILLA_COMMIT='b6ae2bff01f8a4dfc057ef2971b3d988b1028b3e'
HUBZILLA_ADDONS_COMMIT='48725235777e2088fe109b722a5fc9141b6840ec'
# roundcube webmail
WEBMAIL_REPO="https://github.com/roundcube/roundcubemail"
WEBMAIL_COMMIT='78cf9c2e5cff2d78cd8beb647d60570f195a2a9c'
WEBMAIL_ONION_HOSTNAME=
WEBMAIL_ONION_PORT=8097
WEBMAIL_ADMIN_PASSWORD=
# Domain name for git hosting installation
GIT_DOMAIN_NAME=
GIT_CODE=
@ -1066,6 +1073,12 @@ function read_configuration {
if [[ $CONFIGURATION_FILE != "/root/${PROJECT_NAME}.cfg" ]]; then
cp $CONFIGURATION_FILE /root/${PROJECT_NAME}.cfg
fi
if grep -q "WEBMAIL_REPO" $CONFIGURATION_FILE; then
WEBMAIL_REPO=$(grep "WEBMAIL_REPO" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "WEBMAIL_COMMIT" $CONFIGURATION_FILE; then
WEBMAIL_COMMIT=$(grep "WEBMAIL_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "WIFI_INTERFACE" $CONFIGURATION_FILE; then
WIFI_INTERFACE=$(grep "WIFI_INTERFACE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
@ -4450,7 +4463,6 @@ function install_command_line_browser {
echo 'install_command_line_browser' >> $COMPLETION_FILE
}
function configure_email {
if [[ $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
return
@ -7287,6 +7299,12 @@ function install_wiki {
nginx_disable_sniffing $WIKI_DOMAIN_NAME
echo ' add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
echo ' # webmail' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
echo ' location /webmail {' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
echo ' rewrite ^/(.*) /webmail/index.php last;' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
echo ' rewrite ^/(.*) /webmail/installer/index.php last;' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
echo ' # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
echo ' location / {' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
echo ' rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
@ -8815,6 +8833,85 @@ function install_search_engine {
echo 'install_search_engine' >> $COMPLETION_FILE
}
function install_webmail {
if [[ $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
return
fi
WEBMAIL_PATH=/var/www/webmail
# update to a new commit if needed
set_repo_commit $WEBMAIL_PATH "Webmail commit" "$WEBMAIL_COMMIT" $WEBMAIL_REPO
if grep -Fxq "install_webmail" $COMPLETION_FILE; then
return
fi
if [ -d /etc/apache2 ]; then
rm -rf /etc/apache2
echo $'Removed Apache installation after Dokuwiki install'
fi
install_mariadb
get_mariadb_password
repair_databases_script
apt-get -y install php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt git
apt-get -y install php5-dev imagemagick php5-imagick
if [ ! -f $WEBMAIL_PATH/index.php ]; then
git_clone $WEBMAIL_REPO webmail
git checkout $WEBMAIL_COMMIT -b $WEBMAIL_COMMIT
if ! grep -q "Webmail commit" $COMPLETION_FILE; then
echo "Webmail commit:$WEBMAIL_COMMIT" >> $COMPLETION_FILE
else
sed -i "s/Webmail commit.*/Webmail commit:$WEBMAIL_COMMIT/g" $COMPLETION_FILE
fi
chown -R www-data:www-data $WEBMAIL_PATH
fi
WEBMAIL_ONION_HOSTNAME=
if [[ $ONION_ONLY != "no" ]]; then
WEBMAIL_ONION_HOSTNAME=$(add_onion_service webmail 80 ${WEBMAIL_ONION_PORT})
echo "Webmail onion domain:${WEBMAIL_ONION_HOSTNAME}" >> $COMPLETION_FILE
fi
get_mariadb_webmail_admin_password
if [ ! $WEBMAIL_ADMIN_PASSWORD ]; then
if [ -f $IMAGE_PASSWORD_FILE ]; then
WEBMAIL_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
else
WEBMAIL_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
fi
fi
create_database webmail "$WEBMAIL_ADMIN_PASSWORD"
if [ ! -d /var/www/$DEFAULT_DOMAIN_NAME/htdocs ]; then
mkdir -p /var/www/$DEFAULT_DOMAIN_NAME/htdocs
fi
ln -s $WEBMAIL_PATH /var/www/$DEFAULT_DOMAIN_NAME/htdocs/webmail
if ! grep -q "Webmail" /home/$MY_USERNAME/README; then
echo '' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
echo 'Webmail' >> /home/$MY_USERNAME/README
echo '=======' >> /home/$MY_USERNAME/README
if [[ $ONION_ONLY == 'no' ]]; then
echo $"Open https://$DEFAULT_DOMAIN_NAME/webmail/installer/index.php" >> /home/$MY_USERNAME/README
else
echo $"Open http://$WEBMAIL_ONION_HOSTNAME/installer/index.php" >> /home/$MY_USERNAME/README
fi
echo $"Database Type: MySQL" >> /home/$MY_USERNAME/README
echo $"Database name: webmail" >> /home/$MY_USERNAME/README
echo $"Database user name: webmailadmin" >> /home/$MY_USERNAME/README
echo $"Database password: $WEBMAIL_ADMIN_PASSWORD" >> /home/$MY_USERNAME/README
echo $"Enable the Enigma PGP plugin" >> /home/$MY_USERNAME/README
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
chmod 600 /home/$MY_USERNAME/README
fi
echo 'install_webmail' >> $COMPLETION_FILE
}
function install_hubzilla {
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
return
@ -10530,6 +10627,7 @@ install_rss_reader
install_rss_reader_gnusocial
install_rss_mobile_reader
install_hubzilla
#install_webmail
#install_search_engine
install_dlna_server
configure_firewall_for_dlna

View File

@ -395,7 +395,15 @@ function show_domains {
echo ''
fi
fi
if grep -q "Webmail onion domain" $COMPLETION_FILE; then
echo -n -e "$(pad_string 'Webmail')"
WEBMAILDOM='-'
echo -n -e "$(pad_string ${WEBMAILDOM})"
if [ -d /var/lib/tor/hidden_service_webmail ]; then
echo -n "$(cat /var/lib/tor/hidden_service_webmail/hostname)"
fi
echo ''
fi
if grep -q "Search engine onion domain" $COMPLETION_FILE; then
echo -n -e "$(pad_string 'Search engine')"
SEARCHDOM='-'