Help Provisioning Virtual Server with SSL Capability

Hi Guys,

I am trying to provision through the Virtualmin API via WHMCS an account plan that has SSL permissions. Please see the attached image for the settings. In WHMCS when I try to provision this I get the following error:

SSL cannot be enabled for more than one domain on the IP address 69.33.169.228 unless a virtual IP interface or private port is enabled, or the certificate can be used for this domain. The current certificate is only valid for : *.xtremeservices.net, xtremeservices.net, and it is being used by members.xtremeservices.net.

I have setup a range of Static IPs and the proper subnet mask in the Server Template (See attached).

Is there a way to pass the API the instructions to allocate one of the available IPs when the server is provisioned? Or should this happen by default?

I appreciate any direction you can give on this,

~Jeremy

Status: 
Active

Comments

It sounds like WHMCS isn't calling the API with the parameter allocate-ip , which will force allocation of a new IP address for the domain. Allocation is done from the range set at System Settings -> Server Templates -> Default Settings -> Virtual IP Address.

Hi Jamie,

Matt at WHMCS has confirmed that they are not using that API parameter at all. Where can I find the documentation for this parameter (Or maybe can you provide an example of useage) so I can relay it to him to add into WHMCS.

Thanks,

~Jeremy

Hi Jeremy -- if you're interested in using the Virtualmin API to allocate a new IP address for a Virtual Server, rather than defaulting to a shared IP address, you could do that by passing in the --allocate-ip or the --ip option when calling "virtualmin create-domain".

You can run "virtualmin create-domain" by itself to see a list of available parameters, but some examples are:

# Allocate a specific IP
virtualmin create-domain --domain example.tld --ip 1.2.3.4 ...

# Allocate an IP from an existing pool (setup in the Server Templates as Jamie described above)
virtualmin create-domain --domain example.tld --allocate-ip ...

There's online documentation for this available here:

https://www.virtualmin.com/documentation/developer/cli/create_domain

If you have any other questions, feel free to let us know!

Thank you Eric,

I have sent this information to Matt at WHMCS. Hopefully there will be support for this on a per product basis in the next release of WHMCS. I will keep you posted.

WOOT! : )

~Jeremy

Great, let us know if there's anything else we can do to help!

Good news guys, Matt at WHMCS has added support for per Hosting Product Dedicated IP allocation (see attachment).

The bad news, is that when this new parameter is passed I am getting an error in WHMCS and no virtual server is created.

URL: https://www.xtremeservices.net:10000/virtual-server/remote.cgi?

Data: program=create-domain&domain=jeremiahbrock.com&user=jeremiahbrock.com&pass=5X7C3huh3g&email=jbrock%40brockcomputers.biz&template=Standard&plan=Premium&allocate-ip=&features-from-plan=&

Response: Failed to allocate IP address from ranges!

Adds a new Virtualmin virtual server, with the settings and features
specified on the command line.

virtualmin create-domain --domain domain.name
                         --pass password-for-unix-user |
                         --passfile password-file
                        [--parent domain.name | --alias domain.name |
                         --superdom domain.name]
                        [--desc description-for-domain]
                        [--email contact-email]
                        [--user new-unix-user]
                        [--group new-unix-group]
                        [--unix]
                        [--dir]
                        [--dns]
                        [--mail]
                        [--web]
                        [--webalizer]
                        [--ssl]
                        [--logrotate]
                        [--mysql]
                        [--spam]
                        [--virus]
                        [--webmin]
                        [--virtualmin-awstats]
                        [--virtualmin-google-analytics]
                        [--virtualmin-mailman]
                        [--default-features] | [--features-from-plan]
                        [--allocate-ip | --ip virtual.ip.address |
                         --shared-ip existing.ip.address]
                        [--ip-already]
                        [--allocate-ip6 |
                         --ip6 virtual.ip.address]
                        [--ip6-already]
                        [--dns-ip address | --no-dns-ip]
                        [--max-doms domains|*]
                        [--max-aliasdoms domains]
                        [--max-realdoms domains]
                        [--max-mailboxes boxes]
                        [--max-dbs databases]
                        [--max-aliases aliases]
                        [--quota quota-for-domain|UNLIMITED]
                        [--uquota quota-for-unix-user|UNLIMITED]
                        [--bandwidth bytes]
                        [--template "name"]
                        [--plan "name"]
                        [--limits-from-plan]
                        [--prefix username-prefix]
                        [--db database-name]
                        [--fwdto email-address]
                        [--reseller name]
                        [--style name]
                        [--content text|filename]
                        [--mysql-pass password]
                        [--skip-warnings]
                        [--field-name value]*

Exit status: 256

I am trying to debug where the error is originating and wanted to ask you guys where to monitor for errors through the remote.cgi.

Thx,

~Jeremy

This could happen if you have defined an IP range to allocate addresses from, but they are all in use already. Check your range at System Settings -> Server Templates -> Default Settings -> Virtual IP Addresses. Make sure that the IPs in the range have not been activated on your system yet .. Virtualmin will do this automatically as needed.

Wow you hit the nail on the head Jamie!

Apparently in my testing last week I had manually added all of the IP addresses and then thought I had removed them, but I had only removed them from the on boot settings not the "Active Now" and had not rebooted since.

So now the server is being created with the IP! BUT : ( Apache 2 never starts back up on it's own during the creation process. I have to manually restart it in Webmin.

When removing the same virtual server (through the api) it also fails to restart Apache2... This is something completely new.

The only hint I found is in apache2/error.log

[Wed Aug 24 10:56:07 2011] [warn] child process 4023 still did not exit, sending a SIGTERM
[Wed Aug 24 10:56:09 2011] [warn] child process 4023 still did not exit, sending a SIGTERM
[Wed Aug 24 10:56:11 2011] [notice] caught SIGTERM, shutting down
[Wed Aug 24 10:56:35 2011] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Wed Aug 24 10:56:35 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Wed Aug 24 10:56:35 2011] [notice] Digest: generating secret for digest authentication ...
[Wed Aug 24 10:56:35 2011] [notice] Digest: done
[Wed Aug 24 10:56:35 2011] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Wed Aug 24 10:56:35 2011] [notice] Apache/2.2.14 (Ubuntu) DAV/2 mod_fcgid/2.3.4 mod_ssl/2.2.14 OpenSSL/0.9.8k mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations

Notice that the [warn] Init: that occurs at 10:56:35 is my manual start of Apache2 in Webmin. So it appears that Apache2 isn't actually attempting to restart..

If I create a Server that doesn't try to allocate an IP it works great and Apache2 doesn't stay offline. Here might be a clue, in the error.log I see (for the successful creation)

[Wed Aug 24 11:05:31 2011] [notice] SIGUSR1 received.  Doing graceful restart

~Jeremy

This could be due to a problem in the Apache restart script.

If you do a restart from the shell with a command like /etc/init.d/apache2 restart , does it come back up?

Hi Jamie,

I performed a /etc/init.d/apache2 restart and it came back no issues.

Would it be helpful to login to my server?

~Jeremy