EPP Control Panel

Hook

Member
Joined
Jul 8, 2024
Posts
99
Reaction score
79
Trophy points
19
Is there a tool out there to do bulk domain modifications for your own TAG?

The web panel with nominent does not do what I need, I'm looking for a tool to bulk modify NS1 & NS2 in this format: domain,ns1,ns2.

So far I've had no luck, the web panel seems to only let you make bulk changes if you use the same nameservers.

Either looking for an out the box solution, or developer to make this EPP client for me.
 
Why don't you just use a 3rd party web panel, ie. wherever you host your domains? Granted I don't know if any support bulk domain changes. Shouldn't be too difficult to roll your own simple little client you can run in terminal or something if you're just wanting to update your nameservers?
 
Why don't you just use a 3rd party web panel, ie. wherever you host your domains? Granted I don't know if any support bulk domain changes. Shouldn't be too difficult to roll your own simple little client you can run in terminal or something if you're just wanting to update your nameservers?
It has been a time drain for me, only so many hours in the day and lot of domains to regularly update. I was looking for something in terminal, basic, that I can just drop a CSV file or text box which I can drop a list of domains in this format: domains,n1,n2

If you have any examples of the code it'd be appreciated.
 
Ask GPT in a long handed way and it should come up with something surely? Just asked it a question and response below :unsure: replacing the smileys below of course with :p :ROFLMAO:

Login and Logout System: This will allow you to authenticate to the Nominet EPP server.
Domain Management Features: You need the ability to:
Create domains.
List domains associated with a tag.
Bulk change nameservers for multiple domains.
Use EPP Commands: These will be the core functionality for interacting with Nominet's EPP system.
Requirements
PHP version: PHP 7 or later.
Libraries: OpenSSL for handling secure connections with the EPP server.
Session Management: For login and logout functionality.
Here's a PHP script to help get started.

1. Configuration
Create a config.php file for managing Nominet EPP settings, such as the host, port, and login credentials.

php
Copy code
<?php
// config.php
return [
'epp_host' => 'ssl://epp.nominet.org.uk', // Replace with the correct EPP host
'epp_port' => 700, // EPP default port
'epp_username' => 'YOUR_EPP_USERNAME',
'epp_password' => 'YOUR_EPP_PASSWORD',
];
2. Login and Logout
To connect to the Nominet EPP system, we will use the EPP login/logout commands. Start with a simple login form.

php
Copy code
<?php
// index.php
session_start();
$config = require 'config.php';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'];
$password = $_POST['password'];

if ($username === $config['epp_username'] && $password === $config['epp_password']) {
$_SESSION['logged_in'] = true;
header('Location: dashboard.php');
exit;
} else {
echo "Invalid login credentials!";
}
}

if (isset($_GET['logout'])) {
session_destroy();
header('Location: index.php');
exit;
}

?>

<!DOCTYPE html>
<html>
<head>
<title>Nominet EPP Login</title>
</head>
<body>
<h2>Login to Nominet EPP</h2>
<form method="post" action="index.php">
Username: <input type="text" name="username" required><br>
Password: <input type="password" name="password" required><br>
<input type="submit" value="Login">
</form>
</body>
</html>
3. Dashboard: Listing Domains, Creating Domains, Changing Nameservers
Once logged in, redirect to a dashboard where you can issue EPP commands.

php
Copy code
<?php
// dashboard.php
session_start();
if (!isset($_SESSION['logged_in']) || !$_SESSION['logged_in']) {
header('Location: index.php');
exit;
}

$config = require 'config.php';

function eppConnect($config) {
$fp = fsockopen($config['epp_host'], $config['epp_port'], $errno, $errstr, 30);
if (!$fp) {
echo "Error connecting to EPP: $errstr ($errno)";
exit;
}

// Read server greeting
$greeting = fread($fp, 8192);
return $fp;
}

function eppLogin($fp, $config) {
$xml = <<<XML
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<login>
<clID>{$config['epp_username']}</clID>
<pw>{$config['epp_password']}</pw>
<options>
<version>1.0</version>
<lang>en</lang>
</options>
</login>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
XML;

fwrite($fp, $xml);
$response = fread($fp, 8192);
return $response;
}

function eppLogout($fp) {
$xml = <<<XML
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<logout/>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
XML;

fwrite($fp, $xml);
fclose($fp);
}

if (isset($_POST['action'])) {
$fp = eppConnect($config);
eppLogin($fp, $config);

switch ($_POST['action']) {
case 'list_domains':
// EPP command to list domains on a tag
$xml = <<<XML
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<info>
<domain:info xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.co.uk</domain:name>
</domain:info>
</info>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
XML;
fwrite($fp, $xml);
$response = fread($fp, 8192);
echo "Domain list: " . htmlspecialchars($response);
break;

case 'create_domain':
// EPP command to create a domain
$domain = $_POST['domain'];
$xml = <<<XML
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<create>
<domain:create xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>$domain</domain:name>
<domain:period unit="y">1</domain:period>
<domain:ns>
<domain:hostObj>ns1.example.co.uk</domain:hostObj>
<domain:hostObj>ns2.example.co.uk</domain:hostObj>
</domain:ns>
<domain:registrant>YOUR-REGISTRANT-ID</domain:registrant>
<domain:contact type="admin">YOUR-CONTACT-ID</domain:contact>
<domain:contact type="tech">YOUR-CONTACT-ID</domain:contact>
</domain:create>
</create>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
XML;
fwrite($fp, $xml);
$response = fread($fp, 8192);
echo "Domain creation response: " . htmlspecialchars($response);
break;

case 'change_nameservers':
// EPP command to change nameservers for domains
$domain = $_POST['domain'];
$nameservers = explode(",", $_POST['nameservers']); // ns1.example.com,ns2.example.com
$hostObjs = "";
foreach ($nameservers as $ns) {
$hostObjs .= "<domain:hostObj>$ns</domain:hostObj>";
}
$xml = <<<XML
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<update>
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>$domain</domain:name>
<domain:chg>
<domain:ns>
$hostObjs
</domain:ns>
</domain:chg>
</domain:update>
</update>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
XML;
fwrite($fp, $xml);
$response = fread($fp, 8192);
echo "Nameserver update response: " . htmlspecialchars($response);
break;
}

eppLogout($fp);
}

?>

<!DOCTYPE html>
<html>
<head>
<title>EPP Dashboard</title>
</head>
<body>
<h2>EPP Dashboard</h2>
<form method="post" action="dashboard.php">
<input type="hidden" name="action" value="list_domains">
<input type="submit" value="List Domains">
</form>

<form method="post" action="dashboard.php">
<input type="hidden" name="action" value="create_domain">
Domain: <input type="text" name="domain" required><br>
<input type="submit" value="Create Domain">
</form>

<form method="post" action="dashboard.php">
<input type="hidden" name="action" value="change_nameservers">
Domain: <input type="text" name="domain" required><br>
Nameservers (comma separated): <input type="text" name="nameservers" required><br>
<input type="submit" value="Change Nameservers">
</form>

<br><a href="index.php?logout=true">Logout</a>
</body>
</html>
Key Functions:
eppConnect: Opens a connection to the EPP server.
eppLogin: Logs in to the EPP server.
eppLogout: Logs out from the EPP server.
Use POST forms to trigger domain listing, creation, and nameserver changes.
Notes:
Error Handling: For simplicity, there is minimal error handling. Consider adding robust validation and error handling for production.
SSL Certificate: Ensure the EPP server you're connecting to has the right SSL configuration (openssl support is required).
Security: Use HTTPS and protect the PHP session properly in a production environment.
Nominet-specific Details: Update EPP host, port, registrant, and contact IDs to match your Nominet account details.
 
This post hurt my eyes @Ant lol, maybe use a code block next time 😂

You’d get a better response by feeding EPP documentation to it first, and creating functions in bite sized chunks. I knew a dev once who worked in the same way. You gave him the idea for a function or functionality and he built it, but if you gave him the whole idea at once, he would get lost on all sorts of shit.
 
I will report back later with how I get on, right I fed chatgpt the whole of the documentation but it was missing nuisances with what order you are meant to send certain requests and parsing the responses.


I'll have another go :)
 
Also @Aaron might be able to point you in the right direction, he created the legendary terminal tool that used during RoR.
 
Back
Top