@@ -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 | } |
@@ -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" . /** @scrutinizer ignore-type */ print_r($eapTypeArray, true)); |
|
208 | + $this->loggerInstance->debug(4, "This profile supports the following EAP types:\n"./** @scrutinizer ignore-type */ 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 | /** |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | public function prepShowtime() |
748 | 748 | { |
749 | 749 | $properConfig = $this->readyForShowtime(); |
750 | - $this->databaseHandle->exec("UPDATE profile SET sufficient_config = " . ($properConfig ? "TRUE" : "FALSE") . " WHERE profile_id = " . $this->identifier); |
|
750 | + $this->databaseHandle->exec("UPDATE profile SET sufficient_config = ".($properConfig ? "TRUE" : "FALSE")." WHERE profile_id = ".$this->identifier); |
|
751 | 751 | |
752 | 752 | $attribs = $this->getCollapsedAttributes(); |
753 | 753 | // if not enough info to go live, set FALSE |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | $invitationObject = new SilverbulletInvitation($token); |
326 | 326 | $profile = new ProfileSilverbullet($invitationObject->profile); |
327 | 327 | $inst = new IdP($profile->institution); |
328 | - $loggerInstance->debug(5, "tokenStatus: done, got " . $invitationObject->invitationTokenStatus . ", " . $invitationObject->profile . ", " . $invitationObject->userId . ", " . $invitationObject->expiry . ", " . $invitationObject->invitationTokenString . "\n"); |
|
328 | + $loggerInstance->debug(5, "tokenStatus: done, got ".$invitationObject->invitationTokenStatus.", ".$invitationObject->profile.", ".$invitationObject->userId.", ".$invitationObject->expiry.", ".$invitationObject->invitationTokenString."\n"); |
|
329 | 329 | if ($invitationObject->invitationTokenStatus != SilverbulletInvitation::SB_TOKENSTATUS_VALID && $invitationObject->invitationTokenStatus != SilverbulletInvitation::SB_TOKENSTATUS_PARTIALLY_REDEEMED) { |
330 | 330 | throw new Exception("Attempt to generate a SilverBullet installer with an invalid/redeemed/expired token. The user should never have gotten that far!"); |
331 | 331 | } |
@@ -338,12 +338,12 @@ discard block |
||
338 | 338 | throw new Exception("Despite a valid token, the corresponding user was not found in database or database query error!"); |
339 | 339 | } |
340 | 340 | $expiryObject = mysqli_fetch_object(/** @scrutinizer ignore-type */ $userrow); |
341 | - $loggerInstance->debug(5, "EXP: " . $expiryObject->expiry . "\n"); |
|
341 | + $loggerInstance->debug(5, "EXP: ".$expiryObject->expiry."\n"); |
|
342 | 342 | $expiryDateObject = date_create_from_format("Y-m-d H:i:s", $expiryObject->expiry); |
343 | 343 | if ($expiryDateObject === FALSE) { |
344 | 344 | throw new Exception("The expiry date we got from the DB is bogus!"); |
345 | 345 | } |
346 | - $loggerInstance->debug(5, $expiryDateObject->format("Y-m-d H:i:s") . "\n"); |
|
346 | + $loggerInstance->debug(5, $expiryDateObject->format("Y-m-d H:i:s")."\n"); |
|
347 | 347 | // date_create with no parameters can't fail, i.e. is never FALSE |
348 | 348 | $validity = date_diff(/** @scrutinizer ignore-type */ date_create(), $expiryDateObject); |
349 | 349 | $expiryDays = $validity->days + 1; |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | $certString = ""; |
383 | 383 | openssl_x509_export($cert, $certString); |
384 | 384 | $parsedCert = $x509->processCertificate($certString); |
385 | - $loggerInstance->debug(5, "CERTINFO: " . /** @scrutinizer ignore-type */ print_r($parsedCert['full_details'], true)); |
|
385 | + $loggerInstance->debug(5, "CERTINFO: "./** @scrutinizer ignore-type */ print_r($parsedCert['full_details'], true)); |
|
386 | 386 | $realExpiryDate = date_create_from_format("U", $parsedCert['full_details']['validTo_time_t'])->format("Y-m-d H:i:s"); |
387 | 387 | |
388 | 388 | // store new cert info in DB |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | $username = ""; |
443 | 443 | while ($usernameIsUnique === FALSE) { |
444 | 444 | $usernameLocalPart = common\Entity::randomString(64 - 1 - strlen($realm), "0123456789abcdefghijklmnopqrstuvwxyz"); |
445 | - $username = $usernameLocalPart . "@" . $realm; |
|
445 | + $username = $usernameLocalPart."@".$realm; |
|
446 | 446 | $uniquenessQuery = $databaseHandle->exec("SELECT cn from silverbullet_certificate WHERE cn = ? AND ca_type = ?", "ss", $username, $certtype); |
447 | 447 | // SELECT -> resource, not boolean |
448 | 448 | if (mysqli_num_rows(/** @scrutinizer ignore-type */ $uniquenessQuery) == 0) { |
@@ -115,12 +115,12 @@ discard block |
||
115 | 115 | $this->name = $this->languageInstance->getLocalisedValue($this->getAttributes('general:instname')); |
116 | 116 | $eligibility = $this->eligibility(); |
117 | 117 | if (in_array(IdP::ELIGIBILITY_IDP, $eligibility) && in_array(IdP::ELIGIBILITY_SP, $eligibility)) { |
118 | - $eligType = IdP::TYPE_IDPSP . ""; |
|
118 | + $eligType = IdP::TYPE_IDPSP.""; |
|
119 | 119 | $this->type = $eligType; |
120 | 120 | } elseif (in_array(IdP::ELIGIBILITY_IDP, $eligibility)) { |
121 | - $eligType = IdP::TYPE_IDP . ""; |
|
121 | + $eligType = IdP::TYPE_IDP.""; |
|
122 | 122 | } else { |
123 | - $eligType = IdP::TYPE_SP . ""; |
|
123 | + $eligType = IdP::TYPE_SP.""; |
|
124 | 124 | } |
125 | 125 | $this->type = $eligType; |
126 | 126 | $this->loggerInstance->debug(3, "--- END Constructing new IdP object ... ---\n"); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function listProfiles(bool $activeOnly = FALSE) |
136 | 136 | { |
137 | - $query = "SELECT profile_id FROM profile WHERE inst_id = $this->identifier" . ($activeOnly ? " AND showtime = 1" : ""); |
|
137 | + $query = "SELECT profile_id FROM profile WHERE inst_id = $this->identifier".($activeOnly ? " AND showtime = 1" : ""); |
|
138 | 138 | $allProfiles = $this->databaseHandle->exec($query); |
139 | 139 | $returnarray = []; |
140 | 140 | // SELECT -> resource, not boolean |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $returnarray[] = $oneProfile; |
145 | 145 | } |
146 | 146 | |
147 | - $this->loggerInstance->debug(4, "listProfiles: " . /** @scrutinizer ignore-type */ print_r($returnarray, true)); |
|
147 | + $this->loggerInstance->debug(4, "listProfiles: "./** @scrutinizer ignore-type */ print_r($returnarray, true)); |
|
148 | 148 | return $returnarray; |
149 | 149 | } |
150 | 150 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function listDeployments(bool $activeOnly = FALSE) |
158 | 158 | { |
159 | - $query = "SELECT deployment_id FROM deployment WHERE inst_id = $this->identifier" . ($activeOnly ? " AND status = " . AbstractDeployment::ACTIVE : ""); |
|
159 | + $query = "SELECT deployment_id FROM deployment WHERE inst_id = $this->identifier".($activeOnly ? " AND status = ".AbstractDeployment::ACTIVE : ""); |
|
160 | 160 | $allDeployments = $this->databaseHandle->exec($query); |
161 | 161 | $returnarray = []; |
162 | 162 | // SELECT -> resource, not boolean |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $returnarray[] = new DeploymentManaged($this, $deploymentQuery->deployment_id); |
165 | 165 | } |
166 | 166 | |
167 | - $this->loggerInstance->debug(4, "listDeployments: " . /** @scrutinizer ignore-type */ print_r($returnarray, true)); |
|
167 | + $this->loggerInstance->debug(4, "listDeployments: "./** @scrutinizer ignore-type */ print_r($returnarray, true)); |
|
168 | 168 | return $returnarray; |
169 | 169 | } |
170 | 170 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | case AbstractProfile::PROFILETYPE_SILVERBULLET: |
307 | 307 | $theProfile = new ProfileSilverbullet($identifier, $this); |
308 | 308 | $theProfile->addSupportedEapMethod(new \core\common\EAP(\core\common\EAP::EAPTYPE_SILVERBULLET), 1); |
309 | - $theProfile->setRealm($this->identifier . "-" . $theProfile->identifier . "." . strtolower($this->federation) . strtolower(\config\ConfAssistant::SILVERBULLET['realm_suffix'])); |
|
309 | + $theProfile->setRealm($this->identifier."-".$theProfile->identifier.".".strtolower($this->federation).strtolower(\config\ConfAssistant::SILVERBULLET['realm_suffix'])); |
|
310 | 310 | return $theProfile; |
311 | 311 | default: |
312 | 312 | throw new Exception("This type of profile is unknown and can not be added."); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | public function getExternalDBId() |
448 | 448 | { |
449 | 449 | if (\config\ConfAssistant::CONSORTIUM['name'] == "eduroam" && isset(\config\ConfAssistant::CONSORTIUM['deployment-voodoo']) && \config\ConfAssistant::CONSORTIUM['deployment-voodoo'] == "Operations Team") { // SW: APPROVED |
450 | - $idQuery = $this->databaseHandle->exec("SELECT external_db_id FROM institution WHERE inst_id = $this->identifier AND external_db_syncstate = " . self::EXTERNAL_DB_SYNCSTATE_SYNCED); |
|
450 | + $idQuery = $this->databaseHandle->exec("SELECT external_db_id FROM institution WHERE inst_id = $this->identifier AND external_db_syncstate = ".self::EXTERNAL_DB_SYNCSTATE_SYNCED); |
|
451 | 451 | // SELECT -> it's a resource, not a boolean |
452 | 452 | if (mysqli_num_rows(/** @scrutinizer ignore-type */ $idQuery) == 0) { |
453 | 453 | return FALSE; |
@@ -513,16 +513,16 @@ discard block |
||
513 | 513 | } |
514 | 514 | foreach ($baseline as $lang => $value) { |
515 | 515 | if (!key_exists($lang, $newvalues)) { |
516 | - $retval[IdP::INSTNAME_CHANGED] .= "#[Language " . strtoupper($lang) . "] DELETED"; |
|
516 | + $retval[IdP::INSTNAME_CHANGED] .= "#[Language ".strtoupper($lang)."] DELETED"; |
|
517 | 517 | } else { |
518 | 518 | if ($value != $newvalues[$lang]) { |
519 | - $retval[IdP::INSTNAME_CHANGED] .= "#[Language " . strtoupper($lang) . "] CHANGED from '" . $baseline[$lang] . "' to '" . $newvalues[$lang] . "'"; |
|
519 | + $retval[IdP::INSTNAME_CHANGED] .= "#[Language ".strtoupper($lang)."] CHANGED from '".$baseline[$lang]."' to '".$newvalues[$lang]."'"; |
|
520 | 520 | } |
521 | 521 | } |
522 | 522 | } |
523 | 523 | foreach ($newvalues as $lang => $value) { |
524 | 524 | if (!key_exists($lang, $baseline)) { |
525 | - $retval[IdP::INSTNAME_CHANGED] .= "#[Language " . strtoupper($lang) . "] ADDED as '" . $value . "'"; |
|
525 | + $retval[IdP::INSTNAME_CHANGED] .= "#[Language ".strtoupper($lang)."] ADDED as '".$value."'"; |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | return $retval; |
@@ -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 | |
@@ -75,19 +75,19 @@ discard block |
||
75 | 75 | // initialise connection to eduPKI CA / eduroam RA and send the request to them |
76 | 76 | try { |
77 | 77 | $altArray = [# Array mit den Subject Alternative Names |
78 | - "email:" . $csr["USERNAME"] |
|
78 | + "email:".$csr["USERNAME"] |
|
79 | 79 | ]; |
80 | 80 | $soapPub = $this->initEduPKISoapSession("PUBLIC"); |
81 | 81 | $this->loggerInstance->debug(5, "FIRST ACTUAL SOAP REQUEST (Public, newRequest)!\n"); |
82 | - $this->loggerInstance->debug(5, "PARAM_1: " . CertificationAuthorityEduPki::EDUPKI_RA_ID . "\n"); |
|
83 | - $this->loggerInstance->debug(5, "PARAM_2: " . $csr["CSR_STRING"] . "\n"); |
|
82 | + $this->loggerInstance->debug(5, "PARAM_1: ".CertificationAuthorityEduPki::EDUPKI_RA_ID."\n"); |
|
83 | + $this->loggerInstance->debug(5, "PARAM_2: ".$csr["CSR_STRING"]."\n"); |
|
84 | 84 | $this->loggerInstance->debug(5, "PARAM_3: "); |
85 | 85 | $this->loggerInstance->debug(5, $altArray); |
86 | - $this->loggerInstance->debug(5, "PARAM_4: " . CertificationAuthorityEduPki::EDUPKI_CERT_PROFILE . "\n"); |
|
87 | - $this->loggerInstance->debug(5, "PARAM_5: " . sha1("notused") . "\n"); |
|
88 | - $this->loggerInstance->debug(5, "PARAM_6: " . $csr["USERNAME"] . "\n"); |
|
89 | - $this->loggerInstance->debug(5, "PARAM_7: " . $csr["USERNAME"] . "\n"); |
|
90 | - $this->loggerInstance->debug(5, "PARAM_8: " . ProfileSilverbullet::PRODUCTNAME . "\n"); |
|
86 | + $this->loggerInstance->debug(5, "PARAM_4: ".CertificationAuthorityEduPki::EDUPKI_CERT_PROFILE."\n"); |
|
87 | + $this->loggerInstance->debug(5, "PARAM_5: ".sha1("notused")."\n"); |
|
88 | + $this->loggerInstance->debug(5, "PARAM_6: ".$csr["USERNAME"]."\n"); |
|
89 | + $this->loggerInstance->debug(5, "PARAM_7: ".$csr["USERNAME"]."\n"); |
|
90 | + $this->loggerInstance->debug(5, "PARAM_8: ".ProfileSilverbullet::PRODUCTNAME."\n"); |
|
91 | 91 | $this->loggerInstance->debug(5, "PARAM_9: false\n"); |
92 | 92 | $soapNewRequest = $soapPub->newRequest( |
93 | 93 | CertificationAuthorityEduPki::EDUPKI_RA_ID, # RA-ID |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | } catch (Exception $e) { |
110 | 110 | // PHP 7.1 can do this much better |
111 | 111 | if (is_soap_fault($e)) { |
112 | - throw new Exception("Error when sending SOAP request: " . "{$e->faultcode}: { |
|
112 | + throw new Exception("Error when sending SOAP request: "."{$e->faultcode}: { |
|
113 | 113 | $e->faultstring |
114 | 114 | }\n"); |
115 | 115 | } |
116 | - throw new Exception("Something odd happened while doing the SOAP request:" . $e->getMessage()); |
|
116 | + throw new Exception("Something odd happened while doing the SOAP request:".$e->getMessage()); |
|
117 | 117 | } |
118 | 118 | try { |
119 | 119 | $soap = $this->initEduPKISoapSession("RA"); |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | $soapReqnum, [ |
126 | 126 | "RaID" => CertificationAuthorityEduPki::EDUPKI_RA_ID, |
127 | 127 | "Role" => CertificationAuthorityEduPki::EDUPKI_CERT_PROFILE, |
128 | - "Subject" => "DC=eduroam,DC=test,DC=test,C=" . $csr["FED"] . ",O=" . \config\ConfAssistant::CONSORTIUM['name'] . ",OU=" . $csr["FED"] . ",CN=" . $csr['USERNAME'] . ",emailAddress=" . $csr['USERNAME'], |
|
129 | - "SubjectAltNames" => ["email:" . $csr["USERNAME"]], |
|
128 | + "Subject" => "DC=eduroam,DC=test,DC=test,C=".$csr["FED"].",O=".\config\ConfAssistant::CONSORTIUM['name'].",OU=".$csr["FED"].",CN=".$csr['USERNAME'].",emailAddress=".$csr['USERNAME'], |
|
129 | + "SubjectAltNames" => ["email:".$csr["USERNAME"]], |
|
130 | 130 | "NotBefore" => (new \DateTime())->format('c'), |
131 | 131 | "NotAfter" => $expiry->format('c'), |
132 | 132 | ] |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | // for obnoxious reasons, we have to dump the request into a file and let pkcs7_sign read from the file |
146 | 146 | // rather than just using the string. Grr. |
147 | 147 | $tempdir = \core\common\Entity::createTemporaryDirectory("test"); |
148 | - file_put_contents($tempdir['dir'] . "/content.txt", $soapCleartext); |
|
148 | + file_put_contents($tempdir['dir']."/content.txt", $soapCleartext); |
|
149 | 149 | // retrieve our RA cert from filesystem |
150 | 150 | // the RA certificates are not needed right now because we |
151 | 151 | // have resorted to S/MIME signatures with openssl command-line |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | // sign the data, using cmdline because openssl_pkcs7_sign produces strange results |
158 | 158 | // -binary didn't help, nor switch -md to sha1 sha256 or sha512 |
159 | 159 | $this->loggerInstance->debug(5, "Actual content to be signed is this:\n $soapCleartext\n"); |
160 | - $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"; |
|
160 | + $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"; |
|
161 | 161 | $this->loggerInstance->debug(2, "Calling openssl smime with following cmdline: $execCmd\n"); |
162 | 162 | $output = []; |
163 | 163 | $return = 999; |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | throw new Exception("Non-zero return value from openssl smime!"); |
167 | 167 | } |
168 | 168 | // and get the signature blob back from the filesystem |
169 | - $detachedSig = trim(file_get_contents($tempdir['dir'] . "/signature.txt")); |
|
169 | + $detachedSig = trim(file_get_contents($tempdir['dir']."/signature.txt")); |
|
170 | 170 | $this->loggerInstance->debug(5, "Request for server approveRequest has parameters:\n"); |
171 | - $this->loggerInstance->debug(5, $soapReqnum . "\n"); |
|
172 | - $this->loggerInstance->debug(5, $soapCleartext . "\n"); // PHP magically encodes this as base64 while sending! |
|
173 | - $this->loggerInstance->debug(5, $detachedSig . "\n"); |
|
171 | + $this->loggerInstance->debug(5, $soapReqnum."\n"); |
|
172 | + $this->loggerInstance->debug(5, $soapCleartext."\n"); // PHP magically encodes this as base64 while sending! |
|
173 | + $this->loggerInstance->debug(5, $detachedSig."\n"); |
|
174 | 174 | $soapIssueCert = $soap->approveRequest($soapReqnum, $soapCleartext, $detachedSig); |
175 | - $this->loggerInstance->debug(5, "approveRequest Request was: \n" . $soap->__getLastRequest()); |
|
176 | - $this->loggerInstance->debug(5, "approveRequest Response was: \n" . $soap->__getLastResponse()); |
|
175 | + $this->loggerInstance->debug(5, "approveRequest Request was: \n".$soap->__getLastRequest()); |
|
176 | + $this->loggerInstance->debug(5, "approveRequest Response was: \n".$soap->__getLastResponse()); |
|
177 | 177 | if ($soapIssueCert === FALSE) { |
178 | 178 | throw new Exception("The locally approved request was NOT processed by the CA."); |
179 | 179 | } |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | throw new Exception("CAInfo has no root certificate for us!"); |
211 | 211 | } |
212 | 212 | } catch (SoapFault $e) { |
213 | - throw new Exception("SoapFault: Error when sending or receiving SOAP message: " . "{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
213 | + throw new Exception("SoapFault: Error when sending or receiving SOAP message: "."{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
214 | 214 | } catch (Exception $e) { |
215 | - throw new Exception("Exception: Something odd happened between the SOAP requests:" . $e->getMessage()); |
|
215 | + throw new Exception("Exception: Something odd happened between the SOAP requests:".$e->getMessage()); |
|
216 | 216 | } |
217 | 217 | return [ |
218 | 218 | "CERT" => openssl_x509_read($parsedCert['pem']), |
@@ -245,12 +245,12 @@ discard block |
||
245 | 245 | // for obnoxious reasons, we have to dump the request into a file and let pkcs7_sign read from the file |
246 | 246 | // rather than just using the string. Grr. |
247 | 247 | $tempdir = \core\common\Entity::createTemporaryDirectory("test"); |
248 | - file_put_contents($tempdir['dir'] . "/content.txt", $soapRawRevRequest); |
|
248 | + file_put_contents($tempdir['dir']."/content.txt", $soapRawRevRequest); |
|
249 | 249 | // retrieve our RA cert from filesystem |
250 | 250 | // sign the data, using cmdline because openssl_pkcs7_sign produces strange results |
251 | 251 | // -binary didn't help, nor switch -md to sha1 sha256 or sha512 |
252 | 252 | $this->loggerInstance->debug(5, "Actual content to be signed is this:\n$soapRawRevRequest\n"); |
253 | - $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; |
|
253 | + $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; |
|
254 | 254 | $this->loggerInstance->debug(2, "Calling openssl smime with following cmdline: $execCmd\n"); |
255 | 255 | $output = []; |
256 | 256 | $return = 999; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | throw new Exception("Non-zero return value from openssl smime!"); |
260 | 260 | } |
261 | 261 | // and get the signature blob back from the filesystem |
262 | - $detachedSig = trim(file_get_contents($tempdir['dir'] . "/signature.txt")); |
|
262 | + $detachedSig = trim(file_get_contents($tempdir['dir']."/signature.txt")); |
|
263 | 263 | $soapIssueRev = $soap->approveRevocationRequest($soapRevocationSerial, $soapRawRevRequest, $detachedSig); |
264 | 264 | if ($soapIssueRev === FALSE) { |
265 | 265 | throw new Exception("The locally approved revocation request was NOT processed by the CA."); |
@@ -267,9 +267,9 @@ discard block |
||
267 | 267 | } catch (Exception $e) { |
268 | 268 | // PHP 7.1 can do this much better |
269 | 269 | if (is_soap_fault($e)) { |
270 | - throw new Exception("Error when sending SOAP request: " . "{$e->faultcode}: {$e->faultstring}\n"); |
|
270 | + throw new Exception("Error when sending SOAP request: "."{$e->faultcode}: {$e->faultstring}\n"); |
|
271 | 271 | } |
272 | - throw new Exception("Something odd happened while doing the SOAP request:" . $e->getMessage()); |
|
272 | + throw new Exception("Something odd happened while doing the SOAP request:".$e->getMessage()); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
@@ -369,9 +369,9 @@ discard block |
||
369 | 369 | */ |
370 | 370 | public function soapToXmlInteger($x) |
371 | 371 | { |
372 | - return '<' . $x[0] . '>' |
|
372 | + return '<'.$x[0].'>' |
|
373 | 373 | . htmlentities($x[1], ENT_NOQUOTES | ENT_XML1) |
374 | - . '</' . $x[0] . '>'; |
|
374 | + . '</'.$x[0].'>'; |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -390,9 +390,9 @@ discard block |
||
390 | 390 | // dump private key into directory |
391 | 391 | $outstring = ""; |
392 | 392 | openssl_pkey_export($privateKey, $outstring); |
393 | - file_put_contents($tempdir . "/pkey.pem", $outstring); |
|
393 | + file_put_contents($tempdir."/pkey.pem", $outstring); |
|
394 | 394 | // PHP can only do one DC in the Subject. But we need three. |
395 | - $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"; |
|
395 | + $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"; |
|
396 | 396 | $this->loggerInstance->debug(2, "Calling openssl req with following cmdline: $execCmd\n"); |
397 | 397 | $output = []; |
398 | 398 | $return = 999; |
@@ -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 | |
@@ -99,19 +99,19 @@ discard block |
||
99 | 99 | // initialise connection to eduPKI CA / eduroam RA and send the request to them |
100 | 100 | try { |
101 | 101 | $altArray = [# Array mit den Subject Alternative Names |
102 | - "email:" . $csr["USERMAIL"] |
|
102 | + "email:".$csr["USERMAIL"] |
|
103 | 103 | ]; |
104 | 104 | $soapPub = $this->initEduPKISoapSession("PUBLIC"); |
105 | 105 | $this->loggerInstance->debug(5, "FIRST ACTUAL SOAP REQUEST (Public, newRequest)!\n"); |
106 | - $this->loggerInstance->debug(5, "PARAM_1: " . CertificationAuthorityEduPkiServer::EDUPKI_RA_ID . "\n"); |
|
107 | - $this->loggerInstance->debug(5, "PARAM_2: " . $csr["CSR_STRING"] . "\n"); |
|
106 | + $this->loggerInstance->debug(5, "PARAM_1: ".CertificationAuthorityEduPkiServer::EDUPKI_RA_ID."\n"); |
|
107 | + $this->loggerInstance->debug(5, "PARAM_2: ".$csr["CSR_STRING"]."\n"); |
|
108 | 108 | $this->loggerInstance->debug(5, "PARAM_3: "); |
109 | 109 | $this->loggerInstance->debug(5, $altArray); |
110 | - $this->loggerInstance->debug(5, "PARAM_4: " . CertificationAuthorityEduPkiServer::EDUPKI_CERT_PROFILE . "\n"); |
|
111 | - $this->loggerInstance->debug(5, "PARAM_5: " . sha1("notused") . "\n"); |
|
112 | - $this->loggerInstance->debug(5, "PARAM_6: " . $csr["USERNAME"] . "\n"); |
|
113 | - $this->loggerInstance->debug(5, "PARAM_7: " . $csr["USERMAIL"] . "\n"); |
|
114 | - $this->loggerInstance->debug(5, "PARAM_8: " . ProfileSilverbullet::PRODUCTNAME . "\n"); |
|
110 | + $this->loggerInstance->debug(5, "PARAM_4: ".CertificationAuthorityEduPkiServer::EDUPKI_CERT_PROFILE."\n"); |
|
111 | + $this->loggerInstance->debug(5, "PARAM_5: ".sha1("notused")."\n"); |
|
112 | + $this->loggerInstance->debug(5, "PARAM_6: ".$csr["USERNAME"]."\n"); |
|
113 | + $this->loggerInstance->debug(5, "PARAM_7: ".$csr["USERMAIL"]."\n"); |
|
114 | + $this->loggerInstance->debug(5, "PARAM_8: ".ProfileSilverbullet::PRODUCTNAME."\n"); |
|
115 | 115 | $this->loggerInstance->debug(5, "PARAM_9: false\n"); |
116 | 116 | $soapNewRequest = $soapPub->newRequest( |
117 | 117 | CertificationAuthorityEduPkiServer::EDUPKI_RA_ID, # RA-ID |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | } catch (Exception $e) { |
134 | 134 | // PHP 7.1 can do this much better |
135 | 135 | if (is_soap_fault($e)) { |
136 | - throw new Exception("Error when sending SOAP request: " . "{$e->faultcode}: { |
|
136 | + throw new Exception("Error when sending SOAP request: "."{$e->faultcode}: { |
|
137 | 137 | $e->faultstring |
138 | 138 | }\n"); |
139 | 139 | } |
140 | - throw new Exception("Something odd happened while doing the SOAP request:" . $e->getMessage()); |
|
140 | + throw new Exception("Something odd happened while doing the SOAP request:".$e->getMessage()); |
|
141 | 141 | } |
142 | 142 | try { |
143 | 143 | $soap = $this->initEduPKISoapSession("RA"); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | // for obnoxious reasons, we have to dump the request into a file and let pkcs7_sign read from the file |
172 | 172 | // rather than just using the string. Grr. |
173 | 173 | $tempdir = \core\common\Entity::createTemporaryDirectory("test"); |
174 | - file_put_contents($tempdir['dir'] . "/content.txt", $soapCleartext); |
|
174 | + file_put_contents($tempdir['dir']."/content.txt", $soapCleartext); |
|
175 | 175 | // retrieve our RA cert from filesystem |
176 | 176 | // the RA certificates are not needed right now because we |
177 | 177 | // have resorted to S/MIME signatures with openssl command-line |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | // sign the data, using cmdline because openssl_pkcs7_sign produces strange results |
184 | 184 | // -binary didn't help, nor switch -md to sha1 sha256 or sha512 |
185 | 185 | $this->loggerInstance->debug(5, "Actual content to be signed is this:\n $soapCleartext\n"); |
186 | - $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"; |
|
186 | + $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"; |
|
187 | 187 | $this->loggerInstance->debug(2, "Calling openssl smime with following cmdline: $execCmd\n"); |
188 | 188 | $output = []; |
189 | 189 | $return = 999; |
@@ -192,21 +192,21 @@ discard block |
||
192 | 192 | throw new Exception("Non-zero return value from openssl smime!"); |
193 | 193 | } |
194 | 194 | // and get the signature blob back from the filesystem |
195 | - $detachedSig = trim(file_get_contents($tempdir['dir'] . "/signature.txt")); |
|
195 | + $detachedSig = trim(file_get_contents($tempdir['dir']."/signature.txt")); |
|
196 | 196 | $this->loggerInstance->debug(5, "Request for server approveRequest has parameters:\n"); |
197 | - $this->loggerInstance->debug(5, $soapReqnum . "\n"); |
|
198 | - $this->loggerInstance->debug(5, $soapCleartext . "\n"); // PHP magically encodes this as base64 while sending! |
|
199 | - $this->loggerInstance->debug(5, $detachedSig . "\n"); |
|
197 | + $this->loggerInstance->debug(5, $soapReqnum."\n"); |
|
198 | + $this->loggerInstance->debug(5, $soapCleartext."\n"); // PHP magically encodes this as base64 while sending! |
|
199 | + $this->loggerInstance->debug(5, $detachedSig."\n"); |
|
200 | 200 | $soapIssueCert = $soap->approveRequest($soapReqnum, $soapCleartext, $detachedSig); |
201 | - $this->loggerInstance->debug(5, "approveRequest Request was: \n" . $soap->__getLastRequest()); |
|
202 | - $this->loggerInstance->debug(5, "approveRequest Response was: \n" . $soap->__getLastResponse()); |
|
201 | + $this->loggerInstance->debug(5, "approveRequest Request was: \n".$soap->__getLastRequest()); |
|
202 | + $this->loggerInstance->debug(5, "approveRequest Response was: \n".$soap->__getLastResponse()); |
|
203 | 203 | if ($soapIssueCert === FALSE) { |
204 | 204 | throw new Exception("The locally approved request was NOT processed by the CA."); |
205 | 205 | } |
206 | 206 | } catch (SoapFault $e) { |
207 | - throw new Exception("SoapFault: Error when sending or receiving SOAP message: " . "{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
207 | + throw new Exception("SoapFault: Error when sending or receiving SOAP message: "."{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
208 | 208 | } catch (Exception $e) { |
209 | - throw new Exception("Exception: Something odd happened between the SOAP requests:" . $e->getMessage()); |
|
209 | + throw new Exception("Exception: Something odd happened between the SOAP requests:".$e->getMessage()); |
|
210 | 210 | } |
211 | 211 | return $soapReqnum; |
212 | 212 | } |
@@ -258,9 +258,9 @@ discard block |
||
258 | 258 | throw new Exception("CAInfo has no root certificate for us!"); |
259 | 259 | } |
260 | 260 | } catch (SoapFault $e) { |
261 | - throw new Exception("SoapFault: Error when sending or receiving SOAP message: " . "{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
261 | + throw new Exception("SoapFault: Error when sending or receiving SOAP message: "."{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
262 | 262 | } catch (Exception $e) { |
263 | - throw new Exception("Exception: Something odd happened between the SOAP requests:" . $e->getMessage()); |
|
263 | + throw new Exception("Exception: Something odd happened between the SOAP requests:".$e->getMessage()); |
|
264 | 264 | } |
265 | 265 | return [ |
266 | 266 | "CERT" => openssl_x509_read($parsedCert['pem']), |
@@ -293,12 +293,12 @@ discard block |
||
293 | 293 | // for obnoxious reasons, we have to dump the request into a file and let pkcs7_sign read from the file |
294 | 294 | // rather than just using the string. Grr. |
295 | 295 | $tempdir = \core\common\Entity::createTemporaryDirectory("test"); |
296 | - file_put_contents($tempdir['dir'] . "/content.txt", $soapRawRevRequest); |
|
296 | + file_put_contents($tempdir['dir']."/content.txt", $soapRawRevRequest); |
|
297 | 297 | // retrieve our RA cert from filesystem |
298 | 298 | // sign the data, using cmdline because openssl_pkcs7_sign produces strange results |
299 | 299 | // -binary didn't help, nor switch -md to sha1 sha256 or sha512 |
300 | 300 | $this->loggerInstance->debug(5, "Actual content to be signed is this:\n$soapRawRevRequest\n"); |
301 | - $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; |
|
301 | + $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; |
|
302 | 302 | $this->loggerInstance->debug(2, "Calling openssl smime with following cmdline: $execCmd\n"); |
303 | 303 | $output = []; |
304 | 304 | $return = 999; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | throw new Exception("Non-zero return value from openssl smime!"); |
308 | 308 | } |
309 | 309 | // and get the signature blob back from the filesystem |
310 | - $detachedSig = trim(file_get_contents($tempdir['dir'] . "/signature.txt")); |
|
310 | + $detachedSig = trim(file_get_contents($tempdir['dir']."/signature.txt")); |
|
311 | 311 | $soapIssueRev = $soap->approveRevocationRequest($soapRevocationSerial, $soapRawRevRequest, $detachedSig); |
312 | 312 | if ($soapIssueRev === FALSE) { |
313 | 313 | throw new Exception("The locally approved revocation request was NOT processed by the CA."); |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | } catch (Exception $e) { |
316 | 316 | // PHP 7.1 can do this much better |
317 | 317 | if (is_soap_fault($e)) { |
318 | - throw new Exception("Error when sending SOAP request: " . "{$e->faultcode}: {$e->faultstring}\n"); |
|
318 | + throw new Exception("Error when sending SOAP request: "."{$e->faultcode}: {$e->faultstring}\n"); |
|
319 | 319 | } |
320 | - throw new Exception("Something odd happened while doing the SOAP request:" . $e->getMessage()); |
|
320 | + throw new Exception("Something odd happened while doing the SOAP request:".$e->getMessage()); |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public function soapToXmlInteger($x) |
419 | 419 | { |
420 | - return '<' . $x[0] . '>' |
|
420 | + return '<'.$x[0].'>' |
|
421 | 421 | . htmlentities($x[1], ENT_NOQUOTES | ENT_XML1) |
422 | - . '</' . $x[0] . '>'; |
|
422 | + . '</'.$x[0].'>'; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | /** |
@@ -438,9 +438,9 @@ discard block |
||
438 | 438 | // dump private key into directory |
439 | 439 | $outstring = ""; |
440 | 440 | openssl_pkey_export($privateKey, $outstring); |
441 | - file_put_contents($tempdir . "/pkey.pem", $outstring); |
|
441 | + file_put_contents($tempdir."/pkey.pem", $outstring); |
|
442 | 442 | // PHP can only do one DC in the Subject. But we need three. |
443 | - $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"; |
|
443 | + $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"; |
|
444 | 444 | $this->loggerInstance->debug(2, "Calling openssl req with following cmdline: $execCmd\n"); |
445 | 445 | $output = []; |
446 | 446 | $return = 999; |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | class CertificationAuthorityEmbeddedRSA extends EntityWithDBProperties implements CertificationAuthorityInterface |
17 | 17 | { |
18 | 18 | |
19 | - private const LOCATION_ROOT_CA = ROOT . "/config/SilverbulletClientCerts/rootca-RSA.pem"; |
|
20 | - private const LOCATION_ISSUING_CA = ROOT . "/config/SilverbulletClientCerts/real-RSA.pem"; |
|
21 | - private const LOCATION_ISSUING_KEY = ROOT . "/config/SilverbulletClientCerts/real-RSA.key"; |
|
22 | - private const LOCATION_CONFIG = ROOT . "/config/SilverbulletClientCerts/openssl-RSA.cnf"; |
|
19 | + private const LOCATION_ROOT_CA = ROOT."/config/SilverbulletClientCerts/rootca-RSA.pem"; |
|
20 | + private const LOCATION_ISSUING_CA = ROOT."/config/SilverbulletClientCerts/real-RSA.pem"; |
|
21 | + private const LOCATION_ISSUING_KEY = ROOT."/config/SilverbulletClientCerts/real-RSA.key"; |
|
22 | + private const LOCATION_CONFIG = ROOT."/config/SilverbulletClientCerts/openssl-RSA.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(CertificationAuthorityEmbeddedRSA::LOCATION_ROOT_CA); |
68 | 68 | if ($this->rootPem === FALSE) { |
69 | - throw new Exception("Root CA PEM file not found: " . CertificationAuthorityEmbeddedRSA::LOCATION_ROOT_CA); |
|
69 | + throw new Exception("Root CA PEM file not found: ".CertificationAuthorityEmbeddedRSA::LOCATION_ROOT_CA); |
|
70 | 70 | } |
71 | 71 | $this->issuingCertRaw = file_get_contents(CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA); |
72 | 72 | if ($this->issuingCertRaw === FALSE) { |
73 | - throw new Exception("Issuing CA PEM file not found: " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA); |
|
73 | + throw new Exception("Issuing CA PEM file not found: ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA); |
|
74 | 74 | } |
75 | 75 | $rootParsed = openssl_x509_read($this->rootPem); |
76 | 76 | $issuingCertCandidate = openssl_x509_read($this->issuingCertRaw); |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | } |
81 | 81 | $this->issuingCert = $issuingCertCandidate; |
82 | 82 | if (stat(CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY) === FALSE) { |
83 | - throw new Exception("Private key not found: " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY); |
|
83 | + throw new Exception("Private key not found: ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY); |
|
84 | 84 | } |
85 | - $issuingKeyTemp = openssl_pkey_get_private("file://" . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY); |
|
85 | + $issuingKeyTemp = openssl_pkey_get_private("file://".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY); |
|
86 | 86 | if ($issuingKeyTemp === FALSE || is_resource($issuingKeyTemp)) { |
87 | 87 | throw new Exception("The private key did not parse correctly (or is not a PHP8 object)!"); |
88 | 88 | } |
89 | 89 | $this->issuingKey = $issuingKeyTemp; |
90 | 90 | if (stat(CertificationAuthorityEmbeddedRSA::LOCATION_CONFIG) === FALSE) { |
91 | - throw new Exception("openssl configuration not found: " . CertificationAuthorityEmbeddedRSA::LOCATION_CONFIG); |
|
91 | + throw new Exception("openssl configuration not found: ".CertificationAuthorityEmbeddedRSA::LOCATION_CONFIG); |
|
92 | 92 | } |
93 | 93 | $this->conffile = CertificationAuthorityEmbeddedRSA::LOCATION_CONFIG; |
94 | 94 | } |
@@ -131,27 +131,27 @@ discard block |
||
131 | 131 | // generate stub index.txt file |
132 | 132 | $tempdirArray = \core\common\Entity::createTemporaryDirectory("test"); |
133 | 133 | $tempdir = $tempdirArray['dir']; |
134 | - $nowIndexTxt = (new \DateTime())->format("ymdHis") . "Z"; |
|
135 | - $expiryIndexTxt = $originalExpiry->format("ymdHis") . "Z"; |
|
134 | + $nowIndexTxt = (new \DateTime())->format("ymdHis")."Z"; |
|
135 | + $expiryIndexTxt = $originalExpiry->format("ymdHis")."Z"; |
|
136 | 136 | // serials for our CA are always integers |
137 | 137 | $serialHex = strtoupper(dechex((int) $cert->serial)); |
138 | 138 | if (strlen($serialHex) % 2 == 1) { |
139 | - $serialHex = "0" . $serialHex; |
|
139 | + $serialHex = "0".$serialHex; |
|
140 | 140 | } |
141 | 141 | |
142 | - $indexStatement = "$certstatus\t$expiryIndexTxt\t" . ($certstatus == "R" ? "$nowIndexTxt,unspecified" : "") . "\t$serialHex\tunknown\t/O=" . \config\ConfAssistant::CONSORTIUM['name'] . "/OU=$federation/CN=$cert->username\n"; |
|
142 | + $indexStatement = "$certstatus\t$expiryIndexTxt\t".($certstatus == "R" ? "$nowIndexTxt,unspecified" : "")."\t$serialHex\tunknown\t/O=".\config\ConfAssistant::CONSORTIUM['name']."/OU=$federation/CN=$cert->username\n"; |
|
143 | 143 | $this->loggerInstance->debug(4, "index.txt contents-to-be: $indexStatement"); |
144 | - if (!file_put_contents($tempdir . "/index.txt", $indexStatement)) { |
|
144 | + if (!file_put_contents($tempdir."/index.txt", $indexStatement)) { |
|
145 | 145 | $this->loggerInstance->debug(1, "Unable to write openssl index.txt file for revocation handling!"); |
146 | 146 | } |
147 | 147 | // index.txt.attr is dull but needs to exist |
148 | - file_put_contents($tempdir . "/index.txt.attr", "unique_subject = yes\n"); |
|
148 | + file_put_contents($tempdir."/index.txt.attr", "unique_subject = yes\n"); |
|
149 | 149 | // call "openssl ocsp" to manufacture our own OCSP statement |
150 | 150 | // adding "-rmd sha1" to the following command-line makes the |
151 | 151 | // choice of signature algorithm for the response explicit |
152 | 152 | // but it's only available from openssl-1.1.0 (which we do not |
153 | 153 | // want to require just for that one thing). |
154 | - $execCmd = \config\Master::PATHS['openssl'] . " ocsp -issuer " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA . " -sha1 -ndays 10 -no_nonce -serial 0x$serialHex -CA " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA . " -rsigner " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA . " -rkey " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY . " -index $tempdir/index.txt -no_cert_verify -respout $tempdir/$serialHex.response.der"; |
|
154 | + $execCmd = \config\Master::PATHS['openssl']." ocsp -issuer ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA." -sha1 -ndays 10 -no_nonce -serial 0x$serialHex -CA ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA." -rsigner ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA." -rkey ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY." -index $tempdir/index.txt -no_cert_verify -respout $tempdir/$serialHex.response.der"; |
|
155 | 155 | $this->loggerInstance->debug(2, "Calling openssl ocsp with following cmdline: $execCmd\n"); |
156 | 156 | $output = []; |
157 | 157 | $return = 999; |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | if ($return !== 0) { |
160 | 160 | throw new Exception("Non-zero return value from openssl ocsp!"); |
161 | 161 | } |
162 | - $ocsp = file_get_contents($tempdir . "/$serialHex.response.der"); |
|
162 | + $ocsp = file_get_contents($tempdir."/$serialHex.response.der"); |
|
163 | 163 | // remove the temp dir! |
164 | - unlink($tempdir . "/$serialHex.response.der"); |
|
165 | - unlink($tempdir . "/index.txt.attr"); |
|
166 | - unlink($tempdir . "/index.txt"); |
|
164 | + unlink($tempdir."/$serialHex.response.der"); |
|
165 | + unlink($tempdir."/index.txt.attr"); |
|
166 | + unlink($tempdir."/index.txt"); |
|
167 | 167 | rmdir($tempdir); |
168 | 168 | $this->databaseHandle->exec("UPDATE silverbullet_certificate SET OCSP = ?, OCSP_timestamp = NOW() WHERE serial_number = ?", "si", $ocsp, $cert->serial); |
169 | 169 | return $ocsp; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | ?> |
23 | 23 | <?php |
24 | 24 | |
25 | -require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/config/_config.php"; |
|
25 | +require_once dirname(dirname(dirname(dirname(__FILE__))))."/config/_config.php"; |
|
26 | 26 | |
27 | 27 | $validator = new \web\lib\common\InputValidation(); |
28 | 28 | $idRaw = $_GET["id"] ?? ""; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | // Set data type and caching for 30 days |
38 | 38 | $info = new finfo(); |
39 | 39 | $filetype = $info->buffer($finalBlob, FILEINFO_MIME_TYPE); |
40 | - header("Content-type: " . $filetype); |
|
40 | + header("Content-type: ".$filetype); |
|
41 | 41 | |
42 | 42 | switch ($filetype) { |
43 | 43 | case "text/rtf": // fall-through, same treatment |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | header("Cache-Control: must-revalidate"); |
55 | 55 | $offset = 60 * 60 * 24 * 30; |
56 | 56 | // gmdate can't possibly fail, because it operates on time() and an integer offset |
57 | - $ExpStr = "Expires: " . /** @scrutinizer ignore-type */ gmdate("D, d M Y H:i:s", time() + $offset) . " GMT"; |
|
57 | + $ExpStr = "Expires: "./** @scrutinizer ignore-type */ gmdate("D, d M Y H:i:s", time() + $offset)." GMT"; |
|
58 | 58 | header($ExpStr); |
59 | 59 | // Print out the image |
60 | 60 | echo $finalBlob; |
@@ -98,98 +98,98 @@ |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | switch ($operationMode) { |
101 | - case OPERATION_MODE_EDIT: |
|
102 | - $idp = $validator->existingIdP($_GET['inst_id']); |
|
103 | - // editing IdPs is done from within the popup. When we're done, send the |
|
104 | - // user back to the popup (append the result of the operation later) |
|
105 | - $redirectDestination = "manageAdmins.inc.php?inst_id=" . $idp->identifier . "&"; |
|
106 | - if (count($validAddresses) == 0) { |
|
107 | - header("Location: $redirectDestination" . "invitation=INVALIDSYNTAX"); |
|
108 | - exit(1); |
|
109 | - } |
|
110 | - // is the user primary admin of this IdP? |
|
111 | - $is_owner = $idp->isPrimaryOwner($_SESSION['user']); |
|
112 | - // check if he is (also) federation admin for the federation this IdP is in. His invitations have more blessing then. |
|
113 | - $fedadmin = $userObject->isFederationAdmin($idp->federation); |
|
114 | - // check if he is either one, if not, complain |
|
115 | - if (!$is_owner && !$fedadmin) { |
|
116 | - echo "<p>" . sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclatureFed, $uiElements->nomenclatureFed, $uiElements->nomenclatureInst) . "</p>"; |
|
117 | - exit(1); |
|
118 | - } |
|
101 | + case OPERATION_MODE_EDIT: |
|
102 | + $idp = $validator->existingIdP($_GET['inst_id']); |
|
103 | + // editing IdPs is done from within the popup. When we're done, send the |
|
104 | + // user back to the popup (append the result of the operation later) |
|
105 | + $redirectDestination = "manageAdmins.inc.php?inst_id=" . $idp->identifier . "&"; |
|
106 | + if (count($validAddresses) == 0) { |
|
107 | + header("Location: $redirectDestination" . "invitation=INVALIDSYNTAX"); |
|
108 | + exit(1); |
|
109 | + } |
|
110 | + // is the user primary admin of this IdP? |
|
111 | + $is_owner = $idp->isPrimaryOwner($_SESSION['user']); |
|
112 | + // check if he is (also) federation admin for the federation this IdP is in. His invitations have more blessing then. |
|
113 | + $fedadmin = $userObject->isFederationAdmin($idp->federation); |
|
114 | + // check if he is either one, if not, complain |
|
115 | + if (!$is_owner && !$fedadmin) { |
|
116 | + echo "<p>" . sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclatureFed, $uiElements->nomenclatureFed, $uiElements->nomenclatureInst) . "</p>"; |
|
117 | + exit(1); |
|
118 | + } |
|
119 | 119 | |
120 | - $prettyprintname = $idp->name; |
|
121 | - $newtokens = $mgmt->createTokens($fedadmin, $validAddresses, $idp); |
|
122 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $idp->identifier . " - Token created for " . implode(",", $validAddresses)); |
|
123 | - $introtext = "CO-ADMIN"; |
|
124 | - $participant_type = $idp->type; |
|
125 | - break; |
|
126 | - case OPERATION_MODE_NEWUNLINKED: |
|
127 | - $redirectDestination = "../overview_federation.php?"; |
|
128 | - if (count($validAddresses) == 0) { |
|
129 | - header("Location: $redirectDestination"."invitation=INVALIDSYNTAX"); |
|
130 | - exit(1); |
|
131 | - } |
|
132 | - // run an input check and conversion of the raw inputs... just in case |
|
133 | - $newinstname = $validator->string($_POST['name']); |
|
134 | - $newcountry = $validator->string($_POST['country']); |
|
135 | - $participant_type = $validator->partType($_POST['participant_type']); |
|
136 | - $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($newcountry); |
|
137 | - if ($new_idp_authorized_fedadmin !== TRUE) { |
|
138 | - throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclatureInst . ", but are not a " . $uiElements->nomenclatureFed . " admin for the " . $uiElements->nomenclatureFed . " it should be in!"); |
|
139 | - } |
|
140 | - $federation = $validator->existingFederation($newcountry); |
|
141 | - $prettyprintname = $newinstname; |
|
142 | - $introtext = "NEW-FED"; |
|
143 | - // send the user back to his federation overview page, append the result of the operation later |
|
144 | - // do the token creation magic |
|
145 | - $newtokens = $mgmt->createTokens(TRUE, $validAddresses, $newinstname, 0, $newcountry, $participant_type); |
|
146 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "ORG FUTURE - Token created for $participant_type " . implode(",", $validAddresses)); |
|
147 | - break; |
|
148 | - case OPERATION_MODE_NEWFROMDB: |
|
149 | - $redirectDestination = "../overview_federation.php?"; |
|
150 | - if (count($validAddresses) == 0) { |
|
151 | - header("Location: $redirectDestination"."invitation=INVALIDSYNTAX"); |
|
152 | - exit(1); |
|
153 | - } |
|
154 | - // a real external DB entry was submitted and all the required parameters are there |
|
155 | - $newexternalid = $validator->string($_POST['externals']); |
|
156 | - $extinfo = $catInstance->getExternalDBEntityDetails($newexternalid); |
|
157 | - $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($extinfo['country']); |
|
158 | - if ($new_idp_authorized_fedadmin !== TRUE) { |
|
159 | - throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclatureInst . ", but are not a " . $uiElements->nomenclatureFed . " admin for the " . $uiElements->nomenclatureFed . " it should be in!"); |
|
160 | - } |
|
161 | - $federation = $validator->existingFederation($extinfo['country']); |
|
162 | - $newcountry = $extinfo['country']; |
|
163 | - // see if the inst name is defined in the currently set language; if not, pick its English name; if N/A, pick the last in the list |
|
164 | - $prettyprintname = ""; |
|
165 | - foreach ($extinfo['names'] as $lang => $name) { |
|
166 | - if ($lang == $languageInstance->getLang()) { |
|
167 | - $prettyprintname = $name; |
|
120 | + $prettyprintname = $idp->name; |
|
121 | + $newtokens = $mgmt->createTokens($fedadmin, $validAddresses, $idp); |
|
122 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $idp->identifier . " - Token created for " . implode(",", $validAddresses)); |
|
123 | + $introtext = "CO-ADMIN"; |
|
124 | + $participant_type = $idp->type; |
|
125 | + break; |
|
126 | + case OPERATION_MODE_NEWUNLINKED: |
|
127 | + $redirectDestination = "../overview_federation.php?"; |
|
128 | + if (count($validAddresses) == 0) { |
|
129 | + header("Location: $redirectDestination"."invitation=INVALIDSYNTAX"); |
|
130 | + exit(1); |
|
168 | 131 | } |
169 | - } |
|
170 | - if ($prettyprintname == "" && isset($extinfo['names']['en'])) { |
|
171 | - $prettyprintname = $extinfo['names']['en']; |
|
172 | - } |
|
173 | - if ($prettyprintname == "") { |
|
174 | - foreach ($extinfo['names'] as $name) { |
|
175 | - $prettyprintname = $name; |
|
132 | + // run an input check and conversion of the raw inputs... just in case |
|
133 | + $newinstname = $validator->string($_POST['name']); |
|
134 | + $newcountry = $validator->string($_POST['country']); |
|
135 | + $participant_type = $validator->partType($_POST['participant_type']); |
|
136 | + $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($newcountry); |
|
137 | + if ($new_idp_authorized_fedadmin !== TRUE) { |
|
138 | + throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclatureInst . ", but are not a " . $uiElements->nomenclatureFed . " admin for the " . $uiElements->nomenclatureFed . " it should be in!"); |
|
176 | 139 | } |
177 | - } |
|
178 | - $participant_type = $extinfo['type']; |
|
179 | - // fill the rest of the text |
|
180 | - $introtext = "EXISTING-FED"; |
|
181 | - // do the token creation magic |
|
182 | - $newtokens = $mgmt->createTokens(TRUE, $validAddresses, $prettyprintname, $newexternalid); |
|
183 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for " . implode(",", $validAddresses)); |
|
184 | - break; |
|
185 | - default: // includes OPERATION_MODE_INVALID |
|
186 | - // second param is TRUE, so the variable *will* contain a string |
|
187 | - // i.e. ignore Scrutinizer type warning later |
|
188 | - $wrongcontent = print_r($_POST, TRUE); |
|
189 | - echo "<pre>Wrong parameters in POST: |
|
140 | + $federation = $validator->existingFederation($newcountry); |
|
141 | + $prettyprintname = $newinstname; |
|
142 | + $introtext = "NEW-FED"; |
|
143 | + // send the user back to his federation overview page, append the result of the operation later |
|
144 | + // do the token creation magic |
|
145 | + $newtokens = $mgmt->createTokens(TRUE, $validAddresses, $newinstname, 0, $newcountry, $participant_type); |
|
146 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "ORG FUTURE - Token created for $participant_type " . implode(",", $validAddresses)); |
|
147 | + break; |
|
148 | + case OPERATION_MODE_NEWFROMDB: |
|
149 | + $redirectDestination = "../overview_federation.php?"; |
|
150 | + if (count($validAddresses) == 0) { |
|
151 | + header("Location: $redirectDestination"."invitation=INVALIDSYNTAX"); |
|
152 | + exit(1); |
|
153 | + } |
|
154 | + // a real external DB entry was submitted and all the required parameters are there |
|
155 | + $newexternalid = $validator->string($_POST['externals']); |
|
156 | + $extinfo = $catInstance->getExternalDBEntityDetails($newexternalid); |
|
157 | + $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($extinfo['country']); |
|
158 | + if ($new_idp_authorized_fedadmin !== TRUE) { |
|
159 | + throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclatureInst . ", but are not a " . $uiElements->nomenclatureFed . " admin for the " . $uiElements->nomenclatureFed . " it should be in!"); |
|
160 | + } |
|
161 | + $federation = $validator->existingFederation($extinfo['country']); |
|
162 | + $newcountry = $extinfo['country']; |
|
163 | + // see if the inst name is defined in the currently set language; if not, pick its English name; if N/A, pick the last in the list |
|
164 | + $prettyprintname = ""; |
|
165 | + foreach ($extinfo['names'] as $lang => $name) { |
|
166 | + if ($lang == $languageInstance->getLang()) { |
|
167 | + $prettyprintname = $name; |
|
168 | + } |
|
169 | + } |
|
170 | + if ($prettyprintname == "" && isset($extinfo['names']['en'])) { |
|
171 | + $prettyprintname = $extinfo['names']['en']; |
|
172 | + } |
|
173 | + if ($prettyprintname == "") { |
|
174 | + foreach ($extinfo['names'] as $name) { |
|
175 | + $prettyprintname = $name; |
|
176 | + } |
|
177 | + } |
|
178 | + $participant_type = $extinfo['type']; |
|
179 | + // fill the rest of the text |
|
180 | + $introtext = "EXISTING-FED"; |
|
181 | + // do the token creation magic |
|
182 | + $newtokens = $mgmt->createTokens(TRUE, $validAddresses, $prettyprintname, $newexternalid); |
|
183 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for " . implode(",", $validAddresses)); |
|
184 | + break; |
|
185 | + default: // includes OPERATION_MODE_INVALID |
|
186 | + // second param is TRUE, so the variable *will* contain a string |
|
187 | + // i.e. ignore Scrutinizer type warning later |
|
188 | + $wrongcontent = print_r($_POST, TRUE); |
|
189 | + echo "<pre>Wrong parameters in POST: |
|
190 | 190 | " . htmlspecialchars(/** @scrutinizer ignore-type */ $wrongcontent) . " |
191 | 191 | </pre>"; |
192 | - exit(1); |
|
192 | + exit(1); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | // send, and invalidate the token immediately if the mail could not be sent! |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * <base_url>/copyright.php after deploying the software |
21 | 21 | */ |
22 | 22 | |
23 | -require_once dirname(dirname(dirname(__DIR__))) . "/config/_config.php"; |
|
23 | +require_once dirname(dirname(dirname(__DIR__)))."/config/_config.php"; |
|
24 | 24 | |
25 | 25 | $auth = new \web\lib\admin\Authentication(); |
26 | 26 | $auth->authenticate(); |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | $idp = $validator->existingIdP($_GET['inst_id']); |
103 | 103 | // editing IdPs is done from within the popup. When we're done, send the |
104 | 104 | // user back to the popup (append the result of the operation later) |
105 | - $redirectDestination = "manageAdmins.inc.php?inst_id=" . $idp->identifier . "&"; |
|
105 | + $redirectDestination = "manageAdmins.inc.php?inst_id=".$idp->identifier."&"; |
|
106 | 106 | if (count($validAddresses) == 0) { |
107 | - header("Location: $redirectDestination" . "invitation=INVALIDSYNTAX"); |
|
107 | + header("Location: $redirectDestination"."invitation=INVALIDSYNTAX"); |
|
108 | 108 | exit(1); |
109 | 109 | } |
110 | 110 | // is the user primary admin of this IdP? |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | $fedadmin = $userObject->isFederationAdmin($idp->federation); |
114 | 114 | // check if he is either one, if not, complain |
115 | 115 | if (!$is_owner && !$fedadmin) { |
116 | - echo "<p>" . sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclatureFed, $uiElements->nomenclatureFed, $uiElements->nomenclatureInst) . "</p>"; |
|
116 | + echo "<p>".sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclatureFed, $uiElements->nomenclatureFed, $uiElements->nomenclatureInst)."</p>"; |
|
117 | 117 | exit(1); |
118 | 118 | } |
119 | 119 | |
120 | 120 | $prettyprintname = $idp->name; |
121 | 121 | $newtokens = $mgmt->createTokens($fedadmin, $validAddresses, $idp); |
122 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $idp->identifier . " - Token created for " . implode(",", $validAddresses)); |
|
122 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP ".$idp->identifier." - Token created for ".implode(",", $validAddresses)); |
|
123 | 123 | $introtext = "CO-ADMIN"; |
124 | 124 | $participant_type = $idp->type; |
125 | 125 | break; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $participant_type = $validator->partType($_POST['participant_type']); |
136 | 136 | $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($newcountry); |
137 | 137 | if ($new_idp_authorized_fedadmin !== TRUE) { |
138 | - throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclatureInst . ", but are not a " . $uiElements->nomenclatureFed . " admin for the " . $uiElements->nomenclatureFed . " it should be in!"); |
|
138 | + throw new Exception("Something's wrong... you want to create a new ".$uiElements->nomenclatureInst.", but are not a ".$uiElements->nomenclatureFed." admin for the ".$uiElements->nomenclatureFed." it should be in!"); |
|
139 | 139 | } |
140 | 140 | $federation = $validator->existingFederation($newcountry); |
141 | 141 | $prettyprintname = $newinstname; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | // send the user back to his federation overview page, append the result of the operation later |
144 | 144 | // do the token creation magic |
145 | 145 | $newtokens = $mgmt->createTokens(TRUE, $validAddresses, $newinstname, 0, $newcountry, $participant_type); |
146 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "ORG FUTURE - Token created for $participant_type " . implode(",", $validAddresses)); |
|
146 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "ORG FUTURE - Token created for $participant_type ".implode(",", $validAddresses)); |
|
147 | 147 | break; |
148 | 148 | case OPERATION_MODE_NEWFROMDB: |
149 | 149 | $redirectDestination = "../overview_federation.php?"; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $extinfo = $catInstance->getExternalDBEntityDetails($newexternalid); |
157 | 157 | $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($extinfo['country']); |
158 | 158 | if ($new_idp_authorized_fedadmin !== TRUE) { |
159 | - throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclatureInst . ", but are not a " . $uiElements->nomenclatureFed . " admin for the " . $uiElements->nomenclatureFed . " it should be in!"); |
|
159 | + throw new Exception("Something's wrong... you want to create a new ".$uiElements->nomenclatureInst.", but are not a ".$uiElements->nomenclatureFed." admin for the ".$uiElements->nomenclatureFed." it should be in!"); |
|
160 | 160 | } |
161 | 161 | $federation = $validator->existingFederation($extinfo['country']); |
162 | 162 | $newcountry = $extinfo['country']; |
@@ -180,14 +180,14 @@ discard block |
||
180 | 180 | $introtext = "EXISTING-FED"; |
181 | 181 | // do the token creation magic |
182 | 182 | $newtokens = $mgmt->createTokens(TRUE, $validAddresses, $prettyprintname, $newexternalid); |
183 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for " . implode(",", $validAddresses)); |
|
183 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for ".implode(",", $validAddresses)); |
|
184 | 184 | break; |
185 | 185 | default: // includes OPERATION_MODE_INVALID |
186 | 186 | // second param is TRUE, so the variable *will* contain a string |
187 | 187 | // i.e. ignore Scrutinizer type warning later |
188 | 188 | $wrongcontent = print_r($_POST, TRUE); |
189 | 189 | echo "<pre>Wrong parameters in POST: |
190 | -" . htmlspecialchars(/** @scrutinizer ignore-type */ $wrongcontent) . " |
|
190 | +" . htmlspecialchars(/** @scrutinizer ignore-type */ $wrongcontent)." |
|
191 | 191 | </pre>"; |
192 | 192 | exit(1); |
193 | 193 | } |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | } |
213 | 213 | |
214 | 214 | if (count($status) == 0) { |
215 | - header("Location: $redirectDestination" . "invitation=FAILURE"); |
|
215 | + header("Location: $redirectDestination"."invitation=FAILURE"); |
|
216 | 216 | exit; |
217 | 217 | } |
218 | 218 | $finalDestParams = "invitation=SUCCESS"; |
219 | 219 | if (count($status) < count($totalSegments)) { // only a subset of mails was sent, update status |
220 | 220 | $finalDestParams = "invitation=PARTIAL"; |
221 | 221 | } |
222 | -$finalDestParams .= "&successcount=" . count($status); |
|
222 | +$finalDestParams .= "&successcount=".count($status); |
|
223 | 223 | if ($allEncrypted === TRUE) { |
224 | 224 | $finalDestParams .= "&transportsecurity=ENCRYPTED"; |
225 | 225 | } elseif ($allClear === TRUE) { |
@@ -228,4 +228,4 @@ discard block |
||
228 | 228 | $finalDestParams .= "&transportsecurity=PARTIAL"; |
229 | 229 | } |
230 | 230 | |
231 | -header("Location: $redirectDestination" . $finalDestParams); |
|
231 | +header("Location: $redirectDestination".$finalDestParams); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * ****************************************************************************** |
10 | 10 | */ |
11 | 11 | |
12 | -require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/config/_config.php"; |
|
12 | +require_once dirname(dirname(dirname(dirname(__FILE__))))."/config/_config.php"; |
|
13 | 13 | |
14 | 14 | $auth = new \web\lib\admin\Authentication(); |
15 | 15 | $auth->authenticate(); |
@@ -29,31 +29,31 @@ discard block |
||
29 | 29 | ?> |
30 | 30 | |
31 | 31 | <h1><?php $tablecaption = _("User Authentication Records"); echo $tablecaption; ?></h1> |
32 | -<p><?php echo _("Note that:");?></p> |
|
32 | +<p><?php echo _("Note that:"); ?></p> |
|
33 | 33 | <ul> |
34 | - <li><?php echo _("Authentication records are deleted after six months retention time");?></li> |
|
35 | - <li><?php echo _("Operator Domain is based on the RADIUS attribute 'Operator-Name' and not sent by all hotspots");?></li> |
|
36 | - <li><?php echo _("Different MAC addresses per credential may be due to MAC Address randomisation in recent operating systems");?></li> |
|
34 | + <li><?php echo _("Authentication records are deleted after six months retention time"); ?></li> |
|
35 | + <li><?php echo _("Operator Domain is based on the RADIUS attribute 'Operator-Name' and not sent by all hotspots"); ?></li> |
|
36 | + <li><?php echo _("Different MAC addresses per credential may be due to MAC Address randomisation in recent operating systems"); ?></li> |
|
37 | 37 | </ul> |
38 | 38 | <table class='authrecord'> |
39 | - <caption><?php echo $tablecaption;?></caption> |
|
39 | + <caption><?php echo $tablecaption; ?></caption> |
|
40 | 40 | <tr> |
41 | - <th scope="col"><strong><?php echo _("Timestamp");?></strong></th> |
|
42 | - <th scope="col"><strong><?php echo _("Credential");?></strong></th> |
|
43 | - <th scope="col"><strong><?php echo _("MAC Address");?></strong></th> |
|
44 | - <th scope="col"><strong><?php echo _("Result");?></strong></th> |
|
45 | - <th scope="col"><strong><?php echo _("Operator Domain");?></strong></th> |
|
41 | + <th scope="col"><strong><?php echo _("Timestamp"); ?></strong></th> |
|
42 | + <th scope="col"><strong><?php echo _("Credential"); ?></strong></th> |
|
43 | + <th scope="col"><strong><?php echo _("MAC Address"); ?></strong></th> |
|
44 | + <th scope="col"><strong><?php echo _("Result"); ?></strong></th> |
|
45 | + <th scope="col"><strong><?php echo _("Operator Domain"); ?></strong></th> |
|
46 | 46 | </tr> |
47 | 47 | <?php |
48 | 48 | $userAuthData = $profile->getUserAuthRecords($userInt); |
49 | 49 | foreach ($userAuthData as $oneRecord) { |
50 | - echo "<tr class='".($oneRecord['RESULT'] == "Access-Accept" ? "auth-success" : "auth-fail" )."'>" |
|
50 | + echo "<tr class='".($oneRecord['RESULT'] == "Access-Accept" ? "auth-success" : "auth-fail")."'>" |
|
51 | 51 | . "<td>".$oneRecord['TIMESTAMP']."</td>" |
52 | 52 | // $oneRecord['CN'] is a simple string, not an array, so disable Scrutinizer type check here |
53 | - . "<td>"./** @scrutinizer ignore-type */ substr_replace($oneRecord['CN'], "@…", strpos($oneRecord['CN'],"@"))."</td>" |
|
53 | + . "<td>"./** @scrutinizer ignore-type */ substr_replace($oneRecord['CN'], "@…", strpos($oneRecord['CN'], "@"))."</td>" |
|
54 | 54 | . "<td>".$oneRecord['MAC']."</td>" |
55 | 55 | . "<td>".($oneRecord['RESULT'] == "Access-Accept" ? _("Success") : _("Failure"))."</td>" |
56 | - . "<td>".substr($oneRecord['OPERATOR'] ?? "1(unknown)",1)."</td>" |
|
56 | + . "<td>".substr($oneRecord['OPERATOR'] ?? "1(unknown)", 1)."</td>" |
|
57 | 57 | . "</tr>"; |
58 | 58 | } |
59 | 59 | ?> |