1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Problem with Event Manager & Script

Discussion in 'Plesk for Linux - 8.x and Older' started by MaRiOs, Aug 29, 2005.

  1. MaRiOs

    MaRiOs Guest

    I have added this event :

    On Physical hosting created
    do run this :

    /usr/local/psa/bin/protdir.sh -c locked -domain <new_domain_name> -type both -add_user <new_system_user> -passwd <new_system_user_password> -title "ssh key generator"

    the folder is created fine....
    the bad thing is it wont take the password of the ftp (the one you put when you create a new hosting)

    so I used this line in another script

    echo "domain: $1" >> /tmp/event_handler.log # information on the created client account
    echo "login: $2" >> /tmp/event_handler.log # information on the created client account
    echo "pass: $3" >> /tmp/event_handler.log # information on the created client account

    to See what login and password takes and I see this :
    the domain is right... the login is right..
    but as password I get xxxxx
    so I try to login into the password protected folder and i can login only with the right username and the xxxxx password and not the real one.
  2. jamesyeeoc

    jamesyeeoc Guest

    Just a thought, have you tried it with '-passwd_type crypt' ?

    /usr/local/psa/bin/protdir.sh -c locked -domain <new_domain_name> -type both -add_user <new_system_user> -passwd <new_system_user_password> -passwd_type crypt -title "ssh key generator"

    Hmm, also you may want to heed their note about password security:
    Which would mean modifying your script to put the password into one of the environment variables they mentioned and specifying a blank/null password on the command line:

    /usr/local/psa/bin/protdir.sh -c locked -domain <new_domain_name> -type both -add_user <new_system_user> -passwd '' -passwd_type crypt -title "ssh key generator"
  3. MaRiOs

    MaRiOs Guest

    Iused this as you said :

    /usr/local/psa/bin/protdir.sh -c locked -domain <new_domain_name> -type both -add_user <new_system_user> -passwd '' -passwd_type crypt -title "ssh key generator"

    and what Iget is :

    Tue Aug 30 13:05:01 CEST 2005
    uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
    domain: 234test.gr
    login: fghasd
    pass: xxxxxx


    Plesk support said :


    Fortunately, I cannot confirm this bug and everything works as it should be
    on our systems. Please make sure that PSA_PASSWORD variable was not defined
    in your system enviroment.

    and then they tell me to buy support etc..
  4. MaRiOs

    MaRiOs Guest

    with this no protected folder is created at all :(
  5. jamesyeeoc

    jamesyeeoc Guest

    But did you modify your script to put the password into one of the Environment Variables PSA_PASSWORD or PSA_CRYPTED_PASSWORD as the utility's note says? I just don't know if it's 'plain' or 'crypted'.

    So your script should store the password in a variable before doing the protdir.sh command.

    PSA_PASSWORD = <new_system_user_password>


    PSA_CRYPTED_PASSWORD = <new_system_user_password>

    then echo these out and see if either one shows the password, or still just shows xxxxx.

    Keep in mind I have not had a chance to actually try any of this, just going off of what 'should' be proper according to their utility's help info.
  6. MaRiOs

    MaRiOs Guest

    if commaind the event is

    /usr/local/psa/bin/ssh.sh <new_domain_name> <new_system_user> <new_system_user_password>

    shouldnt be like that ?

  7. MaRiOs

    MaRiOs Guest

    I tried anything i could think...
    i cant fix it......
    im desperate
  8. jamesyeeoc

    jamesyeeoc Guest

    Yes, my post was just a guide, not exact commands.....
  9. MaRiOs

    MaRiOs Guest


    I tried PSA_CRYPTED_PASSWORD = <new_system_user_password>

  10. jamesyeeoc

    jamesyeeoc Guest

    Did you do as I suggested and echo out the environment variable to see if it is still the 'xxxxx' which you posted earlier? If it is, then I'll have to find time to experiment/test it myself before posting further.

    Email me your entire script file.
  11. MaRiOs

    MaRiOs Guest

    I get this output :

    Tue Aug 30 16:31:52 CEST 2005
    uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
    domain: sip-info.gr
    login: marmar

    ok I did sent you the email...
  12. acidbox

    acidbox Guest

    I have this same problem. I get xxxxxx for the password. Do you know how to fix this?
  13. MaRiOs

    MaRiOs Guest

    The solution was like that :

    echo "--------------" >> /tmp/event_handler.log
    echo "Hosting Created" >> /tmp/event_handler.log
    echo "--------------" >> /tmp/event_handler.log
    /bin/date >> /tmp/event_handler.log
    /usr/bin/id >> /tmp/event_handler.log


    # Note that this is the ` quote not the ' quote
    mysql -uadmin -pyourpassword -N psa<< eof
    SELECT a.password FROM accounts a, sys_users s WHERE login LIKE '$PSA_USERNAME' and a.id = s.account_id;
    # Note that this is the ` quote, not the ' quote

    echo "domain: $PSA_DOMAINNAME" >>/tmp/event_handler.log
    echo "login: $PSA_USERNAME" >>/tmp/event_handler.log
    echo "pass: $PSA_PASSWORD" >>/tmp/event_handler.log
    echo "--------------" >> /tmp/event_handler.log
    echo ' '

    Credits to James!!!!
  14. acidbox

    acidbox Guest

    That returns an encrypted password. No use for this script. Any other ideas?

  15. MaRiOs

    MaRiOs Guest

    Pay more attention to the script.
    I didn't wrote only this line mysql> SELECT etc etc line.
  16. acidbox

    acidbox Guest

    Well before I impliment the script I want to make sure what its doing. That is why I ran a test on mysql to see what the query would return. Just because it is in another script it doesn't mean it's going to return a different result...
  17. jamesyeeoc

    jamesyeeoc Guest

    The script will return whatever password is in the mySQL database. If the password is encrypted, that is what it will return. If the password is plain text, then you will get plain text.
    Were you hoping that it would decrypt passwords? You have not said what end you are trying to get to...

    The purpose of this script is to lookup the existing password and return it for use in the rest of the script, rather than getting just 'xxxxxxx' from the Event Manager.
  18. acidbox

    acidbox Guest

    I created a script to automate the installation of some custom programs for shared host clients and I was hoping to create the admin account for those programs with the same username and password they use as their hosting account. However, I cannot find a way to get the raw password from the physical hosting creation process. It only returns xxxxxx.

    That said, I have resorted to using the username and a standard password (i.e. ChangeMe123) until I can find out how to get the real password from the creation process (if possible).
  19. jamesyeeoc

    jamesyeeoc Guest

    Right, and that is what this script does, it returns the 'raw' or 'as-is' password directly from the psa database. It was created to get around the fact that the Event Manager only returns a bunch of x's for security reasons.

    Ah, and if the accounts table entries are set for type = 'crypt' instead of 'plain', then that would explain why it is giving you the encrypted passwords (again it would be due to the passwords being stored in the table already encrypted).

    Try running this mysql command:

    SELECT a.password a.type FROM accounts a, sys_users s WHERE login = 'username' and a.id = s.account_id;

    if it returns 'crypt' for the passwords, then I think you're stuck.

    Sorry it didn't work for your needs.
  20. acidbox

    acidbox Guest


    Thanks for all your help anyway.