Showing posts with label openssl. Show all posts
Showing posts with label openssl. Show all posts

Friday, September 7, 2018

Node.js 10 HTTPS server is rejecting connections

Leave a Comment

I have simple Node.js HTTPS server

const https = require('https'); const fs = require('fs');  const config = {   key: fs.readFileSync('cert/server-key.pem'),   cert: fs.readFileSync('cert/server-crt.pem'),   ca: fs.readFileSync('cert/ca-crt.pem'), };  const server = https.createServer(config, ((req, res) => {   console.log('Got request');    res.end(); }));  server.listen(3333); 

I use curl on embedded system.

# curl -V curl 7.52.1 (arm-unknown-linux-gnu) libcurl/7.52.1 wolfSSL/3.9.8 Protocols: file ftp ftps http https smtp smtps telnet tftp  Features: IPv6 Largefile SSL UnixSockets   

When I use Node.js other then version 10 - everything works nicely.

HTTPS server running on Node.js v8.2.1

# curl -k -v "https://10.43.11.128:3333/" *   Trying 10.43.11.128... * TCP_NODELAY set * Connected to 10.43.11.128 (10.43.11.128) port 3333 (#0) * SSL connected > GET / HTTP/1.1 > Host: 10.43.11.128:3333 > User-Agent: curl/7.52.1 > Accept: */* 

HTTPS server running on Node.js v10.1.0

# curl -k -v "https://10.43.11.128:3333/" *   Trying 10.43.11.128... * TCP_NODELAY set * Connected to 10.43.11.128 (10.43.11.128) port 3333 (#0) * SSL_connect failed with error -313: revcd alert fatal error * Curl_http_done: called premature == 1 * Closing connection 0 curl: (35) SSL_connect failed with error -313: revcd alert fatal error 

What has changed in Node.js 10 with regards to HTTPS? I suspect I'll have to change SSL settings but I am to sure how.


UPDATES:

Trying to access HTTP (Node.js v10.1.0)

# curl --insecure -v "10.43.11.128:3333/" *   Trying 10.43.11.128... * TCP_NODELAY set * Connected to 10.43.11.128 (10.43.11.128) port 3333 (#0) > GET / HTTP/1.1 > Host: 10.43.11.128:3333 > User-Agent: curl/7.52.1 > Accept: */* >  * Curl_http_done: called premature == 0 * Empty reply from server * Connection #0 to host 10.43.11.128 left intact curl: (52) Empty reply from server 

Wireshark captured pcap file.

2 Answers

Answers 1

Validate which headers curl sends, you can use the -v argument for that.

curl -vIX "https://10.43.11.128:3333/"

also In node,

just console.log(req._headers) after req.end() and compare your header to further solve the problem.Also i request to try wireshark (http://www.wireshark.org/) for ssl connection testing.

As it's working by --insecure but you need to know the reason.

--insecure

  • (SSL) This option explicitly allows curl to perform "insecure" SSL connections and transfers. All SSL connections are attempted to be made secure by using the CA certificate bundle installed by default. This makes all connections considered "insecure" fail unless -k, --insecure is used.

Also can you please try this

const https = require("https"),   fs = require("fs");  const options = {   key: fs.readFileSync("/cert/server-key.pem"),   cert: fs.readFileSync("/cert/server-cert.pem") };  const app = express();  app.use((req, res) => {   res.writeHead(200);   res.end("hello world\n"); });  app.listen(8000);  https.createServer(options, app).listen(8080); 

Answers 2

Problem is that the client is not broadcasting support for a cipher suite or extension that the server requires.

Some common solutions to this problem may be: - If using ECC, the server requires the Supported Curves Extension to be enabled. Compile wolfSSL with "--enable-supported curves" to resolve. - wolfSSL has static key cipher suites disabled by default for security. Please see note at the top of the README for instructions on re-enabling static-key cipher suites if your server requires them.

Here is the Thread which discuses the error which you have received . Hope this fixes you issue

Read More

Thursday, May 10, 2018

CouchDB won't work over SSL

Leave a Comment

I am running the CouchDB Docker container, V.2.1.1. Everything is working at this point except for SSL. I am following the CouchDB documentation on SSL setup. The container has OpenSSL 1.0.1t.

As shown in the documentation, I am using a self-signed certificate. When I try to connect to the SSL page on port 6984:

Chrome tells me

"ERR_CONNECTION_CLOSED". 

curl gives me

curl -k https://localhost:6984

curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:6984 

In the server log, I get a whole lot of this.

hello terminated with reason: no function clause matching ssl_cipher:hash_algorithm 

A search on this last error turns up information indicating that the Erlang version has an issue. However, I believe the CouchDB container has an already patched version. I did try and upgrade with:

apt-get install Erlang 

This made no difference. Search results also point to the version of OpenSSL having a problem. I upgraded to OpenSSL 1.1.1 from source, Recreated the certificates, and still, the issue persists.

As requested, here is the output from a few more commands.

openssl s_client -connect localhost:6984

CONNECTED(00000005) 140736008328136:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-22.50.2/libressl/ssl/s23_lib.c:124: --- no peer certificate available --- No client certificate CA names sent --- SSL handshake has read 0 bytes and written 318 bytes --- New, (NONE), Cipher is (NONE) Secure Renegotiation IS NOT supported Compression: NONE Expansion: NONE No ALPN negotiated --- 

curl --version

curl 7.54.0 (x86_64-apple-darwin17.0) libcurl/7.54.0 LibreSSL/2.0.20 zlib/1.2.11 nghttp2/1.24.0 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy 

curl -k -v https://localhost:6984

* Rebuilt URL to: https://localhost:6984/ *   Trying ::1... * TCP_NODELAY set * Connected to localhost (::1) port 6984 (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH * successfully set certificate verify locations: *   CAfile: /etc/ssl/cert.pem   CApath: none * TLSv1.2 (OUT), TLS handshake, Client hello (1): * LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:6984 * stopped the pause stream! * Closing connection 0 curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:6984 

curl -k --ciphers DEFAULT https://localhost:6984

curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:6984 

curl -k --ciphers ECDHE-RSA-AES256-GCM-SHA384 https://localhost:6984

curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:6984 

The output from the following three commands is very similar. I will just show the differences. However, it seems that a handshake is now taking place with all of these commands.

$ openssl s_client -tls1 -connect localhost:6984

CONNECTED(00000005) SSL handshake has read 1762 bytes and written 400 bytes New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA Compression: NONE Expansion: NONE SSL-Session:     Protocol  : TLSv1     Cipher    : DHE-RSA-AES256-SHA     Session-ID: 18C5DF9DCA1B8AA0DBD33258BCD253053F8D1D91B524B0561A1C0FAB8CFB5146     Master-Key: FD0C57E4E8FB992C0323D43930C104D82B69C4200F42E03EDB51E38A47448D62FDCB6E813583E2177A339B74B4D0CC4A     Start Time: 1525593658     Timeout   : 7200 (sec) 

$ path/to/brew/version/of/openssl s_client -connect localhost:6984

CONNECTED(00000003) Peer signing digest: SHA512 Server Temp Key: DH, 1024 bits SSL handshake has read 1796 bytes and written 537 bytes New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA256 SSL-Session:     Protocol  : TLSv1.2     Cipher    : DHE-RSA-AES256-SHA256     Session-ID: A19D67CBE634843181859DB2C3C4D1A3416C9F7DAA85CF470D412FE723AD49B4     Master-Key: 61B711B9BEDB651868607527439D01B421780C7D584FCE68C4754A7A7F3563923409C03F4B68BB7914397B48A92FC756     Key-Arg   : None     PSK identity: None     PSK identity hint: None     SRP username: None     Start Time: 1525593604     Timeout   : 300 (sec) 

$ path/to/brew/version/of/openssl s_client -tls1 -connect localhost:6984

SSL handshake has read 1762 bytes and written 397 bytes New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA SSL-Session:     Protocol  : TLSv1     Cipher    : DHE-RSA-AES256-SHA     Session-ID: 6CC7FFE1C7CE258F105C7ADD5D8A9C0DFFB26A5A9555EB218EE48E519D361208     Master-Key: 2D6DFAC01544F6FF5F4138D877A4105485D5A2F77B58B4796822625E2E602455C38E3EEB2CBACE07FA03D207B07C715E     Start Time: 1525593717     Timeout   : 7200 (sec) 

$ curl -k --tlsv1 https://localhost:6984

curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:6984 

$ curl -k --tlsv1.0 https://localhost:6984

{"couchdb":"Welcome","version":"2.1.1","features":["scheduler"],"vendor":{"name":"The Apache Software Foundation"}} 

So I am guessing there is a problem with the built-in version of LibreSSL? The next question is what can be done about it?

2 Answers

Answers 1

If your SSL certificate is self-signed:


You didn't show your curl command, but I guess you are not using the -k option, but you should:

-k, --insecure               (TLS) By default, every SSL connection curl makes is verified to be secure. This option allows curl to proceed and operate even  for               server connections otherwise considered insecure. 

Answers 2

In order to dig deeper, can you post the output of the following commands?

$ openssl s_client -connect localhost:6984  $ curl --version  $ curl -k -v https://localhost:6984  $ curl -k --ciphers DEFAULT https://localhost:6984  $ curl -k --ciphers ECDHE-RSA-AES256-GCM-SHA384 https://localhost:6984 

By the way, I notice that your curl is using LibreSSL not OpenSSL as indicated in the error message you're getting:

curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:6984


When you try openssl:

$ openssl s_client -connect localhost:6984 

You are getting this error:

CONNECTED(00000005) 140736008328136:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-22.50.2/libressl/ssl/s23_lib.c:124:

Can you please report the output of this command:

$ openssl s_client -tls1 -connect localhost:6984 

Also, it might be inferred that the cause of the problem is your macOS default version of LibreSSL/OpenSSL. To fix the problem, try to install the brew version OpenSSL and run this command again, and please report the output:

$ path/to/brew/version/of/openssl s_client -connect localhost:6984 

Also please post the output of this too:

$ path/to/brew/version/of/openssl s_client -tls1 -connect localhost:6984 

Based on your reported outputs, please try the following command and see if it works:

$ curl -k --tlsv1 https://localhost:6984 
Read More

Tuesday, January 30, 2018

decryption of openssl packets with static certificates

Leave a Comment

I am working on a ethical hacking project to monitor all the encrypted packets through openssl. I do have both the public and private keys (cert files). My application code snippet for regular packet decryption is as follows:

 SSL_library_init();  ctx = InitCTX();  server = OpenConnection(hostname, atoi(portnum));  ssl = SSL_new(ctx);      /* create new SSL connection state */  SSL_set_fd(ssl, server);    /* attach the socket descriptor */  ShowCerts(ssl);        /* get any certs */  SSL_write(ssl,acClientRequest, strlen(acClientRequest));   /* encrypt & send message */  bytes = SSL_read(ssl, buf, sizeof(buf)); /* get reply & decrypt */  SSL_free(ssl);        /* release connection state */ 

SSL_read basically gets the certificate at the time of handshaking and utilizes it for decrypting the data. Is there any way to provide the same certificate offline for decryption of data.

Any help/pointers would be highly appreciable.

0 Answers

Read More

Saturday, January 27, 2018

Extra space in openssl CLI output for notAfter/enddate

Leave a Comment

I am getting extra space in enddate output of this command:

$ export IP=google.com;  nc -z -w 3 $IP 443 && (echo | openssl s_client - connect $IP:443 2>/dev/null | openssl x509 -noout -enddate) Connection to google.com port 443 [tcp/https] succeeded! notAfter=Apr  4 09:40:00 2018 GMT 

Note two spaces between Apr and 4 in notAfter= line.

That is the case for both versions I have on laptop and on Linux server:

$ openssl version LibreSSL 2.2.7 $ openssl version OpenSSL 1.0.1f 6 Jan 2014 

Is that bug? I will try to report in https://github.com/openssl/openssl/issues

Here we go:

https://github.com/openssl/openssl/issues/5107

https://github.com/libressl-portable/portable/issues/382

1 Answers

Answers 1

This is intentional behavior from ASN1_TIME_print(), to use a fixed number of characters for the day representation. If the day number is less than 10, it still takes up two columns, with the first one being filled as a space. This is friendly to automated tooling parsers even if it is a little jarring for the human eye. I don't think it's appropriate to change ASN1_TIME_print()'s behavior because it is used in more places than just this.

From https://github.com/kaduk

https://github.com/openssl/openssl/issues/5107#issuecomment-358746180

Read More

Tuesday, January 23, 2018

ruby open ssl api for encrypted key (without nodes option)

Leave a Comment

On a linux machine with openssl lib installed, when you perform “openssl pkcs12” with “-nodes” option then you get output with unencrypted private key but if you skip the –nodes option then output will have encrypted private key.

     e.g.              openssl pkcs12 -in test.pfx -out test.pem  

You should see private key encrypted like below

-----BEGIN ENCRYPTED PRIVATE KEY-----
MIIFDjBABgkqhkiGG7s=
-----END ENCRYPTED PRIVATE KEY-----

How do I achive the above using ruby's open ssl library?

This is how I am generating the private key with ruby:

    @private_key = OpenSSL::PKey::RSA.new 2048     @private_key.to_pem.to_s 

EDIT:

I guess my question how does this command encrypt the private key:

openssl pkcs12 -in test.pfx -out test.pem

whereas:

“openssl pkcs12 -nodes -in test.pfx -out test.pem"

does not. How do i get the same results using ruby?

1 Answers

Answers 1

There must be something more to this. Perhaps the question needs refined. From what I can tell, you want to print a private key in PEM format. I'm not a ruby programmer but I got this working in about 3 minutes by reading the on ruby-docs.org:

$ cat ssl.rb  require 'openssl' key = OpenSSL::PKey::RSA.new 2048 cipher = OpenSSL::Cipher.new 'AES-128-CBC' pass_phrase = 'my secure pass phrase goes here' key_secure = key.export cipher, pass_phrase puts key_secure 

Choose your cipher and your passphrase and voila, you have encrypted a key with a symmetric cipher:

$ ruby ssl.rb -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: AES-128-CBC,D8062F93C8854E593602D503E1FAC309  UsNQt/Bq7QBldOBU7NW6miCDuC+ODpeplaWQ9BvJW4Wg7j0AbKgMZAn7juegAbjG JVkpdDNzhs37UVWmqwg64yYP6KEBGg4zCog2a993UHRvFTQb6tyugKHc+uFeyY+D ... -----END RSA PRIVATE KEY----- 

Is there something more you're trying to do?

--

EDIT: The Asker has clarified that the question is about which encryption is used by openssl pkcs12 when not using the -nodes option.

The -nodes option turns off DES encryption. This page shows that the default encryption for private key creation is triple DES, but I don't see the detail there about which DES option. This is also referred to in the manual for man pkcs12. In any case, it's not yet clear to me if you need to know exactly which cipher is used by openssl or if your question is now answered.

You can list ruby's available ciphers like this:

puts OpenSSL::Cipher.cipher  

(as specified in the docs)

On my system, quite a few DES ciphers are available with varying parameters:

des des-cbc des-cfb des-cfb1 des-cfb8 des-ecb des-ede des-ede-cbc des-ede-cfb des-ede-ofb des-ede3 des-ede3-cbc des-ede3-cfb des-ede3-cfb1 des-ede3-cfb8 des-ede3-ofb des-ofb des3 desx desx-cbc 

I'm not sure if the PKCS12 spec says which DES cipher should be used or if openssl just has a default. Are you trying to figure out which DES cipher is used by OpenSSL?

I looked a bit further through the openssl wiki and I found references to DES in CBC mode, so I'm guessing that the cipher you are looking for is DES-EDE3-CBC.

Sorry, I guess it's still not completely clear exactly what question you're trying to answer. If what you're trying to do is to find out exactly how openssl is encoding the private key when you don't use -nodes you can see that by cating the file into openssl asn1parse. Maybe this helps: you can start with your rsa private key in plain text as you got it from your ruby program:

$ cat key.pem -----BEGIN RSA PRIVATE KEY----- MIIEpA.... -----END RSA PRIVATE KEY $ cat key.pem | openssl asn1parse     0:d=0  hl=4 l=1188 cons: SEQUENCE           4:d=1  hl=2 l=   1 prim: INTEGER           :00 7:d=1  hl=4 l= 257 prim: INTEGER       ... 

You'll see that this is encoded as an ASN1 SEQUENCE of long integers.

But if you put your key through a roundtrip of pkcs12:

$ openssl pkcs12 -inkey key.pem -out key.pfx -export -nocerts -nodes (choose a password) $ openssl pkcs12 -in key.pfx -out outkey.pem -nodes (enter password) 

You'll find your key now wrapped in a new structure, which you can cat to asn1parse:

cat keyout.pem | openssl asn1parse     0:d=0  hl=4 l=1214 cons: SEQUENCE               4:d=1  hl=2 l=   1 prim: INTEGER           :00     7:d=1  hl=2 l=  13 cons: SEQUENCE               9:d=2  hl=2 l=   9 prim: OBJECT            :rsaEncryption 

You now have an ASN1 rsaEncryption Object with a payload of a large octet string.

Is this what you were trying to learn about? How these values are encapsulated in ASN1?

Read More

Wednesday, January 10, 2018

Generating CSR from SecKey using OpenSSL

Leave a Comment

I have created a public/private key pair (Elliptic Curve) with SecKeyGeneratePair.

How can I use the SecKey instances to generate a CSR using OpenSSL in Swift?

1 Answers

Answers 1

As far as I can tell Apple's own Security framework does not have an API currently exposed f or generating CSR's. It is technically OpenSSL wrapped; so in case you do have OpenSSL ( I personally prefer LibreSSL, libtls makes life easy ).

As an alternative you can also use Commoncrypto, which my answer won't cover but there are many many examples out there

So lets go through the steps of finding out how to do this. I found that the easiest way to work with OpenSSL is to ignore the documentation completely and go straight to reading source.

To achieve what we need, we need to 'replicate' the following 2 commands:

openssl ecparam -out server.key -name prime256v1 -genkey

openssl req -new -key server.key -out server.csr

Important Note: Be sure to pick a secure curve. Use openssl ecparam -list_curves to get a list of supported curves by your version of openssl. Read more

Step 1 Generating the key

ecparam tells us we have to look in sslsource/apps/openssl/ecparam.c first.

The source gives us 3 steps: Set up BIO for writing, setting up group parameters and finally generating the key.

Step 2 Generating the CSR

Following the same principles but this time looking in req.c and some code in apps.c which contains some boilerplate code used in req.c

I used this method to create a crude but working proof of concept that runs in swift, you can check it out on github here: CertificateTool The code will run on any system you can compile the swift4+ toolchain on and some version of openSSL.

Edit:

Generating the EC Secret key:

// //  ECKey.swift //  CertificateToolPackageDescription // //  Created by Antwan van Houdt on 10/01/2018. // import CLibreSSL  public class ECKey {     internal let secretKey: OpaquePointer     private let group: OpaquePointer      public init() {         group = EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1)         EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE)         EC_GROUP_set_point_conversion_form(group, POINT_CONVERSION_COMPRESSED)          secretKey = EC_KEY_new()         EC_KEY_set_group(secretKey, group)         EC_KEY_generate_key(secretKey)     }      deinit {         EC_KEY_free(secretKey)         EC_GROUP_free(group)     } } 

Creating the signing request:

// //  CertificateRequest.swift //  CertificateToolPackageDescription // //  Created by Antwan van Houdt on 10/01/2018. // import CLibreSSL  public enum NIDType: String {     case email    = "emailAddress"     case hostName = "CN"     case organizationalUnit = "OU"     case organization      = "O"     case city        = "L"     case state       = "ST"     case countryCode = "C" }  public class CertificateSigningRequest {     private let request: UnsafeMutablePointer<X509_REQ>     private let key:     ECKey     private let name:    UnsafeMutablePointer<X509_NAME>      public init(key: ECKey, email: String, hostName: String, organizationalUnit: String, organization: String, countryCode: String, state: String, city: String) {         request = X509_REQ_new()         self.key = key          name = X509_NAME_new()         X509_REQ_set_version(request, 2)          self.add(name: email, type: .email)         self.add(name: hostName, type: .hostName)         self.add(name: organizationalUnit, type: .organizationalUnit)         self.add(name: organization, type: .organization)         self.add(name: countryCode, type: .countryCode)         self.add(name: city, type: .city)         self.add(name: state, type: .state)          X509_REQ_set_subject_name(request, name)          self.setPublicKey()     }      deinit {         X509_REQ_free(request)         X509_NAME_free(name)     }      private func add(name: String, type: NIDType) {         var buff = Array(name.utf8)         X509_NAME_add_entry_by_NID(self.name, OBJ_txt2nid(type.rawValue), MBSTRING_UTF8, &buff, Int32(buff.count), 0, 0)     }      private func setPublicKey() {         let certKey = EVP_PKEY_new()         EVP_PKEY_set1_EC_KEY(certKey, key.secretKey)          X509_REQ_set_pubkey(request, certKey)         X509_REQ_sign(request, certKey, EVP_sha256())          EVP_PKEY_free(certKey)     } } 

Note This code does not contain any BIO related functions ( yet ) to write out the PEM data to a file or to a data buffer, but they are really easy to add.

Disclaimer: I am not a professional cryptographer nor do I know all the ins and outs of the OpenSSL API. I cannot guarantee that the code I provided is a 100% correct implementation. Always be wary of code, especially crypto code, down

Read More

Saturday, December 23, 2017

Accessing Gmail (or a secure website) without getting a PKIX certification path error

Leave a Comment

Sending an e-mail via gmail resulted in getting a PKIX certification path error. The same applied to sending an e-mail from Tomcat.

After solving the issue, I hope you find this post useful. This post provides you with a step by step diagnosis for these kinds of errors.

Step 1: I tried to solve the problem using this post and another post, but that did not help me. In most cases this will be sufficient. You can use the keytool to list the certificates via 'keytool -list -keystore "%JAVA_HOME%/jre/lib/security/cacerts"'

I added the certificate by clicking the lock-icon of the gmail URL and exporting/importing the certificate to the cacert file of my used JDK version. I could see with keytool -list that the certificate was added. This process is described well in the (linked) posts.

Step 2A: Was I using the right truststore? I added the JVM arguments to direct the certificate search, like -Djavax.net.ssl.trustStore="..../jre/lib/security/cacerts" -Djavax.net.ssl.trustStorePassword="changeit".

Step 2B: When I change the value of the cacerts file to cacertsXYZ I get the error. So, this proofed that the 'cacert' was used.

Caused by: javax.mail.MessagingException: Can't send command to SMTP host; nested exception is: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

Step 2C: Was this also the case for my Tomcat webserver? I verified that in the cacerts of my JRE_HOME that the certificate was there. In Tomcat my JRE_HOME is "C:\Program Files\Java\jdk1.8.0_144\jre". My JAVA_HOME = C:\Program Files\Java\jdk1.8.0_144.

Step 3: I tried with publicly available 'SSLPoke' Java class to see whether I could connect with Google and or smtp.gmail.com. The results are in the listing: I could connect with SSL to google.com AND mail.google.com via port 443.

try {             SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();             // **Fail** TLS - SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket("smtp.gmail.com", 587);             // **Fail** SSL - SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket("smtp.gmail.com", 465);             // **OK**             SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket("google.com", 443);             // OK             SSLSocket sslsocket2 = (SSLSocket) sslsocketfactory.createSocket("mail.google.com", 443);              InputStream in = sslsocket.getInputStream();             OutputStream out = sslsocket.getOutputStream();             out.write(1); // write test byte to get reaction.             while (in.available() > 0) {                 System.out.print(in.read());             }             System.out.println("Successfully connected");         } catch (Exception exception) {             exception.printStackTrace();         } 

Step 4: The trusted store could be corrupt? I installed a newer version of the JDK1.8 being v152. I restarted the application without any success. Had this to do with the difference between JDK and JRE? Only the JRE has a lib\security\cacerts file. I tried both the SSL (465) and TLS (587) ports. Nope.

Step 5: Running openssl (with s_client -connect smtp.gmail.com:587 -starttls smtp) showed that my virus scanner (Avast) was prohibiting the sending of secure mail. So, for a moment I disabled this email-shield. That gave the following error:

java.lang.RuntimeException: javax.mail.AuthenticationFailedException

Step 6: After releasing the virusscanner web shield, using the openssl gave the following error: CN = Google Internet Authority G3 verify error:num=20:unable to get local issuer certificate.

OpenSSL> s_client -connect smtp.gmail.com:587 -starttls smtp CONNECTED(00000280) depth=1 C = US, O = Google Trust Services, CN = Google Internet Authority G3 verify error:num=20:unable to get local issuer certificate ....

Allowing the 'gmail account to be accessable from weakly authenticated apps', a setting in your google account, that finally yielded in correctly sending the e-mail. This is the link to the security settings of your Google account.

Step 7: Sending e-mail from another server may be a problem. Authentication errors are (still) the result. To overcome these errors, you can do:

Notice: The mkyong example is the base of my simple test application.

1 Answers

Answers 1

Finally I found the answer.

1 - Of course the google/gmail certifcates were ok ;-) Step 1 was performing these kinds of checks. Trying to add the certificate CA by hand, etc. See above.

2 - Step 2 was checking whether the known 'SSLPoke' Java class Java class could get contact with the secure website.

3 - After checking all above checks, executing 'openssl' showed that my virus scanner email-shield blocked the traffic. Stopping this defence for some time was step 3.

4 - Then I got the 'not authenticated' error from Gmail. Allowing the 'gmail account accessable from weakly authenticated apps', that finally gave a correctly sent e-mail. This is an Google account security setting

Read More

Thursday, August 24, 2017

Usage difference between SSL_add0_chain_cert and SSL_add1_chain_cert?

Leave a Comment

In OpenSSL documentation it says:

All these functions are implemented as macros. Those containing a 1 increment the reference count of the supplied certificate or chain so it must be freed at some point after the operation. Those containing a 0 do not increment reference counts and the supplied certificate or chain MUST NOT be freed after the operation.

But when I tried to look at examples of cases about which one should be used where I'm confused.

First OpenSSL:

It uses SSL_add0_chain_cert itself in the SSL_CTX_use_certificate_chain_file function of ssl_rsa.c. Here is the source:

static int use_certificate_chain_file(SSL_CTX *ctx, SSL *ssl, const char *file) {     if (ctx)         ret = SSL_CTX_use_certificate(ctx, x);     else         ret = SSL_use_certificate(ssl, x);     ......     while ((ca = PEM_read_bio_X509(in, NULL, passwd_callback,                                    passwd_callback_userdata))            != NULL) {         if (ctx)             r = SSL_CTX_add0_chain_cert(ctx, ca);         else             r = SSL_add0_chain_cert(ssl, ca);     ...... } 

Second usage I see is OpenResty Lua:

It uses SSL_add0_chain_cert in one way of setting certificate (ngx_http_lua_ffi_ssl_set_der_certificate), see here:

int ngx_http_lua_ffi_ssl_set_der_certificate(ngx_http_request_t *r, const char *data, size_t len, char **err) {     ......     if (SSL_use_certificate(ssl_conn, x509) == 0) {         *err = "SSL_use_certificate() failed";         goto failed;     }     ......     while (!BIO_eof(bio)) {          x509 = d2i_X509_bio(bio, NULL);         if (x509 == NULL) {             *err = "d2i_X509_bio() failed";             goto failed;         }          if (SSL_add0_chain_cert(ssl_conn, x509) == 0) {             *err = "SSL_add0_chain_cert() failed";             goto failed;         }     }      BIO_free(bio);      *err = NULL;     return NGX_OK; failed:     ....... } 

Yet uses SSL_add1_chain_cert in another way (ngx_http_lua_ffi_set_cert), see here:

int ngx_http_lua_ffi_set_cert(ngx_http_request_t *r,     void *cdata, char **err) {     ......     if (SSL_use_certificate(ssl_conn, x509) == 0) {         *err = "SSL_use_certificate() failed";         goto failed;     }      x509 = NULL;      /* read rest of the chain */      for (i = 1; i < sk_X509_num(chain); i++) {          x509 = sk_X509_value(chain, i);         if (x509 == NULL) {             *err = "sk_X509_value() failed";             goto failed;         }          if (SSL_add1_chain_cert(ssl_conn, x509) == 0) {             *err = "SSL_add1_chain_cert() failed";             goto failed;         }     }      *err = NULL;     return NGX_OK; /* No free of x509 here */  failed: ...... } 

Yet I don't see a clear difference of what changes when calling these two in Lua, and it doesn't seem like the cert X509, when set successfully, gets freed in either case. According to my understanding of the OpenSSL doc, I should expect X509_free(x509) gets called somewhere after SSL_add1_chain_cert called on that x509. Is that the correct understanding?

Last, the Openssl implementation of ssl_cert_add1_chain_cert (what boils down from SSL_add1_chain_cert macro) does indeed show it's just a wrapper of ssl_cert_add0_chain_cert with reference count incremented on the cert, but how should that be reflected in the calling process?

int ssl_cert_add1_chain_cert(SSL *s, SSL_CTX *ctx, X509 *x) {     if (!ssl_cert_add0_chain_cert(s, ctx, x))         return 0;     X509_up_ref(x);     return 1; } 

Now Nginx only deals with another function SSL_CTX_add_extra_chain_cert which leaves the burden of such choice behind, as it does not deal with switching cert per SSL connection basis. In my case I need to patch Nginx with this capability, switching cert per connection (but without using Lua).

So I'm not sure which one I should be using, SSL_add0_chain_cert or SSL_add1_chain_cert? And what's the freeing practice here?

0 Answers

Read More

Saturday, May 20, 2017

Subject Alternative Name Missing & ERR_SSL_VERSION_OR_CIPHER_MISMATCH

Leave a Comment

I followed this answer to make https://localhost:3000/ work in Chrome & Mac. Today, it suddenly does not work anymore.

https://localhost:3000 gives Not Secure:

Subject Alternative Name Missing The certificate for this site does not contain a Subject Alternative Name extension containing a domain name or IP address. 

I re-trusted this certificate by following the previous steps, it did not help. Then, I saw this answer, I need to remake ssl keys.

I make v3.ext:

authorityKeyIdentifier=keyid,issuer basicConstraints=CA:FALSE keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment subjectAltName = @alt_names  [alt_names] DNS.1 = localhost 

Then,

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -sha256 -extfile v3.ext 

However, it returns

unknown option -extfile req [options] <infile >outfile where options  are  -inform arg    input format - DER or PEM  -outform arg   output format - DER or PEM  ... ... 

Does anyone know what's wrong with my openssl command?

Otherwise, does anyone know how to fix this Subject Alternative Name Missing or NET::ERR_CERT_COMMON_NAME_INVALID error?

enter image description here

Edit 1: I tried to follow this answer and here is my example-com.conf:

[ req ] default_bits        = 2048 default_keyfile     = server-key.pem distinguished_name  = subject req_extensions      = req_ext x509_extensions     = x509_ext string_mask         = utf8only  # The Subject DN can be formed using X501 or RFC 4514 (see RFC 4519 for a description). #   Its sort of a mashup. For example, RFC 4514 does not provide emailAddress. [ subject ] countryName         = Country Name (2 letter code) countryName_default     = US  stateOrProvinceName     = State or Province Name (full name) stateOrProvinceName_default = NY  localityName            = Locality Name (eg, city) localityName_default        = New York  organizationName         = Organization Name (eg, company) organizationName_default    = Example, LLC  # Use a friendly name here because its presented to the user. The server's DNS #   names are placed in Subject Alternate Names. Plus, DNS names here is deprecated #   by both IETF and CA/Browser Forums. If you place a DNS name here, then you #   must include the DNS name in the SAN too (otherwise, Chrome and others that #   strictly follow the CA/Browser Baseline Requirements will fail). commonName          = Common Name (e.g. server FQDN or YOUR name) commonName_default      = Example Company  emailAddress            = Email Address emailAddress_default        = test@example.com  # Section x509_ext is used when generating a self-signed certificate. I.e., openssl req -x509 ... [ x509_ext ]  subjectKeyIdentifier        = hash authorityKeyIdentifier  = keyid,issuer  # You only need digitalSignature below. *If* you don't allow #   RSA Key transport (i.e., you use ephemeral cipher suites), then #   omit keyEncipherment because that's key transport. basicConstraints        = CA:FALSE keyUsage            = digitalSignature, keyEncipherment subjectAltName          = @alternate_names nsComment           = "OpenSSL Generated Certificate"  # RFC 5280, Section 4.2.1.12 makes EKU optional #   CA/Browser Baseline Requirements, Appendix (B)(3)(G) makes me confused #   In either case, you probably only need serverAuth. # extendedKeyUsage  = serverAuth, clientAuth  # Section req_ext is used when generating a certificate signing request. I.e., openssl req ... [ req_ext ]  subjectKeyIdentifier        = hash  basicConstraints        = CA:FALSE keyUsage            = digitalSignature, keyEncipherment subjectAltName          = @alternate_names nsComment           = "OpenSSL Generated Certificate"  # RFC 5280, Section 4.2.1.12 makes EKU optional #   CA/Browser Baseline Requirements, Appendix (B)(3)(G) makes me confused #   In either case, you probably only need serverAuth. # extendedKeyUsage  = serverAuth, clientAuth  [ alternate_names ]  DNS.1       = localhost  # IPv4 localhost IP.1       = 127.0.0.1  # IPv6 localhost IP.2     = ::1 

Then, I did

openssl req -config example-com.conf -new -x509 -sha256 -newkey rsa:2048 -nodes -keyout example-com.key.pem -days 365 -out example-com.cert.pem 

Reopen https://localhost:3000 in Chrome gives me

localhost uses an unsupported protocol. ERR_SSL_VERSION_OR_CIPHER_MISMATCH 

Could anyone help?

1 Answers

Answers 1

I suggest the following solution: create self-signed CA certificate and the web server certificate signed by this CA. When you install this small chain to your web server it will work with Chrome.

Create configuration file for your CA MyCompanyCA.cnf with contents (you can change it to your needs):

[ req ] distinguished_name  = req_distinguished_name x509_extensions     = root_ca  [ req_distinguished_name ] countryName             = Country Name (2 letter code) countryName_min         = 2 countryName_max         = 2 stateOrProvinceName     = State or Province Name (full name) localityName            = Locality Name (eg, city) 0.organizationName      = Organization Name (eg, company) organizationalUnitName  = Organizational Unit Name (eg, section) commonName              = Common Name (eg, fully qualified host name) commonName_max          = 64 emailAddress            = Email Address emailAddress_max        = 64  [ root_ca ] basicConstraints            = critical, CA:true 

Create the extensions configuration file MyCompanyLocalhost.ext for your web server certificate:

subjectAltName = @alt_names extendedKeyUsage = serverAuth  [alt_names] DNS.1   = localhost DNS.2   = mypc.mycompany.com 

Then execute the following commands:

openssl req -x509 -newkey rsa:2048 -out MyCompanyCA.cer -outform PEM -keyout MyCompanyCA.pvk -days 10000 -verbose -config MyCompanyCA.cnf -nodes -sha256 -subj "/CN=MyCompany CA"  openssl req -newkey rsa:2048 -keyout MyCompanyLocalhost.pvk -out MyCompanyLocalhost.req -subj /CN=localhost -sha256 -nodes openssl x509 -req -CA MyCompanyCA.cer -CAkey MyCompanyCA.pvk -in MyCompanyLocalhost.req -out MyCompanyLocalhost.cer -days 10000 -extfile MyCompanyLocalhost.ext -sha256 -set_serial 0x1111 

As result you will get MyCompanyCA.cer, MyCompanyLocalhost.cer and MyCompanyLocalhost.pvk files that you can install to the web server.

How to check that it works with Chrome before installing certificates to the web server. Execute the following command on your local PC to run web server simulator:

openssl s_server -accept 15000 -cert MyCompanyLocalhost.cer -key MyCompanyLocalhost.pvk -CAfile MyCompanyCA.cer -WWW 

Then you can access this page at https://localhost:15000/ You will see an error that MyCompanyLocalhost.cer is not trusted, if you want to eliminate this error also - then install MyCompanyCA.cer to the certificate trusted list of your OS.

Read More

Tuesday, April 25, 2017

OpenSSL connection: alert internal error

Leave a Comment

I have 100 HTTPS services running on a single server using SNI. (Actually, I don't have access to them. It's an assignment. All I know are their domain names N.xxx.yy where N is in range from 00 to 99.) The goal of the assignment is to evaluate security of every single connection to each of these servers. So some of the servers contain expired certificates, certificates with wrong CN, etc.

My problem is that I cannot get past the handshake on some of the servers. I have written my own application in C++ using OpenSSL, but I've also tried it with openssl s_client. This is how I connect to the server:

openssl s_client -host N.xxx.yy -port 443 -verify 1 -servername N.xxx.yy -CAfile assignment-ca.pem 

And this is what I get:

139625941858168:error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:s3_pkt.c:1493:SSL alert number 80 139625941858168:error:140790E5:SSL routines:ssl23_write:ssl handshake failure:s23_lib.c:177: 

In Wireshark, I see that client sent ClientHello, server responded with ServerHello (choosing TLSv1.2 and ECDHE-RSA-AES256-GCM-SHA384) followed by Certificate and then it sent me Alert message containing Internal Error (80).

After trying different thing I have found out that if I run s_client with -tls1 or -tls1_1 I can successfully get past the handshake. -tls1_2 does not work. What is even stranger is that connection through Chrome/Firefox/any other browser succeeds even if TLSv1.2 is negotiated. From what I see, Chrome is sending a different cipher list than me or s_client but even after modifying the cipher list to match the one in Chrome (and making sure that server chooses ECDHE-RSA-AES128-GCM-SHA256), it does not work either. Chrome is sending these TLS extensions, which I don't but most of them seem empty:

Unknown 47802 renegotiation_info Extended Master Secret signed_certificate_timestamp status_request Application Layer Protocol Negotiation channel_id Unknown 6682 

Can anybody explain me what is happening here? Unfortunately, I have no way to debug it on the server side so this is all I know.

UPDATE:

After playing around with forged ClientHello messages I managed to track it down to signature_algorithms extension. My app and s_client provide SHA384 + {RSA,DSA,ECDSA} but if I remove these and keep just SHA256 + {RSA,DSA,ECDSA}, as Chrome does, it works and I receive Server Key Exchange message successfully. Could it be that server somehow does not support it, but instead of providing meaningful error message, it just ends unexpectedly and gives me this internal error?

UPDATE 2:

I found answer to why it works with TLS versions prior to 1.2 in RFC5246. Question from the previous UPDATE still holds.

Note: this extension is not meaningful for TLS versions prior to 1.2.    Clients MUST NOT offer it if they are offering prior versions.    However, even if clients do offer it, the rules specified in [TLSEXT]    require servers to ignore extensions they do not understand. 

1 Answers

Answers 1

Since you wrote that -tls1_2 does not work I assume either you and/or the server uses an older openssl library. The current version while writing this is 1.1.0e

There were quite some fixes since 0.9.8, which could often be seen on older systems.

For Version 1.0.1 there was this fix, which sounds like your problem:

 `Some servers which support TLS 1.0 can choke if we initially indicate  support for TLS 1.2 and later renegotiate using TLS 1.0 in the RSA  encrypted premaster secret. As a workaround use the maximum permitted  client version in client hello, this should keep such servers happy  and still work with previous versions of OpenSSL.` 

Maybe also notable:

Don't allow TLS 1.2 SHA-256 ciphersuites in TLS 1.0, 1.1 connections.

So I would suggest to update your openssl-Version and in case of the servers out of your control I would stick to the settings you already found.

Read More

Thursday, January 26, 2017

Decrypt OpenSSL binary through NGINX as it is received ( on the fly )

Leave a Comment

I have a small embedded Linux device that has 128 MB flash storage available to work with as a scratchpad. This device runs an NGINX web server. In order to do a firmware update - the system receives an encrypted binary file as an HTTPS POST through NGINX to the scratchpad. The system then decrypts the file and flashes a different QSPI flash device in order to complete the update.

The firmware binary is encrypted outside the device like this:

openssl smime -encrypt -binary -aes-256-cbc -in plainfile.zip -out encrypted.zip.enc -outform DER yourSslCertificate.pem 

The firmware binary is decrypted, after being received through NGINX, on the device like this:

openssl smime -decrypt -binary -in encrypted.zip.enc -inform DER -out decrypted.zip -inkey private.key -passin pass:your_password 

I'd really like to decrypt the binary as it is received ( on the fly ) through NGINX, so that it appears on the flash scratchpad in it's decrypted form.

I've been unable to find any existing NGINX modules on Google that would do this. How might I accomplish this? Thanks.

2 Answers

Answers 1

First of all, you need to understand one thing. While nginx will decrypt file - all other request will be blocked. That's why nginx does not support CGI, only FastCGI.

If it ok for you (for example, nginx used only for update purposes), you can use perl or lua extension: http://nginx.org/en/docs/http/ngx_http_perl_module.html, https://github.com/openresty/lua-nginx-module

Using this modules you can exec shell. For access uploaded file need to set client_body_in_file_only directive - https://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_in_file_only

Example for perl module (untested):

location /upload {   client_body_in_file_only clean;   perl 'sub {     my $r = shift;     if ($r->request_body_file) {        system("openssl smime -decrypt -binary -in ".$r->request_body_file." -inform DER -out /tmp/decrypted.zip -inkey private.key -passin pass:your_password");     }   }'; } 

But much better to use fastcgi. You can use light fastcgi wraper for it, for example, fcgiwrap https://www.nginx.com/resources/wiki/start/topics/examples/fcgiwrap/

Answers 2

There's a widely-known attack against non-event-based servers like Apache known as Slowloris, where the client initiates a number of HTTP requests without sending them in full (where each request is instead being sent in part for a prolonged interval, which is a very cheap operation, both to send and receive, for an event-based architecture like that of nginx, but at the same time is very expensive for some other servers).

As a proxy server, nginx protects its backends from such an attack. Indeed, protection may come at a cost in certain circumstances, and can be turned off with the …_request_buffering directives:

What you would do is disable the request buffering, and then pipe the incoming file directly to openssl as it is received.

Note that you can always use /dev/fd/0 in place of the filename to specify stdin (depending on the tool, using - in place of the filename may also be an option).

Read More

Tuesday, June 21, 2016

Self signed SSL does not work after upgrading from iojs to nodejs v4.4.4

Leave a Comment

I was using iojs and koa in my application and recently I decided to update iojs to nodejs v4.4.4. The update was very smooth and my application was running in no time. The problem is that I am using a self signed SSL certificate on my development machine, and after I updated to nodejs I receive the following message when I try to access the website:

This site can’t provide a secure connection

localhost uses an unsupported protocol.

ERR_SSL_VERSION_OR_CIPHER_MISMATCH

The client and server don't support a common SSL protocol version or cipher suite. This is likely to be caused when the server needs RC4, which is no longer considered secure.

I am using nvm so I tried switching to iojs and the website was working again.

After some reading I found out that I have to update the openssl to version 1.0.2g instead of the 1.0.1g that I used to create the .key and .crt files. So I updated openssl and generated new key and certificate files like this:

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

Sadly this did not resolve the issue.

This is the code that I use to setup the https on the server:

let sslOptions = {             key: fs.readFileSync('/etc/apache2/ssl/apache.key'),             cert: fs.readFileSync('/etc/apache2/ssl/apache.crt')                  };  let server = require('https').createServer(sslOptions, app.callback()) 

Am I doing something wrong? Why does it work with iojs and does not work with nodejs?

2 Answers

Answers 1

There will be a truststore (keystore) file, where all trusted certificates need to be registered. You will have to register this newly created certificate there. Client uses that truststore file to check whether a certificate can be trusted or not.

For more details you can take reference from below link :-

Creating Self Signed Certificates (openssl & keytool)

I hope it helps.

Answers 2

Judging by the error message there is nothing wrong with the self signed certificate. But the 'server' offering the ssl connection doesn't support a suitable combination of protocol version an cipher suite.

openssl s_client -connect localhost:443 

or more verbose

openssl s_client -connect localhost:443 -debug 

might tell you what's going wrong during the ssl handshake.

You can also find out what combinations are provided with a tool called sslscan

apt-get install sslscan sslscan localhost:443 sslscan localhost:443 | grep Accepted 

In the end you'll want to configure the ciphersuites your https server offers by providing more ssloptions.

See here https://certsimple.com/blog/a-plus-node-js-ssl

Read More

Friday, March 11, 2016

Unable to build a working FIPS capable OpenSSL on HP-UX

1 comment

I am building openssl-1.0.2f with openssl-fips-2.0.12 (I am going to talk about this configuration in the following lines, but at the end of the post I'll specify all the configurations that I tried), on HP-UX11.31(pa-risc2). Everything is good, but when I try using it (in FIPS mode), it doesn't work.

Note: Given the fact that cwd is set to the build folder (not the installation folder where RPATH points to), I need to instruct the linker where to search for libs (SHLIB_PATH):

[%__OPENSSL_MACHINE_PROMPT%]> OPENSSL_FIPS=1 SHLIB_PATH=./lib ./bin/openssl version -a

2063867464:error:2D06B071:FIPS routines:FIPS_check_incore_fingerprint:fingerprint does not match segment aliasing:fips.c:224:

Note: Instead of displaying any path, I'm replacing it by a meaningful placeholder (name starting with __OPENSSL) surrounded by % signs (the equivalent of Win env vars - don't want to create confusion if any possible UX env vars might be involved).

Here's the output of the "same" command without setting FIPS (OPENSSL_FIPS=1) mode:

[%__OPENSSL_MACHINE_PROMPT%]> SHLIB_PATH=./lib ./bin/openssl version -a

OpenSSL 1.0.2f-fips 28 Jan 2016 built on: Fri Feb 26 09:53:34 2016 platform: hpux-parisc2-gcc options: bn(64,64) rc4(ptr,char) des(ptr,risc1,16,long) blowfish(idx) compiler: gcc -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -DDSO_DL -fPIC -D_REENTRANT -march=2.0 -O3 -DB_ENDIAN -D_REENTRANT -I%__OPENSSL_BUILD_PATH%/include OPENSSLDIR: "%__OPENSSL_PREFIX_DIR%"

This occurs on all the machines I've tried running it (including the very machine I've built it on):

[%__OPENSSL_BUILD_MACHINE_PROMPT%]> uname -a

HP-UX hpux1131 B.11.31 U 9000/800 629887774 unlimited-user license

gcc version (native linker (ld_pa) used):

[%__OPENSSL_BUILD_MACHINE_PROMPT%]> gcc -v

Using built-in specs. Target: hppa2.0w-hp-hpux11.31 Configured with: ../gcc-4.2.4/configure --disable-shared --with-gnu-as --with-as=%__GCC_PREFIX_PATH%/bin/as --with-ld=/bin/ld --disable-nls --enable-threads=posix --prefix=%__GCC_PREFIX_PATH% --with-local-prefix=%__GCC_PREFIX_PATH% Thread model: posix gcc version 4.2.4

  • Here's the openssl-fips-2.1.12 configurator's output:

./config no-asm

Operating system: 9000/800-hp-hpux1x Auto Configuring fipsonly Auto Configuring fipsonly Configuring for hpux-parisc2-gcc Auto Configuring fipsonly Configuring for hpux-parisc2-gcc no-asm [option] OPENSSL_NO_ASM no-bf [option] OPENSSL_NO_BF (skip dir) no-camellia [option] OPENSSL_NO_CAMELLIA (skip dir) no-cast [option] OPENSSL_NO_CAST (skip dir) no-ec_nistp_64_gcc_128 [default] OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir) no-gmp [default] OPENSSL_NO_GMP (skip dir) no-idea [option] OPENSSL_NO_IDEA (skip dir) no-jpake [experimental] OPENSSL_NO_JPAKE (skip dir) no-krb5 [krb5-flavor not specified] OPENSSL_NO_KRB5 no-md2 [option] OPENSSL_NO_MD2 (skip dir) no-md5 [option] OPENSSL_NO_MD5 (skip dir) no-mdc2 [option] OPENSSL_NO_MDC2 (skip dir) no-rc2 [option] OPENSSL_NO_RC2 (skip dir) no-rc4 [option] OPENSSL_NO_RC4 (skip dir) no-rc5 [option] OPENSSL_NO_RC5 (skip dir) no-rfc3779 [default] OPENSSL_NO_RFC3779 (skip dir) no-ripemd [option] OPENSSL_NO_RIPEMD (skip dir) no-seed [option] OPENSSL_NO_SEED (skip dir) no-srp [forced] OPENSSL_NO_SRP (skip dir) no-ssl2 [forced] OPENSSL_NO_SSL2 (skip dir) no-ssl3 [forced] OPENSSL_NO_SSL3 (skip dir) no-store [experimental] OPENSSL_NO_STORE (skip dir) no-tls1 [forced] OPENSSL_NO_TLS1 (skip dir) no-tlsext [forced] OPENSSL_NO_TLSEXT (skip dir) no-zlib [default] no-zlib-dynamic [default]

  • And here's openssl-1.0.2f's:

./config fips shared --prefix=%__OPENSSL_PREFIX_DIR% no-rc5 no-mdc2 no-idea -fPIC no-asm --openssldir=%__OPENSSL_PREFIX_DIR%/openssl

Operating system: 9000/800-hp-hpux1x Configuring for hpux-parisc2-gcc Configuring for hpux-parisc2-gcc no-asm [option] OPENSSL_NO_ASM no-ec_nistp_64_gcc_128 [default] OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir) no-gmp [default] OPENSSL_NO_GMP (skip dir) no-idea [option] OPENSSL_NO_IDEA (skip dir) no-jpake [experimental] OPENSSL_NO_JPAKE (skip dir) no-krb5 [krb5-flavor not specified] OPENSSL_NO_KRB5 no-libunbound [experimental] OPENSSL_NO_LIBUNBOUND (skip dir) no-md2 [default] OPENSSL_NO_MD2 (skip dir) no-mdc2 [option] OPENSSL_NO_MDC2 (skip dir) no-rc5 [option] OPENSSL_NO_RC5 (skip dir) no-rfc3779 [default] OPENSSL_NO_RFC3779 (skip dir) no-rsax [forced] OPENSSL_NO_RSAX (skip dir) no-sctp [default] OPENSSL_NO_SCTP (skip dir) no-ssl-trace [default] OPENSSL_NO_SSL_TRACE (skip dir) no-store [experimental] OPENSSL_NO_STORE (skip dir) no-unit-test [default] OPENSSL_NO_UNIT_TEST (skip dir) no-zlib [default] no-zlib-dynamic [default]

Important note: I've stated the problem that I have using openssl-1.0.2f + openssl-fips-2.0.12 on HP-UX11.31 om PA-RISC2. What else I've tried:

  • openssl-1.0.1X (where X = [e..p]) + openssl-fips-2.0.5
  • HP-UX11.31 or HP-UX11.11 on PA-RISC2
  • HP-UX11.11 on IA64
  • no-asm configure flag specified/unspecified

Note: During debug, I've also modified fips_premain.c (and others), and (shocking :) ), the fingerprint produced by fips_premain_dso (compiled with -DFINGERPRINT_PREMAIN_DSO_LOAD) and the one computed at runtime don't match! I've also dumped the memory zone (in original or hex format) that the fingerprint is being computed on, and (of course) it differs (but so for I can't tell why).

Given the fact that it works (or it is supposed to work) - even if not being tested on pa-risc, but only on IA64 -, and extensive Google search didn't reveal anything truly relevant, I am 99.99 sure that it is related to the machine(s) in my environment.

However, can anyone give me some pointers?

0 Answers

Read More