mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-15 17:16:59 +02:00
DNSSEC configuration options in the panel
This commit is contained in:
parent
47dcdc04c1
commit
d0b413966e
2 changed files with 152 additions and 7 deletions
|
@ -691,7 +691,17 @@ class SystemController extends Controller
|
|||
$this->container->get('flash')->addMessage('error', $errorText);
|
||||
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
|
||||
}
|
||||
|
||||
|
||||
if ($data['dnssec_enable'] === 'on' && $data['bind9_enable'] === 'on') {
|
||||
$dnssec_both = 1;
|
||||
} elseif ($data['dnssec_enable'] === 'on' && $data['bind9_enable'] !== 'on') {
|
||||
$this->container->get('flash')->addMessage('error', 'DNSSEC can be only enabled for BIND9');
|
||||
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
|
||||
} elseif ($data['dnssec_enable'] !== 'on' && $data['bind9_enable'] === 'on') {
|
||||
$this->container->get('flash')->addMessage('error', 'DNSSEC can be only enabled for BIND9');
|
||||
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
|
||||
}
|
||||
|
||||
try {
|
||||
$db->beginTransaction();
|
||||
|
||||
|
@ -772,7 +782,19 @@ class SystemController extends Controller
|
|||
'tldid' => $tld_id
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
if (isset($dnssec_both) && $dnssec_both === 1) {
|
||||
$db->update(
|
||||
'domain_tld',
|
||||
[
|
||||
'secure' => 1
|
||||
],
|
||||
[
|
||||
'id' => $tld_id
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// Loop through category indices from 1 to 10
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
$categoryNameKey = 'categoryName' . $i;
|
||||
|
@ -863,7 +885,7 @@ class SystemController extends Controller
|
|||
unset($_SESSION['u_tld_extension']);
|
||||
|
||||
$this->container->get('flash')->addMessage('success', 'TLD ' . $tld_extension . ' has been updated successfully');
|
||||
return $response->withHeader('Location', '/registry/tlds')->withStatus(302);
|
||||
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
|
||||
} catch (Exception $e) {
|
||||
$db->rollBack();
|
||||
$this->container->get('flash')->addMessage('error', 'Database failure: ' . $e->getMessage());
|
||||
|
@ -913,7 +935,7 @@ class SystemController extends Controller
|
|||
'/^[가-힣]+$/u' => 'Korean',
|
||||
];
|
||||
|
||||
$idnRegex = $tld['idn_table']; // Assume this is the regex from the database
|
||||
$idnRegex = $tld['idn_table'];
|
||||
$scriptName = '';
|
||||
|
||||
// Determine the script name based on the regex
|
||||
|
@ -934,6 +956,51 @@ class SystemController extends Controller
|
|||
$_SESSION['u_tld_id'] = [$tld['id']];
|
||||
$_SESSION['u_tld_extension'] = [$tld['tld']];
|
||||
|
||||
$secureTld = $tld['secure'];
|
||||
if ($secureTld === 1) {
|
||||
// Remove the leading dot
|
||||
$tld_extension_cleaned = ltrim($tld['tld'], '.');
|
||||
|
||||
// Path to the JSON file
|
||||
$jsonFilePath = "/tmp/{$tld_extension_cleaned}.json";
|
||||
|
||||
// Initialize a variable to hold the data for Twig
|
||||
$dnssecData = null;
|
||||
|
||||
if (file_exists($jsonFilePath) && is_readable($jsonFilePath)) {
|
||||
// Read and decode the JSON file
|
||||
$jsonContent = file_get_contents($jsonFilePath);
|
||||
$data = json_decode($jsonContent, true);
|
||||
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
// Ensure keys exist and process them
|
||||
if (isset($data['keys']) && is_array($data['keys'])) {
|
||||
$dnssecData = [
|
||||
'zoneName' => $data['zoneName'] ?? 'N/A',
|
||||
'timestamp' => $data['timestamp'] ?? 'N/A',
|
||||
'keys' => [],
|
||||
];
|
||||
|
||||
foreach ($data['keys'] as $key) {
|
||||
$dnssecData['keys'][] = [
|
||||
'keyFile' => $key['keyFile'] ?? 'N/A',
|
||||
'dsRecord' => $key['dsRecord'] ?? 'N/A',
|
||||
'timestamp' => $key['timestamp'] ?? 'N/A',
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$dnssecData = ['error' => "No keys found in JSON."];
|
||||
}
|
||||
} else {
|
||||
$dnssecData = ['error' => "Failed to decode JSON: " . json_last_error_msg()];
|
||||
}
|
||||
} else {
|
||||
$dnssecData = ['error' => "File {$jsonFilePath} not found or not readable."];
|
||||
}
|
||||
} else {
|
||||
$dnssecData = ['error' => "DNSSEC is not enabled for this TLD."];
|
||||
}
|
||||
|
||||
return view($response,'admin/system/manageTld.twig', [
|
||||
'tld' => $tld,
|
||||
'tld_u' => $tld_u,
|
||||
|
@ -946,6 +1013,8 @@ class SystemController extends Controller
|
|||
'premium_categories' => $premium_categories,
|
||||
'promotions' => $promotions,
|
||||
'launch_phases' => $launch_phases,
|
||||
'secureTld' => $secureTld,
|
||||
'dnssecData' => $dnssecData,
|
||||
'currentUri' => $uri
|
||||
]);
|
||||
} else {
|
||||
|
|
|
@ -48,15 +48,91 @@
|
|||
<div class="datagrid-item">
|
||||
<div class="datagrid-title">DNSSEC</div>
|
||||
<div class="datagrid-content">
|
||||
<span class="status status-yellow">
|
||||
{{ __('Manual') }}
|
||||
</span>
|
||||
{% if secureTld == 1 %}
|
||||
<span class="status status-blue">
|
||||
{{ __('Active') }}
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="status status-yellow">
|
||||
{{ __('Manual') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="datagrid-item">
|
||||
<div class="datagrid-title">Enable DNSSEC</div>
|
||||
<div class="datagrid-content">
|
||||
<label class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="dnssec_enable" {% if secureTld == 1 %} checked disabled {% endif %}>
|
||||
<span class="form-check-label">{{ __('Enable') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="datagrid-item">
|
||||
<div class="datagrid-title">BIND9 DNSSEC</div>
|
||||
<div class="datagrid-content">
|
||||
<label class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="bind9_enable" {% if secureTld == 1 %} checked disabled {% endif %}>
|
||||
<span class="form-check-label">{{ __('Enable') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if dnssecData is defined and dnssecData.keys is defined %}
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title">{{ __('DNSSEC Details') }} <span class="card-subtitle">{{ __('Last Updated:') }} {{ dnssecData.timestamp }}</span></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('Key File') }}</th>
|
||||
<th>{{ __('DS Record') }}</th>
|
||||
<th>{{ __('Timestamp') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for key in dnssecData.keys %}
|
||||
<tr>
|
||||
<td>{{ key.keyFile }}</td>
|
||||
<td><p class="user-select-all tracking-wide mb-0"><kbd>{{ key.dsRecord }}</kbd></p></td>
|
||||
<td>{{ key.timestamp }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% elseif dnssecData.error is defined %}
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title">{{ __('DNSSEC Details') }}</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<h4 class="alert-title">{{ dnssecData.error }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title">{{ __('DNSSEC Details') }}</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="alert alert-info" role="alert">
|
||||
<h4 class="alert-title">{{ __('No DNSSEC data available.') }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title">{{ __('Pricing') }}</h5>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue