migrated ssl-editor; also usable as admin now

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-03-16 13:54:57 +01:00
parent 401eb60062
commit d30c9a2ff7
6 changed files with 133 additions and 141 deletions

View File

@@ -665,6 +665,9 @@ if ($page == 'domains' || $page == 'overview') {
UI::twigOutputBuffer(); UI::twigOutputBuffer();
} }
} }
} elseif ($page == 'domainssleditor') {
require_once __DIR__ . '/ssl_editor.php';
} elseif ($page == 'domaindnseditor' && Settings::Get('system.dnsenabled') == '1') { } elseif ($page == 'domaindnseditor' && Settings::Get('system.dnsenabled') == '1') {
require_once __DIR__ . '/dns_editor.php'; require_once __DIR__ . '/dns_editor.php';

View File

@@ -19,7 +19,6 @@
const AREA = 'customer'; const AREA = 'customer';
require __DIR__ . '/lib/init.php'; require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\Certificates as Certificates;
use Froxlor\Api\Commands\SubDomains as SubDomains; use Froxlor\Api\Commands\SubDomains as SubDomains;
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
@@ -357,63 +356,7 @@ if ($page == 'overview' || $page == 'domains') {
} }
} elseif ($page == 'domainssleditor') { } elseif ($page == 'domainssleditor') {
if ($action == '' || $action == 'view') { require_once __DIR__ . '/ssl_editor.php';
// get domain
try {
$json_result = SubDomains::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result_domain = json_decode($json_result, true)['data'];
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$do_insert = isset($_POST['do_insert']) ? (($_POST['do_insert'] == 1) ? true : false) : false;
try {
if ($do_insert) {
Certificates::getLocal($userinfo, $_POST)->add();
} else {
Certificates::getLocal($userinfo, $_POST)->update();
}
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
// back to domain overview
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => 'domains'
));
}
$stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "`
WHERE `domainid`= :domainid");
$result = Database::pexecute_first($stmt, array(
"domainid" => $id
));
$do_insert = false;
// if no entry can be found, behave like we have empty values
if (!is_array($result) || !isset($result['ssl_cert_file'])) {
$result = array(
'ssl_cert_file' => '',
'ssl_key_file' => '',
'ssl_ca_file' => '',
'ssl_cert_chainfile' => ''
);
$do_insert = true;
}
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$ssleditor_data = include_once dirname(__FILE__) . '/lib/formfields/customer/domains/formfield.domain_ssleditor.php';
$ssleditor_form = \Froxlor\UI\HtmlForm::genHTMLForm($ssleditor_data);
$title = $ssleditor_data['domain_ssleditor']['title'];
$image = $ssleditor_data['domain_ssleditor']['image'];
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domain_ssleditor") . "\";");
}
} elseif ($page == 'domaindnseditor' && $userinfo['dnsenabled'] == '1' && Settings::Get('system.dnsenabled') == '1') { } elseif ($page == 'domaindnseditor' && $userinfo['dnsenabled'] == '1' && Settings::Get('system.dnsenabled') == '1') {
require_once __DIR__ . '/dns_editor.php'; require_once __DIR__ . '/dns_editor.php';
@@ -424,52 +367,3 @@ if ($page == 'overview' || $page == 'domains') {
require_once __DIR__ . '/logfiles_viewer.php'; require_once __DIR__ . '/logfiles_viewer.php';
} }
function formatDomainEntry(&$row, &$idna_convert)
{
$row['domain'] = $idna_convert->decode($row['domain']);
$row['aliasdomain'] = $idna_convert->decode($row['aliasdomain']);
$row['domainalias'] = $idna_convert->decode($row['domainalias']);
/**
* check for set ssl-certs to show different state-icons
*/
// nothing (ssl_global)
$row['domain_hascert'] = 0;
$ssl_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` WHERE `domainid` = :domainid");
Database::pexecute($ssl_stmt, array(
"domainid" => $row['id']
));
$ssl_result = $ssl_stmt->fetch(PDO::FETCH_ASSOC);
if (is_array($ssl_result) && isset($ssl_result['ssl_cert_file']) && $ssl_result['ssl_cert_file'] != '') {
// own certificate (ssl_customer_green)
$row['domain_hascert'] = 1;
} else {
// check if it's parent has one set (shared)
if ($row['parentdomainid'] != 0) {
$ssl_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` WHERE `domainid` = :domainid");
Database::pexecute($ssl_stmt, array(
"domainid" => $row['parentdomainid']
));
$ssl_result = $ssl_stmt->fetch(PDO::FETCH_ASSOC);
if (is_array($ssl_result) && isset($ssl_result['ssl_cert_file']) && $ssl_result['ssl_cert_file'] != '') {
// parent has a certificate (ssl_shared)
$row['domain_hascert'] = 2;
}
}
}
$row['termination_date'] = str_replace("0000-00-00", "", $row['termination_date']);
$row['termination_css'] = "";
if ($row['termination_date'] != "") {
$cdate = strtotime($row['termination_date'] . " 23:59:59");
$today = time();
if ($cdate < $today) {
$row['termination_css'] = 'domain-expired';
} else {
$row['termination_css'] = 'domain-canceled';
}
}
}

View File

@@ -182,14 +182,14 @@ return array(
'visible' => \Froxlor\Settings::Get('system.use_ssl') == '1' ? true : false, 'visible' => \Froxlor\Settings::Get('system.use_ssl') == '1' ? true : false,
'fields' => array( 'fields' => array(
'sslenabled' => array( 'sslenabled' => array(
'visible' => ($ssl_ipsandports != '' ? true : false), 'visible' => (!empty($ssl_ipsandports) ? true : false),
'label' => $lng['admin']['domain_sslenabled'], 'label' => $lng['admin']['domain_sslenabled'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',
'checked' => true 'checked' => true
), ),
'no_ssl_available_info' => array( 'no_ssl_available_info' => array(
'visible' => ($ssl_ipsandports == '' ? true : false), 'visible' => (!empty($ssl_ipsandports) ? true : false),
'label' => 'SSL', 'label' => 'SSL',
'type' => 'label', 'type' => 'label',
'value' => $lng['panel']['nosslipsavailable'] 'value' => $lng['panel']['nosslipsavailable']
@@ -203,7 +203,7 @@ return array(
'is_array' => 1 'is_array' => 1
), ),
'ssl_redirect' => array( 'ssl_redirect' => array(
'visible' => ($ssl_ipsandports != '' ? true : false), 'visible' => (!empty($ssl_ipsandports) ? true : false),
'label' => $lng['domains']['ssl_redirect']['title'], 'label' => $lng['domains']['ssl_redirect']['title'],
'desc' => $lng['domains']['ssl_redirect']['description'], 'desc' => $lng['domains']['ssl_redirect']['description'],
'type' => 'checkbox', 'type' => 'checkbox',
@@ -211,7 +211,7 @@ return array(
'checked' => false 'checked' => false
), ),
'letsencrypt' => array( 'letsencrypt' => array(
'visible' => (\Froxlor\Settings::Get('system.leenabled') == '1' ? ($ssl_ipsandports != '' ? true : false) : false), 'visible' => (\Froxlor\Settings::Get('system.leenabled') == '1' ? (!empty($ssl_ipsandports) ? true : false) : false),
'label' => $lng['admin']['letsencrypt']['title'], 'label' => $lng['admin']['letsencrypt']['title'],
'desc' => $lng['admin']['letsencrypt']['description'], 'desc' => $lng['admin']['letsencrypt']['description'],
'type' => 'checkbox', 'type' => 'checkbox',
@@ -219,7 +219,7 @@ return array(
'checked' => false 'checked' => false
), ),
'http2' => array( 'http2' => array(
'visible' => ($ssl_ipsandports != '' ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' && \Froxlor\Settings::Get('system.http2_support') == '1', 'visible' => (!empty($ssl_ipsandports) ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' && \Froxlor\Settings::Get('system.http2_support') == '1',
'label' => $lng['admin']['domain_http2']['title'], 'label' => $lng['admin']['domain_http2']['title'],
'desc' => $lng['admin']['domain_http2']['description'], 'desc' => $lng['admin']['domain_http2']['description'],
'type' => 'checkbox', 'type' => 'checkbox',
@@ -227,14 +227,14 @@ return array(
'checked' => false 'checked' => false
), ),
'override_tls' => array( 'override_tls' => array(
'visible' => (($ssl_ipsandports != '' ? true : false) && $userinfo['change_serversettings'] == '1' ? true : false), 'visible' => ((!empty($ssl_ipsandports) ? true : false) && $userinfo['change_serversettings'] == '1' ? true : false),
'label' => $lng['admin']['domain_override_tls'], 'label' => $lng['admin']['domain_override_tls'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',
'checked' => false 'checked' => false
), ),
'ssl_protocols' => array( 'ssl_protocols' => array(
'visible' => (($ssl_ipsandports != '' ? true : false) && $userinfo['change_serversettings'] == '1' && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' ? true : false), 'visible' => ((!empty($ssl_ipsandports) ? true : false) && $userinfo['change_serversettings'] == '1' && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' ? true : false),
'label' => $lng['serversettings']['ssl']['ssl_protocols']['title'], 'label' => $lng['serversettings']['ssl']['ssl_protocols']['title'],
'desc' => $lng['serversettings']['ssl']['ssl_protocols']['description'], 'desc' => $lng['serversettings']['ssl']['ssl_protocols']['description'],
'type' => 'checkbox', 'type' => 'checkbox',
@@ -262,21 +262,21 @@ return array(
'is_array' => 1 'is_array' => 1
), ),
'ssl_cipher_list' => array( 'ssl_cipher_list' => array(
'visible' => (($ssl_ipsandports != '' ? true : false) && $userinfo['change_serversettings'] == '1' ? true : false), 'visible' => ((!empty($ssl_ipsandports) ? true : false) && $userinfo['change_serversettings'] == '1' ? true : false),
'label' => $lng['serversettings']['ssl']['ssl_cipher_list']['title'], 'label' => $lng['serversettings']['ssl']['ssl_cipher_list']['title'],
'desc' => $lng['serversettings']['ssl']['ssl_cipher_list']['description'], 'desc' => $lng['serversettings']['ssl']['ssl_cipher_list']['description'],
'type' => 'text', 'type' => 'text',
'value' => \Froxlor\Settings::Get('system.ssl_cipher_list') 'value' => \Froxlor\Settings::Get('system.ssl_cipher_list')
), ),
'tlsv13_cipher_list' => array( 'tlsv13_cipher_list' => array(
'visible' => (($ssl_ipsandports != '' ? true : false) && $userinfo['change_serversettings'] == '1' && \Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1 ? true : false), 'visible' => ((!empty($ssl_ipsandports) ? true : false) && $userinfo['change_serversettings'] == '1' && \Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1 ? true : false),
'label' => $lng['serversettings']['ssl']['tlsv13_cipher_list']['title'], 'label' => $lng['serversettings']['ssl']['tlsv13_cipher_list']['title'],
'desc' => $lng['serversettings']['ssl']['tlsv13_cipher_list']['description'], 'desc' => $lng['serversettings']['ssl']['tlsv13_cipher_list']['description'],
'type' => 'text', 'type' => 'text',
'value' => \Froxlor\Settings::Get('system.tlsv13_cipher_list') 'value' => \Froxlor\Settings::Get('system.tlsv13_cipher_list')
), ),
'ssl_specialsettings' => array( 'ssl_specialsettings' => array(
'visible' => (($ssl_ipsandports != '' ? true : false) && $userinfo['change_serversettings'] == '1' ? true : false), 'visible' => ((!empty($ssl_ipsandports) ? true : false) && $userinfo['change_serversettings'] == '1' ? true : false),
'label' => $lng['admin']['ownsslvhostsettings'], 'label' => $lng['admin']['ownsslvhostsettings'],
'desc' => $lng['serversettings']['default_vhostconf']['description'], 'desc' => $lng['serversettings']['default_vhostconf']['description'],
'type' => 'textarea', 'type' => 'textarea',
@@ -284,7 +284,7 @@ return array(
'rows' => 12 'rows' => 12
), ),
'include_specialsettings' => array( 'include_specialsettings' => array(
'visible' => (($ssl_ipsandports != '' ? true : false) && $userinfo['change_serversettings'] == '1' ? true : false), 'visible' => ((!empty($ssl_ipsandports) ? true : false) && $userinfo['change_serversettings'] == '1' ? true : false),
'label' => $lng['admin']['include_ownvhostsettings'], 'label' => $lng['admin']['include_ownvhostsettings'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',
@@ -300,7 +300,7 @@ return array(
'value' => 0 'value' => 0
), ),
'hsts_sub' => array( 'hsts_sub' => array(
'visible' => ($ssl_ipsandports != '' ? true : false), 'visible' => (!empty($ssl_ipsandports) ? true : false),
'label' => $lng['admin']['domain_hsts_incsub']['title'], 'label' => $lng['admin']['domain_hsts_incsub']['title'],
'desc' => $lng['admin']['domain_hsts_incsub']['description'], 'desc' => $lng['admin']['domain_hsts_incsub']['description'],
'type' => 'checkbox', 'type' => 'checkbox',
@@ -308,7 +308,7 @@ return array(
'checked' => false 'checked' => false
), ),
'hsts_preload' => array( 'hsts_preload' => array(
'visible' => ($ssl_ipsandports != '' ? true : false), 'visible' => (!empty($ssl_ipsandports) ? true : false),
'label' => $lng['admin']['domain_hsts_preload']['title'], 'label' => $lng['admin']['domain_hsts_preload']['title'],
'desc' => $lng['admin']['domain_hsts_preload']['description'], 'desc' => $lng['admin']['domain_hsts_preload']['description'],
'type' => 'checkbox', 'type' => 'checkbox',
@@ -316,7 +316,7 @@ return array(
'checked' => false 'checked' => false
), ),
'ocsp_stapling' => array( 'ocsp_stapling' => array(
'visible' => ($ssl_ipsandports != '' ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd', 'visible' => (!empty($ssl_ipsandports) ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd',
'label' => $lng['admin']['domain_ocsp_stapling']['title'], 'label' => $lng['admin']['domain_ocsp_stapling']['title'],
'desc' => $lng['admin']['domain_ocsp_stapling']['description'] . (\Froxlor\Settings::Get('system.webserver') == 'nginx' ? $lng['admin']['domain_ocsp_stapling']['nginx_version_warning'] : ""), 'desc' => $lng['admin']['domain_ocsp_stapling']['description'] . (\Froxlor\Settings::Get('system.webserver') == 'nginx' ? $lng['admin']['domain_ocsp_stapling']['nginx_version_warning'] : ""),
'type' => 'checkbox', 'type' => 'checkbox',
@@ -324,14 +324,14 @@ return array(
'checked' => false 'checked' => false
), ),
'honorcipherorder' => array( 'honorcipherorder' => array(
'visible' => ($ssl_ipsandports != '' ? true : false), 'visible' => (!empty($ssl_ipsandports) ? true : false),
'label' => $lng['admin']['domain_honorcipherorder'], 'label' => $lng['admin']['domain_honorcipherorder'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',
'checked' => false 'checked' => false
), ),
'sessiontickets' => array( 'sessiontickets' => array(
'visible' => ($ssl_ipsandports != '' ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' && \Froxlor\Settings::Get('system.sessionticketsenabled' != '1'), 'visible' => (!empty($ssl_ipsandports) ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' && \Froxlor\Settings::Get('system.sessionticketsenabled' != '1'),
'label' => $lng['admin']['domain_sessiontickets'], 'label' => $lng['admin']['domain_sessiontickets'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',

View File

@@ -209,14 +209,14 @@ return array(
'visible' => \Froxlor\Settings::Get('system.use_ssl') == '1' ? true : false, 'visible' => \Froxlor\Settings::Get('system.use_ssl') == '1' ? true : false,
'fields' => array( 'fields' => array(
'sslenabled' => array( 'sslenabled' => array(
'visible' => ($ssl_ipsandports != '' ? true : false), 'visible' => (!empty($ssl_ipsandports) ? true : false),
'label' => $lng['admin']['domain_sslenabled'], 'label' => $lng['admin']['domain_sslenabled'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',
'checked' => $result['ssl_enabled'] 'checked' => $result['ssl_enabled']
), ),
'no_ssl_available_info' => array( 'no_ssl_available_info' => array(
'visible' => ($ssl_ipsandports == '' ? true : false), 'visible' => (empty($ssl_ipsandports) ? true : false),
'label' => 'SSL', 'label' => 'SSL',
'type' => 'label', 'type' => 'label',
'value' => $lng['panel']['nosslipsavailable'] 'value' => $lng['panel']['nosslipsavailable']
@@ -230,7 +230,7 @@ return array(
'is_array' => 1 'is_array' => 1
), ),
'ssl_redirect' => array( 'ssl_redirect' => array(
'visible' => ($ssl_ipsandports != '' ? true : false), 'visible' => (!empty($ssl_ipsandports) ? true : false),
'label' => $lng['domains']['ssl_redirect']['title'], 'label' => $lng['domains']['ssl_redirect']['title'],
'desc' => $lng['domains']['ssl_redirect']['description'] . ($result['temporary_ssl_redirect'] > 1 ? $lng['domains']['ssl_redirect_temporarilydisabled'] : ''), 'desc' => $lng['domains']['ssl_redirect']['description'] . ($result['temporary_ssl_redirect'] > 1 ? $lng['domains']['ssl_redirect_temporarilydisabled'] : ''),
'type' => 'checkbox', 'type' => 'checkbox',
@@ -238,7 +238,7 @@ return array(
'checked' => $result['ssl_redirect'] 'checked' => $result['ssl_redirect']
), ),
'letsencrypt' => array( 'letsencrypt' => array(
'visible' => (\Froxlor\Settings::Get('system.leenabled') == '1' ? ($ssl_ipsandports != '' ? true : false) : false), 'visible' => (\Froxlor\Settings::Get('system.leenabled') == '1' ? (!empty($ssl_ipsandports) ? true : false) : false),
'label' => $lng['admin']['letsencrypt']['title'], 'label' => $lng['admin']['letsencrypt']['title'],
'desc' => $lng['admin']['letsencrypt']['description'], 'desc' => $lng['admin']['letsencrypt']['description'],
'type' => 'checkbox', 'type' => 'checkbox',
@@ -246,7 +246,7 @@ return array(
'checked' => $result['letsencrypt'] 'checked' => $result['letsencrypt']
), ),
'http2' => array( 'http2' => array(
'visible' => ($ssl_ipsandports != '' ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' && \Froxlor\Settings::Get('system.http2_support') == '1', 'visible' => (!empty($ssl_ipsandports) ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' && \Froxlor\Settings::Get('system.http2_support') == '1',
'label' => $lng['admin']['domain_http2']['title'], 'label' => $lng['admin']['domain_http2']['title'],
'desc' => $lng['admin']['domain_http2']['description'], 'desc' => $lng['admin']['domain_http2']['description'],
'type' => 'checkbox', 'type' => 'checkbox',
@@ -254,14 +254,14 @@ return array(
'checked' => $result['http2'] 'checked' => $result['http2']
), ),
'override_tls' => array( 'override_tls' => array(
'visible' => (($ssl_ipsandports != '' ? true : false) && $userinfo['change_serversettings'] == '1' ? true : false), 'visible' => ((!empty($ssl_ipsandports) ? true : false) && $userinfo['change_serversettings'] == '1' ? true : false),
'label' => $lng['admin']['domain_override_tls'], 'label' => $lng['admin']['domain_override_tls'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',
'checked' => $result['override_tls'] 'checked' => $result['override_tls']
), ),
'ssl_protocols' => array( 'ssl_protocols' => array(
'visible' => (($ssl_ipsandports != '' ? true : false) && $userinfo['change_serversettings'] == '1' && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' ? true : false), 'visible' => ((!empty($ssl_ipsandports) ? true : false) && $userinfo['change_serversettings'] == '1' && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' ? true : false),
'label' => $lng['serversettings']['ssl']['ssl_protocols']['title'], 'label' => $lng['serversettings']['ssl']['ssl_protocols']['title'],
'desc' => $lng['serversettings']['ssl']['ssl_protocols']['description'], 'desc' => $lng['serversettings']['ssl']['ssl_protocols']['description'],
'type' => 'checkbox', 'type' => 'checkbox',
@@ -287,14 +287,14 @@ return array(
'is_array' => 1 'is_array' => 1
), ),
'ssl_cipher_list' => array( 'ssl_cipher_list' => array(
'visible' => (($ssl_ipsandports != '' ? true : false) && $userinfo['change_serversettings'] == '1' ? true : false), 'visible' => ((!empty($ssl_ipsandports) ? true : false) && $userinfo['change_serversettings'] == '1' ? true : false),
'label' => $lng['serversettings']['ssl']['ssl_cipher_list']['title'], 'label' => $lng['serversettings']['ssl']['ssl_cipher_list']['title'],
'desc' => $lng['serversettings']['ssl']['ssl_cipher_list']['description'], 'desc' => $lng['serversettings']['ssl']['ssl_cipher_list']['description'],
'type' => 'text', 'type' => 'text',
'value' => !empty($result['ssl_cipher_list']) ? $result['ssl_cipher_list'] : \Froxlor\Settings::Get('system.ssl_cipher_list') 'value' => !empty($result['ssl_cipher_list']) ? $result['ssl_cipher_list'] : \Froxlor\Settings::Get('system.ssl_cipher_list')
), ),
'tlsv13_cipher_list' => array( 'tlsv13_cipher_list' => array(
'visible' => (($ssl_ipsandports != '' ? true : false) && $userinfo['change_serversettings'] == '1' && \Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1 ? true : false), 'visible' => ((!empty($ssl_ipsandports) ? true : false) && $userinfo['change_serversettings'] == '1' && \Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1 ? true : false),
'label' => $lng['serversettings']['ssl']['tlsv13_cipher_list']['title'], 'label' => $lng['serversettings']['ssl']['tlsv13_cipher_list']['title'],
'desc' => $lng['serversettings']['ssl']['tlsv13_cipher_list']['description'], 'desc' => $lng['serversettings']['ssl']['tlsv13_cipher_list']['description'],
'type' => 'text', 'type' => 'text',
@@ -316,7 +316,7 @@ return array(
'checked' => $result['include_specialsettings'] 'checked' => $result['include_specialsettings']
), ),
'hsts_maxage' => array( 'hsts_maxage' => array(
'visible' => ($ssl_ipsandports != '' ? true : false), 'visible' => (!empty($ssl_ipsandports) ? true : false),
'label' => $lng['admin']['domain_hsts_maxage']['title'], 'label' => $lng['admin']['domain_hsts_maxage']['title'],
'desc' => $lng['admin']['domain_hsts_maxage']['description'], 'desc' => $lng['admin']['domain_hsts_maxage']['description'],
'type' => 'number', 'type' => 'number',
@@ -325,7 +325,7 @@ return array(
'value' => $result['hsts'] 'value' => $result['hsts']
), ),
'hsts_sub' => array( 'hsts_sub' => array(
'visible' => ($ssl_ipsandports != '' ? true : false), 'visible' => (!empty($ssl_ipsandports) ? true : false),
'label' => $lng['admin']['domain_hsts_incsub']['title'], 'label' => $lng['admin']['domain_hsts_incsub']['title'],
'desc' => $lng['admin']['domain_hsts_incsub']['description'], 'desc' => $lng['admin']['domain_hsts_incsub']['description'],
'type' => 'checkbox', 'type' => 'checkbox',
@@ -333,7 +333,7 @@ return array(
'checked' => $result['hsts_sub'] 'checked' => $result['hsts_sub']
), ),
'hsts_preload' => array( 'hsts_preload' => array(
'visible' => ($ssl_ipsandports != '' ? true : false), 'visible' => (!empty($ssl_ipsandports) ? true : false),
'label' => $lng['admin']['domain_hsts_preload']['title'], 'label' => $lng['admin']['domain_hsts_preload']['title'],
'desc' => $lng['admin']['domain_hsts_preload']['description'], 'desc' => $lng['admin']['domain_hsts_preload']['description'],
'type' => 'checkbox', 'type' => 'checkbox',
@@ -341,7 +341,7 @@ return array(
'checked' => $result['hsts_preload'] 'checked' => $result['hsts_preload']
), ),
'ocsp_stapling' => array( 'ocsp_stapling' => array(
'visible' => ($ssl_ipsandports != '' ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd', 'visible' => (!empty($ssl_ipsandports) ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd',
'label' => $lng['admin']['domain_ocsp_stapling']['title'], 'label' => $lng['admin']['domain_ocsp_stapling']['title'],
'desc' => $lng['admin']['domain_ocsp_stapling']['description'] . (\Froxlor\Settings::Get('system.webserver') == 'nginx' ? $lng['admin']['domain_ocsp_stapling']['nginx_version_warning'] : ""), 'desc' => $lng['admin']['domain_ocsp_stapling']['description'] . (\Froxlor\Settings::Get('system.webserver') == 'nginx' ? $lng['admin']['domain_ocsp_stapling']['nginx_version_warning'] : ""),
'type' => 'checkbox', 'type' => 'checkbox',
@@ -349,14 +349,14 @@ return array(
'checked' => $result['ocsp_stapling'] 'checked' => $result['ocsp_stapling']
), ),
'honorcipherorder' => array( 'honorcipherorder' => array(
'visible' => ($ssl_ipsandports != '' ? true : false), 'visible' => (!empty($ssl_ipsandports) ? true : false),
'label' => $lng['admin']['domain_honorcipherorder'], 'label' => $lng['admin']['domain_honorcipherorder'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',
'checked' => $result['ssl_honorcipherorder'] 'checked' => $result['ssl_honorcipherorder']
), ),
'sessiontickets' => array( 'sessiontickets' => array(
'visible' => ($ssl_ipsandports != '' ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' && \Froxlor\Settings::Get('system.sessionticketsenabled' != '1'), 'visible' => (!empty($ssl_ipsandports) ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' && \Froxlor\Settings::Get('system.sessionticketsenabled' != '1'),
'label' => $lng['admin']['domain_sessiontickets'], 'label' => $lng['admin']['domain_sessiontickets'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',

View File

@@ -25,9 +25,8 @@ return array(
'fields' => array( 'fields' => array(
'domainname' => array( 'domainname' => array(
'label' => $lng['domains']['domainname'], 'label' => $lng['domains']['domainname'],
'type' => 'hidden', 'type' => 'label',
'value' => $result_domain['domain'], 'value' => $result_domain['domain']
'display' => $result_domain['domain']
), ),
'ssl_cert_file' => array( 'ssl_cert_file' => array(
'label' => $lng['admin']['ipsandports']['ssl_cert_file_content'], 'label' => $lng['admin']['ipsandports']['ssl_cert_file_content'],

96
ssl_editor.php Normal file
View File

@@ -0,0 +1,96 @@
<?php
if (!defined('AREA')) {
header("Location: index.php");
exit();
}
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2016-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
*
*/
use Froxlor\Database\Database;
use Froxlor\Api\Commands\Certificates;
use Froxlor\Api\Commands\SubDomains;
use Froxlor\UI\Panel\UI;
// This file is being included in admin_domains and customer_domains
// and therefore does not need to require lib/init.php
if ($action == '' || $action == 'view') {
// get domain
try {
$json_result = SubDomains::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result_domain = json_decode($json_result, true)['data'];
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$do_insert = isset($_POST['do_insert']) ? (($_POST['do_insert'] == 1) ? true : false) : false;
try {
if ($do_insert) {
Certificates::getLocal($userinfo, $_POST)->add();
} else {
Certificates::getLocal($userinfo, $_POST)->update();
}
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
// back to domain overview
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => 'domains'
));
}
$stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "`
WHERE `domainid`= :domainid");
$result = Database::pexecute_first($stmt, array(
"domainid" => $id
));
$do_insert = false;
// if no entry can be found, behave like we have empty values
if (!is_array($result) || !isset($result['ssl_cert_file'])) {
$result = array(
'ssl_cert_file' => '',
'ssl_key_file' => '',
'ssl_ca_file' => '',
'ssl_cert_chainfile' => ''
);
$do_insert = true;
}
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$ssleditor_data = include_once dirname(__FILE__) . '/lib/formfields/formfield.domain_ssleditor.php';
$title = ['title'];
$image = $ssleditor_data['domain_ssleditor']['image'];
UI::twigBuffer('user/form.html.twig', [
'formaction' => $linker->getLink(array('section' => 'domains', 'page' => 'domainssleditor', 'id' => $id)),
'formdata' => $ssleditor_data['domain_ssleditor'],
'editid' => $id,
'actions_links' => [[
'class' => 'btn-outline-primary',
'href' => $linker->getLink(['section' => 'domains', 'page' => 'overview']),
'label' => $lng['admin']['domains'],
'icon' => 'fa fa-globe'
]]
]);
UI::twigOutputBuffer();
}