Store node daemon tokens in an encrypted manner

This commit is contained in:
Dane Everitt 2020-04-10 15:15:38 -07:00
parent 2ac82af25a
commit 7557dddf49
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
26 changed files with 222 additions and 827 deletions

View file

@ -23,4 +23,22 @@ class DaemonConfigurationRepository extends DaemonRepository
return json_decode($response->getBody()->__toString(), true);
}
/**
* Updates the configuration information for a daemon.
*
* @param array $attributes
* @return \Psr\Http\Message\ResponseInterface
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function update(array $attributes = [])
{
try {
return $this->getHttpClient()->post(
'/api/update', array_merge($this->node->getConfiguration(), $attributes)
);
} catch (TransferException $exception) {
throw new DaemonConnectionException($exception);
}
}
}

View file

@ -79,7 +79,7 @@ abstract class DaemonRepository
'timeout' => config('pterodactyl.guzzle.timeout'),
'connect_timeout' => config('pterodactyl.guzzle.connect_timeout'),
'headers' => array_merge($headers, [
'Authorization' => 'Bearer ' . $this->node->daemonSecret,
'Authorization' => 'Bearer ' . $this->node->getDecryptedKey(),
'Accept' => 'application/json',
'Content-Type' => 'application/json',
]),