Moving to an independent default domain name

This commit is contained in:
Bob Mottram 2015-02-03 20:52:38 +00:00
parent 2378256c9c
commit 49f427b8e4
5 changed files with 43 additions and 72 deletions

View File

@ -101,11 +101,11 @@ make install
nano /home/myusername/freedombone/freedombone.cfg
#+END_SRC
Add the following, and set the values as needed. Note that for a full install DOMAIN_NAME should be the same as the wiki domain name.
Add the following, and set the values as needed. DEFAULT_DOMAIN_NAME is where your email/xmpp/irc/voip will be accessed from. It could be the same as one of your other domains, or separate.
#+BEGIN_SRC bash
MY_USERNAME=myusername
DOMAIN_NAME=mywikidomain
DEFAULT_DOMAIN_NAME=mywikidomain
SYSTEM_TYPE=full
INSTALLING_ON_BBB=no
DDNS_PROVIDER=default@freedns.afraid.org

Binary file not shown.

View File

@ -54,7 +54,7 @@ VARIANT_SOCIAL="social"
VARIANT_MEDIA="media"
VARIANT_TOR_DONGLE="tordongle"
DOMAIN_NAME=
DEFAULT_DOMAIN_NAME=
MY_USERNAME=
SYSTEM_TYPE=$VARIANT_FULL
@ -241,10 +241,10 @@ XMPP_CIPHERS='"EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA256:EECDH:+
XMPP_ECC_CURVE='"secp384r1"'
# the default email address
MY_EMAIL_ADDRESS=$MY_USERNAME@$DOMAIN_NAME
MY_EMAIL_ADDRESS=$MY_USERNAME@$DEFAULT_DOMAIN_NAME
# optionally specify your name to appear on the blog
MY_NAME=$DOMAIN_NAME
MY_NAME=$DEFAULT_DOMAIN_NAME
export DEBIAN_FRONTEND=noninteractive
@ -512,7 +512,7 @@ else
# default domain name
-d|--domain)
shift
DOMAIN_NAME="$1"
DEFAULT_DOMAIN_NAME="$1"
;;
# The type of system
-s|--system)
@ -632,7 +632,7 @@ function parse_args {
echo "There is no user '$MY_USERNAME' on the system. Use 'adduser $MY_USERNAME' to create the user."
exit 1
fi
if [ ! "$DOMAIN_NAME" ]; then
if [ ! "$DEFAULT_DOMAIN_NAME" ]; then
echo 'No default domain specified'
show_help
exit 2
@ -706,7 +706,11 @@ function read_configuration {
MY_USERNAME=$(grep "MY_USERNAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DOMAIN_NAME" $CONFIGURATION_FILE; then
DOMAIN_NAME=$(grep "DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
# for backwards compatability
DEFAULT_DOMAIN_NAME=$(grep "DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DEFAULT_DOMAIN_NAME" $CONFIGURATION_FILE; then
DEFAULT_DOMAIN_NAME=$(grep "DEFAULT_DOMAIN_NAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "NAMESERVER1" $CONFIGURATION_FILE; then
NAMESERVER1=$(grep "NAMESERVER1" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
@ -4269,10 +4273,10 @@ function set_your_domain_name {
if grep -Fxq "set_your_domain_name" $COMPLETION_FILE; then
return
fi
echo "$DOMAIN_NAME" > /etc/hostname
hostname $DOMAIN_NAME
sed -i "s/127.0.1.1 arm/127.0.1.1 $DOMAIN_NAME/g" /etc/hosts
echo "127.0.1.1 $DOMAIN_NAME" >> /etc/hosts
echo "$DEFAULT_DOMAIN_NAME" > /etc/hostname
hostname $DEFAULT_DOMAIN_NAME
sed -i "s/127.0.1.1 arm/127.0.1.1 $DEFAULT_DOMAIN_NAME/g" /etc/hosts
echo "127.0.1.1 $DEFAULT_DOMAIN_NAME" >> /etc/hosts
echo 'set_your_domain_name' >> $COMPLETION_FILE
}
@ -4727,7 +4731,7 @@ function configure_email {
sed -i 's|pam_mail.so nopen|pam_mail.so dir=~/Maildir nopen|g' /etc/pam.d/su
echo 'dc_eximconfig_configtype="internet"' > /etc/exim4/update-exim4.conf.conf
echo "dc_other_hostnames='$DOMAIN_NAME'" >> /etc/exim4/update-exim4.conf.conf
echo "dc_other_hostnames='$DEFAULT_DOMAIN_NAME'" >> /etc/exim4/update-exim4.conf.conf
echo "dc_local_interfaces=''" >> /etc/exim4/update-exim4.conf.conf
echo "dc_readhost=''" >> /etc/exim4/update-exim4.conf.conf
echo "dc_relay_domains=''" >> /etc/exim4/update-exim4.conf.conf
@ -4755,7 +4759,7 @@ function configure_email {
chmod 640 /etc/exim4/exim.key /etc/exim4/exim.crt /etc/exim4/exim.dhparam
sed -i '/login_saslauthd_server/,/.endif/ s/# *//' /etc/exim4/exim4.conf.template
sed -i "/.ifdef MAIN_HARDCODE_PRIMARY_HOSTNAME/i\MAIN_HARDCODE_PRIMARY_HOSTNAME = $DOMAIN_NAME\nMAIN_TLS_ENABLE = true" /etc/exim4/exim4.conf.template
sed -i "/.ifdef MAIN_HARDCODE_PRIMARY_HOSTNAME/i\MAIN_HARDCODE_PRIMARY_HOSTNAME = $DEFAULT_DOMAIN_NAME\nMAIN_TLS_ENABLE = true" /etc/exim4/exim4.conf.template
sed -i "s|SMTPLISTENEROPTIONS=''|SMTPLISTENEROPTIONS='-oX 465:25:587 -oP /var/run/exim4/exim.pid'|g" /etc/default/exim4
if ! grep -q "tls_on_connect_ports=465" /etc/exim4/exim4.conf.template; then
sed -i '/SSL configuration for exim/i\tls_on_connect_ports=465' /etc/exim4/exim4.conf.template
@ -5536,7 +5540,7 @@ function create_public_mailing_list {
fi
# does the mailing list have a separate domain name?
if [ ! $PUBLIC_MAILING_LIST_DOMAIN_NAME ]; then
PUBLIC_MAILING_LIST_DOMAIN_NAME=$DOMAIN_NAME
PUBLIC_MAILING_LIST_DOMAIN_NAME=$DEFAULT_DOMAIN_NAME
fi
PUBLIC_MAILING_LIST_USER="mlmmj"
@ -5612,7 +5616,7 @@ function create_public_mailing_list {
echo 'Public mailing list' >> /home/$MY_USERNAME/README
echo '===================' >> /home/$MY_USERNAME/README
echo "To subscribe to the $PUBLIC_MAILING_LIST mailing list send a" >> /home/$MY_USERNAME/README
echo "cleartext email to $PUBLIC_MAILING_LIST+subscribe@$DOMAIN_NAME" >> /home/$MY_USERNAME/README
echo "cleartext email to $PUBLIC_MAILING_LIST+subscribe@$DEFAULT_DOMAIN_NAME" >> /home/$MY_USERNAME/README
fi
addmailinglist $MY_USERNAME "$PUBLIC_MAILING_LIST" "$PUBLIC_MAILING_LIST"
@ -5651,8 +5655,8 @@ function create_private_mailing_list {
ln -s /var/lib/gems/2.1.0/gems/schleuder-2.2.4 /var/lib/schleuder
sed -i 's/#smtp_port: 25/smtp_port: 465/g' /etc/schleuder/schleuder.conf
sed -i 's/#superadminaddr: root@localhost/superadminaddr: root@localhost' /etc/schleuder/schleuder.conf
schleuder-newlist $PRIVATE_MAILING_LIST@$DOMAIN_NAME -realname "$PRIVATE_MAILING_LIST" -adminaddress $MY_EMAIL_ADDRESS -initmember $MY_EMAIL_ADDRESS -initmemberkey $MY_GPG_PUBLIC_KEY -nointeractive
addemailtofolder $MY_USERNAME $PRIVATE_MAILING_LIST@$DOMAIN_NAME $PRIVATE_MAILING_LIST
schleuder-newlist $PRIVATE_MAILING_LIST@$DEFAULT_DOMAIN_NAME -realname "$PRIVATE_MAILING_LIST" -adminaddress $MY_EMAIL_ADDRESS -initmember $MY_EMAIL_ADDRESS -initmemberkey $MY_GPG_PUBLIC_KEY -nointeractive
addemailtofolder $MY_USERNAME $PRIVATE_MAILING_LIST@$DEFAULT_DOMAIN_NAME $PRIVATE_MAILING_LIST
echo 'schleuder:' > /etc/exim4/conf.d/router/550_exim4-config_schleuder
echo ' debug_print = "R: schleuder for $local_part@$domain"' >> /etc/exim4/conf.d/router/550_exim4-config_schleuder
@ -5677,7 +5681,7 @@ function create_private_mailing_list {
useradd -d /var/schleuderlists -s /bin/false schleuder
adduser Debian-exim schleuder
usermod -a -G mail schleuder
#exim -d -bt $PRIVATE_MAILING_LIST@$DOMAIN_NAME
#exim -d -bt $PRIVATE_MAILING_LIST@$DEFAULT_DOMAIN_NAME
echo 'create_private_mailing_list' >> $COMPLETION_FILE
}
@ -6093,11 +6097,10 @@ function install_owncloud {
fi
# if this is exclusively a cloud setup
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" ]]; then
if [ ! $DOMAIN_NAME ]; then
if [ ! $DEFAULT_DOMAIN_NAME ]; then
echo 'No default domain name when installing cloud variant'
exit 5380
fi
OWNCLOUD_DOMAIN_NAME=$DOMAIN_NAME
fi
if [ ! $OWNCLOUD_DOMAIN_NAME ]; then
echo 'No Owncloud domain name was specified'
@ -6359,7 +6362,7 @@ function install_xmpp {
sed -i "/certificate =/a\ curve = $XMPP_ECC_CURVE;" /etc/prosody/conf.avail/xmpp.cfg.lua
fi
sed -i "s/example.com/$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
if ! grep -q "modules_enabled" /etc/prosody/conf.avail/xmpp.cfg.lua; then
@ -6405,14 +6408,14 @@ function install_xmpp {
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|certificate = "/etc/prosody/certs/example.com.crt"|certificate = "/etc/ssl/certs/xmpp.crt"|g' /etc/prosody/prosody.cfg.lua
sed -i "s/example.com/$DOMAIN_NAME/g" /etc/prosody/prosody.cfg.lua
sed -i "s/example.com/$DEFAULT_DOMAIN_NAME/g" /etc/prosody/prosody.cfg.lua
service prosody restart
touch /home/$MY_USERNAME/README
if ! grep -q "Your XMPP password is" /home/$MY_USERNAME/README; then
XMPP_PASSWORD=$(openssl rand -base64 8)
prosodyctl register $MY_USERNAME $DOMAIN_NAME $XMPP_PASSWORD
prosodyctl register $MY_USERNAME $DEFAULT_DOMAIN_NAME $XMPP_PASSWORD
echo '' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
echo 'XMPP' >> /home/$MY_USERNAME/README
@ -6469,8 +6472,8 @@ function install_irc_server {
echo '**************************************************' >> /etc/ngircd/motd
sed -i 's|MotdFile = /etc/ngircd/ngircd.motd|MotdFile = /etc/ngircd/motd|g' /etc/ngircd/ngircd.conf
sed -i "s/irc@irc.example.com/$MY_EMAIL_ADDRESS/g" /etc/ngircd/ngircd.conf
sed -i "s/irc.example.net/$DOMAIN_NAME/g" /etc/ngircd/ngircd.conf
sed -i "s|Yet another IRC Server running on Debian GNU/Linux|IRC Server of $DOMAIN_NAME|g" /etc/ngircd/ngircd.conf
sed -i "s/irc.example.net/$DEFAULT_DOMAIN_NAME/g" /etc/ngircd/ngircd.conf
sed -i "s|Yet another IRC Server running on Debian GNU/Linux|IRC Server of $DEFAULT_DOMAIN_NAME|g" /etc/ngircd/ngircd.conf
sed -i 's/;Password = wealllikedebian/Password =/g' /etc/ngircd/ngircd.conf
sed -i 's|;CertFile = /etc/ssl/certs/server.crt|CertFile = /etc/ssl/certs/ngircd.crt|g' /etc/ngircd/ngircd.conf
sed -i 's|;DHFile = /etc/ngircd/dhparams.pem|DHFile = /etc/ssl/certs/ngircd.dhparam|g' /etc/ngircd/ngircd.conf
@ -6508,8 +6511,8 @@ function install_irc_server {
echo '==========' >> /home/$MY_USERNAME/README
echo 'To connect to your IRC server in irssi:' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
echo " /server add -auto -ssl $DOMAIN_NAME 6697" >> /home/$MY_USERNAME/README
echo " /connect $DOMAIN_NAME" >> /home/$MY_USERNAME/README
echo " /server add -auto -ssl $DEFAULT_DOMAIN_NAME 6697" >> /home/$MY_USERNAME/README
echo " /connect $DEFAULT_DOMAIN_NAME" >> /home/$MY_USERNAME/README
echo ' /join #freedombone' >> /home/$MY_USERNAME/README
fi
@ -6531,10 +6534,6 @@ function install_wiki {
if grep -Fxq "install_wiki" $COMPLETION_FILE; then
return
fi
# if everything is being installed or if this is exclusively a writer setup
if [[ $SYSTEM_TYPE == "$VARIANT_FULL" || $SYSTEM_TYPE == "$VARIANT_WRITER" ]]; then
WIKI_DOMAIN_NAME=$DOMAIN_NAME
fi
if [ ! $WIKI_DOMAIN_NAME ]; then
return
fi
@ -7302,10 +7301,6 @@ function install_redmatrix {
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_TOR_DONGLE" ]]; then
return
fi
# if this is exclusively a social setup
if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" ]]; then
REDMATRIX_DOMAIN_NAME=$DOMAIN_NAME
fi
if [ ! $REDMATRIX_DOMAIN_NAME ]; then
return
fi
@ -7662,10 +7657,6 @@ function install_mediagoblin {
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_TOR_DONGLE" ]]; then
return
fi
# if this is exclusively a writer setup
if [[ $SYSTEM_TYPE == "$VARIANT_MEDIA" ]]; then
MEDIAGOBLIN_DOMAIN_NAME=$DOMAIN_NAME
fi
if [ ! $MEDIAGOBLIN_DOMAIN_NAME ]; then
return
fi
@ -7909,7 +7900,7 @@ function intrusion_detection {
apt-get -y install tripwire
apt-get -y autoremove
cd /etc/tripwire
cp site.key $DOMAIN_NAME-site.key
cp site.key $DEFAULT_DOMAIN_NAME-site.key
echo ''
echo ''
echo '*** Installing intrusion detection. Press Enter when asked for the local and site passphrases. ***'
@ -8119,7 +8110,7 @@ function create_git_project {
echo '' >> /usr/bin/$CREATE_GIT_PROJECT_COMMAND
echo -n 'echo "Your project has been created, ' >> /usr/bin/$CREATE_GIT_PROJECT_COMMAND
echo 'use the following command to clone the repository"' >> /usr/bin/$CREATE_GIT_PROJECT_COMMAND
echo -n " git clone ssh://$MY_USERNAME@$DOMAIN_NAME:$SSH_PORT" >> /usr/bin/$CREATE_GIT_PROJECT_COMMAND
echo -n " git clone ssh://$MY_USERNAME@$DEFAULT_DOMAIN_NAME:$SSH_PORT" >> /usr/bin/$CREATE_GIT_PROJECT_COMMAND
echo '/home/$USER/projects/$GIT_PROJECT_NAME' >> /usr/bin/$CREATE_GIT_PROJECT_COMMAND
echo '' >> /usr/bin/$CREATE_GIT_PROJECT_COMMAND
echo 'exit 0' >> /usr/bin/$CREATE_GIT_PROJECT_COMMAND
@ -8380,7 +8371,7 @@ function install_voip {
exit 57893
fi
sed -i "s|welcometext=.*|welcometext=\"<br />Welcome to $DOMAIN_NAME <b>VoIP</b>.<br />Chat freely!<br />\"|g" /etc/mumble-server.ini
sed -i "s|welcometext=.*|welcometext=\"<br />Welcome to $DEFAULT_DOMAIN_NAME <b>VoIP</b>.<br />Chat freely!<br />\"|g" /etc/mumble-server.ini
if [ $VOIP_SERVER_PASSWORD ]; then
sed -i "s|serverpassword=.*|serverpassword=$VOIP_SERVER_PASSWORD|g" /etc/mumble-server.ini

View File

@ -53,7 +53,7 @@ VARIANT_MEDIA="media"
VARIANT_TOR_DONGLE="tordongle"
MY_USERNAME=
DOMAIN_NAME=
DEFAULT_DOMAIN_NAME=
MY_EMAIL_ADDRESS=
SYSTEM_TYPE=
INSTALLING_ON_BBB=
@ -135,7 +135,7 @@ function save_configuration_file {
fi
echo "MY_USERNAME=$MY_USERNAME" > $CONFIGURATION_FILE
echo "DOMAIN_NAME=$DOMAIN_NAME" >> $CONFIGURATION_FILE
echo "DEFAULT_DOMAIN_NAME=$DEFAULT_DOMAIN_NAME" >> $CONFIGURATION_FILE
echo "SYSTEM_TYPE=$SYSTEM_TYPE" >> $CONFIGURATION_FILE
echo "INSTALLING_ON_BBB=$INSTALLING_ON_BBB" >> $CONFIGURATION_FILE
echo "DDNS_PROVIDER=$DDNS_PROVIDER" >> $CONFIGURATION_FILE
@ -610,10 +610,6 @@ function interactive_configuration {
if [[ $TEST_DOMAIN_NAME != $WIKI_DOMAIN_NAME ]]; then
WIKI_DOMAIN_NAME=
dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [ ! $DOMAIN_NAME ]; then
DOMAIN_NAME=$WIKI_DOMAIN_NAME
fi
fi
fi
done
@ -647,10 +643,6 @@ function interactive_configuration {
if [[ $TEST_DOMAIN_NAME != $FULLBLOG_DOMAIN_NAME ]]; then
FULLBLOG_DOMAIN_NAME=
dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [ ! $DOMAIN_NAME ]; then
DOMAIN_NAME=$FULLBLOG_DOMAIN_NAME
fi
fi
fi
done
@ -679,10 +671,6 @@ function interactive_configuration {
if [[ $TEST_DOMAIN_NAME != $OWNCLOUD_DOMAIN_NAME ]]; then
OWNCLOUD_DOMAIN_NAME=
dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [ ! $DOMAIN_NAME ]; then
DOMAIN_NAME=$OWNCLOUD_DOMAIN_NAME
fi
fi
fi
done
@ -711,10 +699,6 @@ function interactive_configuration {
if [[ $TEST_DOMAIN_NAME != $REDMATRIX_DOMAIN_NAME ]]; then
REDMATRIX_DOMAIN_NAME=
dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [ ! $DOMAIN_NAME ]; then
DOMAIN_NAME=$REDMATRIX_DOMAIN_NAME
fi
fi
fi
done
@ -746,26 +730,22 @@ function interactive_configuration {
if [[ $TEST_DOMAIN_NAME != $MICROBLOG_DOMAIN_NAME ]]; then
MICROBLOG_DOMAIN_NAME=
dialog --title "Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [ ! $DOMAIN_NAME ]; then
DOMAIN_NAME=$MICROBLOG_DOMAIN_NAME
fi
fi
fi
done
save_configuration_file
fi
if [ ! $DOMAIN_NAME ]; then
while [ ! $DOMAIN_NAME ]
if [ ! $DEFAULT_DOMAIN_NAME ]; then
while [ ! $DEFAULT_DOMAIN_NAME ]
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Configuration" \
--inputbox "Domain name" 10 30 "$(grep 'DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2> $data
--inputbox "Domain name" 10 30 "$(grep 'DEFAULT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2> $data
sel=$?
case $sel in
0) DOMAIN_NAME=$(cat $data);;
0) DEFAULT_DOMAIN_NAME=$(cat $data);;
1) exit 0;;
255) exit 0;;
esac

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title></title>
<!-- 2015-02-01 Sun 21:46 -->
<!-- 2015-02-03 Tue 20:51 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="generator" content="Org-mode" />
<meta name="author" content="Bob Mottram" />
@ -359,13 +359,13 @@ nano /home/myusername/freedombone/freedombone.cfg
</div>
<p>
Add the following, and set the values as needed. Note that for a full install DOMAIN_NAME should be the same as the wiki domain name.
Add the following, and set the values as needed. DEFAULT_DOMAIN_NAME is where your email/xmpp/irc/voip will be accessed from. It could be the same as one of your other domains, or separate.
</p>
<div class="org-src-container">
<pre class="src src-bash"><span class="org-variable-name">MY_USERNAME</span>=myusername
<span class="org-variable-name">DOMAIN_NAME</span>=mywikidomain
<span class="org-variable-name">DEFAULT_DOMAIN_NAME</span>=mywikidomain
<span class="org-variable-name">SYSTEM_TYPE</span>=full
<span class="org-variable-name">INSTALLING_ON_BBB</span>=no
<span class="org-variable-name">DDNS_PROVIDER</span>=default@freedns.afraid.org