• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

Issue [12.5.30] Event handler bug: mail account manipulation fails if username contains apostrophe

burnley

Regular Pleskian
Tested on 12.5.30 Update #69 on CentOS 7 with "mail account created" and "mail account deleted". We've just found that we can't use the Plesk event handler if the email username contains an apostrophe, e.g. o'[email protected]. When I create such an account in Plesk the handler registered in Plesk isn't executed. If the username is [email protected] there's no issue.
I know in the past Plesk couldn't manage email usernames containing apostrophe in the local part, but it's been fixed for quite some time. We need to be able to use the event handler for such usernames.
 
Attached a test python script, rename it as /usr/local/bin/emltest-arg.py, create /var/log/python directory and:
Test case 1:
- Add a "mail account created" handler with the command:
/usr/local/bin/emltest-arg.py add ${NEW_MAILNAME}
- Create o'[email protected] account in Plesk. Expected result: log entries /var/log/python/python-apps.log. Actual result: nothing in /var/log/python/python-apps.log
- Create [email protected] account in Plesk. Expected result: log entries /var/log/python/python-apps.log. Actual result: log entries /var/log/python/python-apps.log.
Test case 2:
- Add a "mail account created" handler with the command:
/usr/local/bin/emltest-arg.py add
- Create o'[email protected] account in Plesk. Expected result: log entries /var/log/python/python-apps.log. Actual result: log entries /var/log/python/python-apps.log.
It appears Plesk is tripping on the argument passed in the command line if it contains an apostrophe.
 

Attachments

  • emltest-arg.py.txt
    1.2 KB · Views: 1
I think that there is a problem in your python script.
I have created simple bash script /usr/local/bin/eventcheck.sh

# cat /usr/local/bin/eventcheck.sh
#!/bin/bash
echo "Customer account has been created. Name: ${NEW_MAILNAME}" >> /tmp/event_handler.log

and checked that mail creation event works fine for mailname with apostrophe with:

# tail -f /tmp/event_handler.log

Customer account has been created. Name: [email protected]
Customer account has been created. Name: o'[email protected]
 
Igor, what's the command you're using for the event handler? As per my test cases description:
1. If command is "/usr/local/bin/eventcheck.sh ${NEW_MAILNAME}" it won't work.
2. If command is "/usr/local/bin/eventcheck.sh" it will work.
 
I see, thanks.
I think that you could submit it to Reports as a question to developers. I will forward it and maybe they will help you to sort it out.
 
Igor, how do I submit it? In fact, how can I submit bugs to Plesk nowadays? I went to Plesk Help Center but I can't submit any issue, there's no button to click submit, perhaps I'm not entering the right information there.
 
To whom it may concern, I've changed the handler code to fetch NEW_MAILNAME from the environment and stripped ${NEW_MAILNAME} from the "mail account created" command. Instead of "mailbox add ${NEW_MAILNAME}" the command is now "mailbox add".
 
Back
Top