Here is the dilemma we're having: we developed proprietary bash scripts that do something, which is meant to be secure and closed source.

Our customers however will have to buy separate IOT devices and flash our software (i.e. bash scripts) into them. The IOTs will have a Linux running (alpine or the like).

What we want to do is to flash our scripts into these IOT devices without having to compromise our source codes and close the IOT device for any further modification.

As soon as we "flash" these devices we close SSH ports and close any network connection. The user will have to rip off the nands in order to read the code.

Of course the end user can hit erase and reinstall their devices. That's fine as long as they don't access our scripts.

How do we do this securely?

  • 2
    I'm not sure if I understand your business model. You ask the customer to buy some third party hardware which you don't control and then you want to essentially make this hardware only usable with your own code? And also make sure that no one can access your code? This does not sound doable. But maybe if you describe the overall scenario in more detail and don't just focus on the technical idea you came up (and fail to implement) one would be able to see a way. Jan 30, 2021 at 18:07
  • 1
    You can't. Plain and simple.
    – user163495
    Jan 30, 2021 at 21:59
  • I'd be more concerned about you being able to ssh into a device directly with enough privilege to change system-level configuration. What a horrible model. Even if you go down this road, if you can ssh into the devices with privilege to write the code, the owner would be able to ssh in as well and read the code.
    – mikem
    Feb 3, 2021 at 6:51
  • @SteffenUllrich yes that's exactly the model.
    – AK_
    Feb 18, 2021 at 19:31

1 Answer 1


The simple answer is that you don't.

You want your script to run at a computer not owned and controlled by you.

Law #3: If a bad guy has unrestricted physical access to your computer, it’s not your computer anymore

10 immutable laws of security

In addition, you use a shell scripting language, which by default can be read as clear text.

Microsoft has been trying to stop piracy for a few decades - throwing huge resources at the problem. Have they solved it? Nope.

I would opt for contractual protection. Tell your customers that they cannot distribute your software. If someone wants to copy it, they will likely be able to copy it, no matter what you do.

In addition I'd question the value of what you have. It may take time to make, but is it ultimately that valuable? If yes: is it possible to write a agent that ships whatever data you act upon to a backend server (controlled by you), and do the actual work on the backend? That way you'll be able to control the security (and access) of the proprietary software. All you need on the IoT-device is a agent for sending and receiving data.

  • I own the iPhone, but Apple can still securely flash their iOS into it.
    – AK_
    Feb 3, 2021 at 12:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .