How To Disable Website By Config.conf File??

4 posts / 0 new
Last post
#1 Wed, 11/26/2008 - 00:16
freebrew

How To Disable Website By Config.conf File??

Since there is no billing feature with Virtualmin, I need to be able to enable/disable a particular website and webmin login via text.conf file but not sure the exact or best way to do so.

Somewhere in /etc/webmin/virtualmin??

I see a lot of .acl file but I did not come across the siteEnable=1 or adminLogin=1

Any ideas??

freebrew Out

Wed, 11/26/2008 - 00:45
Joe
Joe's picture

There's a comprehensive API for this exact purpose (which expanded out to include everything else in Virtualmin eventually, but it started out being for billing apps to be able to create, delete, enable, disable, etc. accounts).

The command you're looking for is "disable-domain", and it can be easily called using the virtualmin wrapper command:

virtualmin disable-domain --domain domain.tld --why "No moneys"

It is also available via the remote version of the API. There's huge swaths of documentation about this stuff (and all of the huge array of other functionality in the API) here:

http://www.virtualmin.com/documentation/id,command_line_api/

And:

http://www.virtualmin.com/documentation/id,remote_http_api/

Note that the commands are exactly the same between remote and CLI, so the remote docs only cover how to call them...not any of the specific commands or options.

--

Check out the forum guidelines!

Thu, 11/27/2008 - 04:41
freebrew

Thanks for your reply.

I have another question then.

I need to be able to use php to execute the domain-disable.pl.

I was trying to think of the best secure way to do this....

--Add the server php-web-user to the root group??
--Change permissions of the disable-domain.pl to the php-web-user??
--Somehow user php-ssh-shell(how) to run the command with password embedded??
--Run a cgi-perl script??

Any secure ideas?

Anything would help.

freebrew Out

Thu, 11/27/2008 - 14:35 (Reply to #3)
Joe
Joe's picture

That depends a lot on the situation, but I'd probably suggest using the remote API rather than making your PHP script run as root. This is almost certainly the simplest option.

You could also create a setuid script specifically for all of the root-level actions, if you really wanted it to happen via the command line. You'd, obviously, want to make sure that script was inaccessible to anyone other than the virtual server where your PHP application runs.

--

Check out the forum guidelines!

Topic locked