我正在努力解决这个问题。
我有两个cdn url abc.com指向elb1,def.com指向elb2。
两个elb (elb1和elb2)都指向负载均衡的相同ec2实例(ec2-A和ec2-B)
我可以登录到从abc.com导航的服务器,但无法登录到从def.com导航的服务器
def.com登录显示以下错误。
因为两个dns指向相同EC2。Web.config文件是相同的。
Message: CSRF attack detected.
Exception type: CMS.Protection.Web.UI.CsrfException
Stack trace:
at CMS.Protection.Web.UI.CsrfProtection.ThrowCsrfException(Exception innerException)
at CMS.Protection.Web.UI.CsrfProtection.OnPostMapRequestHandlerExecute(Object sender, EventArgs eventArgs)
at CMS.Base.AbstractHandler.CallEventHandler[TArgs](EventHandler`1 h, TArgs e)
at CMS.Base.AbstractHandler.Raise[TArgs](String partName, List`1 list, TArgs e, Boolean important)
at CMS.Base.SimpleHandler`2.RaiseExecute(TArgs e)
at CMS.Base.SimpleHandler`2.RaiseExecute(TArgs e)
at CMS.Base.SimpleHandler`2.StartEvent(TArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Message: Error occurred during a cryptographic operation.
Exception type: System.Security.Cryptography.CryptographicException
Stack trace:
at System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.HomogenizeErrors(Func`2 func, Byte[] input)
at CMS.Protection.Web.UI.CsrfProtection.OnPostMapRequestHandlerExecute(Object sender, EventArgs eventArgs)发布于 2017-02-16 19:22:57
Kentico中的CSRF保护使用MachineKey.Unprotect()方法验证令牌,因此所有服务器都必须使用相同的加密密钥。
有关如何实现此行为的更多详细信息,请参阅documentation。
发布于 2017-02-16 19:17:42
它已修复,我生成了机器密钥,并将相同的机器密钥放入两个ec2实例中。因此,问题就解决了。
发布于 2017-02-16 17:12:22
Neshi是正确的,你需要确保页面上的post请求来自相同的来源,否则你几乎满足了跨站点脚本的定义。
总体设置相当复杂,但是您仍然需要确保CSRF cookie中的安全令牌与加载时由CMSPage生成的令牌相同,我不确定这些重定向和加载传输是否能够做到这一点,以及是否能够保持足够的会话粘性。
https://stackoverflow.com/questions/42268865
复制相似问题