I've just installed MAMP 3.4 on Yosemite but the Apache version inside is still 2.2. Is there a way to upgrade to Apache 2.4? Moreover I have installed through brew openssl 1.0.2 but MAMP Apache still starts with version OpenSSL/0.9.8zg. Why? I need this updates in order to meet new ATS iOS 9 requirements.
Using MAMP 3.4, how do I upgrade to Apache 2.4 and OpenSSL 1.0.2 to meet the ATS iOS 9 requirements?
2 Answers
As of July 21, 2016, there is a pre-release available of MAMP PRO 4 which includes OpenSSL 1.0.2, get the pre-release here:
-
-
You're welcome, I was in the same position as you so had to share this info :)– sMylesJul 21, 2016 at 17:49
For Mac OS X Yosemite
- Update openssl by brew to version >= 1.0.2d
- TLS 1.2 works only with apache 2.4 and actually MAMP is still given with apache 2.2. SOLUTION: download and install the latest version of AMPPS which runs a version of apache 2.4.x
create a self signed certificate with sha256 (as requested by iOS 9) with
openssl req -x509 -nodes -sha256 -days 365 -newkey rsa:2048 -keyout server.key -out server.crt
and save server.key
and server.crt
into /Applications/AMPPS/apache/conf
- Be sure that ssl modules are loaded inside httpd.conf file of AMPPS
- Edit file
/Applications/AMPPS/apache/conf/extra/httpd-ssl.conf
adding:
<VirtualHost localhost:443>
DocumentRoot "/Applications/AMPPS/www"
ServerName localhost
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCertificateFile "/Applications/AMPPS/apache/conf/server.crt"
SSLCertificateKeyFile "/Applications/AMPPS/apache/conf/server.key"
</VirtualHost>
inside
<IfModule ssl_module> ... </IfModule>
- iOS 9 simulator will annoy you each time you use NSURLSession raising an error 9813 saying that the certificate is not valid (because is self signed). So in each class where you are going to use NSURLSession do, for example, the following:
class LoginService: NSObject, NSURLSessionDelegate {
func URLSession(session: NSURLSession,
task: NSURLSessionTask,
didReceiveChallenge challenge: NSURLAuthenticationChallenge,
completionHandler: (NSURLSessionAuthChallengeDisposition, NSURLCredential?)
-> Void) {
completionHandler(NSURLSessionAuthChallengeDisposition.UseCredential, NSURLCredential(forTrust: challenge.protectionSpace.serverTrust!))
}
...
func requestLoginWithURL (requestURL: NSURL, completionHandler: (success: Bool?) -> Void) {
let configuration =
NSURLSessionConfiguration.defaultSessionConfiguration()
let urlRequest: NSURLRequest = NSURLRequest(URL: requestURL)
let session = NSURLSession(configuration: configuration, delegate: self, delegateQueue:NSOperationQueue.mainQueue())
/*
dataTaskWithRequest: creates an HTTP request for the specified URL request object, and calls a handler upon completion.
*/
let task = session.dataTaskWithRequest(urlRequest, completionHandler: { (data: NSData?, response: NSURLResponse?, error: NSError?) -> Void in
...
}
where the function URLSession
is a delegate which will prevent the app from crashing because of the self signed certificate and it will accept anyway.
vagrant up
to run all of them and boot the VM.