• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Event Parameters are empty

anasafi

New Pleskian
Server operating system version
CentOS Linux 7
Plesk version and microupdate number
18.0.41
I created an Event Handler for "SSL/TLS certificate on domain assigned/unassigned" event in Plesk Settings. However, the specified in the documentation Event Parameters (Event Parameters Passed by Event Handlers) are mostly empty with the exception of DOMAIN_ID and DOMAIN_NAME (new and old).

I'm passing the parameters in <> and then just trying to print them out:

Bash:
/root/ssl-copy-xmpp.sh <NEW_SSL_BINDING_TYPE> <NEW_DOMAIN_ID> <NEW_DOMAIN_NAME> <NEW_CERTIFICATE_ID> <NEW_CERTIFICATE_NAME> <NEW_CERTIFICATE_FILE> <OLD_CERTIFICATE_FILE>


cat /root/ssl-copy-xmpp.sh
#!/bin/bash
echo $1 >> /tmp/ssl-copy-xmpp.log
echo $2 >> /tmp/ssl-copy-xmpp.log
echo $3 >> /tmp/ssl-copy-xmpp.log
echo $4 >> /tmp/ssl-copy-xmpp.log
echo $5 >> /tmp/ssl-copy-xmpp.log
echo $6 >> /tmp/ssl-copy-xmpp.log
echo $7 >> /tmp/ssl-copy-xmpp.log


To test this, I reissue a Letsencrypt certificate through admin panel.


Result:
Code:
""
1
domain.com
""
""
""
""


Meanwhile, all those parameters seem to be available if I check Plesk action log. Is there something I'm doing wrong?
 
Seems like the documentation is a bit outdated in this regard. Here are the environment variables that are actually set up for this event handler by the underlying mechanism:
Code:
NEW_SSL_CERTIFICATE_BINDING_TYPE=WEB
OLD_SSL_CERTIFICATE_BINDING_TYPE=WEB
OLD_DOMAIN_NAME=example.com
NEW_DOMAIN_NAME=example.com
OLD_DOMAIN_ID=30
NEW_DOMAIN_ID=30
OLD_DOMAIN_GUID=41cdaa53-526e-427f-b41a-0f2af698b2dc
NEW_DOMAIN_GUID=41cdaa53-526e-427f-b41a-0f2af698b2dc
OLD_SSL_CERTIFICATE_FILE=scf7WELFT
NEW_SSL_CERTIFICATE_FILE=scf7WELFT
OLD_SSL_CERTIFICATE_NAME=Lets Encrypt example.com
NEW_SSL_CERTIFICATE_NAME=Lets Encrypt example.com
OLD_SSL_CERTIFICATE_ID=62
NEW_SSL_CERTIFICATE_ID=62
OLD_CLIENT_GUID=dffa724f-1719-458e-b10f-8e65b4403800
NEW_CLIENT_GUID=dffa724f-1719-458e-b10f-8e65b4403800

By the way, you can reference them directly in script instead of assigning them to positional parameters:
Bash:
#!/usr/bin/env bash

act_in_some_way "${NEW_DOMAIN_NAME}" "${NEW_SSL_CERTIFICATE_FILE}"

Anyway, I've sent info on this discrepancy to the Documentation Team, can't promise when it'll be fixed. As a W/A you can try dumping envvars into a file, like this:
Bash:
#!/usr/bin/env bash

env > /tmp/params # Or any other location

That will allow you to find out what actual parameters are passed to the script.
 
Back
Top