Create new User with ssl on, but with ssl off for the new domain


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » SSL

Create new User with ssl on, but with ssl off for the new domainLast Modified: Jun 25, 2018, 12:14 pm
In some cases, you might want to create a new User and allow that User the ability to use SSL and SSL certificates, but don't want it turned on by default for the domain, to keep the VH count down.

This can be done with the user_create_post_confirmed.sh script.

So create:

/usr/local/directadmin/scripts/custom/user_create_post_confirmed.sh

with code

#!/bin/sh
CONF=/usr/local/directadmin/data/users/$username/domains/$domain.conf
if [ -s $CONF ]; then
   perl -pi -e 's/ssl=ON/ssl=OFF/' $CONF
   echo "action=rewrite&value=httpd&user=$username" >> /usr/local/directadmin/data/task.queue
fi
exit 0;

and chmod the script to 755.

This will shut off SSL for the new domain after the User is created, and rewrite their httpd.conf file up to 1 minute later, via task.queue (in case you're wondering why the 443 VH might still be added immediately after User creation).

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST