hnryjms / SplunkHealth

Share iOS HealthKit Data with Splunk
MIT License
1 stars 1 forks source link

Add TLS/SSL Socket Connection (TCP) #1

Open hnryjms opened 9 years ago

hnryjms commented 9 years ago

The Splunk app should automatically run a Python script that hosts a TCP socket server with TLS/SSL encryption for streaming data back and forth between the mobile app and the Splunk system.

The iOS app should connect to this server and be able to send sample data back and forth with the server.

Hardcoded values are fine for now, until an interface for specifying a Splunk server URL is implemented.

hnryjms commented 9 years ago

Note: The public/private keys stored by Splunk ($SPLUNK_HOME/etc/auth/server.pem) are encrypted with a passphrase (which is hard-coded to the phrase password). Only Python 2.7.9 and later are able to decode the key pragmatically, but Splunk comes embedded with Python 2.7.6 which cannot decode the key.

I'm currently investigating what it would look like for Python to call the openssl process using something like pexpext/pexpect and push in the passphrase when asked, and then saving the decrypted key for use by our Python script.

hnryjms commented 9 years ago

Note: The socket server generates it's own server.pem file rather than trying to use the Splunk one. This also gives users the control of a custom certificate after they install the app. We automatically generate this file if doesn't exist, based on the $SPLUNK_HOME/etc/auth/server.pem chain, and signed with the $SPLUNK_HOME/etc/auth/ca.pem file if available. see commit 748df14.

Testing tcp_server.py

You can test this using openssl and the s_client module.

$ openssl s_client -connect 127.0.0.1:8087