summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/ldap2apache32
-rwxr-xr-xbin/ldap2awstats4
-rwxr-xr-xbin/ldap2bind10
-rw-r--r--etc/config2
4 files changed, 23 insertions, 25 deletions
diff --git a/bin/ldap2apache b/bin/ldap2apache
index e976fae..5f961b5 100755
--- a/bin/ldap2apache
+++ b/bin/ldap2apache
@@ -26,6 +26,7 @@ clients = ldap.conn.search2(@config['basedn'], LDAP::LDAP_SCOPE_SUBTREE, 'object
@www_gid = @config['module']['apache']['www_gid']
@configtest = @config['module']['apache']['configtest']
@reload = @config['module']['apache']['reload']
+@statsbind = @config['module']['apache']['statsbind']
files = {}
@@ -186,6 +187,19 @@ clients.each{ |c|
config << " </Directory>"
end
config << " #{addto}" if addto
+ #
+ # webstats, part I - proxy to our second webserver
+ unless property['stats'] == "no"
+ config << ' Alias /awstats-classes/ "/usr/share/awstats/classes/"'
+ config << ' Alias /awstats-css/ "/usr/share/awstats/css/"'
+ config << ' Alias /awstats-icon/ "/usr/share/awstats/icon/"'
+ config << " <IfModule mod_proxy.c>"
+ config << " ProxyPass /webstats/ http://#{@statsbind}/"
+ config << " ProxyPassReverse /webstats/ http://#{@statsbind}/"
+ config << " ProxyPreserveHost on"
+ config << " </IfModule>"
+
+ end
config << "</VirtualHost>"
config << '# vim:ft=apache:'
throw "Clash on #{server_name} of client#{c['o'][0]}" if files[ c['o'][0] +"-"+ server_name ]
@@ -212,18 +226,11 @@ clients.each{ |c|
files[ c['o'][0] +"-"+ sn2 ] = config
end
#
- # webstats
- #config << " # Alias " + @webstat_location + " " + @rmagicdir + "/" + server_name + "/"
- #config << ' Alias /awstats-classes/ "/usr/share/awstats/classes/"'
- #config << ' Alias /awstats-css/ "/usr/share/awstats/css/"'
- #config << ' Alias /awstats-icon/ "/usr/share/awstats/icon/"'
- #config << " ScriptAlias /cgi-stats/awstats.pl /usr/lib/cgi-bin/awstats.pl"
- #config << " Redirect permanent " + @webstat_location + " http://"+server_name+"/cgi-stats/awstats.pl"
-
+ # webstats, part II - we need our own vhost since we can't have suexec enabled
unless property['stats'] == "no"
config = []
- config << "<VirtualHost #{bind}:#{bindhttpport}>"
- config << " ServerName stats.#{server_name}"
+ config << "<VirtualHost #{@statsbind}>"
+ config << " ServerName #{server_name}"
config << " ServerAdmin #{server_admin}"
config << " UserDir disabled"
config << " ErrorLog #{client_home}/logs/stats.#{server_name}-error.log"
@@ -234,9 +241,8 @@ clients.each{ |c|
config << ' Alias /awstats-classes/ "/usr/share/awstats/classes/"'
config << ' Alias /awstats-css/ "/usr/share/awstats/css/"'
config << ' Alias /awstats-icon/ "/usr/share/awstats/icon/"'
- config << " ScriptAlias /cgi-stats/awstats.pl /usr/lib/cgi-bin/awstats.pl"
- config << " RewriteEngine on"
- config << " RewriteRule ^/$ /cgi-stats/awstats.pl [L,R]"
+ config << " ScriptAlias /awstats.pl /usr/lib/cgi-bin/awstats.pl"
+ config << " ScriptAlias / /usr/lib/cgi-bin/awstats.pl"
config << "</VirtualHost>"
config << '# vim:ft=apache:'
diff --git a/bin/ldap2awstats b/bin/ldap2awstats
index 8ddab10..7f1d378 100755
--- a/bin/ldap2awstats
+++ b/bin/ldap2awstats
@@ -53,9 +53,9 @@ clients.each{ |c|
config << 'Include "/etc/awstats/awstats.conf"'
config << 'LogFile="zcat '+client_home+'/logs-archive/'+server_name+'-access*gz |"'
config << 'SiteDomain="'+server_name+'"'
- config << 'HostAliases="'+server_aliases+' '+server_name+' stats.'+server_name+'"'
+ config << 'HostAliases="'+server_aliases+' '+server_name+'"'
- files[ 'awstats.stats.'+server_name+'.conf' ] = config.join("\n") + "\n"
+ files[ 'awstats.'+server_name+'.conf' ] = config.join("\n") + "\n"
}
}
diff --git a/bin/ldap2bind b/bin/ldap2bind
index c245e60..139a4b0 100755
--- a/bin/ldap2bind
+++ b/bin/ldap2bind
@@ -180,16 +180,6 @@ magicItems.each { |m|
setAs(vhostalias, m['tnHost'], m['dn'][0])
}
end
- property = {}
- if m['tnWebVHostProperties']
- m['tnWebVHostProperties'].each{ |prop|
- (key, val) = prop.split('=', 2)
- property[key] = val
- }
- end
- unless property['stats'] == "no"
- setAs(m['tnWebVHostServerName'].map { |v| "stats."+v } , m['tnHost'], m['dn'][0])
- end
when 'tnDNSrr'
if m['tnDNSaRecord']
setAsDirect(m['tnDNSdomainname'], m['tnDNSaRecord'], m['dn'][0])
diff --git a/etc/config b/etc/config
index 2798a28..ae1a9c6 100644
--- a/etc/config
+++ b/etc/config
@@ -60,6 +60,8 @@ module:
configdir: /etc/apache2/sites-ldap
configtest: /usr/sbin/apache2 -t -E /dev/null
reload: /usr/sbin/apache2ctl graceful
+ # for webstats vhosts
+ statsbind: 127.0.0.1:2862
analog:
rmagic: /var/cache/analog/rmagic
output: /var/cache/analog/output