Plesk

On Plesk for Linux server, curl command in chrooted shell or in scheduled task fails: curl: (77) error setting certificate verify locations

Symptoms

Cause

The CA certificates are not added into the chrooted environment.

Resolution

Both for chrooted shell and scheduled tasks

  1. Connect to the server using SSH.

  2. Create directories for CA certificates in the chroot template:

    # mkdir -p /var/www/vhosts/chroot/etc/ssl/certs/
    # mkdir -p /var/www/vhosts/chroot/usr/share/ca-certificates/

  3. Copy the CA certificates to those directories:

    # cp -a /etc/ssl/certs/* /var/www/vhosts/chroot/etc/ssl/certs/
    # cp -a /usr/share/ca-certificates/* /var/www/vhosts/chroot/usr/share/ca-certificates/

  4. Update the chroot template by running below commands one by one:

    # curl -o update-chroot.sh https://raw.githubusercontent.com/plesk/kb-scripts/master/update-chroot/update-chroot.sh

    # chmod 700 update-chroot.sh

    # ./update-chroot.sh --apply all

Only for scheduled tasks

Change the shell for executing scheduled tasks:

  • In Plesk interface: go to Tools & Settings > Scheduled Tasks > Settings, change the parameter Crontab shell to /bin/bash, and click OK or Apply to save the changes.

  • In CLI:

    # plesk bin server_pref -u -crontab-secure-shell "/bin/bash"