Skip to content

Commit b752e05

Browse files
Merge pull request #79 from fingerprintjs/inter-1895-akamai-fix-ssl
INTER-1895 Fix SSL Mismatch
2 parents 549b227 + 59ecf5e commit b752e05

2 files changed

Lines changed: 75 additions & 6 deletions

File tree

assets/rulesTemplate.json

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,24 @@
145145
"cacheKeyHostname": "ORIGIN_HOSTNAME",
146146
"compress": true,
147147
"enableTrueClientIp": false,
148-
"verificationMode": "THIRD_PARTY",
148+
"verificationMode": "CUSTOM",
149149
"originSni": true,
150150
"httpPort": 80,
151151
"httpsPort": 443,
152152
"hostname": "{{user.PMUSER_FPJS_PROCDN_ENDPOINT}}",
153153
"originCertificate": "",
154154
"ports": "",
155155
"ipVersion": "DUALSTACK",
156-
"minTlsVersion": "DYNAMIC"
156+
"minTlsVersion": "DYNAMIC",
157+
"customValidCnValues": [
158+
"{{Origin Hostname}}",
159+
"{{Forward Host Header}}"
160+
],
161+
"originCertsToHonor": "STANDARD_CERTIFICATE_AUTHORITIES",
162+
"standardCertificateAuthorities": [
163+
"akamai-permissive",
164+
"THIRD_PARTY_AMAZON"
165+
]
157166
}
158167
},
159168
{
@@ -339,7 +348,7 @@
339348
"cacheKeyHostname": "ORIGIN_HOSTNAME",
340349
"compress": true,
341350
"enableTrueClientIp": true,
342-
"verificationMode": "THIRD_PARTY",
351+
"verificationMode": "CUSTOM",
343352
"originSni": true,
344353
"httpPort": 80,
345354
"httpsPort": 443,
@@ -349,7 +358,16 @@
349358
"ipVersion": "DUALSTACK",
350359
"trueClientIpHeader": "FPJS-Proxy-Client-IP",
351360
"trueClientIpClientSetting": false,
352-
"minTlsVersion": "DYNAMIC"
361+
"minTlsVersion": "DYNAMIC",
362+
"customValidCnValues": [
363+
"{{Origin Hostname}}",
364+
"{{Forward Host Header}}"
365+
],
366+
"originCertsToHonor": "STANDARD_CERTIFICATE_AUTHORITIES",
367+
"standardCertificateAuthorities": [
368+
"akamai-permissive",
369+
"THIRD_PARTY_AMAZON"
370+
]
353371
}
354372
},
355373
{
@@ -415,15 +433,24 @@
415433
"cacheKeyHostname": "ORIGIN_HOSTNAME",
416434
"compress": true,
417435
"enableTrueClientIp": false,
418-
"verificationMode": "THIRD_PARTY",
436+
"verificationMode": "CUSTOM",
419437
"originSni": true,
420438
"httpPort": 80,
421439
"httpsPort": 443,
422440
"hostname": "{{user.PMUSER_FPJS_INGRESS_ENDPOINT}}",
423441
"originCertificate": "",
424442
"ports": "",
425443
"minTlsVersion": "DYNAMIC",
426-
"ipVersion": "DUALSTACK"
444+
"ipVersion": "DUALSTACK",
445+
"customValidCnValues": [
446+
"{{Origin Hostname}}",
447+
"{{Forward Host Header}}"
448+
],
449+
"originCertsToHonor": "STANDARD_CERTIFICATE_AUTHORITIES",
450+
"standardCertificateAuthorities": [
451+
"akamai-permissive",
452+
"THIRD_PARTY_AMAZON"
453+
]
427454
}
428455
},
429456
{

scripts/deployRules.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,47 @@ const createNewVersion = async (propertyId: string) => {
3232
return getLatestVersion(propertyId)
3333
}
3434

35+
const patchDefaultRuleOrigin = async (propertyId: string, version: string) =>
36+
akamaiRequest({
37+
path: `/papi/v1/properties/${propertyId}/versions/${version}/rules?contractId=${process.env.AK_CONTRACT_ID}&groupId=${process.env.AK_GROUP_ID}`,
38+
method: 'PATCH',
39+
headers: {
40+
'Content-Type': 'application/json-patch+json',
41+
},
42+
body: JSON.stringify([
43+
{
44+
op: 'add',
45+
path: '/rules/behaviors/0/options/customValidCnValues',
46+
value: [
47+
"{{Forward Host Header}}",
48+
"{{Origin Hostname}}"
49+
]
50+
},
51+
{
52+
op: 'replace',
53+
path: '/rules/behaviors/0/options/verificationMode',
54+
value: "CUSTOM"
55+
},
56+
{
57+
op: 'add',
58+
path: '/rules/behaviors/0/options/originCertsToHonor',
59+
value: "STANDARD_CERTIFICATE_AUTHORITIES"
60+
},
61+
{
62+
op: 'add',
63+
path: '/rules/behaviors/0/options/standardCertificateAuthorities',
64+
value: [
65+
"THIRD_PARTY_AMAZON",
66+
"akamai-permissive"
67+
]
68+
},
69+
{
70+
op: 'remove',
71+
path: '/rules/behaviors/1',
72+
}
73+
])
74+
})
75+
3576
const patchOriginHostname = async (propertyId: string, version: string) =>
3677
akamaiRequest({
3778
path: `/papi/v1/properties/${propertyId}/versions/${version}/rules?contractId=${process.env.AK_CONTRACT_ID}&groupId=${process.env.AK_GROUP_ID}`,
@@ -130,6 +171,7 @@ import('../dist/patch-body/body.json').then((module) => {
130171
} catch (_) {
131172
// Ignore error if fingerprint rules not exists
132173
}
174+
await patchDefaultRuleOrigin(propertyId, propertyVersion)
133175
await patchAddFingerprintRules(propertyId, propertyVersion, JSON.stringify(patchReqBody))
134176
await activateVersion(propertyId, propertyVersion)
135177
} catch (e: any) {

0 commit comments

Comments
 (0)