Compare commits
7 Commits
ea6e99e4be
...
866e1dcb9b
Author | SHA1 | Date |
---|---|---|
tracer | 866e1dcb9b | |
tracer | 8b6d939123 | |
tracer | faff70eb07 | |
tracer | cf95b67948 | |
tracer | 0410d3b3a1 | |
tracer | f776f7d16b | |
tracer | a953e5cc66 |
33
README.md
33
README.md
|
@ -43,15 +43,12 @@ The CLI is used to perform configuration and some checks:
|
|||
|
||||
![OpenAPI](https://bindapi.24unix.net/assets/bindAPI_api1.png)
|
||||
|
||||
The APi is a RESTful API, there is a self explaining Swagger/OpenAPI available.
|
||||
|
||||
|
||||
The API is a RESTful API, there is a self explaining Swagger/OpenAPI available.
|
||||
|
||||
<a name="installation"></a>
|
||||
# 3. Installation
|
||||
|
||||
You can install the bindAPi on either a standalone server or an existing KeyHelp Panel.
|
||||
However, slave zones are only managed for masters which lie on Keyhelp panels.
|
||||
You can install the bindAPI on either a standalone server or an existing KeyHelp Panel. However, slave zones are only managed for masters which lie on Keyhelp panels.
|
||||
|
||||
## 3.1. Installation on a KeyHelp panel
|
||||
|
||||
|
@ -115,7 +112,13 @@ Remove the defaults files:
|
|||
|
||||
`rm *`
|
||||
|
||||
Next, we'll need to fetch the bindAPI (currently it has no release tag, that will change later)
|
||||
Next, we'll need to fetch the bindAPI. As of now, the latest release is 1.0.1:
|
||||
https://git.24unix.net/tracer/bindAPI/archive/1.0.1.tar.gz
|
||||
|
||||
I'd suggest checking here for the latest version:
|
||||
https://git.24unix.net/tracer/bindAPI/releases
|
||||
|
||||
Or just use git to checkout the latest update:
|
||||
|
||||
```
|
||||
git clone https://git.24unix.net/tracer/bindAPI.git
|
||||
|
@ -132,11 +135,11 @@ We need to pull the dependencies for composer:
|
|||
|
||||
`/usr/bin/keyhelp-php81 /usr/local/bin/composer update`
|
||||
|
||||
You might notice a quite strange command.
|
||||
We need to call php with full path, and explicitly the 8.1 version.
|
||||
KeyHelp relies on the default PHP installation, so the php binary will always point to 7.4 when your on Debian Bullseye.
|
||||
You might notice a quite strange command. We need to call php with full path, and explicitly the 8.1 version. KeyHelp
|
||||
relies on the default PHP installation, so the php binary will always point to 7.4 when you're on Debian Bullseye.
|
||||
|
||||
So, in bin/console the path to /usr/bin/keyhelp-php81 is hardcoded after the shebang, a step we have to remind if we install the standalone version.
|
||||
So, in bin/console the path to /usr/bin/keyhelp-php81 is hardcoded after the shebang, a step we have to remind if we
|
||||
install the standalone version.
|
||||
|
||||
Now make the CLI executable:
|
||||
|
||||
|
@ -151,19 +154,19 @@ Should I create a new config based on config.json.sample? (y/N): n
|
|||
You first have to setup the bindAPI. Bye.
|
||||
```
|
||||
|
||||
So now we can head back to our panel and set the Document root to
|
||||
/home/users/tfunix/ns1.24unix.net/bindAPI/public.
|
||||
So now we can head back to our panel and set the Document root to /home/users/tfunix/ns1.24unix.net/bindAPI/public.
|
||||
|
||||
Additionally, we have to change the open_basedir directive:
|
||||
##DOCROOT##/www:##DOCROOT##/files:##DOCROOT##/tmp:/etc/bind:/etc/bind/local.zones
|
||||
|
||||
TODO: Screenshot
|
||||
`##DOCROOT##/www:##DOCROOT##/files:##DOCROOT##/tmp:/etc/bind:/etc/bind/local.zones`
|
||||
|
||||
![Php Interpreter](https://bindapi.24unix.net/assets/bindAPI_phpsetting.png)
|
||||
|
||||
and remove exec from disabled functions.
|
||||
|
||||
OK, we are finished with the installation and head over to the [4. Configuration](#4-configuration).
|
||||
|
||||
## 3.2. Installation on a plain debian Bullseye
|
||||
## 3.2. Installation on a plain Debian Bullseye
|
||||
|
||||
So, at first you should read and understand all steps in 3.1, as we will learn only the differences.
|
||||
|
||||
|
|
|
@ -477,7 +477,6 @@ class BindAPI
|
|||
break;
|
||||
default:
|
||||
echo 'Server error' . PHP_EOL;
|
||||
print_r(value: $result);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -778,7 +777,7 @@ class BindAPI
|
|||
}
|
||||
|
||||
if ($this->config['verbose']) {
|
||||
print(COLOR_YELLOW . str_pad(string: $server->getName(), length: $maxName));
|
||||
echo COLOR_YELLOW . str_pad(string: $server->getName(), length: $maxName);
|
||||
}
|
||||
|
||||
$a = $server->getA() ?? '';
|
||||
|
@ -1316,7 +1315,7 @@ class BindAPI
|
|||
{
|
||||
$nameservers = $this->nameserverRepository->findAll();
|
||||
|
||||
echo COLOR_DEFAULT . 'You need to add these lines to ' . COLOR_YELLOW . '/etc/bind/local.bindapi.options' . COLOR_DEFAULT . ' and make sure' . PHP_EOL;
|
||||
echo COLOR_DEFAULT . 'You need to add these lines to ' . COLOR_YELLOW . '/etc/bind/local.bindapi.options' . COLOR_DEFAULT . ' on every panel and make sure' . PHP_EOL;
|
||||
echo 'that ' . COLOR_YELLOW . 'include "/etc/bind/local.bindapi.options";' . COLOR_DEFAULT . ' exists in ' . COLOR_YELLOW . '/etc/bind/named.conf.options' . COLOR_DEFAULT . '.' . PHP_EOL;
|
||||
$ip = [];
|
||||
foreach ($nameservers as $nameserver) {
|
||||
|
@ -1336,6 +1335,8 @@ class BindAPI
|
|||
echo "\t$currentIp;" . PHP_EOL;
|
||||
echo '};' . PHP_EOL;
|
||||
echo PHP_EOL . 'After the modification feel free to run ' . COLOR_YELLOW . 'named-checkconf' . COLOR_DEFAULT . ' to ensure there were no errors.' . PHP_EOL;
|
||||
echo PHP_EOL . 'Run ' . COLOR_YELLOW . 'rndc reload' . COLOR_DEFAULT . ' to activate the changes' . PHP_EOL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class DomainController
|
|||
|
||||
echo 'Checking permission:' . PHP_EOL . PHP_EOL;
|
||||
$uid = posix_geteuid();
|
||||
print("UID:\t" . COLOR_YELLOW . $uid . PHP_EOL);
|
||||
echo "UID:\t" . COLOR_YELLOW . $uid . PHP_EOL;
|
||||
|
||||
$pwuid = posix_getpwuid(user_id: $uid);
|
||||
$name = $pwuid['name'];
|
||||
|
@ -122,26 +122,26 @@ class DomainController
|
|||
|
||||
}
|
||||
|
||||
echo 'Checking file: ' . $this->localZoneFile . PHP_EOL;
|
||||
echo COLOR_DEFAULT . 'Checking ' . COLOR_YELLOW . $this->localZoneFile . PHP_EOL;
|
||||
$localZoneFilePermissions = fileperms(filename: $this->localZoneFile);
|
||||
if ($localZoneFilePermissions & 0x0010) {
|
||||
echo "\t✅ Group has write access." . PHP_EOL;
|
||||
echo COLOR_DEFAULT . "\t✅ Group has write access." . PHP_EOL;
|
||||
} else {
|
||||
echo "\t❌Group needs write permission!" . PHP_EOL;
|
||||
echo COLOR_RED . "\t❌Group needs write permission!" . PHP_EOL;
|
||||
}
|
||||
|
||||
echo "Checking $this->namedConfLocalFile" . PHP_EOL;
|
||||
echo 'Checking ' . COLOR_YELLOW . $this->namedConfLocalFile . PHP_EOL;
|
||||
if ($namedConfLocal = file_get_contents(filename: $this->namedConfLocalFile)) {
|
||||
if (!str_contains(haystack: $namedConfLocal, needle: $this->localZoneFile)) {
|
||||
echo "\t❌ $this->localZoneFile needs to be included in $this->namedConfLocalFile . " . PHP_EOL;
|
||||
echo "\t❌ $this->localZoneFile" . COLOR_RED . ' needs to be included in ' . COLOR_YELLOW . $this->namedConfLocalFile . PHP_EOL;
|
||||
} else {
|
||||
echo "\t✅ $this->localZoneFile is included in $this->namedConfLocalFile" . PHP_EOL;
|
||||
echo "\t✅ $this->localZoneFile" . COLOR_DEFAULT . ' is included in ' . COLOR_YELLOW . $this->namedConfLocalFile . PHP_EOL;
|
||||
}
|
||||
} else {
|
||||
echo "\t❌ No access to '$this->namedConfLocalFile' . Please check permissions" . PHP_EOL;
|
||||
}
|
||||
|
||||
echo 'Checking directory: ' . $this->localZonesDir . PHP_EOL;
|
||||
echo COLOR_DEFAULT . 'Checking directory: ' . COLOR_YELLOW . $this->localZonesDir . PHP_EOL;
|
||||
$localZoneDirPermissions = fileperms(filename: $this->localZonesDir);
|
||||
if ($localZoneDirPermissions & 0x0010) {
|
||||
echo "\t✅ Group has write access." . PHP_EOL;
|
||||
|
|
|
@ -161,7 +161,7 @@ class ApikeyRepository
|
|||
|
||||
return $statement->rowCount();
|
||||
} catch (PDOException $e) {
|
||||
print($e->getMessage());
|
||||
echo $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,8 +41,6 @@ class DomainRepository
|
|||
$statement = $this->databaseConnection->getConnection()->prepare(query: $sql);
|
||||
$statement->execute();
|
||||
while ($result = $statement->fetch(mode: PDO::FETCH_ASSOC)) {
|
||||
//print_r($result);
|
||||
//die();
|
||||
$domain = new Domain(name: $result['name'], panel: $result['panel'], id: $result['id']);
|
||||
$domains[] = $domain;
|
||||
}
|
||||
|
@ -187,7 +185,7 @@ class DomainRepository
|
|||
|
||||
return $statement->rowCount();
|
||||
} catch (PDOException $e) {
|
||||
print($e->getMessage());
|
||||
echo $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ class NameserverRepository
|
|||
|
||||
return $statement->rowCount();
|
||||
} catch (PDOException $e) {
|
||||
print($e->getMessage());
|
||||
echo $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ class PanelRepository
|
|||
|
||||
return $statement->rowCount();
|
||||
} catch (PDOException $e) {
|
||||
print($e->getMessage());
|
||||
echo $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue