about summary refs log tree commit diff stats
path: root/bin
diff options
context:
space:
mode:
authorahriman <ahriman@falte.red>2019-04-24 23:44:37 +0000
committerahriman <ahriman@falte.red>2019-04-24 23:44:37 +0000
commit07c3b00510e5f73dafbb25a3315931b97a407432 (patch)
tree3495cb8739d4768daf5b09dc7a77840f8307bf1f /bin
parented6c29e020ce1359c284ad0939594f9922bced93 (diff)
downloadadmin-07c3b00510e5f73dafbb25a3315931b97a407432.tar.gz
sorting and deduplicating httpd-vusers.conf
Diffstat (limited to 'bin')
-rwxr-xr-xbin/makeuser13
1 files changed, 10 insertions, 3 deletions
diff --git a/bin/makeuser b/bin/makeuser
index 0081bbf..d8a3ac3 100755
--- a/bin/makeuser
+++ b/bin/makeuser
@@ -68,10 +68,17 @@ case $1 in
 		}
 	}" > /etc/httpd/$1.conf
 
-# add the user's vhost config to
-# the main httpd config then gracefully
-# reload the httpd config
+# add the user's vhost config to the bridged vhost config, which
+# is loaded by /etc/httpd.conf. This is necessary because httpd(8)
+# does not support globbing on includes
 	echo "include \"/etc/httpd/$1.conf\"" >> /etc/httpd-vusers.conf
+
+# Sort and deduplicate entries in the bridged vhost config file
+# Duplicate entries cause weird behavior. Subdomains after the
+# duplicated entry won't resolve properly and instead resolve
+# to the main site
+    sort -u /etc/httpd-vusers.conf > /etc/httpd-vusers.conf.sorted
+    cp /etc/httpd-vusers.conf.sorted /etc/httpd-vusers.conf
     pkill -HUP httpd
 
 # send welcome email