I want to use the PI for a commercial data logging device that reports the data back to a cloud based server via the internet. There will potentially be thousands of PI's that are physically installed at unsecure sites (like people's homes.)

I will secure all ports on the PI except SSH, and connect to it using SSH-Key authentication only. The PI itself will then use SSH-Key authentication to connect to the server to upload it's data.

As people have physical access to the device, they could remove the SD card from the PI and look at the SSH key for the server, and the server ip address etc.

How can I stop someone from getting the keys to my cloud based server from studying the SD card contents?

  • 3
    You can't. Someone who knows what they are doing will take a few minutes however well you think you have obfuscated the code.
    – joan
    Jul 18, 2015 at 13:54
  • Since you can't prevent someone from breaking a unit open and yanking out the uSD card for inspection, you should be looking at encrypting any part of the filesystem that contains sensitive bits. The tricky part will be protecting the decryption key itself.
    – bobstro
    Jul 19, 2015 at 2:57

3 Answers 3


We had the same issue a while ago. (Considering you don't modify the kernel) our conclusion was:

It's easy to reset passwords. A simple Google search shows you how to do this. It requires an SD card reader and a standard Windows (or Mac).

Our solution was to port all development to C. (Nearly) nobody will be able to read your keys on that.

And use a secured connection (like TLS) to communicate to your server. That will eliminate traffic sniffing.

If you want any hardware asset tracking, you'll have to boot up the raspberry anyway. Therefore you can make a script to hardcode MAC and Serial number into your source code, and compile it right on the device itself.

If you want more information on that I'll make a list on how we did that.

  • I assume we do share the love the Pi so I don't like to say this, but if you're talking about 1000's of devices and you don't need 4 USB's or the HDMI port, there's a lot of cheaper solutions.
    – EDP
    Jul 18, 2015 at 14:41

Typically, to protect the contents of your SD card, you'd encrypt the data, but that's problematic for an autonomous device (because there's typically no one around to enter the decryption key at system boot).

Alternatively, you could protect the contents of the SD card by using epoxy to make it essentially non-removable. A really determined attacker could attach probes to the traces that connect the SD card to the CPU, or disconnect the SD card reader and physically connect it to another computer, but it might be enough of a discouragement for your purposes.

  • Further to this, it's just about within the bounds of possibility that you could epoxy pot the whole Pi, leaving just the essential connectors exposed. I took a look into doing this for use in marine environments, and I think it might be just about plausible to use a combination of a silicone coat on the board, followed by a full epoxy pot. The silicone should help to cushion the epoxy shrinkage. I've never done this, and I'm almost sure I've seen a Pi rep saying that it's likely a bad idea. It would almost certainly shorten the lifespan of the board. But it might work.
    – goobering
    Jul 22, 2015 at 19:50

If you don't use the device or you can walk there to reset your device, you can try to use secure MCU,please search "tamper" by google

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.