| @@ 166-186 (lines=21) @@ | ||
| 163 | ); |
|
| 164 | } |
|
| 165 | ||
| 166 | private function execEasyRsa(array $argv) |
|
| 167 | { |
|
| 168 | $command = sprintf( |
|
| 169 | '%s/easyrsa --vars=%s/vars %s >/dev/null 2>/dev/null', |
|
| 170 | $this->easyRsaDir, |
|
| 171 | $this->easyRsaDataDir, |
|
| 172 | implode(' ', $argv) |
|
| 173 | ); |
|
| 174 | ||
| 175 | exec( |
|
| 176 | $command, |
|
| 177 | $commandOutput, |
|
| 178 | $returnValue |
|
| 179 | ); |
|
| 180 | ||
| 181 | if (0 !== $returnValue) { |
|
| 182 | throw new RuntimeException( |
|
| 183 | sprintf('command "%s" did not complete successfully: "%s"', $command, $commandOutput) |
|
| 184 | ); |
|
| 185 | } |
|
| 186 | } |
|
| 187 | } |
|
| 188 | ||
| @@ 51-69 (lines=19) @@ | ||
| 48 | return FileIO::readFile($taFile); |
|
| 49 | } |
|
| 50 | ||
| 51 | private function execOpenVpn(array $argv) |
|
| 52 | { |
|
| 53 | $command = sprintf( |
|
| 54 | '/usr/sbin/openvpn %s >/dev/null 2>/dev/null', |
|
| 55 | implode(' ', $argv) |
|
| 56 | ); |
|
| 57 | ||
| 58 | exec( |
|
| 59 | $command, |
|
| 60 | $commandOutput, |
|
| 61 | $returnValue |
|
| 62 | ); |
|
| 63 | ||
| 64 | if (0 !== $returnValue) { |
|
| 65 | throw new RuntimeException( |
|
| 66 | sprintf('command "%s" did not complete successfully: "%s"', $command, $commandOutput) |
|
| 67 | ); |
|
| 68 | } |
|
| 69 | } |
|
| 70 | } |
|
| 71 | ||