@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | class CertificationAuthorityEduPki extends EntityWithDBProperties implements CertificationAuthorityInterface |
18 | 18 | { |
19 | 19 | |
20 | - private const LOCATION_RA_CERT = ROOT . "/config/SilverbulletClientCerts/edupki-test-ra.pem"; |
|
21 | - private const LOCATION_RA_KEY = ROOT . "/config/SilverbulletClientCerts/edupki-test-ra.clearkey"; |
|
22 | - private const LOCATION_WEBROOT = ROOT . "/config/SilverbulletClientCerts/eduPKI-webserver-root.pem"; |
|
20 | + private const LOCATION_RA_CERT = ROOT."/config/SilverbulletClientCerts/edupki-test-ra.pem"; |
|
21 | + private const LOCATION_RA_KEY = ROOT."/config/SilverbulletClientCerts/edupki-test-ra.clearkey"; |
|
22 | + private const LOCATION_WEBROOT = ROOT."/config/SilverbulletClientCerts/eduPKI-webserver-root.pem"; |
|
23 | 23 | private const EDUPKI_RA_ID = 700; |
24 | 24 | private const EDUPKI_CERT_PROFILE = "User SOAP"; |
25 | 25 | private const EDUPKI_RA_PKEY_PASSPHRASE = "..."; |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | parent::__construct(); |
36 | 36 | |
37 | 37 | if (stat(CertificationAuthorityEduPki::LOCATION_RA_CERT) === FALSE) { |
38 | - throw new Exception("RA operator PEM file not found: " . CertificationAuthorityEduPki::LOCATION_RA_CERT); |
|
38 | + throw new Exception("RA operator PEM file not found: ".CertificationAuthorityEduPki::LOCATION_RA_CERT); |
|
39 | 39 | } |
40 | 40 | if (stat(CertificationAuthorityEduPki::LOCATION_RA_KEY) === FALSE) { |
41 | - throw new Exception("RA operator private key file not found: " . CertificationAuthorityEduPki::LOCATION_RA_KEY); |
|
41 | + throw new Exception("RA operator private key file not found: ".CertificationAuthorityEduPki::LOCATION_RA_KEY); |
|
42 | 42 | } |
43 | 43 | if (stat(CertificationAuthorityEduPki::LOCATION_WEBROOT) === FALSE) { |
44 | - throw new Exception("CA website root CA file not found: " . CertificationAuthorityEduPki::LOCATION_WEBROOT); |
|
44 | + throw new Exception("CA website root CA file not found: ".CertificationAuthorityEduPki::LOCATION_WEBROOT); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
@@ -72,19 +72,19 @@ discard block |
||
72 | 72 | // initialise connection to eduPKI CA / eduroam RA and send the request to them |
73 | 73 | try { |
74 | 74 | $altArray = [# Array mit den Subject Alternative Names |
75 | - "email:" . $csr["USERNAME"] |
|
75 | + "email:".$csr["USERNAME"] |
|
76 | 76 | ]; |
77 | 77 | $soapPub = $this->initEduPKISoapSession("PUBLIC"); |
78 | 78 | $this->loggerInstance->debug(5, "FIRST ACTUAL SOAP REQUEST (Public, newRequest)!\n"); |
79 | - $this->loggerInstance->debug(5, "PARAM_1: " . CertificationAuthorityEduPki::EDUPKI_RA_ID . "\n"); |
|
80 | - $this->loggerInstance->debug(5, "PARAM_2: " . $csr["CSR"] . "\n"); |
|
79 | + $this->loggerInstance->debug(5, "PARAM_1: ".CertificationAuthorityEduPki::EDUPKI_RA_ID."\n"); |
|
80 | + $this->loggerInstance->debug(5, "PARAM_2: ".$csr["CSR"]."\n"); |
|
81 | 81 | $this->loggerInstance->debug(5, "PARAM_3: "); |
82 | 82 | $this->loggerInstance->debug(5, $altArray); |
83 | - $this->loggerInstance->debug(5, "PARAM_4: " . CertificationAuthorityEduPki::EDUPKI_CERT_PROFILE . "\n"); |
|
84 | - $this->loggerInstance->debug(5, "PARAM_5: " . sha1("notused") . "\n"); |
|
85 | - $this->loggerInstance->debug(5, "PARAM_6: " . $csr["USERNAME"] . "\n"); |
|
86 | - $this->loggerInstance->debug(5, "PARAM_7: " . $csr["USERNAME"] . "\n"); |
|
87 | - $this->loggerInstance->debug(5, "PARAM_8: " . ProfileSilverbullet::PRODUCTNAME . "\n"); |
|
83 | + $this->loggerInstance->debug(5, "PARAM_4: ".CertificationAuthorityEduPki::EDUPKI_CERT_PROFILE."\n"); |
|
84 | + $this->loggerInstance->debug(5, "PARAM_5: ".sha1("notused")."\n"); |
|
85 | + $this->loggerInstance->debug(5, "PARAM_6: ".$csr["USERNAME"]."\n"); |
|
86 | + $this->loggerInstance->debug(5, "PARAM_7: ".$csr["USERNAME"]."\n"); |
|
87 | + $this->loggerInstance->debug(5, "PARAM_8: ".ProfileSilverbullet::PRODUCTNAME."\n"); |
|
88 | 88 | $this->loggerInstance->debug(5, "PARAM_9: false\n"); |
89 | 89 | $soapNewRequest = $soapPub->newRequest( |
90 | 90 | CertificationAuthorityEduPki::EDUPKI_RA_ID, # RA-ID |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | } catch (Exception $e) { |
107 | 107 | // PHP 7.1 can do this much better |
108 | 108 | if (is_soap_fault($e)) { |
109 | - throw new Exception("Error when sending SOAP request: " . "{$e->faultcode}: { |
|
109 | + throw new Exception("Error when sending SOAP request: "."{$e->faultcode}: { |
|
110 | 110 | $e->faultstring |
111 | 111 | }\n"); |
112 | 112 | } |
113 | - throw new Exception("Something odd happened while doing the SOAP request:" . $e->getMessage()); |
|
113 | + throw new Exception("Something odd happened while doing the SOAP request:".$e->getMessage()); |
|
114 | 114 | } |
115 | 115 | try { |
116 | 116 | $soap = $this->initEduPKISoapSession("RA"); |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | $soapReqnum, [ |
123 | 123 | "RaID" => CertificationAuthorityEduPki::EDUPKI_RA_ID, |
124 | 124 | "Role" => CertificationAuthorityEduPki::EDUPKI_CERT_PROFILE, |
125 | - "Subject" => "DC=eduroam,DC=test,DC=test,C=" . $csr["FED"] . ",O=" . \config\ConfAssistant::CONSORTIUM['name'] . ",OU=" . $csr["FED"] . ",CN=" . $csr['USERNAME'] . ",emailAddress=" . $csr['USERNAME'], |
|
126 | - "SubjectAltNames" => ["email:" . $csr["USERNAME"]], |
|
125 | + "Subject" => "DC=eduroam,DC=test,DC=test,C=".$csr["FED"].",O=".\config\ConfAssistant::CONSORTIUM['name'].",OU=".$csr["FED"].",CN=".$csr['USERNAME'].",emailAddress=".$csr['USERNAME'], |
|
126 | + "SubjectAltNames" => ["email:".$csr["USERNAME"]], |
|
127 | 127 | "NotBefore" => (new \DateTime())->format('c'), |
128 | 128 | "NotAfter" => $expiry->format('c'), |
129 | 129 | ] |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | // for obnoxious reasons, we have to dump the request into a file and let pkcs7_sign read from the file |
143 | 143 | // rather than just using the string. Grr. |
144 | 144 | $tempdir = \core\common\Entity::createTemporaryDirectory("test"); |
145 | - file_put_contents($tempdir['dir'] . "/content.txt", $soapCleartext); |
|
145 | + file_put_contents($tempdir['dir']."/content.txt", $soapCleartext); |
|
146 | 146 | // retrieve our RA cert from filesystem |
147 | 147 | // the RA certificates are not needed right now because we |
148 | 148 | // have resorted to S/MIME signatures with openssl command-line |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | // sign the data, using cmdline because openssl_pkcs7_sign produces strange results |
155 | 155 | // -binary didn't help, nor switch -md to sha1 sha256 or sha512 |
156 | 156 | $this->loggerInstance->debug(5, "Actual content to be signed is this:\n $soapCleartext\n"); |
157 | - $execCmd = \config\Master::PATHS['openssl'] . " smime -sign -binary -in " . $tempdir['dir'] . "/content.txt -out " . $tempdir['dir'] . "/signature.txt -outform pem -inkey " . ROOT . "/config/SilverbulletClientCerts/edupki-test-ra.clearkey -signer " . ROOT . "/config/SilverbulletClientCerts/edupki-test-ra.pem"; |
|
157 | + $execCmd = \config\Master::PATHS['openssl']." smime -sign -binary -in ".$tempdir['dir']."/content.txt -out ".$tempdir['dir']."/signature.txt -outform pem -inkey ".ROOT."/config/SilverbulletClientCerts/edupki-test-ra.clearkey -signer ".ROOT."/config/SilverbulletClientCerts/edupki-test-ra.pem"; |
|
158 | 158 | $this->loggerInstance->debug(2, "Calling openssl smime with following cmdline: $execCmd\n"); |
159 | 159 | $output = []; |
160 | 160 | $return = 999; |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | throw new Exception("Non-zero return value from openssl smime!"); |
164 | 164 | } |
165 | 165 | // and get the signature blob back from the filesystem |
166 | - $detachedSig = trim(file_get_contents($tempdir['dir'] . "/signature.txt")); |
|
166 | + $detachedSig = trim(file_get_contents($tempdir['dir']."/signature.txt")); |
|
167 | 167 | $this->loggerInstance->debug(5, "Request for server approveRequest has parameters:\n"); |
168 | - $this->loggerInstance->debug(5, $soapReqnum . "\n"); |
|
169 | - $this->loggerInstance->debug(5, $soapCleartext . "\n"); // PHP magically encodes this as base64 while sending! |
|
170 | - $this->loggerInstance->debug(5, $detachedSig . "\n"); |
|
168 | + $this->loggerInstance->debug(5, $soapReqnum."\n"); |
|
169 | + $this->loggerInstance->debug(5, $soapCleartext."\n"); // PHP magically encodes this as base64 while sending! |
|
170 | + $this->loggerInstance->debug(5, $detachedSig."\n"); |
|
171 | 171 | $soapIssueCert = $soap->approveRequest($soapReqnum, $soapCleartext, $detachedSig); |
172 | - $this->loggerInstance->debug(5, "approveRequest Request was: \n" . $soap->__getLastRequest()); |
|
173 | - $this->loggerInstance->debug(5, "approveRequest Response was: \n" . $soap->__getLastResponse()); |
|
172 | + $this->loggerInstance->debug(5, "approveRequest Request was: \n".$soap->__getLastRequest()); |
|
173 | + $this->loggerInstance->debug(5, "approveRequest Response was: \n".$soap->__getLastResponse()); |
|
174 | 174 | if ($soapIssueCert === FALSE) { |
175 | 175 | throw new Exception("The locally approved request was NOT processed by the CA."); |
176 | 176 | } |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | throw new Exception("CAInfo has no root certificate for us!"); |
208 | 208 | } |
209 | 209 | } catch (SoapFault $e) { |
210 | - throw new Exception("SoapFault: Error when sending or receiving SOAP message: " . "{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
210 | + throw new Exception("SoapFault: Error when sending or receiving SOAP message: "."{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
211 | 211 | } catch (Exception $e) { |
212 | - throw new Exception("Exception: Something odd happened between the SOAP requests:" . $e->getMessage()); |
|
212 | + throw new Exception("Exception: Something odd happened between the SOAP requests:".$e->getMessage()); |
|
213 | 213 | } |
214 | 214 | return [ |
215 | 215 | "CERT" => openssl_x509_read($parsedCert['pem']), |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | // for obnoxious reasons, we have to dump the request into a file and let pkcs7_sign read from the file |
243 | 243 | // rather than just using the string. Grr. |
244 | 244 | $tempdir = \core\common\Entity::createTemporaryDirectory("test"); |
245 | - file_put_contents($tempdir['dir'] . "/content.txt", $soapRawRevRequest); |
|
245 | + file_put_contents($tempdir['dir']."/content.txt", $soapRawRevRequest); |
|
246 | 246 | // retrieve our RA cert from filesystem |
247 | 247 | // sign the data, using cmdline because openssl_pkcs7_sign produces strange results |
248 | 248 | // -binary didn't help, nor switch -md to sha1 sha256 or sha512 |
249 | 249 | $this->loggerInstance->debug(5, "Actual content to be signed is this:\n$soapRawRevRequest\n"); |
250 | - $execCmd = \config\Master::PATHS['openssl'] . " smime -sign -binary -in " . $tempdir['dir'] . "/content.txt -out " . $tempdir['dir'] . "/signature.txt -outform pem -inkey " . CertificationAuthorityEduPki::LOCATION_RA_KEY . " -signer " . CertificationAuthorityEduPki::LOCATION_RA_CERT; |
|
250 | + $execCmd = \config\Master::PATHS['openssl']." smime -sign -binary -in ".$tempdir['dir']."/content.txt -out ".$tempdir['dir']."/signature.txt -outform pem -inkey ".CertificationAuthorityEduPki::LOCATION_RA_KEY." -signer ".CertificationAuthorityEduPki::LOCATION_RA_CERT; |
|
251 | 251 | $this->loggerInstance->debug(2, "Calling openssl smime with following cmdline: $execCmd\n"); |
252 | 252 | $output = []; |
253 | 253 | $return = 999; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | throw new Exception("Non-zero return value from openssl smime!"); |
257 | 257 | } |
258 | 258 | // and get the signature blob back from the filesystem |
259 | - $detachedSig = trim(file_get_contents($tempdir['dir'] . "/signature.txt")); |
|
259 | + $detachedSig = trim(file_get_contents($tempdir['dir']."/signature.txt")); |
|
260 | 260 | $soapIssueRev = $soap->approveRevocationRequest($soapRevocationSerial, $soapRawRevRequest, $detachedSig); |
261 | 261 | if ($soapIssueRev === FALSE) { |
262 | 262 | throw new Exception("The locally approved revocation request was NOT processed by the CA."); |
@@ -264,9 +264,9 @@ discard block |
||
264 | 264 | } catch (Exception $e) { |
265 | 265 | // PHP 7.1 can do this much better |
266 | 266 | if (is_soap_fault($e)) { |
267 | - throw new Exception("Error when sending SOAP request: " . "{$e->faultcode}: {$e->faultstring}\n"); |
|
267 | + throw new Exception("Error when sending SOAP request: "."{$e->faultcode}: {$e->faultstring}\n"); |
|
268 | 268 | } |
269 | - throw new Exception("Something odd happened while doing the SOAP request:" . $e->getMessage()); |
|
269 | + throw new Exception("Something odd happened while doing the SOAP request:".$e->getMessage()); |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
@@ -366,9 +366,9 @@ discard block |
||
366 | 366 | */ |
367 | 367 | public function soapToXmlInteger($x) |
368 | 368 | { |
369 | - return '<' . $x[0] . '>' |
|
369 | + return '<'.$x[0].'>' |
|
370 | 370 | . htmlentities($x[1], ENT_NOQUOTES | ENT_XML1) |
371 | - . '</' . $x[0] . '>'; |
|
371 | + . '</'.$x[0].'>'; |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | /** |
@@ -387,9 +387,9 @@ discard block |
||
387 | 387 | // dump private key into directory |
388 | 388 | $outstring = ""; |
389 | 389 | openssl_pkey_export($privateKey, $outstring); |
390 | - file_put_contents($tempdir . "/pkey.pem", $outstring); |
|
390 | + file_put_contents($tempdir."/pkey.pem", $outstring); |
|
391 | 391 | // PHP can only do one DC in the Subject. But we need three. |
392 | - $execCmd = \config\Master::PATHS['openssl'] . " req -new -sha256 -key $tempdir/pkey.pem -out $tempdir/request.csr -subj /DC=test/DC=test/DC=eduroam/C=$fed/O=" . \config\ConfAssistant::CONSORTIUM['name'] . "/OU=$fed/CN=$username/emailAddress=$username"; |
|
392 | + $execCmd = \config\Master::PATHS['openssl']." req -new -sha256 -key $tempdir/pkey.pem -out $tempdir/request.csr -subj /DC=test/DC=test/DC=eduroam/C=$fed/O=".\config\ConfAssistant::CONSORTIUM['name']."/OU=$fed/CN=$username/emailAddress=$username"; |
|
393 | 393 | $this->loggerInstance->debug(2, "Calling openssl req with following cmdline: $execCmd\n"); |
394 | 394 | $output = []; |
395 | 395 | $return = 999; |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | class CertificationAuthorityEmbeddedECDSA extends EntityWithDBProperties implements CertificationAuthorityInterface |
17 | 17 | { |
18 | 18 | |
19 | - private const LOCATION_ROOT_CA = ROOT . "/config/SilverbulletClientCerts/rootca-ECDSA.pem"; |
|
20 | - private const LOCATION_ISSUING_CA = ROOT . "/config/SilverbulletClientCerts/real-ECDSA.pem"; |
|
21 | - private const LOCATION_ISSUING_KEY = ROOT . "/config/SilverbulletClientCerts/real-ECDSA.key"; |
|
22 | - private const LOCATION_CONFIG = ROOT . "/config/SilverbulletClientCerts/openssl-ECDSA.cnf"; |
|
19 | + private const LOCATION_ROOT_CA = ROOT."/config/SilverbulletClientCerts/rootca-ECDSA.pem"; |
|
20 | + private const LOCATION_ISSUING_CA = ROOT."/config/SilverbulletClientCerts/real-ECDSA.pem"; |
|
21 | + private const LOCATION_ISSUING_KEY = ROOT."/config/SilverbulletClientCerts/real-ECDSA.key"; |
|
22 | + private const LOCATION_CONFIG = ROOT."/config/SilverbulletClientCerts/openssl-ECDSA.cnf"; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * string with the PEM variant of the root CA |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | parent::__construct(); |
67 | 67 | $this->rootPem = file_get_contents(CertificationAuthorityEmbeddedECDSA::LOCATION_ROOT_CA); |
68 | 68 | if ($this->rootPem === FALSE) { |
69 | - throw new Exception("Root CA PEM file not found: " . CertificationAuthorityEmbeddedECDSA::LOCATION_ROOT_CA); |
|
69 | + throw new Exception("Root CA PEM file not found: ".CertificationAuthorityEmbeddedECDSA::LOCATION_ROOT_CA); |
|
70 | 70 | } |
71 | 71 | $this->issuingCertRaw = file_get_contents(CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA); |
72 | 72 | if ($this->issuingCertRaw === FALSE) { |
73 | - throw new Exception("Issuing CA PEM file not found: " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA); |
|
73 | + throw new Exception("Issuing CA PEM file not found: ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA); |
|
74 | 74 | } |
75 | 75 | $rootParsed = openssl_x509_read($this->rootPem); |
76 | 76 | $this->issuingCert = openssl_x509_read($this->issuingCertRaw); |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | throw new Exception("At least one CA PEM file did not parse correctly!"); |
79 | 79 | } |
80 | 80 | if (stat(CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY) === FALSE) { |
81 | - throw new Exception("Private key not found: " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY); |
|
81 | + throw new Exception("Private key not found: ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY); |
|
82 | 82 | } |
83 | - $issuingKeyTemp = openssl_pkey_get_private("file://" . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY); |
|
83 | + $issuingKeyTemp = openssl_pkey_get_private("file://".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY); |
|
84 | 84 | if ($issuingKeyTemp === FALSE) { |
85 | 85 | throw new Exception("The private key did not parse correctly!"); |
86 | 86 | } |
87 | 87 | $this->issuingKey = $issuingKeyTemp; |
88 | 88 | if (stat(CertificationAuthorityEmbeddedECDSA::LOCATION_CONFIG) === FALSE) { |
89 | - throw new Exception("openssl configuration not found: " . CertificationAuthorityEmbeddedECDSA::LOCATION_CONFIG); |
|
89 | + throw new Exception("openssl configuration not found: ".CertificationAuthorityEmbeddedECDSA::LOCATION_CONFIG); |
|
90 | 90 | } |
91 | 91 | $this->conffile = CertificationAuthorityEmbeddedECDSA::LOCATION_CONFIG; |
92 | 92 | } |
@@ -129,27 +129,27 @@ discard block |
||
129 | 129 | // generate stub index.txt file |
130 | 130 | $tempdirArray = \core\common\Entity::createTemporaryDirectory("test"); |
131 | 131 | $tempdir = $tempdirArray['dir']; |
132 | - $nowIndexTxt = (new \DateTime())->format("ymdHis") . "Z"; |
|
133 | - $expiryIndexTxt = $originalExpiry->format("ymdHis") . "Z"; |
|
132 | + $nowIndexTxt = (new \DateTime())->format("ymdHis")."Z"; |
|
133 | + $expiryIndexTxt = $originalExpiry->format("ymdHis")."Z"; |
|
134 | 134 | // serials for our CA are always integers |
135 | 135 | $serialHex = strtoupper(dechex((int) $cert->serial)); |
136 | 136 | if (strlen($serialHex) % 2 == 1) { |
137 | - $serialHex = "0" . $serialHex; |
|
137 | + $serialHex = "0".$serialHex; |
|
138 | 138 | } |
139 | 139 | |
140 | - $indexStatement = "$certstatus\t$expiryIndexTxt\t" . ($certstatus == "R" ? "$nowIndexTxt,unspecified" : "") . "\t$serialHex\tunknown\t/O=" . \config\ConfAssistant::CONSORTIUM['name'] . "/OU=$federation/CN=$cert->username\n"; |
|
140 | + $indexStatement = "$certstatus\t$expiryIndexTxt\t".($certstatus == "R" ? "$nowIndexTxt,unspecified" : "")."\t$serialHex\tunknown\t/O=".\config\ConfAssistant::CONSORTIUM['name']."/OU=$federation/CN=$cert->username\n"; |
|
141 | 141 | $this->loggerInstance->debug(4, "index.txt contents-to-be: $indexStatement"); |
142 | - if (!file_put_contents($tempdir . "/index.txt", $indexStatement)) { |
|
142 | + if (!file_put_contents($tempdir."/index.txt", $indexStatement)) { |
|
143 | 143 | $this->loggerInstance->debug(1, "Unable to write openssl index.txt file for revocation handling!"); |
144 | 144 | } |
145 | 145 | // index.txt.attr is dull but needs to exist |
146 | - file_put_contents($tempdir . "/index.txt.attr", "unique_subject = yes\n"); |
|
146 | + file_put_contents($tempdir."/index.txt.attr", "unique_subject = yes\n"); |
|
147 | 147 | // call "openssl ocsp" to manufacture our own OCSP statement |
148 | 148 | // adding "-rmd sha1" to the following command-line makes the |
149 | 149 | // choice of signature algorithm for the response explicit |
150 | 150 | // but it's only available from openssl-1.1.0 (which we do not |
151 | 151 | // want to require just for that one thing). |
152 | - $execCmd = \config\Master::PATHS['openssl'] . " ocsp -issuer " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA . " -sha1 -ndays 10 -no_nonce -serial 0x$serialHex -CA " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA . " -rsigner " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA . " -rkey " . CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY . " -index $tempdir/index.txt -no_cert_verify -respout $tempdir/$serialHex.response.der"; |
|
152 | + $execCmd = \config\Master::PATHS['openssl']." ocsp -issuer ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA." -sha1 -ndays 10 -no_nonce -serial 0x$serialHex -CA ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA." -rsigner ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_CA." -rkey ".CertificationAuthorityEmbeddedECDSA::LOCATION_ISSUING_KEY." -index $tempdir/index.txt -no_cert_verify -respout $tempdir/$serialHex.response.der"; |
|
153 | 153 | $this->loggerInstance->debug(2, "Calling openssl ocsp with following cmdline: $execCmd\n"); |
154 | 154 | $output = []; |
155 | 155 | $return = 999; |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | if ($return !== 0) { |
158 | 158 | throw new Exception("Non-zero return value from openssl ocsp!"); |
159 | 159 | } |
160 | - $ocsp = file_get_contents($tempdir . "/$serialHex.response.der"); |
|
160 | + $ocsp = file_get_contents($tempdir."/$serialHex.response.der"); |
|
161 | 161 | // remove the temp dir! |
162 | - unlink($tempdir . "/$serialHex.response.der"); |
|
163 | - unlink($tempdir . "/index.txt.attr"); |
|
164 | - unlink($tempdir . "/index.txt"); |
|
162 | + unlink($tempdir."/$serialHex.response.der"); |
|
163 | + unlink($tempdir."/index.txt.attr"); |
|
164 | + unlink($tempdir."/index.txt"); |
|
165 | 165 | rmdir($tempdir); |
166 | 166 | $this->databaseHandle->exec("UPDATE silverbullet_certificate SET OCSP = ?, OCSP_timestamp = NOW() WHERE serial_number = ?", "si", $ocsp, $cert->serial); |
167 | 167 | return $ocsp; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | case "core\User": |
140 | 140 | return $this->userName; |
141 | 141 | default: |
142 | - throw new Exception("Operating on a class where we don't know the relevant identifier in the DB - " . get_class($this) . "!"); |
|
142 | + throw new Exception("Operating on a class where we don't know the relevant identifier in the DB - ".get_class($this)."!"); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function beginFlushAttributes($extracondition = "") |
179 | 179 | { |
180 | - $quotedIdentifier = (!is_int($this->getRelevantIdentifier()) ? "\"" : "") . $this->getRelevantIdentifier() . (!is_int($this->getRelevantIdentifier()) ? "\"" : ""); |
|
180 | + $quotedIdentifier = (!is_int($this->getRelevantIdentifier()) ? "\"" : "").$this->getRelevantIdentifier().(!is_int($this->getRelevantIdentifier()) ? "\"" : ""); |
|
181 | 181 | $this->databaseHandle->exec("DELETE FROM $this->entityOptionTable WHERE $this->entityIdColumn = $quotedIdentifier AND option_name NOT LIKE '%_file' $extracondition"); |
182 | 182 | $this->updateFreshness(); |
183 | 183 | $execFlush = $this->databaseHandle->exec("SELECT row FROM $this->entityOptionTable WHERE $this->entityIdColumn = $quotedIdentifier $extracondition"); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public function commitFlushAttributes(array $tobedeleted) |
199 | 199 | { |
200 | - $quotedIdentifier = (!is_int($this->getRelevantIdentifier()) ? "\"" : "") . $this->getRelevantIdentifier() . (!is_int($this->getRelevantIdentifier()) ? "\"" : ""); |
|
200 | + $quotedIdentifier = (!is_int($this->getRelevantIdentifier()) ? "\"" : "").$this->getRelevantIdentifier().(!is_int($this->getRelevantIdentifier()) ? "\"" : ""); |
|
201 | 201 | foreach (array_keys($tobedeleted) as $row) { |
202 | 202 | $this->databaseHandle->exec("DELETE FROM $this->entityOptionTable WHERE $this->entityIdColumn = $quotedIdentifier AND row = $row"); |
203 | 203 | $this->updateFreshness(); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | { |
227 | 227 | $relevantId = $this->getRelevantIdentifier(); |
228 | 228 | $identifierType = (is_int($relevantId) ? "i" : "s"); |
229 | - $this->databaseHandle->exec("INSERT INTO $this->entityOptionTable ($this->entityIdColumn, option_name, option_lang, option_value) VALUES(?,?,?,?)", $identifierType . "sss", $relevantId, $attrName, $attrLang, $attrValue); |
|
229 | + $this->databaseHandle->exec("INSERT INTO $this->entityOptionTable ($this->entityIdColumn, option_name, option_lang, option_value) VALUES(?,?,?,?)", $identifierType."sss", $relevantId, $attrName, $attrLang, $attrValue); |
|
230 | 230 | $this->updateFreshness(); |
231 | 231 | } |
232 | 232 |
@@ -109,7 +109,6 @@ |
||
109 | 109 | * ["my.server.name"] => "my.server.name" |
110 | 110 | * ["foo.bar.de", "baz.bar.ge"] => "e" |
111 | 111 | * ["server1.example.com", "server2.example.com", "serverN.example.com"] => ".example.com" |
112 | - |
|
113 | 112 | * @return string |
114 | 113 | */ |
115 | 114 | public function longestNameSuffix() |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | protected function setSupportedEapMethods($eapArray) |
86 | 86 | { |
87 | 87 | $this->supportedEapMethods = $eapArray; |
88 | - $this->loggerInstance->debug(4, "This device (" . __CLASS__ . ") supports the following EAP methods: "); |
|
88 | + $this->loggerInstance->debug(4, "This device (".__CLASS__.") supports the following EAP methods: "); |
|
89 | 89 | $this->loggerInstance->debug(4, $this->supportedEapMethods); |
90 | 90 | } |
91 | 91 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | break 2; |
138 | 138 | } |
139 | 139 | } |
140 | - $longestSuffix = $candidate . $longestSuffix; |
|
140 | + $longestSuffix = $candidate.$longestSuffix; |
|
141 | 141 | } |
142 | 142 | return $longestSuffix; |
143 | 143 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | throw new Exception("No EAP type available."); |
176 | 176 | } |
177 | 177 | $this->attributes = $this->getProfileAttributes($profile); |
178 | - $this->deviceUUID = common\Entity::uuid('', 'CAT' . $profile->institution . "-" . $profile->identifier . "-" . $this->device_id); |
|
178 | + $this->deviceUUID = common\Entity::uuid('', 'CAT'.$profile->institution."-".$profile->identifier."-".$this->device_id); |
|
179 | 179 | |
180 | 180 | |
181 | 181 | // if we are instantiating a Silverbullet profile AND have been given |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | // create temporary directory, its full path will be saved in $this->FPATH; |
200 | 200 | $tempDir = \core\common\Entity::createTemporaryDirectory($purpose); |
201 | 201 | $this->FPATH = $tempDir['dir']; |
202 | - mkdir($tempDir['dir'] . '/tmp'); |
|
203 | - chdir($tempDir['dir'] . '/tmp'); |
|
202 | + mkdir($tempDir['dir'].'/tmp'); |
|
203 | + chdir($tempDir['dir'].'/tmp'); |
|
204 | 204 | $caList = []; |
205 | 205 | $x509 = new \core\common\X509(); |
206 | 206 | if (isset($this->attributes['eap:ca_file'])) { |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $this->support_url_substitute = sprintf(_("your local %s support page"), \config\ConfAssistant::CONSORTIUM['display_name']); |
237 | 237 | |
238 | 238 | if ($this->signer && $this->options['sign']) { |
239 | - $this->sign = ROOT . '/signer/' . $this->signer; |
|
239 | + $this->sign = ROOT.'/signer/'.$this->signer; |
|
240 | 240 | } |
241 | 241 | $this->installerBasename = $this->getInstallerBasename(); |
242 | 242 | common\Entity::outOfThePotatoes(); |
@@ -296,10 +296,10 @@ discard block |
||
296 | 296 | */ |
297 | 297 | protected function findSourceFile($file) |
298 | 298 | { |
299 | - if (is_file($this->module_path . '/Files/' . $this->device_id . '/' . $file)) { |
|
300 | - return $this->module_path . '/Files/' . $this->device_id . '/' . $file; |
|
301 | - } elseif (is_file($this->module_path . '/Files/' . $file)) { |
|
302 | - return $this->module_path . '/Files/' . $file; |
|
299 | + if (is_file($this->module_path.'/Files/'.$this->device_id.'/'.$file)) { |
|
300 | + return $this->module_path.'/Files/'.$this->device_id.'/'.$file; |
|
301 | + } elseif (is_file($this->module_path.'/Files/'.$file)) { |
|
302 | + return $this->module_path.'/Files/'.$file; |
|
303 | 303 | } else { |
304 | 304 | $this->loggerInstance->debug(2, "requested file $file does not exist\n"); |
305 | 305 | return FALSE; |
@@ -423,17 +423,17 @@ discard block |
||
423 | 423 | */ |
424 | 424 | private function getInstallerBasename() |
425 | 425 | { |
426 | - $baseName = $this->customTranslit(\config\ConfAssistant::CONSORTIUM['name']) . "-" . $this->getDeviceId(); |
|
426 | + $baseName = $this->customTranslit(\config\ConfAssistant::CONSORTIUM['name'])."-".$this->getDeviceId(); |
|
427 | 427 | if (isset($this->attributes['profile:customsuffix'][1])) { |
428 | 428 | // this string will end up as a filename on a filesystem, so always |
429 | 429 | // take a latin-based language variant if available |
430 | 430 | // and then scrub non-ASCII just in case |
431 | - return $baseName . $this->customTranslit($this->attributes['profile:customsuffix'][1]); |
|
431 | + return $baseName.$this->customTranslit($this->attributes['profile:customsuffix'][1]); |
|
432 | 432 | } |
433 | 433 | // Okay, no custom suffix. |
434 | 434 | // Use the configured inst name and apply shortening heuristics |
435 | 435 | $lang_pointer = \config\Master::LANGUAGES[$this->languageInstance->getLang()]['latin_based'] == TRUE ? 0 : 1; |
436 | - $this->loggerInstance->debug(5, "getInstallerBasename1:" . $this->attributes['general:instname'][$lang_pointer] . "\n"); |
|
436 | + $this->loggerInstance->debug(5, "getInstallerBasename1:".$this->attributes['general:instname'][$lang_pointer]."\n"); |
|
437 | 437 | $inst = $this->customTranslit($this->attributes['general:instname'][$lang_pointer]); |
438 | 438 | $this->loggerInstance->debug(4, "getInstallerBasename2:$inst\n"); |
439 | 439 | $Inst_a = explode('_', $inst); |
@@ -448,10 +448,10 @@ discard block |
||
448 | 448 | if (!empty($this->attributes['profile:name']) && !empty($this->attributes['profile:name'][$lang_pointer])) { |
449 | 449 | $profTemp = $this->customTranslit($this->attributes['profile:name'][$lang_pointer]); |
450 | 450 | $prof = preg_replace('/_+$/', '', $profTemp); |
451 | - return $baseName . $inst . '-' . $prof; |
|
451 | + return $baseName.$inst.'-'.$prof; |
|
452 | 452 | } |
453 | 453 | } |
454 | - return $baseName . $inst; |
|
454 | + return $baseName.$inst; |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | /** |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | $ext = 'unsupported'; |
570 | 570 | } |
571 | 571 | $this->loggerInstance->debug(5, "saveLogoFile: $mime : $ext\n"); |
572 | - $fileName = 'logo-' . $type . $iterator . '.' . $ext; |
|
572 | + $fileName = 'logo-'.$type.$iterator.'.'.$ext; |
|
573 | 573 | $fileHandle = fopen($fileName, "w"); |
574 | 574 | if (!$fileHandle) { |
575 | 575 | $this->loggerInstance->debug(2, "saveLogoFile failed for: $fileName\n"); |
@@ -596,13 +596,13 @@ discard block |
||
596 | 596 | $mime = $finfo->buffer($blob); |
597 | 597 | $ext = isset($this->mime_extensions[$mime]) ? $this->mime_extensions[$mime] : 'usupported'; |
598 | 598 | $this->loggerInstance->debug(5, "saveInfoFile: $mime : $ext\n"); |
599 | - $fileHandle = fopen('local-info.' . $ext, "w"); |
|
599 | + $fileHandle = fopen('local-info.'.$ext, "w"); |
|
600 | 600 | if ($fileHandle === FALSE) { |
601 | 601 | throw new Exception("problem opening the file"); |
602 | 602 | } |
603 | 603 | fwrite($fileHandle, $blob); |
604 | 604 | fclose($fileHandle); |
605 | - return(['name' => 'local-info.' . $ext, 'mime' => $ext]); |
|
605 | + return(['name' => 'local-info.'.$ext, 'mime' => $ext]); |
|
606 | 606 | } |
607 | 607 | |
608 | 608 | /** |
@@ -656,9 +656,9 @@ discard block |
||
656 | 656 | { |
657 | 657 | $outerId = NULL; |
658 | 658 | if (isset($this->attributes['internal:use_anon_outer']) && $this->attributes['internal:use_anon_outer'][0] == "1" && isset($this->attributes['internal:realm'])) { |
659 | - $outerId = "@" . $this->attributes['internal:realm'][0]; |
|
659 | + $outerId = "@".$this->attributes['internal:realm'][0]; |
|
660 | 660 | if (isset($this->attributes['internal:anon_local_value'])) { |
661 | - $outerId = $this->attributes['internal:anon_local_value'][0] . $outerId; |
|
661 | + $outerId = $this->attributes['internal:anon_local_value'][0].$outerId; |
|
662 | 662 | } |
663 | 663 | } |
664 | 664 | return $outerId; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | protected function saveDownloadDetails($idpIdentifier, $profileId, $deviceId, $area, $lang, $eapType) |
135 | 135 | { |
136 | 136 | if (\config\Master::PATHS['logdir']) { |
137 | - $file = fopen(\config\Master::PATHS['logdir'] . "/download_details.log", "a"); |
|
137 | + $file = fopen(\config\Master::PATHS['logdir']."/download_details.log", "a"); |
|
138 | 138 | if ($file === FALSE) { |
139 | 139 | throw new Exception("Unable to open file for append: $file"); |
140 | 140 | } |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | } |
170 | 170 | // check if a CA with identical DN was added - alert NRO if so |
171 | 171 | if (array_search($ca['subject'], $baselineCA) !== FALSE) { |
172 | - $retval[AbstractProfile::CA_CLASH_ADDED] .= "#SHA1 for CA with DN '" . print_r($ca['subject'], TRUE) . "' has SHA1 fingerprints (pre-existing) " . /** @scrutinizer ignore-type */ array_search($ca['subject'], $baselineCA) . " and (added) " . $ca['sha1']; |
|
172 | + $retval[AbstractProfile::CA_CLASH_ADDED] .= "#SHA1 for CA with DN '".print_r($ca['subject'], TRUE)."' has SHA1 fingerprints (pre-existing) "./** @scrutinizer ignore-type */ array_search($ca['subject'], $baselineCA)." and (added) ".$ca['sha1']; |
|
173 | 173 | } else { |
174 | - $retval[AbstractProfile::CA_ADDED] .= "#CA with DN '" . print_r($ca['subject'], TRUE) . "' and SHA1 fingerprint " . $ca['sha1'] . " was added as trust anchor"; |
|
174 | + $retval[AbstractProfile::CA_ADDED] .= "#CA with DN '".print_r($ca['subject'], TRUE)."' and SHA1 fingerprint ".$ca['sha1']." was added as trust anchor"; |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | // check if a servername was added |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | foreach ($new->getAttributes("eap:server_name") as $newName) { |
183 | 183 | if (!in_array($newName['value'], $baselineNames)) { |
184 | - $retval[AbstractProfile::SERVERNAME_ADDED] .= "#New server name '" . $newName['value'] . "' added"; |
|
184 | + $retval[AbstractProfile::SERVERNAME_ADDED] .= "#New server name '".$newName['value']."' added"; |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | return $retval; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $eaptype = new common\EAP($eapQuery->eap_method_id); |
206 | 206 | $eapTypeArray[] = $eaptype; |
207 | 207 | } |
208 | - $this->loggerInstance->debug(4, "This profile supports the following EAP types:\n" . print_r($eapTypeArray, true)); |
|
208 | + $this->loggerInstance->debug(4, "This profile supports the following EAP types:\n".print_r($eapTypeArray, true)); |
|
209 | 209 | return $eapTypeArray; |
210 | 210 | } |
211 | 211 | |
@@ -287,16 +287,16 @@ discard block |
||
287 | 287 | if (count($this->getAttributes("internal:checkuser_outer")) > 0) { |
288 | 288 | // we are supposed to use a specific outer username for checks, |
289 | 289 | // which is different from the outer username we put into installers |
290 | - return $this->getAttributes("internal:checkuser_value")[0]['value'] . "@" . $realm; |
|
290 | + return $this->getAttributes("internal:checkuser_value")[0]['value']."@".$realm; |
|
291 | 291 | } |
292 | 292 | if (count($this->getAttributes("internal:use_anon_outer")) > 0) { |
293 | 293 | // no special check username, but there is an anon outer ID for |
294 | 294 | // installers - so let's use that one |
295 | - return $this->getAttributes("internal:anon_local_value")[0]['value'] . "@" . $realm; |
|
295 | + return $this->getAttributes("internal:anon_local_value")[0]['value']."@".$realm; |
|
296 | 296 | } |
297 | 297 | // okay, no guidance on outer IDs at all - but we need *something* to |
298 | 298 | // test with for the RealmChecks. So: |
299 | - return "@" . $realm; |
|
299 | + return "@".$realm; |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | public function prepShowtime() |
745 | 745 | { |
746 | 746 | $properConfig = $this->readyForShowtime(); |
747 | - $this->databaseHandle->exec("UPDATE profile SET sufficient_config = " . ($properConfig ? "TRUE" : "FALSE") . " WHERE profile_id = " . $this->identifier); |
|
747 | + $this->databaseHandle->exec("UPDATE profile SET sufficient_config = ".($properConfig ? "TRUE" : "FALSE")." WHERE profile_id = ".$this->identifier); |
|
748 | 748 | |
749 | 749 | $attribs = $this->getCollapsedAttributes(); |
750 | 750 | // if not enough info to go live, set FALSE |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | private function inputValidationError($customtext) |
41 | 41 | { |
42 | 42 | \core\common\Entity::intoThePotatoes(); |
43 | - $retval = "<p>" . _("Input validation error: ") . $customtext . "</p>"; |
|
43 | + $retval = "<p>"._("Input validation error: ").$customtext."</p>"; |
|
44 | 44 | \core\common\Entity::outOfThePotatoes(); |
45 | 45 | return $retval; |
46 | 46 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | try { |
542 | 542 | $image->readImageBlob($binary); |
543 | 543 | } catch (\ImagickException $exception) { |
544 | - echo "Error" . $exception->getMessage(); |
|
544 | + echo "Error".$exception->getMessage(); |
|
545 | 545 | return FALSE; |
546 | 546 | } |
547 | 547 | // image survived the sanity check |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | class CertificationAuthorityEduPkiServer extends EntityWithDBProperties implements CertificationAuthorityInterface |
18 | 18 | { |
19 | 19 | |
20 | - private const LOCATION_RA_CERT = ROOT . "/config/SilverbulletClientCerts/edupki-test-ra.pem"; |
|
21 | - private const LOCATION_RA_KEY = ROOT . "/config/SilverbulletClientCerts/edupki-test-ra.clearkey"; |
|
22 | - private const LOCATION_WEBROOT = ROOT . "/config/SilverbulletClientCerts/eduPKI-webserver-root.pem"; |
|
20 | + private const LOCATION_RA_CERT = ROOT."/config/SilverbulletClientCerts/edupki-test-ra.pem"; |
|
21 | + private const LOCATION_RA_KEY = ROOT."/config/SilverbulletClientCerts/edupki-test-ra.clearkey"; |
|
22 | + private const LOCATION_WEBROOT = ROOT."/config/SilverbulletClientCerts/eduPKI-webserver-root.pem"; |
|
23 | 23 | private const EDUPKI_RA_ID = 700; |
24 | 24 | private const EDUPKI_CERT_PROFILE = "Radius Server SOAP"; |
25 | 25 | private const EDUPKI_RA_PKEY_PASSPHRASE = "..."; |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | parent::__construct(); |
36 | 36 | |
37 | 37 | if (stat(CertificationAuthorityEduPkiServer::LOCATION_RA_CERT) === FALSE) { |
38 | - throw new Exception("RA operator PEM file not found: " . CertificationAuthorityEduPkiServer::LOCATION_RA_CERT); |
|
38 | + throw new Exception("RA operator PEM file not found: ".CertificationAuthorityEduPkiServer::LOCATION_RA_CERT); |
|
39 | 39 | } |
40 | 40 | if (stat(CertificationAuthorityEduPkiServer::LOCATION_RA_KEY) === FALSE) { |
41 | - throw new Exception("RA operator private key file not found: " . CertificationAuthorityEduPkiServer::LOCATION_RA_KEY); |
|
41 | + throw new Exception("RA operator private key file not found: ".CertificationAuthorityEduPkiServer::LOCATION_RA_KEY); |
|
42 | 42 | } |
43 | 43 | if (stat(CertificationAuthorityEduPkiServer::LOCATION_WEBROOT) === FALSE) { |
44 | - throw new Exception("CA website root CA file not found: " . CertificationAuthorityEduPkiServer::LOCATION_WEBROOT); |
|
44 | + throw new Exception("CA website root CA file not found: ".CertificationAuthorityEduPkiServer::LOCATION_WEBROOT); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
@@ -96,19 +96,19 @@ discard block |
||
96 | 96 | // initialise connection to eduPKI CA / eduroam RA and send the request to them |
97 | 97 | try { |
98 | 98 | $altArray = [# Array mit den Subject Alternative Names |
99 | - "email:" . $csr["USERMAIL"] |
|
99 | + "email:".$csr["USERMAIL"] |
|
100 | 100 | ]; |
101 | 101 | $soapPub = $this->initEduPKISoapSession("PUBLIC"); |
102 | 102 | $this->loggerInstance->debug(5, "FIRST ACTUAL SOAP REQUEST (Public, newRequest)!\n"); |
103 | - $this->loggerInstance->debug(5, "PARAM_1: " . CertificationAuthorityEduPkiServer::EDUPKI_RA_ID . "\n"); |
|
104 | - $this->loggerInstance->debug(5, "PARAM_2: " . $csr["CSR"] . "\n"); |
|
103 | + $this->loggerInstance->debug(5, "PARAM_1: ".CertificationAuthorityEduPkiServer::EDUPKI_RA_ID."\n"); |
|
104 | + $this->loggerInstance->debug(5, "PARAM_2: ".$csr["CSR"]."\n"); |
|
105 | 105 | $this->loggerInstance->debug(5, "PARAM_3: "); |
106 | 106 | $this->loggerInstance->debug(5, $altArray); |
107 | - $this->loggerInstance->debug(5, "PARAM_4: " . CertificationAuthorityEduPkiServer::EDUPKI_CERT_PROFILE . "\n"); |
|
108 | - $this->loggerInstance->debug(5, "PARAM_5: " . sha1("notused") . "\n"); |
|
109 | - $this->loggerInstance->debug(5, "PARAM_6: " . $csr["USERNAME"] . "\n"); |
|
110 | - $this->loggerInstance->debug(5, "PARAM_7: " . $csr["USERMAIL"] . "\n"); |
|
111 | - $this->loggerInstance->debug(5, "PARAM_8: " . ProfileSilverbullet::PRODUCTNAME . "\n"); |
|
107 | + $this->loggerInstance->debug(5, "PARAM_4: ".CertificationAuthorityEduPkiServer::EDUPKI_CERT_PROFILE."\n"); |
|
108 | + $this->loggerInstance->debug(5, "PARAM_5: ".sha1("notused")."\n"); |
|
109 | + $this->loggerInstance->debug(5, "PARAM_6: ".$csr["USERNAME"]."\n"); |
|
110 | + $this->loggerInstance->debug(5, "PARAM_7: ".$csr["USERMAIL"]."\n"); |
|
111 | + $this->loggerInstance->debug(5, "PARAM_8: ".ProfileSilverbullet::PRODUCTNAME."\n"); |
|
112 | 112 | $this->loggerInstance->debug(5, "PARAM_9: false\n"); |
113 | 113 | $soapNewRequest = $soapPub->newRequest( |
114 | 114 | CertificationAuthorityEduPkiServer::EDUPKI_RA_ID, # RA-ID |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | } catch (Exception $e) { |
131 | 131 | // PHP 7.1 can do this much better |
132 | 132 | if (is_soap_fault($e)) { |
133 | - throw new Exception("Error when sending SOAP request: " . "{$e->faultcode}: { |
|
133 | + throw new Exception("Error when sending SOAP request: "."{$e->faultcode}: { |
|
134 | 134 | $e->faultstring |
135 | 135 | }\n"); |
136 | 136 | } |
137 | - throw new Exception("Something odd happened while doing the SOAP request:" . $e->getMessage()); |
|
137 | + throw new Exception("Something odd happened while doing the SOAP request:".$e->getMessage()); |
|
138 | 138 | } |
139 | 139 | try { |
140 | 140 | $soap = $this->initEduPKISoapSession("RA"); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | // for obnoxious reasons, we have to dump the request into a file and let pkcs7_sign read from the file |
169 | 169 | // rather than just using the string. Grr. |
170 | 170 | $tempdir = \core\common\Entity::createTemporaryDirectory("test"); |
171 | - file_put_contents($tempdir['dir'] . "/content.txt", $soapCleartext); |
|
171 | + file_put_contents($tempdir['dir']."/content.txt", $soapCleartext); |
|
172 | 172 | // retrieve our RA cert from filesystem |
173 | 173 | // the RA certificates are not needed right now because we |
174 | 174 | // have resorted to S/MIME signatures with openssl command-line |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | // sign the data, using cmdline because openssl_pkcs7_sign produces strange results |
181 | 181 | // -binary didn't help, nor switch -md to sha1 sha256 or sha512 |
182 | 182 | $this->loggerInstance->debug(5, "Actual content to be signed is this:\n $soapCleartext\n"); |
183 | - $execCmd = \config\Master::PATHS['openssl'] . " smime -sign -binary -in " . $tempdir['dir'] . "/content.txt -out " . $tempdir['dir'] . "/signature.txt -outform pem -inkey " . ROOT . "/config/SilverbulletClientCerts/edupki-test-ra.clearkey -signer " . ROOT . "/config/SilverbulletClientCerts/edupki-test-ra.pem"; |
|
183 | + $execCmd = \config\Master::PATHS['openssl']." smime -sign -binary -in ".$tempdir['dir']."/content.txt -out ".$tempdir['dir']."/signature.txt -outform pem -inkey ".ROOT."/config/SilverbulletClientCerts/edupki-test-ra.clearkey -signer ".ROOT."/config/SilverbulletClientCerts/edupki-test-ra.pem"; |
|
184 | 184 | $this->loggerInstance->debug(2, "Calling openssl smime with following cmdline: $execCmd\n"); |
185 | 185 | $output = []; |
186 | 186 | $return = 999; |
@@ -189,21 +189,21 @@ discard block |
||
189 | 189 | throw new Exception("Non-zero return value from openssl smime!"); |
190 | 190 | } |
191 | 191 | // and get the signature blob back from the filesystem |
192 | - $detachedSig = trim(file_get_contents($tempdir['dir'] . "/signature.txt")); |
|
192 | + $detachedSig = trim(file_get_contents($tempdir['dir']."/signature.txt")); |
|
193 | 193 | $this->loggerInstance->debug(5, "Request for server approveRequest has parameters:\n"); |
194 | - $this->loggerInstance->debug(5, $soapReqnum . "\n"); |
|
195 | - $this->loggerInstance->debug(5, $soapCleartext . "\n"); // PHP magically encodes this as base64 while sending! |
|
196 | - $this->loggerInstance->debug(5, $detachedSig . "\n"); |
|
194 | + $this->loggerInstance->debug(5, $soapReqnum."\n"); |
|
195 | + $this->loggerInstance->debug(5, $soapCleartext."\n"); // PHP magically encodes this as base64 while sending! |
|
196 | + $this->loggerInstance->debug(5, $detachedSig."\n"); |
|
197 | 197 | $soapIssueCert = $soap->approveRequest($soapReqnum, $soapCleartext, $detachedSig); |
198 | - $this->loggerInstance->debug(5, "approveRequest Request was: \n" . $soap->__getLastRequest()); |
|
199 | - $this->loggerInstance->debug(5, "approveRequest Response was: \n" . $soap->__getLastResponse()); |
|
198 | + $this->loggerInstance->debug(5, "approveRequest Request was: \n".$soap->__getLastRequest()); |
|
199 | + $this->loggerInstance->debug(5, "approveRequest Response was: \n".$soap->__getLastResponse()); |
|
200 | 200 | if ($soapIssueCert === FALSE) { |
201 | 201 | throw new Exception("The locally approved request was NOT processed by the CA."); |
202 | 202 | } |
203 | 203 | } catch (SoapFault $e) { |
204 | - throw new Exception("SoapFault: Error when sending or receiving SOAP message: " . "{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
204 | + throw new Exception("SoapFault: Error when sending or receiving SOAP message: "."{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
205 | 205 | } catch (Exception $e) { |
206 | - throw new Exception("Exception: Something odd happened between the SOAP requests:" . $e->getMessage()); |
|
206 | + throw new Exception("Exception: Something odd happened between the SOAP requests:".$e->getMessage()); |
|
207 | 207 | } |
208 | 208 | return $soapReqnum; |
209 | 209 | } |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | throw new Exception("CAInfo has no root certificate for us!"); |
256 | 256 | } |
257 | 257 | } catch (SoapFault $e) { |
258 | - throw new Exception("SoapFault: Error when sending or receiving SOAP message: " . "{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
258 | + throw new Exception("SoapFault: Error when sending or receiving SOAP message: "."{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
259 | 259 | } catch (Exception $e) { |
260 | - throw new Exception("Exception: Something odd happened between the SOAP requests:" . $e->getMessage()); |
|
260 | + throw new Exception("Exception: Something odd happened between the SOAP requests:".$e->getMessage()); |
|
261 | 261 | } |
262 | 262 | return [ |
263 | 263 | "CERT" => openssl_x509_read($parsedCert['pem']), |
@@ -290,12 +290,12 @@ discard block |
||
290 | 290 | // for obnoxious reasons, we have to dump the request into a file and let pkcs7_sign read from the file |
291 | 291 | // rather than just using the string. Grr. |
292 | 292 | $tempdir = \core\common\Entity::createTemporaryDirectory("test"); |
293 | - file_put_contents($tempdir['dir'] . "/content.txt", $soapRawRevRequest); |
|
293 | + file_put_contents($tempdir['dir']."/content.txt", $soapRawRevRequest); |
|
294 | 294 | // retrieve our RA cert from filesystem |
295 | 295 | // sign the data, using cmdline because openssl_pkcs7_sign produces strange results |
296 | 296 | // -binary didn't help, nor switch -md to sha1 sha256 or sha512 |
297 | 297 | $this->loggerInstance->debug(5, "Actual content to be signed is this:\n$soapRawRevRequest\n"); |
298 | - $execCmd = \config\Master::PATHS['openssl'] . " smime -sign -binary -in " . $tempdir['dir'] . "/content.txt -out " . $tempdir['dir'] . "/signature.txt -outform pem -inkey " . CertificationAuthorityEduPkiServer::LOCATION_RA_KEY . " -signer " . CertificationAuthorityEduPkiServer::LOCATION_RA_CERT; |
|
298 | + $execCmd = \config\Master::PATHS['openssl']." smime -sign -binary -in ".$tempdir['dir']."/content.txt -out ".$tempdir['dir']."/signature.txt -outform pem -inkey ".CertificationAuthorityEduPkiServer::LOCATION_RA_KEY." -signer ".CertificationAuthorityEduPkiServer::LOCATION_RA_CERT; |
|
299 | 299 | $this->loggerInstance->debug(2, "Calling openssl smime with following cmdline: $execCmd\n"); |
300 | 300 | $output = []; |
301 | 301 | $return = 999; |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | throw new Exception("Non-zero return value from openssl smime!"); |
305 | 305 | } |
306 | 306 | // and get the signature blob back from the filesystem |
307 | - $detachedSig = trim(file_get_contents($tempdir['dir'] . "/signature.txt")); |
|
307 | + $detachedSig = trim(file_get_contents($tempdir['dir']."/signature.txt")); |
|
308 | 308 | $soapIssueRev = $soap->approveRevocationRequest($soapRevocationSerial, $soapRawRevRequest, $detachedSig); |
309 | 309 | if ($soapIssueRev === FALSE) { |
310 | 310 | throw new Exception("The locally approved revocation request was NOT processed by the CA."); |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | } catch (Exception $e) { |
313 | 313 | // PHP 7.1 can do this much better |
314 | 314 | if (is_soap_fault($e)) { |
315 | - throw new Exception("Error when sending SOAP request: " . "{$e->faultcode}: {$e->faultstring}\n"); |
|
315 | + throw new Exception("Error when sending SOAP request: "."{$e->faultcode}: {$e->faultstring}\n"); |
|
316 | 316 | } |
317 | - throw new Exception("Something odd happened while doing the SOAP request:" . $e->getMessage()); |
|
317 | + throw new Exception("Something odd happened while doing the SOAP request:".$e->getMessage()); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | |
@@ -414,9 +414,9 @@ discard block |
||
414 | 414 | */ |
415 | 415 | public function soapToXmlInteger($x) |
416 | 416 | { |
417 | - return '<' . $x[0] . '>' |
|
417 | + return '<'.$x[0].'>' |
|
418 | 418 | . htmlentities($x[1], ENT_NOQUOTES | ENT_XML1) |
419 | - . '</' . $x[0] . '>'; |
|
419 | + . '</'.$x[0].'>'; |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | /** |
@@ -435,9 +435,9 @@ discard block |
||
435 | 435 | // dump private key into directory |
436 | 436 | $outstring = ""; |
437 | 437 | openssl_pkey_export($privateKey, $outstring); |
438 | - file_put_contents($tempdir . "/pkey.pem", $outstring); |
|
438 | + file_put_contents($tempdir."/pkey.pem", $outstring); |
|
439 | 439 | // PHP can only do one DC in the Subject. But we need three. |
440 | - $execCmd = \config\Master::PATHS['openssl'] . " req -new -sha256 -key $tempdir/pkey.pem -out $tempdir/request.csr -subj /DC=test/DC=test/DC=eduroam/C=$fed/O=" . \config\ConfAssistant::CONSORTIUM['name'] . "/OU=$fed/CN=$username/emailAddress=$username"; |
|
440 | + $execCmd = \config\Master::PATHS['openssl']." req -new -sha256 -key $tempdir/pkey.pem -out $tempdir/request.csr -subj /DC=test/DC=test/DC=eduroam/C=$fed/O=".\config\ConfAssistant::CONSORTIUM['name']."/OU=$fed/CN=$username/emailAddress=$username"; |
|
441 | 441 | $this->loggerInstance->debug(2, "Calling openssl req with following cmdline: $execCmd\n"); |
442 | 442 | $output = []; |
443 | 443 | $return = 999; |
@@ -157,11 +157,11 @@ |
||
157 | 157 | ]; |
158 | 158 | |
159 | 159 | /** |
160 | - * Lists the RADIUS servers. They have a built-in DB to log auth requests. |
|
161 | - * We need to query those to get auth stats for silverbullet admins |
|
162 | - * |
|
163 | - * @var array |
|
164 | - */ |
|
160 | + * Lists the RADIUS servers. They have a built-in DB to log auth requests. |
|
161 | + * We need to query those to get auth stats for silverbullet admins |
|
162 | + * |
|
163 | + * @var array |
|
164 | + */ |
|
165 | 165 | const DB = [ |
166 | 166 | // names don't matter - the source code will iterate through |
167 | 167 | // all entries |
@@ -170,12 +170,12 @@ |
||
170 | 170 | 'db' => 'radacct', |
171 | 171 | 'user' => 'someuser', |
172 | 172 | 'pass' => 'somepass', |
173 | - 'readonly' => TRUE,], |
|
173 | + 'readonly' => TRUE, ], |
|
174 | 174 | 'RADIUS_2' => [ |
175 | 175 | 'host' => 'auth-2.hosted.eduroam.org', |
176 | 176 | 'db' => 'radacct', |
177 | 177 | 'user' => 'someuser', |
178 | 178 | 'pass' => 'somepass', |
179 | - 'readonly' => TRUE,], |
|
179 | + 'readonly' => TRUE, ], |
|
180 | 180 | ]; |
181 | 181 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $serverCandidates[IdPlist::geoDistance($adminLocation, ['lat' => $iterator->location_lat, 'lon' => $iterator->location_lon])] = $iterator->server_id; |
255 | 255 | } |
256 | 256 | if ($clients > $maxSupportedClients * 0.9) { |
257 | - $this->loggerInstance->debug(1, "A RADIUS server for Managed SP (" . $iterator->server_id . ") is serving at more than 90% capacity!"); |
|
257 | + $this->loggerInstance->debug(1, "A RADIUS server for Managed SP (".$iterator->server_id.") is serving at more than 90% capacity!"); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | if (count($serverCandidates) == 0 && $federation != "DEFAULT") { |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | return $this->findGoodServerLocation($adminLocation, "DEFAULT", $blacklistedServers); |
264 | 264 | } |
265 | 265 | if (count($serverCandidates) == 0) { |
266 | - throw new Exception("No available server found for new SP! $federation " . print_r($serverCandidates, true)); |
|
266 | + throw new Exception("No available server found for new SP! $federation ".print_r($serverCandidates, true)); |
|
267 | 267 | } |
268 | 268 | // put the nearest server on top of the list |
269 | 269 | ksort($serverCandidates); |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $foundFreePort1 = 0; |
292 | 292 | while ($foundFreePort1 == 0) { |
293 | 293 | $portCandidate = random_int(1200, 65535); |
294 | - $check = $this->databaseHandle->exec("SELECT port_instance_1 FROM deployment WHERE radius_instance_1 = '" . $ourserver . "' AND port_instance_1 = $portCandidate"); |
|
294 | + $check = $this->databaseHandle->exec("SELECT port_instance_1 FROM deployment WHERE radius_instance_1 = '".$ourserver."' AND port_instance_1 = $portCandidate"); |
|
295 | 295 | if (mysqli_num_rows(/** @scrutinizer ignore-type */ $check) == 0) { |
296 | 296 | $foundFreePort1 = $portCandidate; |
297 | 297 | } |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | $foundFreePort2 = 0; |
301 | 301 | while ($foundFreePort2 == 0) { |
302 | 302 | $portCandidate = random_int(1200, 65535); |
303 | - $check = $this->databaseHandle->exec("SELECT port_instance_2 FROM deployment WHERE radius_instance_2 = '" . $ourSecondServer . "' AND port_instance_2 = $portCandidate"); |
|
303 | + $check = $this->databaseHandle->exec("SELECT port_instance_2 FROM deployment WHERE radius_instance_2 = '".$ourSecondServer."' AND port_instance_2 = $portCandidate"); |
|
304 | 304 | if (mysqli_num_rows(/** @scrutinizer ignore-type */ $check) == 0) { |
305 | 305 | $foundFreePort2 = $portCandidate; |
306 | 306 | } |
307 | 307 | } |
308 | 308 | // and make up a shared secret that is halfways readable |
309 | 309 | $futureSecret = $this->randomString(16, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); |
310 | - $this->databaseHandle->exec("UPDATE deployment SET radius_instance_1 = '" . $ourserver . "', radius_instance_2 = '" . $ourSecondServer . "', port_instance_1 = $foundFreePort1, port_instance_2 = $foundFreePort2, secret = '$futureSecret' WHERE deployment_id = $this->identifier"); |
|
310 | + $this->databaseHandle->exec("UPDATE deployment SET radius_instance_1 = '".$ourserver."', radius_instance_2 = '".$ourSecondServer."', port_instance_1 = $foundFreePort1, port_instance_2 = $foundFreePort2, secret = '$futureSecret' WHERE deployment_id = $this->identifier"); |
|
311 | 311 | return ["port_instance_1" => $foundFreePort1, "port_instance_2" => $foundFreePort2, "secret" => $futureSecret, "radius_instance_1" => $ourserver, "radius_instance_2" => $ourserver]; |
312 | 312 | } |
313 | 313 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | */ |
355 | 355 | public function deactivate() |
356 | 356 | { |
357 | - $this->databaseHandle->exec("UPDATE deployment SET status = " . DeploymentManaged::INACTIVE . " WHERE deployment_id = $this->identifier"); |
|
357 | + $this->databaseHandle->exec("UPDATE deployment SET status = ".DeploymentManaged::INACTIVE." WHERE deployment_id = $this->identifier"); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | /** |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | */ |
366 | 366 | public function activate() |
367 | 367 | { |
368 | - $this->databaseHandle->exec("UPDATE deployment SET status = " . DeploymentManaged::ACTIVE . " WHERE deployment_id = $this->identifier"); |
|
368 | + $this->databaseHandle->exec("UPDATE deployment SET status = ".DeploymentManaged::ACTIVE." WHERE deployment_id = $this->identifier"); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | { |
378 | 378 | $customAttrib = $this->getAttributes("managedsp:operatorname"); |
379 | 379 | if (count($customAttrib) == 0) { |
380 | - return "1sp." . $this->identifier . "-" . $this->institution . \config\ConfAssistant::SILVERBULLET['realm_suffix']; |
|
380 | + return "1sp.".$this->identifier."-".$this->institution.\config\ConfAssistant::SILVERBULLET['realm_suffix']; |
|
381 | 381 | } |
382 | 382 | return $customAttrib[0]["value"]; |
383 | 383 | } |
@@ -393,13 +393,13 @@ discard block |
||
393 | 393 | { |
394 | 394 | |
395 | 395 | $hostname = "radius_hostname_$idx"; |
396 | - $ch = curl_init("http://" . $this->$hostname); |
|
396 | + $ch = curl_init("http://".$this->$hostname); |
|
397 | 397 | if ($ch === FALSE) { |
398 | 398 | $res = 'FAILURE'; |
399 | 399 | } else { |
400 | 400 | curl_setopt($ch, CURLOPT_POST, 1); |
401 | 401 | curl_setopt($ch, CURLOPT_POSTFIELDS, $post); |
402 | - $this->loggerInstance->debug(1, "Posting to http://" . $this->$hostname . ": $post\n"); |
|
402 | + $this->loggerInstance->debug(1, "Posting to http://".$this->$hostname.": $post\n"); |
|
403 | 403 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
404 | 404 | curl_setopt($ch, CURLOPT_HEADER, 0); |
405 | 405 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
@@ -408,13 +408,13 @@ discard block |
||
408 | 408 | $this->loggerInstance->debug(1, "curl_exec failure"); |
409 | 409 | $res = 'FAILURE'; |
410 | 410 | } else { |
411 | - $res = (string)$exec; // it is always a string due to RETURNTRANSFER but let's make Scrutinizer which thinks this could be TRUE as well |
|
411 | + $res = (string) $exec; // it is always a string due to RETURNTRANSFER but let's make Scrutinizer which thinks this could be TRUE as well |
|
412 | 412 | } |
413 | 413 | $this->loggerInstance->debug(1, "Response from FR configurator: $res\n"); |
414 | 414 | $this->loggerInstance->debug(1, $this); |
415 | 415 | } |
416 | 416 | $this->loggerInstance->debug(1, "Database update"); |
417 | - $this->databaseHandle->exec("UPDATE deployment SET radius_status_$idx = " . ($res == 'OK' ? \core\AbstractDeployment::RADIUS_OK : \core\AbstractDeployment::RADIUS_FAILURE) . " WHERE deployment_id = $this->identifier"); |
|
417 | + $this->databaseHandle->exec("UPDATE deployment SET radius_status_$idx = ".($res == 'OK' ? \core\AbstractDeployment::RADIUS_OK : \core\AbstractDeployment::RADIUS_FAILURE)." WHERE deployment_id = $this->identifier"); |
|
418 | 418 | return $res; |
419 | 419 | } |
420 | 420 | |
@@ -435,19 +435,19 @@ discard block |
||
435 | 435 | } else { |
436 | 436 | $txt = $remove ? _('Profile dectivation failed') : _('Profile activation/modification failed'); |
437 | 437 | } |
438 | - $txt = $txt . ' '; |
|
438 | + $txt = $txt.' '; |
|
439 | 439 | if (array_count_values($response)[$status] == 2) { |
440 | - $txt = $txt . _('on both RADIUS servers: primary and backup') . '.'; |
|
440 | + $txt = $txt._('on both RADIUS servers: primary and backup').'.'; |
|
441 | 441 | } else { |
442 | 442 | if ($response['res[1]'] == $status) { |
443 | - $txt = $txt . _('on primary RADIUS server') . '.'; |
|
443 | + $txt = $txt._('on primary RADIUS server').'.'; |
|
444 | 444 | } else { |
445 | - $txt = $txt . _('on backup RADIUS server') . '.'; |
|
445 | + $txt = $txt._('on backup RADIUS server').'.'; |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | $mail = \core\common\OutsideComm::mailHandle(); |
449 | 449 | $email = $this->getAttributes("support:email")[0]['value']; |
450 | - $mail->FromName = \config\Master::APPEARANCE['productname'] . " Notification System"; |
|
450 | + $mail->FromName = \config\Master::APPEARANCE['productname']." Notification System"; |
|
451 | 451 | $mail->addAddress($email); |
452 | 452 | if ($status == 'OK') { |
453 | 453 | $mail->Subject = _('RADIUS profile update problem fixed'); |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | return NULL; |
482 | 482 | } |
483 | 483 | $timeout = 10; |
484 | - curl_setopt($ch, CURLOPT_URL, 'http://' . $host); |
|
484 | + curl_setopt($ch, CURLOPT_URL, 'http://'.$host); |
|
485 | 485 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
486 | 486 | curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
487 | 487 | curl_exec($ch); |
@@ -572,32 +572,32 @@ discard block |
||
572 | 572 | { |
573 | 573 | $remove = ($this->status == \core\AbstractDeployment::INACTIVE) ? 0 : 1; |
574 | 574 | $toPost = ($onlyone ? array($onlyone => '') : array(1 => '', 2 => '')); |
575 | - $toPostTemplate = 'instid=' . $this->institution . '&deploymentid=' . $this->identifier . '&secret=' . $this->secret . '&country=' . $this->getAttributes("internal:country")[0]['value'] . '&'; |
|
575 | + $toPostTemplate = 'instid='.$this->institution.'&deploymentid='.$this->identifier.'&secret='.$this->secret.'&country='.$this->getAttributes("internal:country")[0]['value'].'&'; |
|
576 | 576 | if ($remove) { |
577 | - $toPostTemplate = $toPostTemplate . 'remove=1&'; |
|
577 | + $toPostTemplate = $toPostTemplate.'remove=1&'; |
|
578 | 578 | } else { |
579 | 579 | if ($this->getAttributes("managedsp:operatorname")[0]['value'] ?? NULL) { |
580 | - $toPostTemplate = $toPostTemplate . 'operatorname=' . $this->getAttributes("managedsp:operatorname")[0]['value'] . '&'; |
|
580 | + $toPostTemplate = $toPostTemplate.'operatorname='.$this->getAttributes("managedsp:operatorname")[0]['value'].'&'; |
|
581 | 581 | } |
582 | 582 | if ($this->getAttributes("managedsp:vlan")[0]['value'] ?? NULL) { |
583 | 583 | $allRealms = $this->getAllRealms(); |
584 | 584 | if (!empty($allRealms)) { |
585 | - $toPostTemplate = $toPostTemplate . 'vlan=' . $this->getAttributes("managedsp:vlan")[0]['value'] . '&'; |
|
586 | - $toPostTemplate = $toPostTemplate . 'realmforvlan[]=' . implode('&realmforvlan[]=', $allRealms) . '&'; |
|
585 | + $toPostTemplate = $toPostTemplate.'vlan='.$this->getAttributes("managedsp:vlan")[0]['value'].'&'; |
|
586 | + $toPostTemplate = $toPostTemplate.'realmforvlan[]='.implode('&realmforvlan[]=', $allRealms).'&'; |
|
587 | 587 | } |
588 | 588 | } |
589 | 589 | } |
590 | 590 | foreach (array_keys($toPost) as $key) { |
591 | - $elem = 'port' . $key; |
|
592 | - $toPost[$key] = $toPostTemplate . 'port=' . $this->$elem; |
|
591 | + $elem = 'port'.$key; |
|
592 | + $toPost[$key] = $toPostTemplate.'port='.$this->$elem; |
|
593 | 593 | } |
594 | 594 | $response = array(); |
595 | 595 | foreach ($toPost as $key => $value) { |
596 | - $this->loggerInstance->debug(1, 'toPost ' . $toPost[$key] . "\n"); |
|
597 | - $response['res[' . $key . ']'] = $this->sendToRADIUS($key, $toPost[$key]); |
|
596 | + $this->loggerInstance->debug(1, 'toPost '.$toPost[$key]."\n"); |
|
597 | + $response['res['.$key.']'] = $this->sendToRADIUS($key, $toPost[$key]); |
|
598 | 598 | } |
599 | 599 | if ($onlyone) { |
600 | - $response['res[' . ($onlyone == 1) ? 2 : 1 . ']'] = \core\AbstractDeployment::RADIUS_OK; |
|
600 | + $response['res['.($onlyone == 1) ? 2 : 1.']'] = \core\AbstractDeployment::RADIUS_OK; |
|
601 | 601 | } |
602 | 602 | foreach (array('OK', 'FAILURE') as $status) { |
603 | 603 | if ((($status == 'OK' && $notify) || ($status == 'FAILURE')) && in_array($status, $response)) { |