• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Problem with Event Manager & Script

M

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.
 
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:
Note:
For security reasons, you can transfer not encrypted passwords via environment
variable PSA_PASSWORD, by specifying the empty value in the command line for
the passwd arguments (like " -passwd ''") and setting the password value in
the PSA_PASSWORD variable.
Similarly, you can transfer the crypted password via the environment variable
PSA_CRYPTED_PASSWORD, by specifying the empty value in the command line for
the passwd arguments (like " -passwd ''") and by setting the password value in
the PSA_CRYPTED_PASSWORD variable.
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"
 
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)
/home/httpd/vhosts/234test.gr
domain: 234test.gr
login: fghasd
pass: xxxxxx


same...

Plesk support said :

Hello,

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..
 
/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" [/B]

with this no protected folder is created at all :(
 
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>

or

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.
 
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 ?


PSA_CRYPTED_PASSWORD = $3 ?
 
I tried anything i could think...
i cant fix it......
im desperate
 
I tried PSA_CRYPTED_PASSWORD = $3
I tried PSA_CRYPTED_CRYPTED_PASSWORD = $3

I tried PSA_CRYPTED_PASSWORD = <new_system_user_password>

nothin....
 
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.
 
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)
/home/httpd/vhosts/sip-info.gr
domain: sip-info.gr
login: marmar
pass:


ok I did sent you the email...
 
I have this same problem. I get xxxxxx for the password. Do you know how to fix this?
 
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

PSA_DOMAINNAME=$1
PSA_USERNAME=$2

# Note that this is the ` quote not the ' quote
PSA_PASSWORD=`
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;
eof`
# 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!!!!
 
That returns an encrypted password. No use for this script. Any other ideas?

mysql> SELECT a.password FROM accounts a, sys_users s WHERE login = 'username' and a.id = s.account_id;
+------------------------------------+
| $1$0p9gzRHG$YNZ9.y6Z8kVudZoluNN9H/ |
+------------------------------------+
1 row in set (0.00 sec)
 
Pay more attention to the script.
I didn't wrote only this line mysql> SELECT etc etc line.
 
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...
 
That returns an encrypted password.
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.
No use for this script.
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.
 
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).
 
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.
 
mysql> SELECT a.password, a.type FROM accounts a, sys_users s WHERE login = 'username' and a.id = s.account_id;
+------------------------------------+-------+
| $1$0p9gzRHG$YNZ9.y6Z8kVudZoluNN9H/ | crypt |
+------------------------------------+-------+
1 row in set (0.00 sec)

Bummer.

Thanks for all your help anyway.
 
Back
Top