[pve-devel] Create a VM after receive a mail

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Mar 17 08:22:02 CET 2017


Hi,

On 03/16/2017 05:21 PM, Gilberto Nunes wrote:
> Hi guys...
>
> I am here thing about how can we add some news functionality to Proxmox.
> Going to that direction, I search something in the web, and found this:
>
> https://www.thecodingmachine.com/triggering-a-php-script-when-your-postfix-server-receives-a-mail/
>
>
> The idea is simple: after received a mail, the system will use some command
> to create a VM based in a template...

If this is useful and you may not do it in another way, you really need 
to make sure only your  mails trigger some action.
Else someone could send ten thousand mails and you script would create 
ten thousand VMs.
Also just checking the senders name isn't enough as this  can be 
spoofed/faked.

> What about this idea???

If you mean if it is doable, then yes, it is.
But to be honest, as email is not known for it's great security or 
reliability,
so using it as a trigger to modify a system can be problematic, IMHO.


What is the base problem you want to address? In which scenario you 
would use this?
Maybe we find another, more secure/fitting, way to achieve this.

> Is there any change to became true???

You can access our API through various language bindings, one of them, 
is PHP:
https://github.com/CpuID/pve2-api-php-client

Also a browsable API overview can be found here:
http://pve.proxmox.com/pve-docs/api-viewer/index.html

For creating a VM you would need to log into the API with an user that 
has VM creation permissions
and the trigger a POST request at

POST: /nodes/$NODENAME/qemu/ -vmid 12345 $PARAMETER

cheers,
Thomas

> I am here make some work for myself.
>
> Thanks for any help...
>





More information about the pve-devel mailing list