Configurable IRC port

This commit is contained in:
Bob Mottram 2015-08-09 14:05:24 +01:00
parent 482a120a19
commit 53938eee2c
1 changed files with 9 additions and 5 deletions

View File

@ -67,6 +67,7 @@ INSTALLING_FROM_CONFIGURATION_FILE="no"
CONFIGURATION_FILE="freedombone.cfg"
SSH_PORT=2222
IRC_PORT=6697
# parameters used when adding a new domain
DDNS_PROVIDER="default@freedns.afraid.org"
@ -749,6 +750,9 @@ function read_configuration {
fi
if [ -f $CONFIGURATION_FILE ]; then
if grep -q "IRC_PORT" $CONFIGURATION_FILE; then
IRC_PORT=$(grep "IRC_PORT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "WIFI_CHANNEL" $CONFIGURATION_FILE; then
WIFI_CHANNEL=$(grep "WIFI_CHANNEL" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
@ -1685,7 +1689,7 @@ function configure_avahi {
echo '<name replace-wildcards="yes">%h IRC</name>' >> /etc/avahi/services/irc.service
echo '<service>' >> /etc/avahi/services/irc.service
echo '<type>_irc._tcp</type>' >> /etc/avahi/services/irc.service
echo "<port>6697</port>" >> /etc/avahi/services/irc.service
echo "<port>$IRC_PORT</port>" >> /etc/avahi/services/irc.service
echo '</service>' >> /etc/avahi/services/irc.service
echo '</service-group>' >> /etc/avahi/services/irc.service
@ -5897,8 +5901,8 @@ function configure_firewall_for_irc {
# docker does its own firewalling
return
fi
iptables -A INPUT -i eth0 -p tcp --dport 6697 -j ACCEPT
iptables -I INPUT -i eth0 -p tcp --dport 1024:65535 --sport 6697 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport $IRC_PORT -j ACCEPT
iptables -I INPUT -i eth0 -p tcp --dport 1024:65535 --sport $IRC_PORT -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 9999 -j ACCEPT
save_firewall_settings
echo 'configure_firewall_for_irc' >> $COMPLETION_FILE
@ -8268,7 +8272,7 @@ function install_irc_server {
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
sed -i 's|;KeyFile = /etc/ssl/private/server.key|KeyFile = /etc/ssl/private/ngircd.key|g' /etc/ngircd/ngircd.conf
sed -i 's/;Ports = 6697, 9999/Ports = 6697, 9999/g' /etc/ngircd/ngircd.conf
sed -i "s/;Ports =.*/Ports = $IRC_PORT, 9999/g" /etc/ngircd/ngircd.conf
sed -i 's/;Name = #ngircd/Name = #freedombone/g' /etc/ngircd/ngircd.conf
sed -i 's/;Topic = Our ngircd testing channel/Topic = Freedombone chat channel/g' /etc/ngircd/ngircd.conf
sed -i 's/;MaxUsers = 23/MaxUsers = 23/g' /etc/ngircd/ngircd.conf
@ -8301,7 +8305,7 @@ 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 $DEFAULTDOMAIN 6697" >> /home/$MY_USERNAME/README
echo " /server add -auto -ssl $DEFAULTDOMAIN $IRC_PORT" >> /home/$MY_USERNAME/README
echo " /connect $DEFAULT_DOMAIN_NAME" >> /home/$MY_USERNAME/README
echo ' /join #freedombone' >> /home/$MY_USERNAME/README
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README