Execute certbot-auto command using perl system command


#1

Hello ,

I am working to automate the certificate create process upon selecting a domain from my drop-down list.

Server side programming i am using is in Perl Language.

I have used to create the certificate by use of system command as follows.

$command = /root/letsencrypt/./certbot-auto certonly --standalone -n -d ‘. $domainname .’ -w '. $webroot;

system($command);

But, it always throwing below error

Can’t exec “/root/letsencrypt/./certbot-auto”: Permission denied

Can anyone help on this please.

Thanks in advance
Rajkumar S


#2

Are you running your perl script as root?


#3

Yes, i am running as root user


#4

Try to run the command in your shell, if it works, there should be no permission problem.

/root/letsencrypt/./certbot-auto certificates


#5
No issues were found on this command

-------------------------------------------------------------------------------
Found the following certs:
  Certificate Name: mydomain.com
    Domains: mydomain.com
    Expiry Date: 2018-07-08 12:07:31+00:00 (INVALID: TEST_CERT)
    Certificate Path: /etc/letsencrypt/live/mydomain.com/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/mydomain.com/privkey.pem
-------------------------------------------------------------------------------


Let me check to find if any other issues 

Thanks

#6

If you can run the exact same command line on your shell, it must work with perl’s system() command, too.

Try the following in a perl script:

$command = “/root/letsencrypt/./certbot-auto certificates”;
system($command);


#7

@bytecamp

thanks .

The error was with my side as i am running the let’s encrypt service without root user. Now it has been corrected.

Thanks
Rajkumar S


#8

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.