Security Settings
The five endpoints behind panel access, the password rules and the banned lists.
Overview
These five endpoints hold the installation's front door. Where the admin panel is, who can reach it, how strong passwords must be, and who cannot register at all.
Two of them can lock you out: the folder name changes the panel's address, and the address restriction narrows who gets in. One more cannot be undone and touches everyone. This article is largely about those three.
Reference
Reading the General Settings
Returns where the panel is, who can reach it, and the password rules.
curl 'https://panel.example.com/api/v1/admin/settings/security/general' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.example.com/api/v1/admin/settings/security/general', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/settings/security/general');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// The admin folder name is a kind of SECRET: keep it out of your own logs and away from outsiders.
$sec = Api::Settings()->GetSecurityGeneral()['data'];Writing the General Settings
Applies the settings you send. Changing the folder name changes the panel's address.
curl -X PUT 'https://panel.example.com/api/v1/admin/settings/security/general' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"password_length":10,"password_reset_cycle":90,"clickjacking_protection":1}'const res = await fetch('https://panel.example.com/api/v1/admin/settings/security/general', {
method: 'PUT',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
password_length: 10,
password_reset_cycle: 90,
clickjacking_protection: 1,
}),
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/settings/security/general');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'password_length' => 10,
'password_reset_cycle' => 90,
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Changing the folder changes the panel's ADDRESS; do not send it without noting the new one.
// The address restriction locks too: keep your own address on the list.
Api::Settings()->UpdateSecurityGeneral([
'admin_ip_restriction' => $myAddress,
'password_length' => 10,
]);Reading the Banned Lists
Returns the domains, addresses, numbers and words refused at registration.
curl 'https://panel.example.com/api/v1/admin/settings/security/prohibited' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.example.com/api/v1/admin/settings/security/prohibited', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/settings/security/prohibited');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$prohibited = Api::Settings()->GetProhibited()['data'];Writing the Banned Lists
Writes the banned lists. The list you send replaces the old one.
curl -X PUT 'https://panel.example.com/api/v1/admin/settings/security/prohibited' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"block_temporary_email":1,"domain_list":["example-spam.com"]}'const res = await fetch('https://panel.example.com/api/v1/admin/settings/security/prohibited', {
method: 'PUT',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
block_temporary_email: 1,
domain_list: ['example-spam.com'],
}),
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/settings/security/prohibited');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'block_temporary_email' => 1,
'domain_list' => ['example-spam.com'],
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// To ADD one domain send the existing list too, or the earlier ones are deleted.
$lists = Api::Settings()->GetProhibited()['data'];
$domains = $lists['domain_list'];
$domains[] = 'example-spam.com';
Api::Settings()->UpdateProhibited(['domain_list' => $domains]);Forcing a Password Reset
Forces every user to renew their password on their next sign-in.
curl -X POST 'https://panel.example.com/api/v1/admin/settings/security/force-reset-password' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.example.com/api/v1/admin/settings/security/force-reset-password', {
method: 'POST',
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/settings/security/force-reset-password');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// This request touches EVERY user and CANNOT be undone: there is no body and no confirmation step.
// Run it only with a real reason behind it, such as after a breach.
Api::Settings()->ForceResetPassword();Pitfalls
Changing the admin folder renames the directory: the panel is no longer at its old address. Do not send this request without writing the new name down somewhere. The name cannot be empty, cannot be predictable and cannot clash with an existing file. Those raise errors. A wrong yet valid name raises none and leaves the panel unfindable.
Restricting panel access by address makes no exceptions. Leave your own address off the list and the next attempt shuts you out as well. On a connection whose address changes, not using this setting is the safer choice.
This endpoint takes no body, no filter and has no confirmation step. The moment you call it every user must renew their password at their next sign-in, and it cannot be undone. The response does not even say how many were affected. Do not run it without a real reason.
The list you send replaces the old one. Adding a single domain means reading the current list and appending to it, or every ban you built up disappears in one request, with no error to say so.
The admin folder name is the secret part of the address and behaves like a credential. Do not write the value you read from here into your own records or show it in error messages. The system masks it even in its own error log.
Related Articles
Thanks for your feedback!
Our support team is here around the clock for anything you can't find above.