mirror of
https://github.com/DanWin/hosting.git
synced 2025-08-17 19:13:46 +02:00
Fixed potential race condition pointed out in issue #31
This commit is contained in:
parent
5cd13e9269
commit
756e16b533
1 changed files with 2 additions and 3 deletions
|
@ -117,10 +117,9 @@ foreach($onions as $onion){
|
|||
if($onion[2]==2){
|
||||
//php openssl implementation has some issues, re-export using native openssl
|
||||
$pkey=openssl_pkey_get_private($onion[1]);
|
||||
openssl_pkey_export_to_file($pkey, 'key.tmp');
|
||||
openssl_pkey_export($pkey, $exported);
|
||||
openssl_pkey_free($pkey);
|
||||
$priv_key=shell_exec('openssl rsa < key.tmp');
|
||||
unlink('key.tmp');
|
||||
$priv_key=shell_exec('echo ' . escapeshellarg($exported) . ' | openssl rsa');
|
||||
//save hidden service
|
||||
mkdir("/var/lib/tor-instances/$firstchar/hidden_service_$onion[0].onion", 0700);
|
||||
file_put_contents("/var/lib/tor-instances/$firstchar/hidden_service_$onion[0].onion/private_key", $priv_key);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue