Smitty519

Member
Jun 15, 2008
12
0
51
We have several applications that need the services of mod_auth[nz]_external. Is there a supported way to install this module and not have to manually edit httpd.conf every time a new configuration is built?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
The better way to add any module that is dynamic is to use apxs to dynamically compile it:

Code:
cd /root
wget http://mod-auth-external.googlecode.com/files/mod_authnz_external-3.2.5.tar.gz
tar xzf mod_authnz_external-3.2.5.tar.gz 
cd mod_authnz_external-3.2.5
apxs -c mod_authnz_external.c
apxs -i -a mod_authnz_external.la
After doing the above, it will then put a "LoadModule" into /usr/local/apache/conf/httpd.conf file:

Code:
LoadModule authnz_external_module modules/mod_authnz_external.so
Normally, these type of modules can cause conflicts during EasyApache, so I would suggest moving it and distilling it. Remove the line from httpd.conf file, then run these commands:

Code:
echo "LoadModule authnz_external_module modules/mod_authnz_external.so" >> /usr/local/apache/conf/includes/pre_main_global.conf
cp /usr/local/apache/conf/httpd/conf /usr/local/apache/conf/httpd.conf.bak110818
/usr/local/cpanel/bin/apache_conf_distiller --update
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart
Copy the mod_authnz_external.so file to /root to save a copy of it, since future /scripts/easyapache recompiles will move the file out of /usr/local/apache/modules folder:

Code:
cp /usr/local/apache/modules/mod_authnz_external.so /root
Now, before you run /scripts/easyapache in the future, create these files:

Code:
vi /scripts/preeasyapache
Place the following content into the file:

Code:
#!/bin/bash

sed -i 's/LoadModule authnz_external_module/#LoadModule authnz_external_module/g' /usr/local/apache/conf/includes/pre_main_global.conf
Next, create this file:

Code:
vi /scripts/posteasyapache
Place the following content into the file:

Code:
#!/bin/bash

cp /root/mod_authnz_external.so /usr/local/apache/modules/
sed -i 's/#LoadModule authnz_external_module/LoadModule authnz_external_module/g' /usr/local/apache/conf/includes/pre_main_global.conf
/etc/init.d/httpd restart
The first script comments out the LoadModule in /usr/local/apache/conf/includes/pre_main_global.conf at the beginning of the Apache build. The second script copies mod_authnz_external.so back into /usr/local/apache/modules folder, uncomments the LoadModule, and restarts Apache at the end of the build.

After saving these files, ensure they can execute:

Code:
chmod +x /scripts/preeasyapache
chmod +x /scripts/posteasyapache