Help - Search - Members - Calendar
Full Version: ENSIM Pro X automatic site creation possible?
The Planet Forums > Control Panels > Ensim > Ensim HOWTOs
zolex900
Maybe anyone knows...
Is it possible to create a virtual site on ENSIM Pro X without using actually the ENSIM. I mean with a somekind of external script?
Penguin
Yes, it can be done, however it depends on how you wish to accomplish this. Modernbill for example hooks into Ensim and can create accounts. There are various command line utils for Ensim that you could call using sudo for example.
James Jhurani
dig around in the source code, maybe you can find a .py file that can be called with some arguments to do this.
Penguin
If you're going to sue sudo, I would recommend just reading the technical reference guide on ENsim's website as this lists all fo the command line utilities to create & manage accounts
AdamS
QUOTE (Penguin @ Nov 5 2007, 08:00 AM) *
If you're going to sue sudo, I would recommend just reading the technical reference guide on ENsim's website as this lists all fo the command line utilities to create & manage accounts


As penguin said, use the technical reference guide.

Look at the syntax for AddVirtDomain, EditVirtDomain, DeleteVirtDomain in the guide.

I would also look into the sudo command if you are not familiar with it. Do a 'man sudo' for more info.
zolex900
QUOTE (AdamS @ Nov 5 2007, 02:27 PM) *
As penguin said, use the technical reference guide.

Look at the syntax for AddVirtDomain, EditVirtDomain, DeleteVirtDomain in the guide.

I would also look into the sudo command if you are not familiar with it. Do a 'man sudo' for more info.


Actually I am not. Thanks for your answer. Trying to look through it.
zolex900
Thanks to everybody.
I will try to figure it up.
zolex900
If anybody in the future needs it, here is how it can be done.
First of all you need a 'sudo' version to be installed on your system ('sudo' - is a program which allows you running root commands without actually being root. Pretty easy to find and install it. It's also preinstalled on much racks)
After that create a virtual plan through the ENSIM web interface. Let's call it Plan1.
Now we have to configure the sudo to work properly for us.
Open sudo configuration file using any SSH client under root:
CODE
pico /etc/sudoers

Find the following lines in the opened file :
CODE
## Command Aliases
## These are groups of related commands...

And after them add some code :
CODE
##ENSIM
Cmnd_Alias ENSIM = /usr/local/bin/AddVirtDomain

This is how we created a command alias which will be needed further for giving out permissions.
Now you will need to find this line
CODE
Defaults specification

and comment it, so it'll look like
CODE
#  Defaults specification

It'll prevent sudo of giving the error about TTY.
Now somewhere at the end of file insert the following code
CODE
## Allow apache to run AddVitDomain script
apache ALL=(ALL) NOPASSWD: ENSIM

Now save the file by quitting pico (Ctrl+x, answering Y about saving etc).
We are done with the shell part and we can run AddVirtDomain ENSIM script right from our PHP script.

AddVirtDomain has plenty of arguments, you can look through the technical docimentation for advanced use of it. I will show you how to create a virtual site, using a hosting plan, we have created (Plan1)

Here is an example PHP code you need:
CODE
<?php
$string_exec='/usr/bin/sudo /usr/local/bin/AddVirtDomain -p Plan1 -c siteinfo,domain=example.com,admin_user=username,tpasswd=password,email=my@email.
om';
exec($string_exec);
?>

Where
example.com - the desired domain name
username - site admin username
password - site admin password
my@email.com - site admin e-mail.

That's it.

I can also explain how to integrate all this with 2checkout for full automated solution. Just let me know.
xUx
QUOTE (zolex900 @ Nov 9 2007, 08:07 AM) *
If anybody in the future needs it, here is how it can be done.
First of all you need a 'sudo' version to be installed on your system ('sudo' - is a program which allows you running root commands without actually being root. Pretty easy to find and install it. It's also preinstalled on much racks)
After that create a virtual plan through the ENSIM web interface. Let's call it Plan1.
Now we have to configure the sudo to work properly for us.
Open sudo configuration file using any SSH client under root:
CODE
pico /etc/sudoers

Find the following lines in the opened file :
CODE
## Command Aliases
## These are groups of related commands...

And after them add some code :
CODE
##ENSIM
Cmnd_Alias ENSIM = /usr/local/bin/AddVirtDomain

This is how we created a command alias which will be needed further for giving out permissions.
Now you will need to find this line
CODE
Defaults specification

and comment it, so it'll look like
CODE
#  Defaults specification

It'll prevent sudo of giving the error about TTY.
Now somewhere at the end of file insert the following code
CODE
## Allow apache to run AddVitDomain script
apache ALL=(ALL) NOPASSWD: ENSIM

Now save the file by quitting pico (Ctrl+x, answering Y about saving etc).
We are done with the shell part and we can run AddVirtDomain ENSIM script right from our PHP script.

AddVirtDomain has plenty of arguments, you can look through the technical docimentation for advanced use of it. I will show you how to create a virtual site, using a hosting plan, we have created (Plan1)

Here is an example PHP code you need:
CODE
<?php
$string_exec='/usr/bin/sudo /usr/local/bin/AddVirtDomain -p Plan1 -c siteinfo,domain=example.com,admin_user=username,tpasswd=password,email=my@email.
om';
exec($string_exec);
?>

Where
example.com - the desired domain name
username - site admin username
password - site admin password
my@email.com - site admin e-mail.

That's it.

I can also explain how to integrate all this with 2checkout for full automated solution. Just let me know.



Now, what can you say about allowing "everyone" to mess up with your server? icon_wink.gif unless all your sites run in secure mode.

my 2 cents icon_smile.gif
AdamS
Sorry to bring back a thread from 08 but this is good topic for convo I think.

Here is my two cents:

For security, you could run a second apache server to handle the scripts which calls the ensim commands (giving the second apache server a unique username separate from the main server and using that unique user as the wheel user). After installing the second apache, just proxy a the second server or have the script call the second server on it's own port. I have this current setup on my ensim box. This way users cannot execute commands from their php scripts.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.