Security at the Edge
local graph
Chapter 12 — Security at the Edge
Section titled “Chapter 12 — Security at the Edge”One of the key benefits that Edge computing offers is better data protection by keeping personal and private information local to the user – in their possession, so to speak. However, Edge computing also introduces some specific security challenges directly related to the fact that Edge devices and servers are not physically protected by the four walls of a data center. Edge computing is done where real work is done, in the presence of working people – giving them unprecedented access to the computers they use to process their work data.
This chapter will discuss those various challenges and how Open Horizon is designed to address them. From this, you will be better equipped to recognize the potential security issues you might encounter and understand how you can leverage Open Horizon to address them. Some of these issues are addressed for you by virtue of how Open Horizon is designed. Others require your participation. This chapter will show you what you need to do to help Open Horizon protect your Edge solution.
In this chapter, we’re going to cover the following main topics:
- Security vulnerabilities at the Edge
- How Open Horizon protects your Edge
- Workload signing
- API keys, secrets, and the Vault
Technical requirements
Section titled “Technical requirements”This chapter will require that you have an appreciation for common security vulnerabilities such as the potential to spoof the system, tamper with workloads, exploit backdoor network connections, the ability to reverse-engineer software to exploit weaknesses in the code, timeliness of attack responses, and so on. We will also be leveraging the Open Horizon hzn commands you learned in the Developing an Open Horizon service section of Chapter 9.
Security vulnerabilities at the Edge
Section titled “Security vulnerabilities at the Edge”Think back to your last trip to the grocery store. Likely, the point-of-sale (POS) terminal was at a counter with the back facing you in line. All the ports to the computer inside that register were facing out to you – just begging for someone to plug in a USB stick or to pull out one of the network or power cables.
This is typical for nearly all far Edge devices and servers. They are physically exposed to workers, and in retail scenarios, for example, to the general public. This is further exacerbated by the following facts:
- Software must be deployed to the equipment over the network
- Any data stored on the local hard drive can be easily removed
- Network connections (the physical Ethernet jacks, for example) are also exposed, enabling other, potentially malicious, devices to be connected to the enterprise network
- Other, potentially rogue, networks can be plugged into the legitimate equipment
And that creates several vulnerabilities for this equipment. Let’s discuss some of those in this section.
Masquerading devices
Section titled “Masquerading devices”How do you know that only legitimate equipment is plugged into your network? With network cables distributed across your facilities, what is preventing someone from bringing their own laptop and just plugging it into your network? Would you recognize it if the device was rogue and not authorized for use on your network?
Of course, there are techniques using wireless network certificates to protect your Wi-Fi or cellular network, and VPNs to protect access to your critical data, but these require a high degree of administrative discipline and, by themselves, may not identify whether the equipment is legitimate or not. Most VPNs are designed to identify the user of the machine, not the machine itself.
A common technique for identifying a piece of equipment is to register and track the machine’s Media Access Control (MAC) address – a unique identifier associated with the network card embedded in the device. However, this can be hard to keep up with if you ever need to replace a network card in the field – the MAC address will change with the new card, even though the machine remains the same machine. In essence, this technique means the same machine can have multiple identities. Furthermore, it is possible to spoof a MAC address in software.
You need a strong mechanism for uniquely attesting to the identity of each individual device, cast in the hardware of the machine so that it can’t be tampered with and won’t change with field upgrades or repairs.
Software tampering
Section titled “Software tampering”How do you know the software you’ve loaded on the equipment hasn’t been tampered with? Software on your Edge nodes may be installed at the factory or in a secure warehouse location before being sent out to the Edge location. However, most of your software will be downloaded from a central IT or cloud data center over the network and stored locally on the Edge node.
From the time that software is built in your DevOps environment to the moment it is loaded in memory for execution, it is vulnerable to someone tampering with the code – inserting malicious logic to trap or modify the data you collect or subvert the functionality you rely on for your business.
This can occur in the container registry where you store your images, in the network while it is being transmitted to your Edge node, in any intermediate storage locations you use to buffer that distribution, or even in the Edge node itself where you store the image prior to being loaded in memory.1
1 Theoretically your code could be tampered with even after its loaded in memory, however this is significantly more difficult and there are several hardware architectures coming from ARM, AMD, and Intel to help prevent that – at some additional cost, of course.
You need a mechanism that will detect and protect your code from being tampered with or contaminated at any point in the distribution chain.
Backdoor attacks
Section titled “Backdoor attacks”The most common remote attack occurs when a rogue is able to connect to a device and hack into the operating system or other software on a device or server. This all begins with connecting to the equipment, which can occur if the software on that machine has opened a listening port on which an outside connection can be made.
Programmers often design their software using a client-server relationship between distributed components – where one component acts as a client to other components operating as a server. In fact, this design point is encouraged by cloud-native microservice architectures. These client-server relationships must be enabled by one end opening a listening port so that the other end can connect to it.
It doesn’t really matter whether the client or the server end, or both, opens the listening port, as long as one can connect to the other. It is instinctually common to suppose the server will open the listening port and the client will connect to it when it needs to, so this becomes the common implementation pattern. And if your client is always at the Edge and your server is in the IT or Cloud data center, then this assumption generally works well.
However, on occasion, the paradigm is reversed, where the client is in the data center and the server is at the Edge. If, as a result, you create a listening port at the Edge device or server to receive connections to your microservice, you have just created an opportunity for rogue software (other clients) to connect to your machine and attack the software and data on your machine.
You can protect those cases by introducing a firewall on your device or server that prevents network connections or packets from clients that you don’t recognize or authorize. However, this requires administrative discipline that gets increasingly more difficult to manage as you increase the number of places where listening ports are open.
You need to limit the number of places where software will open a listening port, and ensure you have the right network protections in place in those locations where those listening ports are necessary. Furthermore, your DevOps pipeline should scan for any software that does open a listening port, and then protect your software from rogues that may tamper with that software by inserting a listening port into it after it leaves your pipeline (see the previous Software tampering discussion).
Replay attacks
Section titled “Replay attacks”One way a rogue can mount an attack on the system is to replay previous legitimate message exchanges. As a simple example, an agent may initiate the download of a large AI/ML model from the Exchange. A rogue performing a classic man-in-the-middle attack inserted in the network, observing that exchange, could copy those messages and fire them repeatedly to the Exchange – masquerading as the original agent – and cause the Exchange to re-download that same file many times. They can use this to overload the system – causing it to do more work than it has resources to accomplish, and possibly forcing it to fail.
You need the system to protect itself from this type of attack by putting in circuit breakers to prevent overloading, as well as to detect and suppress the replaying of earlier legitimate messages.
Unauthorized channels
Section titled “Unauthorized channels”Following the cloud-native best practice of componentizing your application into a set of microservices can also create a vulnerability. Since the application will be communicating between these microservices to accomplish its functionality, that communication must be protected to ensure that outside applications do not use those microservices in ways that are unauthorized or were not designed for.
In some scenarios, you may not even be aware that your services are being used by a rogue – consuming resources you had not planned for. In the worst case, malicious software may be using your services to subvert the functionality or integrity of your application or the data it operates on.
Of course, these same cases exist in Cloud computing but are exacerbated in Edge computing when these components are distributed between different physical systems, and in the inherently unprotected Edge environments, especially when these systems are also being shared with other applications.
You need the system to isolate all your application components and to protect the communication between them.
Hacking
Section titled “Hacking”Hacking is an ever-evolving art – an arms race between hacking techniques and tools for detecting and protecting against them. Arguably, there is a high risk that someone will hack into your system at some point, or at least they will try to. The hack may have been planned over years and introduced through the supply chain, as they did in the XZ Utils attack.2
Your goal must start by trying to prevent that from happening at all. But if it does happen, then you must at least limit the damage that can be done to that system and other systems under your control. This is referred to as reducing the blast radius of an attack.
According to NordVPN,3 one of the most common techniques for hacking into a system is credential reuse – that is, stealing the user ID and password you use for one system and then reusing that login to other systems you also use.
3 https://nordvpn.com/blog/hacking/
Clearly, you need to protect your user credentials from being stolen or otherwise acquired through nefarious means, such as phishing. Just as important, you need to have distinct credentials for each node in your Edge or Cloud system. In this way, even if someone does obtain the credentials for one node, they won’t necessarily be able to access any other node in your system.
Excessive privilege
Section titled “Excessive privilege”A related issue is that, often, individual credentials are granted more privileges than they need to perform their duties. Root authority is a good example of this given its power to do virtually anything in the system. As discussed in Hands-on – Set up a non-root user in Chapter 6, granting root authority should be highly constrained – requiring all other activities that don’t need it be performed with privileges that limit users to only performing the tasks needed for their role.
Exploiting software vulnerabilities
Section titled “Exploiting software vulnerabilities”Unfortunately, software programmers often have very little training on the issues of security they may be exposed to and how to protect against those in their code. Some of this is simply the consequence of the ever-evolving threat vectors – it is difficult to keep up with these and learn how to mitigate against them.
The DevSecOps 4 trend is intended to deliberately infuse a higher awareness of these issues and techniques to protect against the most common and obvious of them in programming practices.
4 https://www.ibm.com/topics/devsecops
One particularly relevant element of this practice is to never hardcode secrets in your software. The rationale for this should be obvious: anything that is hardcoded in a program can be reverse-engineered, even without the source code. Once exposed, it is no longer a secret. A common example of such a secret is the API key you need that grants access to a cloud service – public or private.
You should always maintain these types of secrets in a secure vault and then securely distribute them to your software when needed, and only for as long as they’re needed. These secrets should never be stored persistently where they can be discovered by rogue software.
Operating failure
Section titled “Operating failure”Of course, any kind of failure in the system can itself be a security issue, or at least prevent security guards in the system from performing as needed. This is true regardless of whether the failure was initiated intentionally by a rogue actor or inadvertently due to latent bugs in the software or a hardware malfunction.
In the world of cybersecurity threats, human responses to these failures may be way too slow. The minutes or even seconds it might take for a person to recognize and remediate an outage may be more than enough time for malicious software to exploit a vulnerability in the system left open by that failure. And, of course, that outage may have a significant impact on whatever business is not being conducted during that outage.
You need systems to constantly monitor themselves for glitches and to automatically recover themselves to close gaps in security and business operations.
System inconsistencies
Section titled “System inconsistencies”Perhaps the most common cause of system vulnerabilities is the result of running software that is out of date. Even the most diligent security practices and attempts to close security exposures in software are moot if those remediations are never deployed to the operating environment.
Security teams have many tools that they use to identify exposures. These include performing a red team threat assessment where a group of advocates will perform ethical hacks on the system to see what vulnerabilities they can uncover. Many of these vulnerabilities are the result of poor software practices – things such as opening listening ports, as we discussed in the Backdoor attacks section earlier in this chapter.
These assessments should be taken seriously. Software vulnerabilities in application programs must be patched to remove those exposures. But, most importantly, these updates then need to be deployed back out of the operational system as quickly as possible.
In an Edge system with hundreds or many thousands of devices and servers spread over many geographically diverse locations, it is often too easy to overlook all the nodes that need to be updated. You need to use a deployment system that will automate this process and do so expediently.
How Open Horizon protects your Edge
Section titled “How Open Horizon protects your Edge”Open Horizon is a deployment management system designed specifically to address a number of security challenges. We will discuss those capabilities now. However, it is also important to understand that Open Horizon does not intermediate your own application code or any communication it performs with other services in other nodes. You are responsible for ensuring your own code is adhering to good security practices.
Device attestation
Section titled “Device attestation”As discussed in the Components of the Management Hub section of Chapter 4, Open Horizon supports the FIDO Device Onboard (FDO) system to enable zero-touch provisioning of the Open Horizon agent.
The core of FDO is built on the idea that device manufacturers will create a non-repudiable, secure token representing the authenticity of the individual device. The voucher, and the subsequent registration mechanism supported by Open Horizon, can be used to attest to the authenticity of the device. It is not subject to MAC addresses or any other mechanism that can be replaced in the system that would otherwise result in the equipment’s identity changing with that replacement.
When you acquire equipment from a manufacturer that supports FDO and register that equipment with Open Horizon upon receipt, you will be able to track the provisioning of that device in its intended location, and subsequently, track that device through future changes.
When using the FDO system, if any unrecognized device attempts to connect to your system, Open Horizon will automatically detect that and prevent the agent from being provisioned to that device – and consequently, prevent any workloads from being deployed to that device.
Tamper resistance
Section titled “Tamper resistance”When you publish a service to the Open Horizon Management Hub, it will automatically be cryptographically signed. You can have it signed with a key that you provide, or Open Horizon will create a public key pair for you before storing the service in your targeted container registry. When the service is pulled from the registry by the agent, and again before loading that service into memory, its signature is rechecked to ensure it was not changed at any point – in storage, in the network during transmission, or on the local Edge node.
We demonstrate how to publish and sign a service in the Workload signing section later in this chapter.
Intrusion resistance
Section titled “Intrusion resistance”As we discussed in the Backdoor attacks section, it is important that you avoid creating listening ports in your application software unless you can ensure it is protected by a firewall that is actively maintained. Open Horizon, for its part, never opens any listening ports in the Open Horizon Agent.
All connections between the Agent and the Management Hub are initiated by the Agent. The Management Hub is the only spot in the Open Horizon system that you need to protect with a firewall. Furthermore, communication between the Agent and the Management Hub is performed over the HTTPS protocol, using port 443, and therefore, avoids the need for any special firewall rules.
Even when the Management Hub has work for the Agent to perform, it waits for the Agent to contact it to request those instructions (see the discussion about the switchboard in Chapter 4). This helps Open Horizon resist any intrusion from outside attackers attempting to connect to and coerce the agent’s responsibilities.
Replay resistance
Section titled “Replay resistance”Furthermore, all communication between the Agent and the Management Hub is encrypted with perfect forward secrecy.5 Not only does this protect each message with a unique key that won’t compromise that message, even if the key for other messages is somehow cracked, but it also prevents the same message from being re-sent again in the future. There is no opportunity for a man-in-the-middle attack from replaying messages between the Agent and Management Hub to cause unintended behaviors from either component.
5 https://www.sectigo.com/resource-library/perfect-forward-secrecy
Workload isolation
Section titled “Workload isolation”As we described in What is a service? in Chapter 4, a workload is simply one or more services in a dependency tree, and a service is one or more containers that are published as a unit. A workload implies a collection of inter-related and inter-dependent containerized microservices. They are treated by Open Horizon as a whole. They are deployed as a whole and protected as a whole.
The container runtime (Docker, Podman, or Kubernetes) will isolate each individual container in its own execution environment – giving it virtualized access to the resources it needs to ensure protection between them. But Open Horizon will then create a virtual private network between the containers in a given workload to enable them to communicate with each other over local sockets.
As long as the application does not open its own listening ports, these containers are protected from any outside communication that could be used to subvert their functionality.
Tip
Limit the deployment of external services to only upstream servers and the cloud where you are assured to have a firewall installed that protects access to that service. If your service is intended to be externally accessible, then use a service policy to set a constraint indicating a dependence on a firewall – something along the lines of 'firewall-reqd = true', and then set that property at only those nodes where you have provisioned a firewall.
Blast protection
Section titled “Blast protection”To ensure damage is limited in the event that someone does hack into any particular Edge device or server, every Edge node is assigned its own credentials. If the credentials of one node are compromised, that cannot be used to subvert any other node.
Furthermore, the capabilities of a node credential are limited to only manipulating information about that one node. You can’t perform actions with those credentials that would change information about any other node.
Role-based privileges
Section titled “Role-based privileges”Open Horizon supports several distinct roles, including the following:
- IAM user: This represents the credentials of any user of the system. It is the most basic role any user can have, although other Open Horizon roles are typically assigned when those user credentials are created.
- Exchange root user: This has unlimited authority to perform any action in the Exchange. This is the equivalent of having root authority in any system and so should be assigned with a great deal of caution. This authority can be disabled altogether to provide added security.
- Exchange hub admin user: This is responsible for setting up organizations in a multi-tenanted Open Horizon system.
- Exchange org admin user: This has unlimited access to the Exchange within a given organization.
- Exchange user: This can create resources in the Exchange, including nodes, services, patterns, and policies, and can subsequently update or delete any of the resources they have created. In addition, the Exchange user role can view any resource (public or private) within their own organization, and public resources in other organizations.
- Exchange nodes: This is a role assigned to any node credential, permitting them to read or update the resources for that node, as well as to read any services, patterns, or policy resources of their own organization, and public services, patterns, or policy resources of other organizations.
- Exchange Agbots: This is assigned to Agbots. This role, when assigned to credentials in the IBM organization, can read (but not create or update) resources from any organization.
Important note
User credentials are created in your Identity and Access Management (IAM) system. Open Horizon has an open architecture for plugging in different IAM systems and provides a default plugin for Lightweight Directory Access Protocol (LDAP). You can substitute a different plugin shim for your system if your enterprise does not support LDAP.
By assigning roles to each of your users (including the nodes and services of the system), you constrain what each user can do to just those things needed for their specific responsibilities, and no more. If any of your user’s credentials are compromised, the hacker cannot do more than what they can within the confines of the role assigned to that user. Just as important, if any employees accidentally or maliciously change the system, their damage can be contained.
Secrets management
Section titled “Secrets management”Integration with the HashiCorp Vault is built into Open Horizon. Any secrets that your services depend on should be stored in the Vault. Through service bindings, Open Horizon will automatically and securely distribute that service’s secrets to that service wherever it ends up being deployed.
We will demonstrate how to program and use the Open Horizon secrets management system in the API keys, secrets, and the Vault section later in this chapter.
Failure resistance
Section titled “Failure resistance”The Open Horizon agent constantly monitors the services running at its node to ensure they are always running. If a service fails, it automatically restarts it. If it fails repeatedly, the agent will revert to an earlier version of the service until a fix can be provided for whatever bug is preventing the current version from running properly. You can specify both the number of retries to perform as well as the version of the service to fall back to in the case of a repeated failure as part of the service definition for that service.
The agent will continue to perform this responsibility even if the node is disconnected from the network.
Tip
You can never know when a network outage will occur. Services that will be deployed to the Edge should be written to tolerate network outages that prevent them from accessing upstream service dependencies for periods of time.
In turn, the Agent is executed as a systemd process and relies on the operating system to restart it in the rare case that it fails. Nonetheless, services will continue to run independent of whether the agent is running to monitor them.
In this way, the system is very resilient – even in nodes that don’t benefit from the additional resilience that Kubernetes can offer – helping to prevent any security lapses that a rogue can use to exploit your enterprise business.
Infrastructure currency
Section titled “Infrastructure currency”That brings us to the core of what Open Horizon is about – that is, deploying software to your Edge and keeping it up to date.
The policy-based system we have discussed in earlier chapters is designed expressly to handle the various complexities of your Edge system. As new Edge devices and servers are introduced, services are created or updated, the configuration and available resources of Edge nodes are changed, Edge nodes are moved around your facilities or their primary roles and responsibilities are updated to meet your business needs, new operating procedures are updated in your business, and business activities increase or decline, inventories and backlogs shift, and priorities change, Open Horizon will evaluate the published policies to determine what services need to be deployed to which Edge nodes, taking down and moving existing services if needed to ensure those policy conditions are satisfied.
In particular, note that this is performed automatically when you update your services. If you discover a security vulnerability in a service and update that service with a new version, the Open Horizon system will automatically update all the nodes where that service is deployed with that update. In this way, the system is always kept current.
Workload signing
Section titled “Workload signing”As discussed in the Tamper resistance section, signing your workload is key to protecting it from being tampered with. Fortunately, Open Horizon makes signing your workload easy.
Once you have written and containerized your microservice, for example, using docker build, you need to create a service configuration file, as outlined in the Developing an Open Horizon service section of Chapter 8.
With that in place, you then issue an hzn command to publish that service to the Open Horizon Management Hub, like this:
hzn exchange service publish - f <your-service-config.json>
Substitute the filename you’ve given to your service configuration file in place of <your-service-config.json>.
If you do nothing else, Open Horizon will automatically generate a random key pair and store the public key with the service.
However, if you want to create your own public key pair, you can do so and then store the private key in a file. You can then provide the name of that file in any of the following ways:
- In the
-kor--private-key-file=argument of the precedinghzn exchange servicepublishcommand - In the
HZN_PRIVATE_KEY_FILEenvironment variable of your command shell - In the
~/.hzn/keys/service.private.keyfile of your filesystem
Open Horizon will evaluate each of these in that order, resorting to generating a random key pair by default if it can’t be found.
Under the covers, Open Horizon will instruct the container registry to sign your workload in the process of registering each of the containers in that workload. Subsequently, the Open Horizon Agent will test the signature of that workload when deploying it to an Edge node, and again before reloading those images at runtime thereafter. This ensures the workload is not tampered with from the moment you publish it to the moment it is loaded in memory for execution.
API keys, secrets, and the Vault
Section titled “API keys, secrets, and the Vault”To avoid hardcoding secrets in your application code, Open Horizon includes a secrets manager that will securely make those secrets available to your service wherever it gets deployed. To enable this, Open Horizon integrates with the HashiCorp Vault.
To leverage the secrets manager to protect your application’s secrets, you must follow these steps:
- Write your application with the expectation that any secrets it needs will be made available in a file stored in the container’s private (and protected) storage system (you will specify the name of that file as part of the service configuration file in a later step).
- Create a container image for your microservice.
- In the deployment section of the service configuration file, include the following
Create a label for your secret and substitute it for"secrets": {"<secret-name>": {"description": "<optional-description>"}}
<secret-name>. This will be the name of the file in which the secret is placed later. Optionally, you can include a description of your labeled secret to help you identify it later. - You can now publish your service using the
hzn exchange service publishcommand, as we’ve described previously. - Store your secrets in the Vault with the
Secrets have two parts –hzn secretsmanager secret add --secretKey <secret-key> --secretDetail <secret-value> <secret-name>
<secret-key>and<secret-value>– both of which are string values. By convention, the key is used to specify the type of the secret – for example,"basicauth", indicating that the value of the secret will be in the form of"user:<password>". Open Horizon assigns no semantics to either part of the secret so you are free to use whatever taxonomy works for your application.<secret-name>is the label you want to refer to this secret as in the Vault. Typically, this will be the same label that you specified in Step 3; however, there will be an opportunity for you to map to the service’s expected label in the next step. - Now, you must create a binding to that secret in your pattern or deployment policy that will affect the deployment of your service. Include the following JSON in your pattern or deployment policy
Here,"secretBinding": [{"serviceUrl": "<service-URL>","serviceOrgid": "<service-org-id>","serviceArch": "<service-hardware-architecture>","serviceVersionRange": "x.y.z","secrets": [{"<service-secret-name>":"<secrets-manager-secret-name>"}]}]
serviceUrl,serviceOrgid,serviceArch, andserviceVersionRangemay be redundant with the similarname,org,arch, andserviceVersionfields in theserviceportion of the deployment file, but they offer the opportunity to bind different secrets to different variants of the service being deployed.<secrets-manager-secret-name>should match thesecret-namelabel provided when you created the secret in the Vault in Step 5.<service-secret-name>may be the same, but it must match the name identified in the service definition in Step 3. - When you publish the pattern or deployment policy with this secrets binding information and when, as a consequence, Open Horizon now deploys your service to an Edge node, it will retrieve the secret (both the key and value) from the Vault and place them in a file. The file will be given the name you specified in the service definition as
<secret-name>in Step 3, will be placed in theopen-horizon-secretsfolder of the service’s container, and will contain the following JSON structure:The service will not be deployed if the expected secret has not been already added to the Vault, as described in Step 5.{"key": "<secret-key>","value: "<secret-value>"}
Your code can now read its secret from the corresponding file.
Summary
Section titled “Summary”The Edge is a vulnerable space – unprotected by the strengths of physical controls we associate with and rely on in enterprise and Cloud data centers. Far Edge equipment is provisioned in the presence of people – both workers and customers – with little or no IT experience. Anyone can access these machines and can either accidentally or maliciously disrupt their intended functionality. Network attachments can be tampered with in uncontrolled ways that are hard to predict and difficult to prevent.
Nonetheless, these concerns should not detract from the real value that Edge computing brings to enhancing user experiences, protecting personal and private customer information, maintaining resiliency, and providing operational efficiency. Instead, we must leverage the benefits that robust deployment systems, such as Open Horizon, offer to help manage and mitigate security exposures that exist at the Edge.
In this chapter, we have outlined the key vulnerabilities that can exist at the Edge and the necessary steps for addressing them. You have learned about the capabilities offered by Open Horizon for mitigating these threats, and how it is essential to ensure the protection of your Edge deployments. We have shown you how to program and control Open Horizon to sign workloads and store and bind secrets in the Open Horizon system.
In the next chapter, we will discuss the symbiotic relationship between the Edge and secure enterprise networking.