To torify the irc server, or not to torify the irc server? That is the question.

This commit is contained in:
Bob Mottram 2016-04-12 17:28:52 +01:00
parent 3c6d049848
commit 339789c5e1
2 changed files with 33 additions and 5 deletions

View File

@ -6874,13 +6874,17 @@ function install_irc_client {
echo ' {' >> /home/$MY_USERNAME/.irssi/config echo ' {' >> /home/$MY_USERNAME/.irssi/config
if [[ $ONION_ONLY == 'no' ]]; then if [[ $ONION_ONLY == 'no' ]]; then
echo " address = \"${DEFAULT_DOMAIN_NAME}\";" >> /home/$MY_USERNAME/.irssi/config echo " address = \"${DEFAULT_DOMAIN_NAME}\";" >> /home/$MY_USERNAME/.irssi/config
echo " port = \"${IRC_PORT}\";" >> /home/$MY_USERNAME/.irssi/config
echo ' use_ssl = "yes";' >> /home/$MY_USERNAME/.irssi/config
else else
IRC_ONION_HOSTNAME=$(cat $COMPLETION_FILE | grep "IRC onion domain" | awk -F ':' '{print $2}') IRC_ONION_HOSTNAME=$(cat $COMPLETION_FILE | grep "IRC onion domain" | awk -F ':' '{print $2}')
echo " address = \"${IRC_ONION_HOSTNAME}\";" >> /home/$MY_USERNAME/.irssi/config echo " address = \"${IRC_ONION_HOSTNAME}\";" >> /home/$MY_USERNAME/.irssi/config
echo " port = \"${IRC_ONION_PORT}\";" >> /home/$MY_USERNAME/.irssi/config
echo ' use_ssl = "no";' >> /home/$MY_USERNAME/.irssi/config
sed -i "s/;Ports =.*/Ports = $IRC_PORT, $IRC_ONION_PORT/1" /etc/ngircd/ngircd.conf
systemctl restart ngircd
fi fi
echo ' chatnet = "Freedombone";' >> /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 ' ssl_verify = "no";' >> /home/$MY_USERNAME/.irssi/config
echo ' autoconnect = "yes";' >> /home/$MY_USERNAME/.irssi/config echo ' autoconnect = "yes";' >> /home/$MY_USERNAME/.irssi/config
if [ $IRC_PASSWORD ]; then if [ $IRC_PASSWORD ]; then
@ -7011,7 +7015,19 @@ function install_irc_server {
echo "IRC onion domain:$IRC_ONION_HOSTNAME" >> $COMPLETION_FILE echo "IRC onion domain:$IRC_ONION_HOSTNAME" >> $COMPLETION_FILE
fi fi
systemctl restart ngircd systemctl stop ngircd
if [ ! -f /lib/systemd/system/ngircd.service ]; then
echo $'No systemd daemon found for ngircd'
exit 82528
fi
if [[ $ONION_ONLY == 'no' ]]; then
sed -i 's|ExecStart.*|ExecStart=/usr/sbin/ngircd|g' /lib/systemd/system/ngircd.service
else
sed -i 's|ExecStart.*|ExecStart=/usr/bin/torify /usr/sbin/ngircd|g' /lib/systemd/system/ngircd.service
fi
systemctl daemon-reload
systemctl start ngircd
# keep the daemon running # keep the daemon running
echo '' >> /usr/bin/$WATCHDOG_SCRIPT_NAME echo '' >> /usr/bin/$WATCHDOG_SCRIPT_NAME

View File

@ -742,6 +742,12 @@ function change_ssh_public_key {
} }
function irc_via_onion { function irc_via_onion {
if [ ! -f /lib/systemd/system/ngircd.service ]; then
dialog --title $"IRC Server" \
--msgbox $"ngircd systemd daemon not found" 8 50
return
fi
dialog --title $"IRC Server" \ dialog --title $"IRC Server" \
--backtitle $"Freedombone Control Panel" \ --backtitle $"Freedombone Control Panel" \
--defaultno \ --defaultno \
@ -760,13 +766,19 @@ function irc_via_onion {
sed -i "s/Ports = $IRC_PORT, $IRC_ONION_PORT/;Ports = $IRC_PORT, $IRC_ONION_PORT/1" /etc/ngircd/ngircd.conf sed -i "s/Ports = $IRC_PORT, $IRC_ONION_PORT/;Ports = $IRC_PORT, $IRC_ONION_PORT/1" /etc/ngircd/ngircd.conf
fi fi
fi fi
systemctl restart ngircd systemctl stop ngircd
sed -i 's|ExecStart.*|ExecStart=/usr/sbin/ngircd|g' /lib/systemd/system/ngircd.service
systemctl daemon-reload
systemctl start ngircd
dialog --title $"IRC Server" \ dialog --title $"IRC Server" \
--msgbox $"The IRC server can now be accessed via SSL at your main domain name" 8 50 --msgbox $"The IRC server can now be accessed via SSL at your main domain name" 8 50
else else
if grep -q ";Ports = $IRC_PORT, $IRC_ONION_PORT" /etc/ngircd/ngircd.conf; then if grep -q ";Ports = $IRC_PORT, $IRC_ONION_PORT" /etc/ngircd/ngircd.conf; then
sed -i "s/;Ports =.*/Ports = $IRC_PORT, $IRC_ONION_PORT/1" /etc/ngircd/ngircd.conf sed -i "s/;Ports =.*/Ports = $IRC_PORT, $IRC_ONION_PORT/1" /etc/ngircd/ngircd.conf
systemctl restart ngircd systemctl stop ngircd
sed -i 's|ExecStart.*|ExecStart=/usr/bin/torify /usr/sbin/ngircd|g' /lib/systemd/system/ngircd.service
systemctl daemon-reload
systemctl start ngircd
fi fi
dialog --title $"IRC Server" \ dialog --title $"IRC Server" \
--msgbox $"The IRC server can now be accessed via its onion address without SSL" 8 50 --msgbox $"The IRC server can now be accessed via its onion address without SSL" 8 50