[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ABAEHAE07PFC1SA0QAD1K4":3,"skill-same:01M7ABAEHAE07PFC1SA0QAD1K4":87},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":50,"commitSha":51,"skillDirectory":52,"forksCount":14,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":6,"ownerDescription":55,"updatedAt":56,"install":57,"resources":70},"01M7ABAEHAE07PFC1SA0QAD1K4","securing-historian-server-in-ot-environment",null,"Audits and hardens process historian servers (OSIsoft PI, Honeywell PHD, GE Proficy, AVEVA Historian) in OT environments: Purdue-level network placement, interface access control, secure DMZ replication via data diodes or PI-to-PI connectors, SQL injection prevention, and process data integrity. Use when auditing or hardening a historian server, or designing secure OT-to-IT data replication through a DMZ.","NeelakshSaxena\u002FVayu","NeelakshSaxena","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F87892838?v=4","01M7A3B9YFS6F6N9DD1787DT86","Neelaksh Saxena","01M7A3B9ZKBT09MNMPX2XN69BY",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-historian-server-in-ot-environment\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-historian-server-in-ot-environment\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: securing-historian-server-in-ot-environment\ndescription: 'Audits and hardens process historian servers (OSIsoft PI, Honeywell PHD,\n  GE Proficy, AVEVA Historian) in OT environments: Purdue-level network placement,\n  interface access control, secure DMZ replication via data diodes or PI-to-PI connectors,\n  SQL injection prevention, and process data integrity. Use when auditing or hardening\n  a historian server, or designing secure OT-to-IT data replication through a DMZ.\n\n  '\ndomain: cybersecurity\nsubdomain: ot-ics-security\ntags:\n- ot-security\n- ics\n- scada\n- industrial-control\n- iec62443\n- historian\n- osisoft-pi\n- data-integrity\nversion: 1.0.0\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.IR-01\n- DE.CM-01\n- ID.AM-05\n- GV.OC-02\nmitre_attack:\n- T1078\n- T1190\n- T1059\n- T1055\n- T0816\n---\n\n# Securing Historian Server in OT Environment\n\n## When to Use\n\n- When deploying a new historian server in an OT environment and configuring it securely from the start\n- When hardening an existing historian after a security assessment identified it as a high-risk target\n- When designing historian data replication architecture through a DMZ for IT access to process data\n- When implementing access controls to prevent unauthorized modification of historical process data\n- When investigating suspected historian compromise or data integrity issues\n\n**Do not use** for IT-only database security without OT data (see general database hardening), for real-time SCADA data transmission security (see detecting-attacks-on-scada-systems), or for historian selection and sizing decisions.\n\n## Prerequisites\n\n- Historian platform (OSIsoft PI, Honeywell PHD, GE Proficy, AVEVA Historian) installed and operational\n- Network segmentation with historian placed in Level 3 (Site Operations) per Purdue Model\n- Understanding of data flows: field devices -> PLCs -> OPC servers -> historian\n- Access to historian administration credentials\n- DMZ infrastructure for IT-facing data replication\n\n## Workflow\n\n### Step 1: Audit Current Historian Security Configuration\n\nEvaluate the current security posture of the historian server including network exposure, authentication, and access controls.\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"Historian Security Audit Tool.\n\nEvaluates the security configuration of process historian servers\nincluding network exposure, authentication, access controls,\nand data integrity protections.\n\"\"\"\n\nimport json\nimport socket\nimport ssl\nimport subprocess\nimport sys\nfrom dataclasses import dataclass, field, asdict\nfrom datetime import datetime\n\n\n@dataclass\nclass AuditFinding:\n    finding_id: str\n    severity: str\n    category: str\n    title: str\n    detail: str\n    remediation: str\n\n\nclass HistorianSecurityAudit:\n    \"\"\"Security audit for OT historian servers.\"\"\"\n\n    def __init__(self, historian_ip, historian_type=\"PI\"):\n        self.ip = historian_ip\n        self.type = historian_type\n        self.findings = []\n        self.counter = 1\n\n    def check_network_exposure(self):\n        \"\"\"Check which network services are exposed by the historian.\"\"\"\n        print(f\"[*] Checking network exposure: {self.ip}\")\n\n        # Common historian ports\n        ports_to_check = {\n            5450: (\"PI Data Archive\", \"PI SDK\u002FAPI connections\"),\n            5457: (\"PI AF Server\", \"PI Asset Framework\"),\n            5459: (\"PI Notifications\", \"PI Notification Service\"),\n            443: (\"HTTPS\", \"PI Vision \u002F Web API\"),\n            80: (\"HTTP\", \"Unsecured web interface\"),\n            1433: (\"MS SQL Server\", \"Direct database access\"),\n            5432: (\"PostgreSQL\", \"Direct database access\"),\n            3389: (\"RDP\", \"Remote Desktop\"),\n            135: (\"RPC\", \"Windows RPC\"),\n            445: (\"SMB\", \"Windows File Sharing\"),\n            8080: (\"HTTP Alt\", \"Alternative web interface\"),\n        }\n\n        exposed = []\n        for port, (service, desc) in ports_to_check.items():\n            try:\n                sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n                sock.settimeout(3)\n                result = sock.connect_ex((self.ip, port))\n                sock.close()\n                if result == 0:\n                    exposed.append({\"port\": port, \"service\": service, \"description\": desc})\n            except Exception:\n                pass\n\n        # Flag unnecessary exposed services\n        for svc in exposed:\n            if svc[\"port\"] in (80, 135, 445, 3389):\n                self.findings.append(AuditFinding(\n                    finding_id=f\"HIST-{self.counter:03d}\",\n                    severity=\"high\",\n                    category=\"Network Exposure\",\n                    title=f\"Unnecessary service exposed: {svc['service']} (port {svc['port']})\",\n                    detail=f\"Port {svc['port']} ({svc['description']}) is accessible on historian\",\n                    remediation=f\"Disable {svc['service']} or restrict via host firewall\",\n                ))\n                self.counter += 1\n\n        if any(s[\"port\"] == 80 for s in exposed):\n            self.findings.append(AuditFinding(\n                finding_id=f\"HIST-{self.counter:03d}\",\n                severity=\"high\",\n                category=\"Encryption\",\n                title=\"Historian web interface on unencrypted HTTP\",\n                detail=\"Port 80 (HTTP) is open, exposing credentials and data in cleartext\",\n                remediation=\"Redirect HTTP to HTTPS; disable port 80\",\n            ))\n            self.counter += 1\n\n        return exposed\n\n    def check_authentication(self):\n        \"\"\"Check historian authentication configuration.\"\"\"\n        print(f\"[*] Checking authentication configuration\")\n\n        # Check if PI Trust authentication is still enabled (legacy, insecure)\n        # PI Trust allows IP-based authentication without credentials\n        checks = [\n            {\n                \"check\": \"PI Trust Authentication\",\n                \"risk\": \"PI Trust allows connections based on IP address alone without credentials\",\n                \"severity\": \"critical\",\n                \"remediation\": \"Migrate all PI Trust connections to Windows Integrated Security\",\n            },\n            {\n                \"check\": \"Default piadmin account\",\n                \"risk\": \"Default PI administrator account may have default or weak password\",\n                \"severity\": \"critical\",\n                \"remediation\": \"Disable piadmin; use named Windows accounts with PI mappings\",\n            },\n            {\n                \"check\": \"PI SDK anonymous access\",\n                \"risk\": \"Anonymous PI SDK connections may be permitted\",\n                \"severity\": \"high\",\n                \"remediation\": \"Require authentication for all PI SDK connections\",\n            },\n        ]\n\n        for check in checks:\n            self.findings.append(AuditFinding(\n                finding_id=f\"HIST-{self.counter:03d}\",\n                severity=check[\"severity\"],\n                category=\"Authentication\",\n                title=f\"Check: {check['check']}\",\n                detail=check[\"risk\"],\n                remediation=check[\"remediation\"],\n            ))\n            self.counter += 1\n\n    def check_data_integrity(self):\n        \"\"\"Check data integrity protections.\"\"\"\n        print(f\"[*] Checking data integrity protections\")\n\n        integrity_checks = [\n            AuditFinding(\n                finding_id=f\"HIST-{self.counter:03d}\",\n                severity=\"high\",\n                category=\"Data Integrity\",\n                title=\"Verify historical data modification audit trail\",\n                detail=\"Modifications to historical process data should be logged with before\u002Fafter values\",\n                remediation=\"Enable PI audit trail for all data modifications; restrict edit permissions\",\n            ),\n            AuditFinding(\n                finding_id=f\"HIST-{self.counter + 1:03d}\",\n                severity=\"medium\",\n                category=\"Data Integrity\",\n                title=\"Verify backup integrity and recovery testing\",\n                detail=\"Historian backups should be tested regularly for recovery capability\",\n                remediation=\"Implement automated backup verification with quarterly recovery testing\",\n            ),\n        ]\n        self.findings.extend(integrity_checks)\n        self.counter += len(integrity_checks)\n\n    def generate_report(self):\n        \"\"\"Generate historian security audit report.\"\"\"\n        report = []\n        report.append(\"=\" * 70)\n        report.append(\"HISTORIAN SECURITY AUDIT REPORT\")\n        report.append(f\"Target: {self.ip} ({self.type})\")\n        report.append(f\"Date: {datetime.now().isoformat()}\")\n        report.append(\"=\" * 70)\n\n        for sev in [\"critical\", \"high\", \"medium\", \"low\"]:\n            findings = [f for f in self.findings if f.severity == sev]\n            if findings:\n                report.append(f\"\\n--- {sev.upper()} ({len(findings)}) ---\")\n                for f in findings:\n                    report.append(f\"  [{f.finding_id}] {f.title}\")\n                    report.append(f\"    {f.detail}\")\n                    report.append(f\"    Fix: {f.remediation}\")\n\n        return \"\\n\".join(report)\n\n\nif __name__ == \"__main__\":\n    target = sys.argv[1] if len(sys.argv) > 1 else \"10.30.1.50\"\n    audit = HistorianSecurityAudit(target, \"PI\")\n    audit.check_network_exposure()\n    audit.check_authentication()\n    audit.check_data_integrity()\n    print(audit.generate_report())\n```\n\n### Step 2: Harden Historian Server\n\nApply security hardening based on vendor security guides and IEC 62443 requirements.\n\n```powershell\n# OSIsoft PI Server Hardening Script (Windows)\n# Based on OSIsoft Security Best Practices Guide\n\n# 1. Disable PI Trust authentication - migrate to Windows Integrated Security\n# In PI SMT (System Management Tools):\n# Security > Mappings & Trusts > Delete all Trust entries\n# Create PI Mappings for Windows groups instead\n\n# 2. Disable the default piadmin account\n# In PI SMT: Security > Identities, Users & Groups\n# Set piadmin account to disabled\n\n# 3. Configure Windows Firewall for PI Server\nNew-NetFirewallRule -DisplayName \"PI Data Archive\" -Direction Inbound `\n    -Protocol TCP -LocalPort 5450 -Action Allow `\n    -RemoteAddress \"10.30.0.0\u002F16\",\"10.20.0.0\u002F16\" `\n    -Description \"Allow PI SDK connections from OT zones only\"\n\nNew-NetFirewallRule -DisplayName \"PI AF Server\" -Direction Inbound `\n    -Protocol TCP -LocalPort 5457 -Action Allow `\n    -RemoteAddress \"10.30.0.0\u002F16\" `\n    -Description \"Allow PI AF connections from Operations zone\"\n\nNew-NetFirewallRule -DisplayName \"PI Vision HTTPS\" -Direction Inbound `\n    -Protocol TCP -LocalPort 443 -Action Allow `\n    -RemoteAddress \"172.16.0.0\u002F16\" `\n    -Description \"Allow PI Vision HTTPS from DMZ only\"\n\n# Block HTTP (force HTTPS)\nNew-NetFirewallRule -DisplayName \"Block HTTP\" -Direction Inbound `\n    -Protocol TCP -LocalPort 80 -Action Block\n\n# Block RDP from non-authorized sources\nNew-NetFirewallRule -DisplayName \"RDP Restrict\" -Direction Inbound `\n    -Protocol TCP -LocalPort 3389 -Action Allow `\n    -RemoteAddress \"10.30.1.100\" `\n    -Description \"Allow RDP from admin jump server only\"\n\n# 4. Enable Windows audit policies for CIP-007 compliance\nauditpol \u002Fset \u002Fsubcategory:\"Logon\" \u002Fsuccess:enable \u002Ffailure:enable\nauditpol \u002Fset \u002Fsubcategory:\"Account Lockout\" \u002Fsuccess:enable \u002Ffailure:enable\nauditpol \u002Fset \u002Fsubcategory:\"File System\" \u002Fsuccess:enable \u002Ffailure:enable\nauditpol \u002Fset \u002Fsubcategory:\"Registry\" \u002Fsuccess:enable \u002Ffailure:enable\n\n# 5. Configure PI audit trail for data integrity\n# In PI SMT: Audit > Enable auditing for security changes\n# Enable auditing for: point creation\u002Fdeletion, data edits, security changes\n```\n\n### Step 3: Implement Secure Data Replication to DMZ\n\nConfigure historian data replication through the DMZ using PI-to-PI interfaces or data diodes to provide IT access to process data without exposing the OT historian.\n\n```yaml\n# Historian DMZ Replication Architecture\n#\n# OT Historian (Level 3) --> Data Diode --> DMZ Historian (Level 3.5) \u003C-- Enterprise (Level 4)\n#\n# Key principle: Enterprise users NEVER connect directly to the OT historian.\n# Data flows unidirectionally from OT to DMZ.\n\narchitecture:\n  ot_historian:\n    location: \"Level 3 - Site Operations\"\n    server: \"PI-OT-01 (10.30.1.50)\"\n    role: \"Primary data collection from OPC servers and PLCs\"\n    access: \"OT operators and engineers only\"\n\n  data_diode:\n    location: \"Between Level 3 and Level 3.5\"\n    device: \"Waterfall Security Unidirectional Gateway\"\n    direction: \"OT -> DMZ (physically enforced one-way)\"\n    protocol: \"PI-to-PI replication protocol\"\n\n  dmz_historian:\n    location: \"Level 3.5 - DMZ\"\n    server: \"PI-DMZ-01 (172.16.1.50)\"\n    role: \"Read-only mirror of OT historian for enterprise access\"\n    access: \"Enterprise users via PI Vision (HTTPS)\"\n    data_delay: \"Near real-time (typically 5-30 second delay)\"\n\n  enterprise_access:\n    method: \"PI Vision web application on DMZ historian\"\n    authentication: \"Windows Integrated Security with MFA\"\n    protocol: \"HTTPS (TLS 1.2+)\"\n    restrictions:\n      - \"Read-only access to process data\"\n      - \"No write-back capability to OT historian\"\n      - \"No direct database queries - PI Vision API only\"\n      - \"Session timeout after 30 minutes of inactivity\"\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Process Historian | Server that collects, stores, and serves time-series process data from industrial control systems at high frequency (sub-second to seconds) |\n| PI Trust | Legacy OSIsoft PI authentication method based on IP address\u002Fhostname; insecure and should be migrated to Windows Integrated Security |\n| Data Diode | Hardware-enforced unidirectional gateway ensuring historian data flows only from OT to DMZ, preventing reverse access |\n| PI-to-PI Interface | OSIsoft replication mechanism that synchronizes PI data between servers, used for DMZ data mirroring |\n| Audit Trail | Historian feature logging all modifications to historical data with before\u002Fafter values, user identity, and timestamp |\n| Tag Security | Per-tag access control in PI determining which users\u002Fapplications can read or write specific process data points |\n\n## Tools & Systems\n\n- **OSIsoft PI Server**: Industry-leading process historian by AVEVA (formerly OSIsoft) used in 90%+ of large industrial facilities\n- **AVEVA Historian**: Time-series database for process data with SQL-like query interface\n- **Waterfall Security**: Hardware data diode for unidirectional historian replication\n- **PI Vision**: Web-based visualization tool for PI data, deployed in DMZ for enterprise access\n\n## Output Format\n\n```\nHistorian Security Assessment Report\n=====================================\nHistorian: [Type and Version]\nServer: [Hostname\u002FIP]\nNetwork Zone: [Purdue Level]\n\nAUTHENTICATION:\n  PI Trust entries: [N] (should be 0)\n  Default accounts: [enabled\u002Fdisabled]\n  Windows auth: [enabled\u002Fdisabled]\n\nNETWORK EXPOSURE:\n  Open ports: [list]\n  Unnecessary services: [list]\n\nDATA INTEGRITY:\n  Audit trail: [enabled\u002Fdisabled]\n  Backup tested: [date]\n\nDMZ REPLICATION:\n  Method: [PI-to-PI \u002F Data Diode \u002F VPN]\n  Direction: [Unidirectional \u002F Bidirectional]\n```\n","# Securing Historian Server in OT Environment\n\n## When to Use\n\n- When deploying a new historian server in an OT environment and configuring it securely from the start\n- When hardening an existing historian after a security assessment identified it as a high-risk target\n- When designing historian data replication architecture through a DMZ for IT access to process data\n- When implementing access controls to prevent unauthorized modification of historical process data\n- When investigating suspected historian compromise or data integrity issues\n\n**Do not use** for IT-only database security without OT data (see general database hardening), for real-time SCADA data transmission security (see detecting-attacks-on-scada-systems), or for historian selection and sizing decisions.\n\n## Prerequisites\n\n- Historian platform (OSIsoft PI, Honeywell PHD, GE Proficy, AVEVA Historian) installed and operational\n- Network segmentation with historian placed in Level 3 (Site Operations) per Purdue Model\n- Understanding of data flows: field devices -> PLCs -> OPC servers -> historian\n- Access to historian administration credentials\n- DMZ infrastructure for IT-facing data replication\n\n## Workflow\n\n### Step 1: Audit Current Historian Security Configuration\n\nEvaluate the current security posture of the historian server including network exposure, authentication, and access controls.\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"Historian Security Audit Tool.\n\nEvaluates the security configuration of process historian servers\nincluding network exposure, authentication, access controls,\nand data integrity protections.\n\"\"\"\n\nimport json\nimport socket\nimport ssl\nimport subprocess\nimport sys\nfrom dataclasses import dataclass, field, asdict\nfrom datetime import datetime\n\n\n@dataclass\nclass AuditFinding:\n    finding_id: str\n    severity: str\n    category: str\n    title: str\n    detail: str\n    remediation: str\n\n\nclass HistorianSecurityAudit:\n    \"\"\"Security audit for OT historian servers.\"\"\"\n\n    def __init__(self, historian_ip, historian_type=\"PI\"):\n        self.ip = historian_ip\n        self.type = historian_type\n        self.findings = []\n        self.counter = 1\n\n    def check_network_exposure(self):\n        \"\"\"Check which network services are exposed by the historian.\"\"\"\n        print(f\"[*] Checking network exposure: {self.ip}\")\n\n        # Common historian ports\n        ports_to_check = {\n            5450: (\"PI Data Archive\", \"PI SDK\u002FAPI connections\"),\n            5457: (\"PI AF Server\", \"PI Asset Framework\"),\n            5459: (\"PI Notifications\", \"PI Notification Service\"),\n            443: (\"HTTPS\", \"PI Vision \u002F Web API\"),\n            80: (\"HTTP\", \"Unsecured web interface\"),\n            1433: (\"MS SQL Server\", \"Direct database access\"),\n            5432: (\"PostgreSQL\", \"Direct database access\"),\n            3389: (\"RDP\", \"Remote Desktop\"),\n            135: (\"RPC\", \"Windows RPC\"),\n            445: (\"SMB\", \"Windows File Sharing\"),\n            8080: (\"HTTP Alt\", \"Alternative web interface\"),\n        }\n\n        exposed = []\n        for port, (service, desc) in ports_to_check.items():\n            try:\n                sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n                sock.settimeout(3)\n                result = sock.connect_ex((self.ip, port))\n                sock.close()\n                if result == 0:\n                    exposed.append({\"port\": port, \"service\": service, \"description\": desc})\n            except Exception:\n                pass\n\n        # Flag unnecessary exposed services\n        for svc in exposed:\n            if svc[\"port\"] in (80, 135, 445, 3389):\n                self.findings.append(AuditFinding(\n                    finding_id=f\"HIST-{self.counter:03d}\",\n                    severity=\"high\",\n                    category=\"Network Exposure\",\n                    title=f\"Unnecessary service exposed: {svc['service']} (port {svc['port']})\",\n                    detail=f\"Port {svc['port']} ({svc['description']}) is accessible on historian\",\n                    remediation=f\"Disable {svc['service']} or restrict via host firewall\",\n                ))\n                self.counter += 1\n\n        if any(s[\"port\"] == 80 for s in exposed):\n            self.findings.append(AuditFinding(\n                finding_id=f\"HIST-{self.counter:03d}\",\n                severity=\"high\",\n                category=\"Encryption\",\n                title=\"Historian web interface on unencrypted HTTP\",\n                detail=\"Port 80 (HTTP) is open, exposing credentials and data in cleartext\",\n                remediation=\"Redirect HTTP to HTTPS; disable port 80\",\n            ))\n            self.counter += 1\n\n        return exposed\n\n    def check_authentication(self):\n        \"\"\"Check historian authentication configuration.\"\"\"\n        print(f\"[*] Checking authentication configuration\")\n\n        # Check if PI Trust authentication is still enabled (legacy, insecure)\n        # PI Trust allows IP-based authentication without credentials\n        checks = [\n            {\n                \"check\": \"PI Trust Authentication\",\n                \"risk\": \"PI Trust allows connections based on IP address alone without credentials\",\n                \"severity\": \"critical\",\n                \"remediation\": \"Migrate all PI Trust connections to Windows Integrated Security\",\n            },\n            {\n                \"check\": \"Default piadmin account\",\n                \"risk\": \"Default PI administrator account may have default or weak password\",\n                \"severity\": \"critical\",\n                \"remediation\": \"Disable piadmin; use named Windows accounts with PI mappings\",\n            },\n            {\n                \"check\": \"PI SDK anonymous access\",\n                \"risk\": \"Anonymous PI SDK connections may be permitted\",\n                \"severity\": \"high\",\n                \"remediation\": \"Require authentication for all PI SDK connections\",\n            },\n        ]\n\n        for check in checks:\n            self.findings.append(AuditFinding(\n                finding_id=f\"HIST-{self.counter:03d}\",\n                severity=check[\"severity\"],\n                category=\"Authentication\",\n                title=f\"Check: {check['check']}\",\n                detail=check[\"risk\"],\n                remediation=check[\"remediation\"],\n            ))\n            self.counter += 1\n\n    def check_data_integrity(self):\n        \"\"\"Check data integrity protections.\"\"\"\n        print(f\"[*] Checking data integrity protections\")\n\n        integrity_checks = [\n            AuditFinding(\n                finding_id=f\"HIST-{self.counter:03d}\",\n                severity=\"high\",\n                category=\"Data Integrity\",\n                title=\"Verify historical data modification audit trail\",\n                detail=\"Modifications to historical process data should be logged with before\u002Fafter values\",\n                remediation=\"Enable PI audit trail for all data modifications; restrict edit permissions\",\n            ),\n            AuditFinding(\n                finding_id=f\"HIST-{self.counter + 1:03d}\",\n                severity=\"medium\",\n                category=\"Data Integrity\",\n                title=\"Verify backup integrity and recovery testing\",\n                detail=\"Historian backups should be tested regularly for recovery capability\",\n                remediation=\"Implement automated backup verification with quarterly recovery testing\",\n            ),\n        ]\n        self.findings.extend(integrity_checks)\n        self.counter += len(integrity_checks)\n\n    def generate_report(self):\n        \"\"\"Generate historian security audit report.\"\"\"\n        report = []\n        report.append(\"=\" * 70)\n        report.append(\"HISTORIAN SECURITY AUDIT REPORT\")\n        report.append(f\"Target: {self.ip} ({self.type})\")\n        report.append(f\"Date: {datetime.now().isoformat()}\")\n        report.append(\"=\" * 70)\n\n        for sev in [\"critical\", \"high\", \"medium\", \"low\"]:\n            findings = [f for f in self.findings if f.severity == sev]\n            if findings:\n                report.append(f\"\\n--- {sev.upper()} ({len(findings)}) ---\")\n                for f in findings:\n                    report.append(f\"  [{f.finding_id}] {f.title}\")\n                    report.append(f\"    {f.detail}\")\n                    report.append(f\"    Fix: {f.remediation}\")\n\n        return \"\\n\".join(report)\n\n\nif __name__ == \"__main__\":\n    target = sys.argv[1] if len(sys.argv) > 1 else \"10.30.1.50\"\n    audit = HistorianSecurityAudit(target, \"PI\")\n    audit.check_network_exposure()\n    audit.check_authentication()\n    audit.check_data_integrity()\n    print(audit.generate_report())\n```\n\n### Step 2: Harden Historian Server\n\nApply security hardening based on vendor security guides and IEC 62443 requirements.\n\n```powershell\n# OSIsoft PI Server Hardening Script (Windows)\n# Based on OSIsoft Security Best Practices Guide\n\n# 1. Disable PI Trust authentication - migrate to Windows Integrated Security\n# In PI SMT (System Management Tools):\n# Security > Mappings & Trusts > Delete all Trust entries\n# Create PI Mappings for Windows groups instead\n\n# 2. Disable the default piadmin account\n# In PI SMT: Security > Identities, Users & Groups\n# Set piadmin account to disabled\n\n# 3. Configure Windows Firewall for PI Server\nNew-NetFirewallRule -DisplayName \"PI Data Archive\" -Direction Inbound `\n    -Protocol TCP -LocalPort 5450 -Action Allow `\n    -RemoteAddress \"10.30.0.0\u002F16\",\"10.20.0.0\u002F16\" `\n    -Description \"Allow PI SDK connections from OT zones only\"\n\nNew-NetFirewallRule -DisplayName \"PI AF Server\" -Direction Inbound `\n    -Protocol TCP -LocalPort 5457 -Action Allow `\n    -RemoteAddress \"10.30.0.0\u002F16\" `\n    -Description \"Allow PI AF connections from Operations zone\"\n\nNew-NetFirewallRule -DisplayName \"PI Vision HTTPS\" -Direction Inbound `\n    -Protocol TCP -LocalPort 443 -Action Allow `\n    -RemoteAddress \"172.16.0.0\u002F16\" `\n    -Description \"Allow PI Vision HTTPS from DMZ only\"\n\n# Block HTTP (force HTTPS)\nNew-NetFirewallRule -DisplayName \"Block HTTP\" -Direction Inbound `\n    -Protocol TCP -LocalPort 80 -Action Block\n\n# Block RDP from non-authorized sources\nNew-NetFirewallRule -DisplayName \"RDP Restrict\" -Direction Inbound `\n    -Protocol TCP -LocalPort 3389 -Action Allow `\n    -RemoteAddress \"10.30.1.100\" `\n    -Description \"Allow RDP from admin jump server only\"\n\n# 4. Enable Windows audit policies for CIP-007 compliance\nauditpol \u002Fset \u002Fsubcategory:\"Logon\" \u002Fsuccess:enable \u002Ffailure:enable\nauditpol \u002Fset \u002Fsubcategory:\"Account Lockout\" \u002Fsuccess:enable \u002Ffailure:enable\nauditpol \u002Fset \u002Fsubcategory:\"File System\" \u002Fsuccess:enable \u002Ffailure:enable\nauditpol \u002Fset \u002Fsubcategory:\"Registry\" \u002Fsuccess:enable \u002Ffailure:enable\n\n# 5. Configure PI audit trail for data integrity\n# In PI SMT: Audit > Enable auditing for security changes\n# Enable auditing for: point creation\u002Fdeletion, data edits, security changes\n```\n\n### Step 3: Implement Secure Data Replication to DMZ\n\nConfigure historian data replication through the DMZ using PI-to-PI interfaces or data diodes to provide IT access to process data without exposing the OT historian.\n\n```yaml\n# Historian DMZ Replication Architecture\n#\n# OT Historian (Level 3) --> Data Diode --> DMZ Historian (Level 3.5) \u003C-- Enterprise (Level 4)\n#\n# Key principle: Enterprise users NEVER connect directly to the OT historian.\n# Data flows unidirectionally from OT to DMZ.\n\narchitecture:\n  ot_historian:\n    location: \"Level 3 - Site Operations\"\n    server: \"PI-OT-01 (10.30.1.50)\"\n    role: \"Primary data collection from OPC servers and PLCs\"\n    access: \"OT operators and engineers only\"\n\n  data_diode:\n    location: \"Between Level 3 and Level 3.5\"\n    device: \"Waterfall Security Unidirectional Gateway\"\n    direction: \"OT -> DMZ (physically enforced one-way)\"\n    protocol: \"PI-to-PI replication protocol\"\n\n  dmz_historian:\n    location: \"Level 3.5 - DMZ\"\n    server: \"PI-DMZ-01 (172.16.1.50)\"\n    role: \"Read-only mirror of OT historian for enterprise access\"\n    access: \"Enterprise users via PI Vision (HTTPS)\"\n    data_delay: \"Near real-time (typically 5-30 second delay)\"\n\n  enterprise_access:\n    method: \"PI Vision web application on DMZ historian\"\n    authentication: \"Windows Integrated Security with MFA\"\n    protocol: \"HTTPS (TLS 1.2+)\"\n    restrictions:\n      - \"Read-only access to process data\"\n      - \"No write-back capability to OT historian\"\n      - \"No direct database queries - PI Vision API only\"\n      - \"Session timeout after 30 minutes of inactivity\"\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Process Historian | Server that collects, stores, and serves time-series process data from industrial control systems at high frequency (sub-second to seconds) |\n| PI Trust | Legacy OSIsoft PI authentication method based on IP address\u002Fhostname; insecure and should be migrated to Windows Integrated Security |\n| Data Diode | Hardware-enforced unidirectional gateway ensuring historian data flows only from OT to DMZ, preventing reverse access |\n| PI-to-PI Interface | OSIsoft replication mechanism that synchronizes PI data between servers, used for DMZ data mirroring |\n| Audit Trail | Historian feature logging all modifications to historical data with before\u002Fafter values, user identity, and timestamp |\n| Tag Security | Per-tag access control in PI determining which users\u002Fapplications can read or write specific process data points |\n\n## Tools & Systems\n\n- **OSIsoft PI Server**: Industry-leading process historian by AVEVA (formerly OSIsoft) used in 90%+ of large industrial facilities\n- **AVEVA Historian**: Time-series database for process data with SQL-like query interface\n- **Waterfall Security**: Hardware data diode for unidirectional historian replication\n- **PI Vision**: Web-based visualization tool for PI data, deployed in DMZ for enterprise access\n\n## Output Format\n\n```\nHistorian Security Assessment Report\n=====================================\nHistorian: [Type and Version]\nServer: [Hostname\u002FIP]\nNetwork Zone: [Purdue Level]\n\nAUTHENTICATION:\n  PI Trust entries: [N] (should be 0)\n  Default accounts: [enabled\u002Fdisabled]\n  Windows auth: [enabled\u002Fdisabled]\n\nNETWORK EXPOSURE:\n  Open ports: [list]\n  Unnecessary services: [list]\n\nDATA INTEGRITY:\n  Audit trail: [enabled\u002Fdisabled]\n  Backup tested: [date]\n\nDMZ REPLICATION:\n  Method: [PI-to-PI \u002F Data Diode \u002F VPN]\n  Direction: [Unidirectional \u002F Bidirectional]\n```\n",{"name":5,"tags":25,"author":34,"domain":35,"license":15,"version":36,"nist_csf":37,"subdomain":42,"description":43,"mitre_attack":44},[26,27,28,29,30,31,32,33],"ot-security","ics","scada","industrial-control","iec62443","historian","osisoft-pi","data-integrity","mahipal","cybersecurity","1.0.0",[38,39,40,41],"PR.IR-01","DE.CM-01","ID.AM-05","GV.OC-02","ot-ics-security","Audits and hardens process historian servers (OSIsoft PI, Honeywell PHD, GE Proficy, AVEVA Historian) in OT environments: Purdue-level network placement, interface access control, secure DMZ replication via data diodes or PI-to-PI connectors, SQL injection prevention, and process data integrity. Use when auditing or hardening a historian server, or designing secure OT-to-IT data replication through a DMZ.\n",[45,46,47,48,49],"T1078","T1190","T1059","T1055","T0816","main","7540bbccf0c1ded6156a467b02c95b61ad62413f",".agents\u002Fskills\u002Fsecuring-historian-server-in-ot-environment","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena","Currently exploring the intersection of tech","2026-09-11 03:02:31",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add NeelakshSaxena\u002FVayu --skill securing-historian-server-in-ot-environment",{"tool":63,"command":64},"bunx","bunx skills add NeelakshSaxena\u002FVayu --skill securing-historian-server-in-ot-environment",{"tool":66,"command":67},"pnpm","pnpm dlx skills add NeelakshSaxena\u002FVayu --skill securing-historian-server-in-ot-environment","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-historian-server-in-ot-environment\u002FSKILL.md",true,[71,75,81],{"path":72,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":74,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":76,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":79,"sourceHtmlUrl":80},"references\u002Fapi-reference.md","REFERENCE","参考文档",1521,"https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-historian-server-in-ot-environment\u002Freferences\u002Fapi-reference.md",{"path":82,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":85,"sourceHtmlUrl":86},"scripts\u002Fagent.py","SCRIPT","脚本",8022,"https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-historian-server-in-ot-environment\u002Fscripts\u002Fagent.py",[88,95,102,109,116,123],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":20},"01M7ACCCVNCFKMA9X6D15X6G98","runpodctl","Runpod CLI for managing GPU\u002FCPU workloads from the terminal — pods, serverless endpoints, templates, network volumes, Hub deploys, models, SSH, and file transfer (send\u002Freceive). Use for terminal\u002FCI\u002Fscripting, Hub browse\u002Fdeploy, SSH setup, `doctor`, or when the Runpod MCP tools are not connected. For structured tool calls in an MCP-enabled session, prefer runpod-mcp.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpodctl\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":20},"01M7ACC63SRHEA5KMCHSMZK2TC","runpod","Start here for any Runpod task — running GPU\u002FCPU pods, deploying serverless endpoints, templates, network volumes, building images, or understanding how Runpod works. Routes to the right skill (runpod-mcp, runpodctl, flash, companion-clis, runpod-usage, runpod-templates, runpod-migrate) and indexes two dozen live-verified end-to-end examples (golden paths) — use it when the lane is unclear, and for any multi-step or provisioning task even when it is not.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":20},"01M7ACC0Q1C89N9BZBV91CTQTF","runpod-usage","How Runpod works and how to work it — pods vs serverless, GPU\u002FVRAM selection, storage, building a container, networking, plus the agentic pod development loop (provision → ssh-exec → set up → poll readiness) and on-pod install hygiene (uv\u002Fapt). Use to answer \"how does X work\", \"which GPU\", \"how do I build a container\", or \"how do I stand up a workload on a pod\". Guidance, not a tool — execute with runpodctl, runpod-mcp, or flash.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-usage\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":20},"01M7ACBRPE345GF5GM5B8P8RRC","runpod-templates","Runpod's official prebuilt pod templates (ComfyUI, PyTorch, and others): what each image ships, which ports and paths it uses, how to pick one, how to pin a version, and what is missing on first boot. Use when a task says \"run \u003CX> on a pod\" and an official template already covers it, instead of building an image — and when a user needs help with or wants to fix something about a Runpod template they are already running (won't boot, can't reach the UI, missing models, wrong CUDA line, broken ComfyUI workflow metadata on imported workflows): start here and route onward. Deploy with runpodctl or runpod-mcp; end-to-end walkthroughs live in the runpod router's golden paths.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-templates\u002FSKILL.md",[],[],{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":122,"publishedAt":20},"01M7ACBJATHKVX1TWES2F44GY8","runpod-migrate","Migrate a codebase from the Runpod GraphQL API or REST v1 to REST v2 — inventory which parts use which API version, rewrite the call sites, flag breaking changes, and verify. Use when someone asks to move to v2, asks what v2 would change, or asks which Runpod API their code is on. For managing infrastructure rather than migrating code, use runpod-mcp or runpodctl.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-migrate\u002FSKILL.md",[],[],{"skillNo":124,"name":125,"nameZh":6,"description":126,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":127,"categories":128,"keywords":129,"publishedAt":20},"01M7ACBC7GHVH6T9YEAPCG2AP8","runpod-mcp","Manage Runpod infrastructure — pods, serverless endpoints, jobs, templates, network volumes, container-registry auth, GPU\u002FCPU catalog, and billing — via the Runpod MCP server's structured tool calls. Use when the Runpod MCP tools (create-pod, list-endpoints, …) are connected in this session, or to connect them (hosted OAuth or local npx). Prefer this over runpodctl for plain infra CRUD when MCP is available; use runpodctl for the terminal, file transfer, or SSH setup.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-mcp\u002FSKILL.md",[],[]]