Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mrzcn/db0e2f7ed01d1fca367e69402cd5251d to your computer and use it in GitHub Desktop.
Save mrzcn/db0e2f7ed01d1fca367e69402cd5251d to your computer and use it in GitHub Desktop.
EXCHANGE 2016 OWA reCAPTCHA DOĞRULAMA EKLEME
Exchange sunucularınızın güvenliği için “Captcha Doğrulama” ile bruteforce ataklara karşı güvenliğinizi daha da sıkılaştırabilirsiniz.
İlk olarak google hizmeti olan captcha sayfasına giderek site (site) ve secret (gizli) keylerimizi alıyoruz.
https://www.google.com/recaptcha/about/
Captcha keylerimizi aldıktan sonra Exchange sunucusuna bağlanıyoruz ve aşağıdaki path’e gidiyoruz.
C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\owa\auth
*Yapacağımız değişikliklerden önce auth klasörünün yedeğini alalım.
Auth klasörü içinde “recaptcha.aspx” adında file oluturuyoruz ve içisine aşağıdaki içeriği kopyalıyoruz.
Kod satırında bulunan 6Le.. ile başlayan satıra google captcha sayfasından aldığınız Private Key’i yazıyorsunuz.
<% @ Page AspCompat=True Language = "VB" %>
<%
' Put your own private key in the next line
Dim strPrivateKey As String = "6Le....."
Dim strResponse = Request("response")
Dim objWinHTTP As Object
objWinHTTP = Server.CreateObject("WinHTTP.WinHTTPRequest.5.1")
objWinHTTP.Open("POST", "https://www.google.com/recaptcha/api/siteverify", False)
objWinHTTP.SetRequestHeader("Content-type", "application/x-www-form-urlencoded")
Dim strData As String = "secret=" & strPrivateKey & _
"&response=" & strResponse
objWinHTTP.Send(strData)
Dim strResponseText = objWinHTTP.ResponseText
Response.Write(strResponseText)
%>
İlgili değişiklikleri yaptıktan sonra dosyası kaydedip kapatıyoruz.
Daha sonra aynı auth klasörü içinde bulunan logon.aspx dosyasını edit diyerek açıyoruz ve aşağıdaki metni ctrl + f ile bulup bir alttaki satırda görüldüğü şekilde düzenliyoruz.
form action=”/owa/auth.owa” method=”POST” name=”logonForm”
form action=”” method=”POST” name=”logonForm”
Yine aynı dosya içerisinde <div><input id="passwordText" dizinini buluyoruz ve bu satırın altına aşağıdaki komut satırlanı ekliyoruz.
Aşağıdaki komut satırında sitekey’i google captcha’dan aldığımız sitekey’i yazıyoruz.
<tr>
<td>
<script type="text/javascript">
function myClkLgn()
{
var oReq = new XMLHttpRequest();
var sResponse = document.getElementById("g-recaptcha-response").value;
var sData = "response=" + sResponse;
oReq.open("GET", "/owa/auth/recaptcha.aspx?" + sData, false);
oReq.send(sData);
if (oReq.responseText.indexOf("true") != -1)
{
document.forms[0].action = "/owa/auth.owa";
clkLgn();
}
else
{
alert("reCAPTCHA is not valid");
}
}
</script>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<div class="g-recaptcha" data-sitekey="6Le....."></div>
</td>
</tr>
Son olarak ise yine logon.aspx içerisindeki komutu aşağıdaki şekilde değiştiriyoruz ve kaydet diyerek kapatıyoruz.
<div onclick=”clkLgn()” class=”signinbutton” role=”button” tabIndex=”0″ >
<div onclick=”myClkLgn()” class=”signinbutton” role=”button” tabIndex=”0″ >
Tüm ayarları tamamladıktan sonra herhangi bir restart işlemi yapmadan direkt owa girişiniz sırasında reCAPTCHA doğrulama ekranı gelecektir.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment