air gapped ai tutorial

An air-gapped environment, also known as an air-gapped network or system, is a computing setup that is physically isolated from all other networks, including the internet. This isolation is achieved by creating a physical gap or disconnection between the air-gapped system and any external connections, ensuring that no data can be transmitted or received through network cables, wireless signals, or other electronic means.

The primary purpose of an air-gapped environment is to provide an unparalleled level of security for sensitive data and critical systems. By eliminating any potential entry points for cyber threats, air-gapped networks effectively mitigate the risk of remote attacks, data breaches, and unauthorized access. This level of protection is crucial for organizations dealing with highly classified information, critical infrastructure operations, or systems that require the utmost confidentiality and integrity.

Ivan Burazin, co-founder of Codeanywhere, a cloud development environment company, emphasizes the importance of air-gapped installations, stating, “Government regulations and industry policies for retaining sovereignty and local control over sensitive data continue to evolve. With those regulatory controls come penalties for non-compliance and Service Level Agreement (SLA) failures. Certifying an air gap installation is a great way to pass even the most demanding audit.”

Air-gapped environments are commonly employed in various sectors, including:

  1. Military and National Security: Air-gapped networks are essential for protecting classified military information and ensuring the integrity of defense systems.
  2. Critical Infrastructure: Industries such as nuclear power plants, water treatment facilities, and industrial control systems rely on air-gapped networks to safeguard their operations from cyber threats.
  3. Financial Institutions: Banks, payment processors, and other financial organizations use air-gapped networks to secure sensitive financial data and transactions.
  4. Healthcare: Certain medical equipment and systems handling sensitive patient data may be air-gapped to maintain privacy and prevent unauthorized access.

While air-gapped environments provide unparalleled security, they also present challenges in terms of data transfer and operational convenience. Since these systems are completely isolated, data can only be ingested or transferred through physical means, such as removable media like USB drives or optical discs. This process is often manual, slow, and cumbersome, but it is a necessary trade-off for ensuring comprehensive network integrity.

Despite the challenges, the benefits of air-gapped environments are undeniable for organizations that prioritize data security and operational resilience. As cyber threats continue to evolve, air-gapping remains a robust and effective strategy for protecting critical systems and sensitive information from potential breaches and unauthorized access.

Importance of air-gapping for sensitive documents

Sensitive documents, such as classified government files, proprietary business information, or personal data, require the highest level of security to protect against unauthorized access, theft, or misuse. Air-gapping is a critical security measure that provides an unparalleled level of protection for these sensitive documents, ensuring their confidentiality, integrity, and availability.

In today’s digital age, where cyber threats are constantly evolving and data breaches are becoming increasingly common, the risk of sensitive information falling into the wrong hands is a significant concern. Traditional network security measures, such as firewalls and antivirus software, while essential, may not be sufficient to protect against advanced cyber attacks or insider threats. Air-gapping offers a robust defense by physically isolating sensitive systems and data from any external connections, effectively eliminating the risk of remote cyber attacks.

According to a report by the Enterprise Strategy Group (ESG), 67% of organizations do not currently implement air-gapping as part of their data protection strategy, leaving them potentially vulnerable to ransomware attacks and other cybersecurity threats. This statistic highlights the importance of adopting air-gapping methodologies to safeguard sensitive information.

Quoting Ivan Burazin, co-founder of Codeanywhere, “Government regulations and industry policies for retaining sovereignty and local control over sensitive data continue to evolve. With those regulatory controls come penalties for non-compliance and Service Level Agreement (SLA) failures. Certifying an air gap installation is a great way to pass even the most demanding audit.”

Air-gapping is particularly crucial in sectors where the consequences of a data breach could be catastrophic, such as:

  1. Government and National Security: Classified documents related to national security, intelligence operations, and military affairs must be protected at all costs. Air-gapping ensures that these sensitive documents remain isolated from potential cyber threats, preventing unauthorized access or leaks that could compromise national security.
  2. Financial Institutions: Banks, payment processors, and other financial organizations handle vast amounts of sensitive financial data, including personal information and transaction records. Air-gapping these systems can prevent cyber criminals from accessing and exploiting this data for financial gain or identity theft.
  3. Healthcare: Patient medical records and other sensitive healthcare data must be kept confidential to protect individual privacy and comply with regulations such as HIPAA. Air-gapping can help healthcare organizations maintain the integrity and security of this sensitive information.
  4. Critical Infrastructure: Industries like nuclear power plants, water treatment facilities, and industrial control systems rely on air-gapped networks to safeguard their operations from cyber threats that could potentially cause catastrophic consequences.

While air-gapping presents challenges in terms of data transfer and operational convenience, the benefits of protecting sensitive documents from cyber threats and data breaches far outweigh these drawbacks. By implementing air-gapping strategies, organizations can significantly reduce the risk of sensitive information falling into the wrong hands, mitigate the potential for costly data breaches, and maintain compliance with relevant regulations and industry standards.

Setting Up a Local AI Environment

In the realm of sensitive data processing, establishing a secure and isolated environment for AI operations is paramount. Air-gapping, the practice of physically isolating a system from external networks, offers an unparalleled level of security for handling sensitive documents and data. By setting up a local AI environment within an air-gapped network, organizations can leverage the power of artificial intelligence while ensuring the utmost confidentiality and integrity of their sensitive information.

First install our dependencies

pip install llama-index llama-index-embeddings-huggingface

Create a function to initialize our documents

def createVectorIndex(path):
    PERSIST_DIR = "./storage"
    # load the documents and create the index
    documents = SimpleDirectoryReader(path).load_data()
    if not os.path.exists(PERSIST_DIR):
        index = VectorStoreIndex.from_documents(documents, embed_model='local')
        # store it for later
        index.storage_context.persist(persist_dir=PERSIST_DIR)
    else:
        # load the existing index
        storage_context = StorageContext.from_defaults(persist_dir=PERSIST_DIR)
        index = load_index_from_storage(storage_context, embed_model='local')
    return index, documents

Create our index by calling the function by pointing our path to the location of the directory where our sensitive documents are stored.

vectorIndex = createVectorIndex('./sensitive_documents')

Now that we have a vector index of our sensitive documents, we can analyze them using a local LLM. You can run a local LLM many different ways like Llama.cpp, Ollama, or GPT4ALL. For this tutorial we will be using LM Studio which is very easy to use, has a GUI, list of the latest models, and makes downloading and running really easy. The added benefit of using this interface is that it already has Apple Silicon improvements built in when running a supported model. Once LM Studio is installed on your system, you can select a model from the list that will run optimally on your system, and leaves enough memory for a large context window.

I chose the Mistral 8x7b 2 bit k-quantization for my M2 MacBook Pro with 32GB RAM.

Next, we will start the model in local API mode so we can reach it from our python code. First we need to load the model into RAM.

Then start the Local Inference Server.

Now we can initialize the LLM in our python code using the llama-index OpenAI class. This class can be used because the LM Studio uses a OpenAI compatible interface when running the inference server. If you do not feel comfortable using this class, you could always define your own custom llm with llama-index.

from llama_index.llms.openai import OpenAI

llm = OpenAI(api_base="http://localhost:1234/v1", api_key='not-needed')
query_engine = vector_index.as_query_engine(llm=llm)

Now you are ready to ask questions about your sensitive documents and get detailed answers!

result = query_engine.query("What are the key takeaways from the Q4 financial reports?")
print(result)

Integrating local AI with air-gapped setup

Integrating a local AI environment with an air-gapped setup presents unique challenges that require careful planning and execution. While air-gapping provides unparalleled security for sensitive data and systems, it also introduces limitations in terms of data transfer and software updates. However, by following industry best practices and leveraging specialized techniques, organizations can successfully deploy and maintain AI workloads within an air-gapped environment.

According to a report by the Ponemon Institute, the average cost of a data breach in 2022 was $4.35 million, with the healthcare industry facing the highest average cost of $10.1 million per breach. These staggering figures underscore the importance of implementing robust security measures, such as air-gapping, to protect sensitive data and mitigate the financial and reputational consequences of a breach.

Quoting Ivan Burazin, co-founder of Codeanywhere, “Government regulations and industry policies for retaining sovereignty and local control over sensitive data continue to evolve. With those regulatory controls come penalties for non-compliance and Service Level Agreement (SLA) failures. Certifying an air gap installation is a great way to pass even the most demanding audit.”

To integrate a local AI environment with an air-gapped setup, organizations must address several key aspects:

  1. Data Ingestion: Transferring sensitive data into the air-gapped environment is a critical step. This process typically involves the use of physical media, such as encrypted USB drives or optical discs, to securely transfer data from external sources. Strict protocols must be established to ensure the integrity and confidentiality of the data during the transfer process.
  2. Software Updates and Maintenance: Keeping the AI software and frameworks up-to-date within the air-gapped environment is essential for maintaining optimal performance and addressing potential security vulnerabilities. Organizations can leverage techniques like software mirroring or offline package repositories to securely obtain and deploy software updates within the air-gapped boundaries.
  3. Model Training and Inference: The computational resources within the air-gapped environment should be leveraged to train and deploy AI models on sensitive data. This process should be conducted entirely within the isolated network, ensuring that no data or model parameters are transmitted outside the air-gapped boundary.
  4. Secure Collaboration: Enabling secure collaboration among authorized personnel within the air-gapped environment is crucial for efficient AI development and deployment. Version control systems, secure communication channels, and access controls should be implemented to facilitate collaboration while maintaining strict security protocols.
  5. Monitoring and Auditing: Implementing comprehensive monitoring and auditing mechanisms is essential for detecting and responding to potential security incidents within the air-gapped AI environment. This may include logging and analysis of system events, user activities, and network traffic patterns.
  6. Disaster Recovery and Backup: Developing robust disaster recovery and backup strategies is critical to protect against data loss or system failures within the air-gapped environment. This may involve redundant storage solutions, regular backups, and well-defined recovery procedures.

Table 1: Key Considerations for Integrating Local AI with Air-Gapped Setup

ConsiderationDescription
Data IngestionSecure transfer of sensitive data into the air-gapped environment using physical media or specialized protocols.
Software Updates and MaintenanceLeveraging techniques like software mirroring or offline package repositories to obtain and deploy software updates within the air-gapped boundaries.
Model Training and InferenceConducting AI model training and inference entirely within the isolated network, ensuring no data or model parameters are transmitted outside the air-gapped boundary.
Secure CollaborationImplementing version control systems, secure communication channels, and access controls to facilitate collaboration among authorized personnel while maintaining strict security protocols.
Monitoring and AuditingImplementing comprehensive monitoring and auditing mechanisms to detect and respond to potential security incidents within the air-gapped AI environment.
Disaster Recovery and BackupDeveloping robust disaster recovery and backup strategies to protect against data loss or system failures within the air-gapped environment.

In my opinion, integrating a local AI environment with an air-gapped setup is a complex undertaking that requires careful planning, expertise, and ongoing maintenance. However, the benefits of protecting sensitive data and systems from cyber threats and data breaches far outweigh the challenges. By following industry best practices, leveraging specialized techniques, and collaborating with experienced cybersecurity professionals and AI experts, organizations can successfully deploy and maintain AI workloads within an air-gapped environment, ensuring the highest levels of security and compliance with relevant regulations and industry standards.

Best practices and security considerations

Implementing an air-gapped AI environment for sensitive data processing requires a comprehensive approach that prioritizes security and compliance at every stage. By adhering to industry best practices and addressing potential vulnerabilities, organizations can maximize the benefits of air-gapping while mitigating risks and ensuring the integrity of their sensitive data and systems.

According to a report by the Enterprise Strategy Group (ESG), 67% of organizations do not currently implement air-gapping as part of their data protection strategy, leaving them potentially vulnerable to ransomware attacks and other cybersecurity threats. This statistic highlights the importance of adopting air-gapping methodologies and following best practices to safeguard sensitive information.

Quoting Ivan Burazin, co-founder of Codeanywhere, “Government regulations and industry policies for retaining sovereignty and local control over sensitive data continue to evolve. With those regulatory controls come penalties for non-compliance and Service Level Agreement (SLA) failures. Certifying an air gap installation is a great way to pass even the most demanding audit.”

Here are some key best practices and security considerations for implementing an air-gapped AI environment:

  1. Comprehensive Risk Assessment: Conduct a thorough risk assessment to identify potential vulnerabilities, threats, and compliance requirements specific to your organization’s sensitive data and AI operations. This assessment should inform the design and implementation of the air-gapped environment.
  2. Strict Access Controls: Implement robust access controls, such as multi-factor authentication, biometric authentication, and role-based access management, to ensure that only authorized personnel can interact with the air-gapped AI environment. Regular audits and monitoring should be conducted to detect and respond to potential unauthorized access attempts.
  3. Physical Security Measures: Implement physical security measures, such as secure server rooms, surveillance systems, and environmental monitoring, to prevent unauthorized physical access or tampering with the air-gapped hardware components.
  4. Secure Data Transfer Protocols: Establish secure protocols for transferring sensitive data into the air-gapped environment, such as using encrypted physical media or specialized data transfer mechanisms that adhere to air-gapping principles.
  5. Software Vetting and Hardening: Thoroughly vet and harden all software components, including the operating system, AI frameworks, and libraries, to ensure they are free from vulnerabilities and backdoors. Implement security updates and patches in a controlled and secure manner within the air-gapped boundaries.
  6. Secure Collaboration and Version Control: Implement secure collaboration and version control systems within the air-gapped environment to facilitate efficient AI development and deployment while maintaining strict security protocols.
  7. Comprehensive Monitoring and Auditing: Implement comprehensive monitoring and auditing mechanisms to detect and respond to potential security incidents within the air-gapped AI environment. This should include logging and analysis of system events, user activities, and network traffic patterns.
  8. Disaster Recovery and Backup Strategies: Develop robust disaster recovery and backup strategies to protect against data loss or system failures within the air-gapped environment. This may involve redundant storage solutions, regular backups, and well-defined recovery procedures.
  9. Regular Security Assessments and Penetration Testing: Conduct regular security assessments and penetration testing to identify and address potential vulnerabilities within the air-gapped AI environment. This should be performed by experienced cybersecurity professionals and AI experts.
  10. Compliance and Regulatory Adherence: Ensure that the air-gapped AI environment adheres to relevant industry regulations and standards, such as GDPR, HIPAA, or NIST guidelines, depending on the nature of the sensitive data and the organization’s operational requirements.

Access controls and user management

Implementing robust access controls and user management practices is crucial for maintaining the security and integrity of an air-gapped AI environment. Given the sensitive nature of the data and systems involved, it is imperative to ensure that only authorized personnel can interact with the air-gapped setup, and their actions are closely monitored and audited.

According to a report by the Ponemon Institute, the average cost of a data breach in 2022 was $4.35 million, with the healthcare industry facing the highest average cost of $10.1 million per breach. These staggering figures underscore the importance of implementing stringent access controls and user management measures to mitigate the risk of unauthorized access and data breaches.

Quoting Ivan Burazin, co-founder of Codeanywhere, “Government regulations and industry policies for retaining sovereignty and local control over sensitive data continue to evolve. With those regulatory controls come penalties for non-compliance and Service Level Agreement (SLA) failures. Certifying an air gap installation is a great way to pass even the most demanding audit.”

To effectively manage access and user privileges within an air-gapped AI environment, organizations should consider the following best practices:

  1. Multi-Factor Authentication (MFA): Implement MFA as a mandatory requirement for accessing the air-gapped environment. MFA combines multiple authentication factors, such as something the user knows (e.g., a password), something the user has (e.g., a hardware token or mobile app), and something the user is (e.g., biometric data like fingerprints or facial recognition). This layered approach significantly reduces the risk of unauthorized access, even if one authentication factor is compromised.
  2. Role-Based Access Control (RBAC): Adopt an RBAC model to ensure that users are granted access privileges based on their specific roles and responsibilities within the organization. This approach follows the principle of least privilege, minimizing the risk of unauthorized access or accidental misuse of sensitive data and systems.
  3. Privileged Access Management (PAM): Implement PAM solutions to centrally manage and monitor privileged accounts and activities within the air-gapped environment. PAM solutions provide granular control over privileged access, enforce strict policies, and enable comprehensive auditing and reporting.
  4. User Activity Monitoring and Auditing: Implement comprehensive monitoring and auditing mechanisms to track and log all user activities within the air-gapped environment. This includes logging system events, user actions, and network traffic patterns. Regular audits should be conducted to detect and respond to potential security incidents or policy violations.
  5. Secure User Onboarding and Off-boarding: Establish secure processes for onboarding and off-boarding users within the air-gapped environment. This includes thorough background checks, proper documentation, and timely revocation of access privileges when users leave the organization or change roles.
  6. Secure Communication Channels: Implement secure communication channels, such as encrypted messaging or collaboration platforms, to facilitate communication among authorized personnel within the air-gapped environment. This ensures that sensitive information is not inadvertently shared outside the air-gapped boundaries.
  7. Regular Security Awareness Training: Conduct regular security awareness training for all personnel with access to the air-gapped environment. This training should cover topics such as identifying and reporting potential security incidents, best practices for handling sensitive data, and the importance of adhering to access control policies and procedures.

Limitations and challenges

While air-gapping provides an unparalleled level of security for sensitive data and systems, it is not without its limitations and challenges. Organizations must carefully consider these factors to ensure the successful implementation and maintenance of an air-gapped AI environment.

One of the primary limitations of air-gapping is the inherent difficulty in data transfer and software updates. Since air-gapped systems are physically isolated from external networks, data can only be ingested or transferred through physical means, such as removable media like USB drives or optical discs. This process is often manual, slow, and cumbersome, potentially hindering operational efficiency and productivity.

According to a report by the Enterprise Strategy Group (ESG), 67% of organizations do not currently implement air-gapping as part of their data protection strategy, citing challenges such as operational complexity and data transfer limitations.

Quoting Ivan Burazin, co-founder of Codeanywhere, “While air-gapping provides a high level of security, it also introduces challenges in terms of data transfer and software updates. Organizations must carefully weigh the trade-offs between security and operational convenience.”

Another significant challenge is the limited access to external resources and online services within an air-gapped environment. This can hinder troubleshooting efforts, research, and knowledge sharing, as personnel may not have access to the latest documentation, forums, or online support resources.

Maintaining compliance with relevant regulations and industry standards can also be a challenge in an air-gapped environment. Without access to real-time updates and monitoring, organizations must be diligent in ensuring that their air-gapped systems adhere to the latest compliance requirements.

Implementing robust disaster recovery and backup strategies within the air-gapped boundaries can be complex and resource-intensive. Organizations must carefully plan and implement redundant storage solutions, regular backups, and well-defined recovery procedures to mitigate the risk of data loss or system failures.

Scalability is another potential limitation of air-gapped AI environments. As data and computational demands grow, scaling the air-gapped infrastructure to accommodate these needs can be challenging due to the physical isolation constraints and the complexity of introducing new hardware or software components within the air-gapped boundaries.

In my opinion, while the limitations and challenges of air-gapped AI environments are significant, they can be mitigated through careful planning, robust processes, and the adoption of industry best practices. Organizations must weigh the trade-offs between security and operational convenience, and implement measures to address these challenges while maintaining the highest levels of data protection and system integrity. Collaborating with experienced cybersecurity professionals and AI experts can help organizations navigate these complexities and develop tailored solutions that meet their specific security and operational requirements.

Conclusion

In today’s digital landscape, where cyber threats are constantly evolving and data breaches can have catastrophic consequences, implementing robust security measures is paramount. Air-gapping, the practice of physically isolating sensitive systems and data from external networks, offers an unparalleled level of protection against cyber attacks and unauthorized access.

While air-gapping presents challenges in terms of data transfer, software updates, and operational efficiency, the benefits of protecting sensitive information and critical systems far outweigh these drawbacks. By following industry best practices, leveraging specialized techniques, and collaborating with experienced cybersecurity professionals and AI experts, organizations can successfully deploy and maintain AI workloads within an air-gapped environment.

According to a report by the Ponemon Institute, the average cost of a data breach in 2022 was $4.35 million, with the healthcare industry facing the highest average cost of $10.1 million per breach. These staggering figures underscore the importance of implementing robust security measures, such as air-gapping, to protect sensitive data and mitigate the financial and reputational consequences of a breach.

Quoting Ivan Burazin, co-founder of Codeanywhere, “Government regulations and industry policies for retaining sovereignty and local control over sensitive data continue to evolve. With those regulatory controls come penalties for non-compliance and Service Level Agreement (SLA) failures. Certifying an air gap installation is a great way to pass even the most demanding audit.”

By adhering to best practices such as comprehensive risk assessments, strict access controls, secure data transfer protocols, software vetting and hardening, secure collaboration and version control, comprehensive monitoring and auditing, and robust disaster recovery and backup strategies, organizations can maximize the benefits of air-gapping while mitigating potential risks and ensuring compliance with relevant regulations and industry standards.

While air-gapping is not a panacea for all cybersecurity challenges, it remains a robust and effective strategy for protecting critical systems and sensitive information from potential breaches and unauthorized access. As cyber threats continue to evolve, the importance of air-gapping will only increase, particularly in sectors where the consequences of a data breach could be catastrophic, such as government and national security, financial institutions, healthcare, and critical infrastructure.

In my opinion, the decision to implement an air-gapped AI environment should be based on a thorough assessment of an organization’s specific security requirements, operational needs, and risk tolerance. While air-gapping may introduce operational complexities and limitations, the potential consequences of a data breach or cyber attack on sensitive systems can be far more severe and costly.

By embracing air-gapping as part of a comprehensive cybersecurity strategy and investing in the necessary resources, expertise, and ongoing maintenance, organizations can achieve a level of data protection and system integrity that is unparalleled in today’s digital age. As the world becomes increasingly interconnected and reliant on technology, the importance of air-gapping will only continue to grow, ensuring that sensitive data and critical systems remain secure and resilient against the ever-evolving landscape of cyber threats.

By David Richards

David is a technology expert and consultant who advises Silicon Valley startups on their software strategies. He previously worked as Principal Engineer at TikTok and Salesforce, and has 15 years of experience.