[one-users] Contextualisation: interpreted variable during vm creation

Ruben S. Montero rsmontero at opennebula.org
Thu Apr 12 07:52:56 PDT 2012


Hi,

I'm afraid that currently there is no way to escape the '$' character.
So OpenNebula is actually trying to substitute $1$9qqmIcc6$N4MpG by
the values of the variables 1, 9qqmIcc6 and N4MpG, which are not
defined.

You can either:

1.- Base64 encode the password (and decode it in the VM)
2.- Store the passwords in the user template

> oneuser update <use_id>

Then add in a varible like

VM_USERNAME = "user-2"
VM_PASSWORD = "$1$9qqmIcc6$N4MpGPRFm6tMLVocJAU011"

And in the VM template use

CONTEXT = [ HOSTNAME = "host-2",
            MYUSERNAME = "$USER[VM_USERNAME]",
            MYPASSWORD = "$USER[VM_PASSWORD]"  ]

This second method is the most flexible as you can create the same
template for a bunch of users and each one will use its own password.
Also you can defined a set of well-known fields in your setup e.g.
VM_PASSWORD, SSH_PUB_KEY, WEB_PASSWORD .... and prepare context
scripts that deals with your pre-defined user data....


Cheers

Ruben
On Thu, Apr 12, 2012 at 4:22 PM, Stéphane Bulot <stephane at altern-it.com> wrote:
> Hello,
>
> I'm trying to set encrypted (md5) user password in the context.sh file.
>
> Here is my context section of my vm template file.
> CONTEXT = [ HOSTNAME = "host-2",
>             MYUSERNAME = "user-2",
>             MYPASSWORD = '$1$9qqmIcc6$N4MpGPRFm6tMLVocJAU011'  ]
>
> My template is created without any problem. Unfortunatly, as I create the vm
> from this template, I get in my context.sh file
> HOSTNAME=host-2
> MYUSERNAME=user-2
> MYPASSWORD=''
> It means that MYPASSWORD string is interpreted. For example, if I have a md5
> password $1$9qqmIcc6$N4MpG/fizog, MYPASSWORD is '/fizog'
> I can not figure out what is the problem. Is there something obvious I
> missed?
>
> Thanks in advance for your help.
> Best regards.
>
> --
> Stéphane Bulot
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>

-- 
Ruben S. Montero, PhD
Project co-Lead and Chief Architect
OpenNebula - The Open Source Solution for Data Center Virtualization
www.OpenNebula.org | rsmontero at opennebula.org | @OpenNebula



More information about the Users mailing list