Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add certificate based transport #55

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Classes/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ public function run(ServerRequestInterface $request): ResponseInterface

// Generate json
if ($output = json_encode($data)) {
if (
extension_loaded('openssl')
&& $settings['enableSSLsecuredConnection']
&& is_file($settings['privateKeyFile'])
&& in_array($settings, openssl_get_cipher_methods())
) {
$output = openssl_encrypt($output, $settings['openSSLcipher'], $settings['privateKeyFile']);
}
$response = $response->withHeader('Content-Type', 'application/json; charset=utf-8');
$response->getBody()->write($output);

Expand Down
11 changes: 10 additions & 1 deletion ext_conf_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,13 @@ secret =
allowedIps = *

# cat=features/enable/3; type=boolean; label=Enable debugging: Instead of silently stopping the endpoint call, the error is outputted. Just enable this to debug if a connection is not possible!
enableDebugForErrors = 0
enableDebugForErrors = 0

# cat=features/enable/4; type=string; label=Path to users private key file, eg. ~/.ssh/id_rsa
privateKeyFile = ~/.ssh/id_rsa

# cat=features/enable/5; type=boolean; label=Enable the private key file secure transport
enableSSLsecuredConnection = 0

# cat=features/enable/6; type=string; label=Cipher for secure transport
openSSLcipher = aes-256-gcm