Jump to content
Froxlor Forum

Froxlor 9.21 Fixit Script


Stephen

Recommended Posts

To keep my sites online I have had to execute the below script to work around Froxlor bugs. This script can be executed automatically whenever Froxlor updates the config files by going to "Server > Settings > Webserver reload command" and entering the path to this script in that field. This script assumes there is a glue record in the Bind9 zone file to get the IP numbers. A glue record is not something Froxlor automatically does yet. If you do not have one it is necessary to add one or alter this script.

 

Froxlor can be made to create a bind9 glue record for the name server by creating a subdomain for the nameserver as a work around. In my instance I created the ns1 subdomain for my site just as it is done for any subdomain for a site. I find that if I do not have a glue record my site's domain name never gets associated with its IP number and so cannot be accessed by its URL.

 

This script needs as the first argument the site's domain name. It assumes the nameserver has the ns1 subdomain. If you are using other than that this script must also be edited for that.

 

The script will take as an optional second argument the action lighttpd and bind9 are to take. The default is reload.

 

Do not forget to give this script execute permissions and to test this script before counting on it to work for you.

 

In addition to this script, if the recommended lighttpd.conf file has been copied and pasted from "Server > Configuration" it is necessary to delete or comment out the line:

include_shell "cat /etc/lighttpd/froxlor-diroptions/*.conf" 

This line is for a feature that does not yet work due to this issue:

http://redmine.froxlor.org/issues/803

 

#!/bin/bash
# Fix DNS Config Files

# Get the glue record of $1
line=`pcregrep "^ns1[\s]*?IN[\s]*?A[\s]*?(\d*?\.\d*?\.\d*?\.\d*)" /etc/bind/domains/"$1".zone` 

# Extract the IP address from the glue record 
ipadd=`expr "$line" : '[0-9A-Za-z]*[	 ]*IN[	 ]*A[	 ]*\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$\)'`

# Escape the dots with \
ipadd="${ipadd//./\\.}"
urlpat="${1//./\\.}"

# Sometimes Froxlor will put the nameserver URL instead of the IP numbers in the allow-transfer sections 
# of froxlor_bind.conf. This will cause bind9 config files to fail to load and bind9 will fail to start.
# Find the nameserver and replace with IP numbers:
perl -p -i -e "s/ns1\.$urlpat/$ipadd/g" /etc/bind/froxlor_bind.conf

# Add the + before = to all instances of "alias.url =" involving awstats-icon (This should be the second instance)
# Issue http://redmine.froxlor.org/issues/803 
find /etc/lighttpd/conf-enabled/vhosts -type f -exec perl -p -i -e 's/alias.url = \( \"\/awstats-icon/alias.url += \( \"\/awstats-icon/'  '{}' +

# Make the socket file settings consistent
# Issue http://redmine.froxlor.org/issues/804 
# Find the line that contains the location of the fcgi socket:
line=`pcregrep "^[^#][\s]*?\"socket\"[\s]*?=>" /etc/lighttpd/lighttpd.conf`

# Extract the socket file from the line:
socket=`expr "$line" : '[^=]*=>[^\"]*\"\([^\"]*\)'`
# Add socket number:
socket="${socket}-0"

# Insert socket into the vhost files:
find /etc/lighttpd/conf-enabled -type f -exec perl -p -i -e 's%\"socket\"[\s]*=>[^,]*\"%\"socket\" => \"/var/run/lighttpd/froxlor.panel-froxlor.jail4judges.info-php-fpm.socket-0\"%'  '{}' +

wait

if [ -n "$2" ] ; then
command=$2
else
command="reload"
fi

# Reload the configuration files
/etc/init.d/lighttpd $command
# If the socket already existed before restart or reload it gets deleted
# instead of created. This makes sure it exists before exiting.
i=0;
while (($i<30)); do
sleep 1
if [[ -S "$socket" ]]; then
break
fi
/etc/init.d/lighttpd "$command"
let i++;
done

/etc/init.d/bind9 "$command"

Link to comment
Share on other sites

  • 3 months later...

Update for the menu path to the "Webserver reload command" field: "Server > Settings > Webserver settings > Webserver reload command".

 

There is also a Bind9 reload command field that must also execute this script. It is found at:

"Server > Settings > Nameserver settings > Nameservers"

Link to comment
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...