### Enable and Start Nginx and PHP-FPM
Source: https://docs.poweradmin.org/installation/centos
Enables Nginx and PHP-FPM services to start on boot and starts them immediately.
```bash
systemctl enable nginx php-fpm
systemctl start nginx php-fpm
```
--------------------------------
### Enable and Start Apache Service
Source: https://docs.poweradmin.org/installation/centos
Enables the Apache service to start automatically on boot and starts the service immediately.
```bash
systemctl enable httpd
systemctl start httpd
```
--------------------------------
### Example Database Configuration
Source: https://docs.poweradmin.org/configuration/database
This is an example of how to configure the database connection settings in `config/settings.php`. Ensure you replace 'your_secure_password' with a strong password.
```php
return [
'database' => [
'host' => 'localhost',
'port' => '3306',
'name' => 'poweradmin',
'user' => 'poweradmin',
'password' => 'your_secure_password',
'type' => 'mysql',
'charset' => 'latin1',
'file' => '',
'debug' => false,
'pdns_db_name' => 'powerdns', // Optional, MySQL/MariaDB only: Use when PowerDNS tables are in a separate database
],
];
```
--------------------------------
### Install Project Dependencies
Source: https://docs.poweradmin.org/contributing/development
Install project dependencies using Composer for PHP and NPM for frontend assets. Ensure you have Composer and Node.js installed.
```bash
composer install
```
```bash
npm install
```
--------------------------------
### Install Curl and Unzip
Source: https://docs.poweradmin.org/installation/centos
Installs the curl and unzip utilities if they are not already present on the system.
```bash
dnf install -y curl unzip
```
--------------------------------
### Legacy Configuration File Example
Source: https://docs.poweradmin.org/configuration/legacy-configuration
Example of the legacy inc/config.inc.php file, defining database credentials, session key, and DNS server details.
```php
[
'enabled' => true,
'uri' => 'ldap://ldap.company.com',
'base_dn' => 'ou=users,dc=company,dc=com',
'bind_dn' => 'cn=admin,dc=company,dc=com',
'bind_password' => 'password',
'user_attribute' => 'uid',
'search_filter' => '(&(objectClass=posixAccount)(uid=%s))',
],
];
```
--------------------------------
### Copy Custom CSS Example Files
Source: https://docs.poweradmin.org/upgrading/v4.1.0
Copy example CSS files to your custom directory for theming. These changes persist across upgrades.
```bash
cp custom_light.css.example custom_light.css
cp custom_dark.css.example custom_dark.css
```
--------------------------------
### Copy Example CSS Files
Source: https://docs.poweradmin.org/configuration/ui/custom-css
Copy the example CSS files to your theme's style directory to begin customization. These files serve as templates for your custom styles.
```bash
cp custom_light.css.example custom_light.css
cp custom_dark.css.example custom_dark.css
```
--------------------------------
### Basic Configuration File Example
Source: https://docs.poweradmin.org/configuration/basic
Create `config/settings.php` with your custom settings. This file contains database, security, and DNS configurations.
```php
[
'host' => 'localhost',
'name' => 'powerdns-db',
'user' => 'poweradmin-db-user',
'password' => 'poweradmin-db-user-password',
'type' => 'mysql',
],
'security' => [
'session_key' => 'change_this_key',
],
'dns' => [
'hostmaster' => 'hostmaster.example.com',
'ns1' => 'ns1.example.com',
'ns2' => 'ns2.example.com',
],
];
```
--------------------------------
### Install Nginx Web Server
Source: https://docs.poweradmin.org/installation/ubuntu
Installs the Nginx web server on Ubuntu systems. This is an alternative to Apache for serving Poweradmin.
```bash
apt install nginx
```
--------------------------------
### Install Apache HTTP Server
Source: https://docs.poweradmin.org/installation/centos
Installs the Apache HTTP Server, a common web server for hosting web applications.
```bash
dnf install -y httpd
```
--------------------------------
### Full DNS Wizards Configuration Example
Source: https://docs.poweradmin.org/configuration/dns-wizards
A comprehensive example of the `dns_wizards` configuration in `config/settings.php`, including enabled status, available types, and custom CAA providers.
```php
'dns_wizards' => [
'enabled' => true,
'available_types' => ['DMARC', 'SPF', 'DKIM', 'CAA', 'TLSA', 'SRV'],
'caa_providers' => [
'letsencrypt.org' => "Let's Encrypt",
'digicert.com' => 'DigiCert',
'sectigo.com' => 'Sectigo (Comodo)',
'pki.goog' => 'Google Trust Services',
// Add custom CAs as needed
],
],
```
--------------------------------
### Complete Mail Configuration Example
Source: https://docs.poweradmin.org/configuration/mail
This example shows a comprehensive configuration for the mail settings, including SMTP details and debug options. It is intended for the `config/settings.php` file.
```php
return [
'mail' => [
'enabled' => true,
'from' => 'dns@example.com',
'from_name' => 'DNS Administrator',
'return_path' => 'dns@example.com',
'transport' => 'smtp',
'smtp' => [
'host' => 'smtp.example.com',
'port' => 587,
'username' => 'smtp_user',
'password' => 'smtp_password',
'encryption' => 'tls', // 'tls', 'ssl', or null
'auth' => true,
],
'debug' => false, // Set to true for detailed logging (v4.0.3+)
],
];
```
--------------------------------
### API Key Authentication Example
Source: https://docs.poweradmin.org/configuration/api
Example of how to authenticate with the Poweradmin API using an API key.
```APIDOC
## API Key Authentication
### Description
Use an API key for secure, token-based authentication with the Poweradmin API.
### Method
`GET` (example for listing zones)
### Endpoint
`/api/v1/zones` or `/api/v2/zones`
### Request Headers
- `X-API-Key`: your-api-key-here
- `Content-Type`: application/json
### Request Example
```bash
curl -H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
https://your-domain.com/api/v1/zones
```
```
--------------------------------
### HTTP Basic Authentication Example
Source: https://docs.poweradmin.org/configuration/api
Example of how to authenticate with the Poweradmin API using HTTP Basic Authentication.
```APIDOC
## HTTP Basic Authentication
### Description
Use traditional username and password for HTTP Basic Authentication with the Poweradmin API.
### Method
`GET` (example for listing zones)
### Endpoint
`/api/v1/zones` or `/api/v2/zones`
### Request Headers
- `Content-Type`: application/json
### Request Example
```bash
curl -u username:password \
-H "Content-Type: application/json" \
https://your-domain.com/api/v1/zones
```
```
--------------------------------
### RDAP Configuration Example
Source: https://docs.poweradmin.org/configuration/rdap
Configure RDAP settings in `config/settings.php`. This example enables RDAP, sets a custom server for '.za' domains, and adjusts the request timeout.
```php
return [
'rdap' => [
'enabled' => true,
'default_server' => '',
'custom_servers' => [
'za' => 'https://rdap.example.com/za/',
],
'request_timeout' => 15,
'restrict_to_admin' => true,
],
];
```
--------------------------------
### Full-Featured Configuration Example
Source: https://docs.poweradmin.org/configuration/record-types
A comprehensive configuration that includes a wide range of supported DNS record types for both forward and reverse zones.
```php
'domain_record_types' => [
'A', 'AAAA', 'CNAME', 'MX', 'NS', 'SOA', 'TXT', 'SRV', 'CAA',
'DNSKEY', 'DS', 'NAPTR', 'SSHFP', 'TLSA'
],
'reverse_record_types' => ['PTR', 'NS', 'SOA', 'TXT', 'CNAME'],
```
--------------------------------
### Basic Poweradmin Configuration (`config/settings.php`)
Source: https://docs.poweradmin.org/installation/composer
This example shows the structure for the `config/settings.php` file, including database, security, and DNS settings. Modify these with your specific details.
```php
[
'host' => 'localhost',
'name' => 'your_db_name',
'user' => 'your_db_user',
'password' => 'your_db_password',
'type' => 'mysql', // or 'pgsql', 'sqlite'
],
/**
* Security Settings
*/
'security' => [
'session_key' => 'generate_a_strong_random_key_here',
],
/**
* DNS Settings
*/
'dns' => [
'hostmaster' => 'hostmaster.example.com',
'ns1' => 'ns1.example.com',
'ns2' => 'ns2.example.com',
],
];
```
--------------------------------
### Modern LDAP Configuration Example
Source: https://docs.poweradmin.org/configuration/ldap
Configure LDAP settings using the modern array format in `config/settings.php`. This example shows all available options.
```php
return [
'ldap' => [
'enabled' => true,
'debug' => false,
'uri' => 'ldap://domaincontroller.example.com',
'base_dn' => 'ou=users,dc=example,dc=com',
'bind_dn' => 'cn=admin,dc=example,dc=com',
'bind_password' => 'some_password',
'user_attribute' => 'uid',
'protocol_version' => 3,
'search_filter' => '(objectClass=account)',
'session_cache_timeout' => 300, // Cache for 5 minutes (v4.1.0+)
],
];
```
--------------------------------
### Docker Compose Basic Setup with MySQL
Source: https://docs.poweradmin.org/installation/docker
Defines a Docker Compose setup for Poweradmin with a MySQL database. Includes service definitions for both Poweradmin and MySQL, with persistent storage for MySQL data.
```yaml
version: '3.8'
services:
poweradmin:
image: poweradmin/poweradmin:stable
ports:
- "80:80"
environment:
PA_CREATE_ADMIN: "true"
PA_ADMIN_PASSWORD: "change-me"
DB_TYPE: mysql
DB_HOST: mysql
DB_USER: poweradmin
DB_PASS: poweradmin-password
DB_NAME: poweradmin
DNS_NS1: ns1.example.com
DNS_NS2: ns2.example.com
DNS_HOSTMASTER: hostmaster.example.com
depends_on:
- mysql
mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD: root-password
MYSQL_DATABASE: poweradmin
MYSQL_USER: poweradmin
MYSQL_PASSWORD: poweradmin-password
volumes:
- mysql-data:/var/lib/mysql
volumes:
mysql-data:
```
--------------------------------
### Install Composer Dependencies
Source: https://docs.poweradmin.org/installation/remote-setup-guide
Install the necessary PHP dependencies for Poweradmin using Composer. Ensure you are in the Poweradmin directory.
```bash
composer install --no-dev
```
--------------------------------
### Poweradmin Security Configuration Example
Source: https://docs.poweradmin.org/configuration/security-policies
This example demonstrates a comprehensive security configuration for Poweradmin, covering session keys, password encryption, account lockout, MFA, password reset, and reCAPTCHA settings.
```php
return [
'security' => [
'session_key' => 'random_secure_string_here',
'password_encryption' => 'bcrypt',
'password_cost' => 12,
'login_token_validation' => true,
'global_token_validation' => true,
'account_lockout' => [
'enable_lockout' => true,
'lockout_attempts' => 3,
'lockout_duration' => 30,
'track_ip_address' => true,
'clear_attempts_on_success' => true,
'whitelist_ip_addresses' => ['192.168.1.0/24', '10.0.0.*'],
'blacklist_ip_addresses' => ['1.2.3.4', '5.6.7.0/24'],
],
'mfa' => [
'enabled' => true,
'app_enabled' => true,
'email_enabled' => true,
'recovery_codes' => 8,
'recovery_code_length' => 10,
],
'password_reset' => [
'enabled' => true,
'token_lifetime' => 3600,
'rate_limit_attempts' => 5,
'rate_limit_window' => 3600,
'min_time_between_requests' => 60,
],
'recaptcha' => [
'enabled' => true,
'site_key' => 'your_site_key_here',
'secret_key' => 'your_secret_key_here',
'version' => 'v3',
'v3_threshold' => 0.5,
],
],
];
```
--------------------------------
### API Configuration for Production
Source: https://docs.poweradmin.org/configuration/api
Example configuration for enabling the API, disabling basic authentication in favor of API keys, and disabling documentation in production environments.
```php
'api' => [
'enabled' => true,
'basic_auth_enabled' => false, // Use API keys only
'docs_enabled' => false, // Disable docs in production
],
```
--------------------------------
### End-to-End OIDC Example with Keycloak Roles
Source: https://docs.poweradmin.org/configuration/oidc
An example demonstrating the OIDC configuration for Keycloak, mapping 'roles' claim to Poweradmin permission templates. The first matching group in the mapping determines the user's template.
```php
'oidc' => [
'enabled' => true,
'default_permission_template' => 'Guest',
'permission_template_mapping' => [
'dns-admin' => 'Administrator',
'dns-viewer' => 'Viewer',
],
'providers' => [
'keycloak' => [
// ... other settings ...
'user_mapping' => [
'username' => 'preferred_username',
'email' => 'email',
'first_name' => 'given_name',
'last_name' => 'family_name',
'display_name' => 'name',
'groups' => 'roles', // Tell Poweradmin to read the 'roles' claim
],
],
],
],
```
--------------------------------
### Install PostgreSQL Schema Files
Source: https://docs.poweradmin.org/database/postgresql-configuration
Command-line instructions to apply the Poweradmin and PowerDNS SQL schema to your PostgreSQL database using the psql client.
```bash
psql -U poweradmin -d powerdns -f sql/poweradmin-pgsql-db-structure.sql
psql -U poweradmin -d powerdns -f sql/pdns/[version]/schema.pgsql.sql
```
--------------------------------
### Basic Web Server Configuration Example
Source: https://docs.poweradmin.org/configuration/record-types
A basic configuration for web server environments, limiting record types to essential ones for A, AAAA, CNAME, MX, and PTR records.
```php
'domain_record_types' => ['A', 'AAAA', 'CNAME', 'MX', 'TXT'],
'reverse_record_types' => ['PTR', 'NS', 'SOA'],
```
--------------------------------
### Example User Agreement HTML Template
Source: https://docs.poweradmin.org/configuration/user-agreements
An example HTML template for a user agreement, including sections for acceptable use, data protection, security, and compliance.
```html
DNS Management System - Terms of Use
1. Acceptable Use
You agree to use this DNS management system only for legitimate business purposes...
2. Data Protection
All DNS data is confidential and must not be shared with unauthorized parties...
3. Security Requirements
- Use strong passwords and change them regularly
- Do not share your account credentials
- Report security incidents immediately
4. Compliance
Users must comply with all applicable laws and regulations...
```
--------------------------------
### Install Perl LWP::UserAgent Module
Source: https://docs.poweradmin.org/user-guide/ddns/client-setup
Install the 'LWP::UserAgent' module using cpan, which is necessary for the Perl dynamic DNS client script.
```bash
cpan install LWP::UserAgent
```
--------------------------------
### Generate Documentation
Source: https://docs.poweradmin.org/contributing/development
Generate project documentation using phpDocumentor. This command installs phpDocumentor via Phive and then runs the documentation generation script.
```bash
phive install phpDocumentor
composer run docs
```
--------------------------------
### Legacy Logging Configuration Example
Source: https://docs.poweradmin.org/configuration/logging
Set up diagnostic and audit logging using legacy global variables. This method is suitable for older Poweradmin versions or specific environments.
```php
['A', 'AAAA', 'CNAME', 'MX', 'NS', 'SOA', 'TXT', 'DNSKEY', 'DS'],
'reverse_record_types' => ['PTR', 'NS', 'SOA'],
```
--------------------------------
### API Key Authentication Example
Source: https://docs.poweradmin.org/configuration/api
Use this `curl` command to authenticate API requests using an API key. Ensure the `X-API-Key` header contains your valid API key.
```bash
curl -H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
https://your-domain.com/api/v1/zones
```
--------------------------------
### Modern Logging Configuration Example
Source: https://docs.poweradmin.org/configuration/logging
Configure diagnostic and audit logging settings using the modern array-based configuration. Ensure all desired logging types and levels are enabled as needed.
```php
return [
'logging' => [
'type' => 'native',
'level' => 'warning',
'database_enabled' => true,
'syslog_enabled' => true,
'syslog_identity' => 'poweradmin',
'syslog_facility' => LOG_USER,
],
];
```
--------------------------------
### Install Latest Stable Poweradmin with Composer
Source: https://docs.poweradmin.org/installation/composer
Use this command to create a new Poweradmin project in the current directory, downloading the latest stable version without development dependencies.
```bash
composer create-project --no-dev poweradmin/poweradmin
```
--------------------------------
### Backup MySQL Database
Source: https://docs.poweradmin.org/upgrading/v4.1.0
Example command to create a SQL dump of your Poweradmin database using mysqldump.
```bash
# Example MySQL backup
mysqldump -u username -p poweradmin_db > poweradmin_backup_$(date +%Y%m%d).sql
```
--------------------------------
### Corporate Environment User Agreement Configuration
Source: https://docs.poweradmin.org/configuration/user-agreements
Example configuration for a corporate environment, setting a specific version string and enabling re-acceptance on version changes.
```php
'user_agreement' => [
'enabled' => true,
'current_version' => 'CORP-2024.1',
'require_on_version_change' => true,
],
```
--------------------------------
### Old Configuration Format (pre-4.0.0)
Source: https://docs.poweradmin.org/upgrading/v4.0.0
Example of the direct variable assignment format used in `inc/config.inc.php` for versions prior to 4.0.0.
```php
$db_host = 'localhost';
$db_user = 'poweradmin';
$db_pass = 'password';
$db_name = 'powerdns';
$db_type = 'mysql';
```
--------------------------------
### HTTP Basic Authentication Example
Source: https://docs.poweradmin.org/configuration/api
Authenticate API requests using traditional username and password with HTTP Basic Authentication. Replace `username` and `password` with your credentials.
```bash
curl -u username:password \
-H "Content-Type: application/json" \
https://your-domain.com/api/v1/zones
```
--------------------------------
### Install MySQL Schema
Source: https://docs.poweradmin.org/database/mysql-configuration
Import the Poweradmin and PowerDNS SQL schemas into your database using the MySQL client. Ensure you use the correct schema file paths.
```bash
mysql -u poweradmin -p powerdns < sql/poweradmin-mysql-db-structure.sql
mysql -u poweradmin -p powerdns < sql/pdns/[version]/schema.mysql.sql
```
--------------------------------
### Run Poweradmin Docker Container with API Enabled
Source: https://docs.poweradmin.org/getting-started/docker-demo
Starts a Poweradmin Docker container with the API and API documentation endpoints enabled. This allows for testing the RESTful API.
```bash
docker run -d --name poweradmin -p 80:80 \
-e PA_API_ENABLED=true \
-e PA_API_DOCS_ENABLED=true \
poweradmin/poweradmin:latest
```
--------------------------------
### Docker Compose Configuration with Secrets
Source: https://docs.poweradmin.org/installation/docker-secrets
Example Docker Compose file demonstrating how to configure Poweradmin and a MySQL database to use Docker secrets for sensitive information.
```yaml
version: '3.8'
services:
poweradmin:
image: poweradmin/poweradmin:stable
ports:
- "80:80"
environment:
DB_TYPE: mysql
DB_HOST: mysql
DB_USER: poweradmin
DB_PASS__FILE: /run/secrets/db_password
DB_NAME: poweradmin
PA_PDNS_API_KEY__FILE: /run/secrets/pdns_api_key
PA_SMTP_PASSWORD__FILE: /run/secrets/smtp_password
secrets:
- db_password
- pdns_api_key
- smtp_password
mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/mysql_root_password
MYSQL_DATABASE: poweradmin
MYSQL_USER: poweradmin
MYSQL_PASSWORD_FILE: /run/secrets/db_password
secrets:
- mysql_root_password
- db_password
secrets:
db_password:
file: ./secrets/db_password.txt
mysql_root_password:
file: ./secrets/mysql_root_password.txt
pdns_api_key:
file: ./secrets/pdns_api_key.txt
smtp_password:
file: ./secrets/smtp_password.txt
```
--------------------------------
### Configure pdnsutil Permissions (Ubuntu/Apache)
Source: https://docs.poweradmin.org/configuration/dnssec
Example commands to grant the web server user necessary permissions to run pdnsutil and access PowerDNS configuration files. This is required for the legacy pdnsutil method.
```bash
# Add the web server user to the root group
adduser www-data root
# Make pdns.conf readable by the web server user
chmod 640 /etc/powerdns/pdns.conf
```
--------------------------------
### Install Python Requests Dependency
Source: https://docs.poweradmin.org/user-guide/ddns/client-setup
Install the 'requests' library, which is required for the Python dynamic DNS client script.
```bash
pip install requests
```
--------------------------------
### Poweradmin PostgreSQL Configuration Example
Source: https://docs.poweradmin.org/database/postgresql-configuration
This PHP array defines the database connection settings for Poweradmin when using PostgreSQL. Ensure sensitive information like passwords is kept secure.
```php
[
'type' => 'pgsql',
'host' => 'localhost',
'port' => '5432',
'user' => 'poweradmin',
'password' => 'your_password',
'name' => 'powerdns',
'charset' => 'UTF8',
'file' => '',
'debug' => false,
// SSL/TLS Settings (optional, added in 4.1.0)
'ssl' => false,
'ssl_verify' => false,
'ssl_ca' => '',
'ssl_key' => '',
'ssl_cert' => '',
],
// Other configuration sections remain the same as in settings.defaults.php
];
```
--------------------------------
### Install PHP Extensions for Poweradmin
Source: https://docs.poweradmin.org/installation/centos
Installs essential PHP extensions required for Poweradmin functionality on CentOS/RHEL systems.
```bash
dnf install -y php php-intl php-gettext php-pdo php-xml php-fpm
```
--------------------------------
### Install PHP Extensions for Poweradmin
Source: https://docs.poweradmin.org/installation/debian
Installs necessary PHP extensions required for Poweradmin functionality on Debian systems.
```bash
apt install php php-intl php-php-gettext php-tokenizer php-xml php-fpm
```
--------------------------------
### Corporate Branding Header Example
Source: https://docs.poweradmin.org/configuration/ui/layout
An example of a custom header incorporating corporate branding with a logo and a specific title.
```html
Corporate DNS Management Portal
```
--------------------------------
### Install PHP Database Drivers
Source: https://docs.poweradmin.org/installation/debian
Installs the PHP database driver for your chosen database system (MySQL/MariaDB, PostgreSQL, or SQLite).
```bash
# For MySQL/MariaDB
apt install php-mysql
# For PostgreSQL
apt install php-pgsql
# For SQLite
apt install php-sqlite3
```
--------------------------------
### API Response Format Example
Source: https://docs.poweradmin.org/configuration/api
Example JSON structure for a successful API response, including resource details and timestamps.
```json
{
"success": true,
"data": {
"id": 123,
"name": "example.com",
"type": "A",
"content": "192.168.1.100",
"ttl": 3600,
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z"
}
}
```
--------------------------------
### Example PHP Parse Error
Source: https://docs.poweradmin.org/troubleshooting/debugging
This is an example of a PHP parse error that can occur due to special characters in passwords within the configuration file.
```php
Parse error: syntax error, unexpected 'password' in config/settings.php on line 42
```
--------------------------------
### Extended Footer with Links Example
Source: https://docs.poweradmin.org/configuration/ui/layout
An example of a custom footer that includes copyright information and navigation links to support, documentation, and contact pages.
```html
```
--------------------------------
### Manually Initialize SQLite Database
Source: https://docs.poweradmin.org/database/sqlite
Commands to create an SQLite database file, set permissions, and import the schema. Replace 'www-data:www-data' with your web server's user and group.
```bash
# Create the database file
touch /path/to/your/poweradmin.sqlite
# Set proper permissions
chmod 664 /path/to/your/poweradmin.sqlite
chown www-data:www-data /path/to/your/poweradmin.sqlite # Replace with your web server user
# Import the schema
sqlite3 /path/to/your/poweradmin.sqlite < /path/to/poweradmin/sql/poweradmin-sqlite-db-structure.sql
```
--------------------------------
### Creating Multi-line Secrets (Certificates and Keys)
Source: https://docs.poweradmin.org/installation/docker-secrets
Demonstrates how to create files containing multi-line secrets like certificates and private keys, which can then be used with Docker secrets.
```bash
# Create certificate secret
cat > ./secrets/saml_cert.txt << 'EOF'
MIICnTCCAYUCBgF...
...certificate content...
EOF
# Create private key secret
cat > ./secrets/saml_key.txt << 'EOF'
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBg...
...key content...
-----END PRIVATE KEY-----
EOF
```
--------------------------------
### API Request Format Example
Source: https://docs.poweradmin.org/configuration/api
Example JSON structure for an API request, typically used for creating or updating resources like DNS records.
```json
{
"name": "example.com",
"type": "A",
"content": "192.168.1.100",
"ttl": 3600
}
```
--------------------------------
### API Error Response Format Example
Source: https://docs.poweradmin.org/configuration/api
Example JSON structure for an API error response, detailing the error code, message, and specific field issues.
```json
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid record type",
"details": {
"field": "type",
"value": "INVALID"
}
}
}
```
--------------------------------
### Enable DNS Wizards
Source: https://docs.poweradmin.org/configuration/dns-wizards
Add this configuration to `config/settings.php` to enable the DNS wizard feature.
```php
'dns_wizards' => [
'enabled' => true,
],
```
--------------------------------
### Run Poweradmin with SQLite (Default)
Source: https://docs.poweradmin.org/installation/docker
Launches a Poweradmin container using SQLite as the database. The admin user is automatically created. Mounts a volume for database persistence.
```bash
docker run -d --name poweradmin -p 80:80 \
-e PA_CREATE_ADMIN=1 \
-v poweradmin-db:/db \
poweradmin/poweradmin:stable
```
--------------------------------
### LDAP Search Filter Examples
Source: https://docs.poweradmin.org/configuration/legacy-configuration
Examples of how to define the LDAP search filter for user authentication. These filters specify criteria for matching user accounts in the LDAP directory.
```php
$ldap_search_filter = '(memberOf=cn=powerdns,ou=groups,dc=poweradmin,dc=org)';
```
```php
$ldap_search_filter = '(objectClass=account)';
```
```php
$ldap_search_filter = '(objectClass=person)(memberOf=cn=admins,ou=groups,dc=poweradmin,dc=org)';
```
```php
$ldap_search_filter = '(cn=*admin*)';
```
--------------------------------
### Configure SP Signing Certificate and Key in Settings
Source: https://docs.poweradmin.org/configuration/saml
Load the generated SP certificate and private key into the Poweradmin SAML configuration. Ensure the paths to the certificate and key files are correct.
```php
'saml' => [
'sp' => [
'x509cert' => file_get_contents('/path/to/sp-certificate.crt'),
'private_key' => file_get_contents('/path/to/sp-private.key'),
],
],
```
--------------------------------
### Backup SQLite Database
Source: https://docs.poweradmin.org/upgrading/v4.1.0
Example command to create a file copy backup of your Poweradmin SQLite database.
```bash
# Example SQLite backup
cp /path/to/poweradmin.db /path/to/poweradmin_backup_$(date +%Y%m%d).db
```
--------------------------------
### Backup PostgreSQL Database
Source: https://docs.poweradmin.org/upgrading/v4.1.0
Example command to create a SQL dump of your Poweradmin database using pg_dump.
```bash
# Example PostgreSQL backup
pg_dump -h localhost -U username poweradmin_db > poweradmin_backup_$(date +%Y%m%d).sql
```
--------------------------------
### Enable User Agreement System
Source: https://docs.poweradmin.org/configuration/user-agreements
Configure the user agreement system in `config/settings.php`. Set 'enabled' to true to activate the system.
```php
return [
'user_agreement' => [
'enabled' => true,
'current_version' => '2.1',
'require_on_version_change' => true,
],
];
```
--------------------------------
### Add New Configuration Options
Source: https://docs.poweradmin.org/upgrading/v3.2.0
PHP configuration snippet showing how to add `index_display` and `database_enabled` options to `inc/config.inc.php`.
```php
'interface' => [
// ... existing configuration ...
'index_display' => 'cards', // Options: 'cards', 'list' (added in 3.2.0)
// ... existing configuration ...
],
'logging' => [
// ... existing configuration ...
'database_enabled' => false, // Enable logging zone and record changes to the database (added in 3.2.0)
// ... existing configuration ...
],
```
--------------------------------
### Deploy Poweradmin to Web Server
Source: https://docs.poweradmin.org/installation/debian
Copies the extracted Poweradmin files to the web server's document root and sets the correct ownership for the web server user.
```bash
cp -r poweradmin-4.0.5/* /var/www/html/
chown -R www-data:www-data /var/www/html/
```
--------------------------------
### Clone Poweradmin Repository
Source: https://docs.poweradmin.org/contributing/development
Clone the Poweradmin repository to your local machine. Navigate into the cloned directory to proceed with installation.
```bash
git clone https://github.com/poweradmin/poweradmin.git
cd poweradmin
```
--------------------------------
### Enable WHOIS Functionality
Source: https://docs.poweradmin.org/configuration/whois
Configure the 'whois' section in `config/settings.php` to enable WHOIS lookup. This example shows how to enable the feature, set a default server, define custom TLD-to-server mappings, adjust socket timeout, and restrict usage to administrators.
```php
return [
'whois' => [
'enabled' => true,
'default_server' => '',
'custom_servers' => [
'za' => 'whois.registry.net.za',
'co.za' => 'whois.registry.net.za',
],
'socket_timeout' => 15,
'restrict_to_admin' => true,
],
];
```
--------------------------------
### Enable Database Logging (Legacy Configuration)
Source: https://docs.poweradmin.org/configuration/database-logging
Enable database logging using the legacy $dblog_use variable.
```php
$dblog_use = true;
```
--------------------------------
### Run Perl Dynamic DNS Client
Source: https://docs.poweradmin.org/user-guide/ddns/client-setup
Execute the Perl dynamic DNS client script after installing the required modules.
```perl
perl dynamic_dns_client.pl
```
--------------------------------
### New Configuration Format (4.0.0+)
Source: https://docs.poweradmin.org/upgrading/v4.0.0
Example of the structured array format used in `config/settings.php` for Poweradmin version 4.0.0 and later.
```php
return [
'database' => [
'host' => 'localhost',
'user' => 'poweradmin',
'password' => 'password',
'name' => 'powerdns',
'type' => 'mysql',
],
];
```
--------------------------------
### Enable Both Permission Systems
Source: https://docs.poweradmin.org/configuration/permissions
Configure `settings.php` to show both user and group access template management in the UI. This is the default behavior.
```php
'permissions' => [
'show_user_access_templates' => true,
'show_group_access_templates' => true,
],
```
--------------------------------
### Backup Poweradmin Configuration Files
Source: https://docs.poweradmin.org/maintenance
Create a compressed archive of Poweradmin's configuration files for backup purposes.
```bash
# Create a compressed archive of configuration files
tar -czf poweradmin_config_$(date +%Y%m%d).tar.gz /path/to/poweradmin/inc/config.inc.php /path/to/poweradmin/config/
```
--------------------------------
### Update Poweradmin Package with Composer
Source: https://docs.poweradmin.org/installation/composer
Run this command to update only the Poweradmin package to a newer version without installing development dependencies.
```bash
composer update poweradmin/poweradmin --no-dev
```
--------------------------------
### Exclude Secrets from Version Control
Source: https://docs.poweradmin.org/installation/docker-secrets
Example `.gitignore` entries to prevent sensitive secret files from being committed to version control systems.
```gitignore
secrets/
*.key
*.pem
```
--------------------------------
### Create MySQL Database and User
Source: https://docs.poweradmin.org/database/mysql-configuration
Execute these SQL commands to create the database, user, and grant necessary privileges for Poweradmin. Remember to replace 'your_password' with your chosen password.
```sql
CREATE DATABASE powerdns CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'poweradmin'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON powerdns.* TO 'poweradmin'@'localhost';
FLUSH PRIVILEGES;
```