LetsEncrypt Show Logs

Virtualizor logs every last request for renewal or installation of certificate. Use the LetsEncrypt Show Logs API to show the logs of the activity relating to the Let’s encrypt certificate i.e. certificate installation and certificate renewal. You can also view the current progress of certificate request using the Tasks API or at the Tasks page of the Virtualizor admin panel.

For more information, you can refer this Let’s Encrypt.

HTTP Request

https://hostname:4085/index.php?act=letsencrypt

Parameters

NameMethodValueDescriptionRequired
actGETletsencryptThe action specified to perform the operation and return dataYes
optPOSTshow_logsThis will return logs of letsencryptYes

Sample Code

<?php

    require_once('/usr/local/virtualizor/sdk/admin.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['opt'] = 'show_logs';

    $output = $admin->letsencrypt($post);

    print_r(json_encode($output));
?>

Output

{
    "title": "LetsEncrypt",
    "done": true,
    "crt_config_options": {
        "crt_save_cfg_frm": {
            "inputs": {
                "primary_domain": {
                    "type": "text",
                    "value": "hostname"
                },
                "contact_email": {
                    "type": "text",
                    "value": "specified_email"
                },
                "key_size": {
                    "type": "select",
                    "value": "2048"
                },
                "renew_days": {
                    "type": "text",
                    "value": 80
                },
                "staging": {
                    "type": "checkbox",
                    "value": 1
                },
                "enable_force": {
                    "type": "checkbox",
                    "value": 0
                }
            }
        }
    },
    "crt_details": {
        "crt_domain": "hostname",
        "crt_san": "DNS:hostname<br>",
        "crt_issuer": "Let's Encrypt Authority X3",
        "crt_serialno": "CERTSERIALNO",
        "crt_valid_from_time": "Sat, 12 Nov 2016 08:36:00 GMT",
        "crt_valid_to_time": "Fri, 10 Feb 2017 08:36:00 GMT",
        "next_renew": "Tue, 31 Jan 2017 09:35:52 GMT",
        "crt_installed": "<span style=\"color: green;\">Yes<\/span>"
    },
    "actid": null,
    "logs": "3677\n[Wed Nov 16 07:14:26 GMT 2016] Verifying information\n[Wed Nov 16 07:14:26 GMT 2016] Information verification complete, processing requested action\n[Wed Nov 16 07:14:26 GMT 2016] Requested action: get_crt\n[Wed Nov 16 07:14:26 GMT 2016] Checking whether domain hostname resolves to this server\n[Wed Nov 16 07:14:26 GMT 2016] Checking whether port 80 is available or not\n[Wed Nov 16 07:14:27 GMT 2016] Port 80 not available\n[Wed Nov 16 07:14:27 GMT 2016] Port 80 is used by Virtualizor Nginx service, we will use it for domain verification\n[Wed Nov 16 07:14:27 GMT 2016] Using webroot mode, webroot: \/usr\/local\/virtualizor\/enduser\n[Wed Nov 16 07:14:27 GMT 2016] Executing acme script with command: bash \/usr\/local\/virtualizor\/scripts\/acme.sh --issue --days 80 --home '\/usr\/local\/virtualizor\/conf\/le\/acme' --certhome '\/usr\/local\/virtualizor\/conf\/le\/acme\/certs' -d 'hostname' --webroot '\/usr\/local\/virtualizor\/enduser' --test --accountemail 'specified_email' --keylength '2048' >> '\/var\/virtualizor\/log\/letsencrypt.log' 2>&1\n[Wed Nov 16 07:14:27 GMT 2016] Using stage api:https:\/\/acme-staging.api.letsencrypt.org\n[Wed Nov 16 07:14:27 GMT 2016] Skip, Next renewal time is: \"Tue Jan 31 09:35:52 UTC 2017\"\n[Wed Nov 16 07:14:27 GMT 2016] Execution completed, ACME script returned value: 2\n[Wed Nov 16 07:14:27 GMT 2016] Skipped Get Certificate request, next renew on Tue, 31 Jan 2017 09:35:52 GMT\n[Wed Nov 16 07:14:27 GMT 2016] Checking whether certificate for primary domain exists\n[Wed Nov 16 07:14:27 GMT 2016] Verifying whether LetsEncrypt certficate is already installed\n[Wed Nov 16 07:14:27 GMT 2016] LetsEncrypt Certificate already installed, skipping installation\n[Wed Nov 16 07:14:27 GMT 2016] Processing failed, following errors were found : \nLetsEncrypt Certificate already installed, skipping installation\n",
    "timenow": "1480504710",
    "time_taken": "0.560"
}
Was this helpful to you?