SafeAI documentation

Device setup guides by vendor

Point each platform at SafeAI — the read-only account, device logs, SNMP and access control. Copy-and-paste, per vendor.

Everything SafeAI reads on each platform, with a complete, hardened, copy-and-paste onboarding per vendor. Every recipe is read-only and scoped to SafeAI’s address only: a least-privilege account or API role, hardened access, the device’s logs sent to SafeAI, read-only SNMP and NetFlow/IPFIX where the platform supports them, and NTP. SafeAI never changes a device. Fill in the placeholders at the top of each block — <SAFEAI-IP> is the SafeAI server’s address (the lab uses 10.100.0.61). Platforms marked preview are built from vendor documentation and not yet proven on a real device — the compatibility matrix says exactly what is tested where.

Network devices — read over SSH

Cisco IOS / IOS XE

! ============================================================================
!  SafeAI onboarding — Cisco IOS / IOS-XE (15.x / 16.x / 17.x)
!  SafeAI is READ-ONLY: it logs in, runs show/more commands, and reads syslog,
!  NetFlow and SNMP. It never changes the device. Everything below is scoped
!  to SafeAI's address only.
!
!  Fill in:
!    <SAFEAI-IP>      SafeAI's address as this device reaches it   (lab: 10.100.0.61)
!    <READONLY-PW>    a strong password for the SafeAI read account
!    <SNMP-AUTH-PW>   SNMPv3 auth passphrase
!    <SNMP-PRIV-PW>   SNMPv3 privacy passphrase
!    <SRC-INTF>       the interface SafeAI reaches this device on (e.g. Loopback0 / GigabitEthernet0/0)
! ============================================================================

! --- 0. Prerequisites for SSH key generation ------------------------------
hostname EDGE-RTR-01
ip domain name corp.example.com

! --- 1. Restrict every SafeAI touchpoint to SafeAI's address --------------
ip access-list standard SAFEAI-MGMT
 permit host <SAFEAI-IP>
 deny   any log

! --- 2. Least-privilege read-only account (privilege level 5) -------------
!  SafeAI reads the config via 'more system:running-config' at level 5, plus
!  show/ping for inventory, interfaces, routes and reachability. No config mode.
!  NOTE: 'privilege exec level 5 show' raises 'show' to level 5 globally; in a
!  shared device keep your admins at privilege 15 (they are unaffected).
file privilege 5
privilege exec level 5 show
privilege exec level 5 more
privilege exec level 5 terminal
privilege exec level 5 ping
username safeai privilege 5 algorithm-type scrypt secret <READONLY-PW>

! --- 3. SSH, hardened (avoids the legacy-algorithm flag on SafeAI Health) --
crypto key generate rsa modulus 4096 label SAFEAI-SSH
ip ssh version 2
ip ssh time-out 60
ip ssh authentication-retries 3
ip ssh server algorithm hostkey rsa-sha2-512 rsa-sha2-256
ip ssh server algorithm kex ecdh-sha2-nistp384 ecdh-sha2-nistp256 diffie-hellman-group14-sha256
ip ssh server algorithm encryption aes256-ctr aes192-ctr aes128-ctr
ip ssh server algorithm mac hmac-sha2-512 hmac-sha2-256

! --- 4. VTY: SSH only, from SafeAI only -----------------------------------
line vty 0 15
 access-class SAFEAI-MGMT in
 exec-timeout 10 0
 login local
 transport input ssh
 transport output none

! --- 5. Send device logs to SafeAI (syslog) -------------------------------
service timestamps log datetime msec localtime show-timezone
service timestamps debug datetime msec localtime show-timezone
logging source-interface <SRC-INTF>
logging host <SAFEAI-IP> transport udp port 514      ! lab maps 514 -> 5514 on the SafeAI host
logging trap informational
archive
 log config
  logging enable
  notify syslog contenttype plaintext

! --- 6. SNMPv3 read-only (used for discovery), SafeAI-only ----------------
snmp-server view  SAFEAI-RO iso included
snmp-server group SAFEAI-RO v3 priv read SAFEAI-RO access SAFEAI-MGMT
snmp-server user  safeai-snmp SAFEAI-RO v3 auth sha <SNMP-AUTH-PW> priv aes 256 <SNMP-PRIV-PW>

! --- 7. NetFlow / IPFIX export to SafeAI:2055 (Flexible NetFlow) -----------
flow record SAFEAI-IPV4
 match ipv4 source address
 match ipv4 destination address
 match ipv4 protocol
 match transport source-port
 match transport destination-port
 match ipv4 tos
 collect interface input
 collect interface output
 collect counter bytes long
 collect counter packets long
 collect transport tcp flags
 collect timestamp sys-uptime first
 collect timestamp sys-uptime last
flow exporter SAFEAI-EXPORT
 destination <SAFEAI-IP>
 source <SRC-INTF>
 transport udp 2055
 template data timeout 60
 option interface-table timeout 60
 option application-table timeout 60
flow monitor SAFEAI-MON
 exporter SAFEAI-EXPORT
 cache timeout active 60
 cache timeout inactive 15
 record SAFEAI-IPV4
!
! Apply on each interface you want traffic visibility for (both directions):
interface <SRC-INTF>
 ip flow monitor SAFEAI-MON input
 ip flow monitor SAFEAI-MON output

! --- 8. Save --------------------------------------------------------------
end
write memory

Cisco NX-OS

! ============================================================================
!  SafeAI onboarding — Cisco NX-OS (Nexus 3k/5k/7k/9k)
!  SafeAI is READ-ONLY: show/more reads, plus syslog, NetFlow and SNMP. It never
!  changes the device. Scoped to SafeAI's address and the management VRF.
!
!  Fill in:
!    <SAFEAI-IP>     SafeAI's address                              (lab: 10.100.0.61)
!    <READONLY-PW>   strong password for the SafeAI read account
!    <SNMP-AUTH-PW>  SNMPv3 auth passphrase
!    <SNMP-PRIV-PW>  SNMPv3 privacy passphrase
!    <MGMT-SVI>      the L3 interface SafeAI reaches you on (e.g. mgmt0)
! ============================================================================

! --- 1. Features used for telemetry ---------------------------------------
feature ssh
feature netflow

! --- 2. Least-privilege read-only account (built-in network-operator) -----
username safeai password 0 <READONLY-PW> role network-operator

! --- 3. Restrict management (ACL on the mgmt VRF / mgmt0) ------------------
ip access-list SAFEAI-MGMT
 10 permit ip host <SAFEAI-IP> any
 20 deny  ip any any log
interface mgmt0
 ip access-group SAFEAI-MGMT in

! --- 4. Harden SSH --------------------------------------------------------
ssh key rsa 4096 force
ssh login-attempts 3

! --- 5. Send device logs to SafeAI (via the management VRF) ----------------
logging timestamp milliseconds
logging server <SAFEAI-IP> 6 use-vrf management facility local7   ! 514; lab host remaps to 5514
logging source-interface mgmt0

! --- 6. SNMPv3 read-only, SafeAI-only -------------------------------------
snmp-server user safeai-snmp network-operator auth sha <SNMP-AUTH-PW> priv aes-128 <SNMP-PRIV-PW>
snmp-server host <SAFEAI-IP> version 3 priv safeai-snmp use-vrf management

! --- 7. NetFlow / IPFIX export to SafeAI:2055 ------------------------------
flow exporter SAFEAI-EXPORT
 destination <SAFEAI-IP> use-vrf management
 source mgmt0
 transport udp 2055
 version 9
flow record SAFEAI-IPV4
 match ipv4 source address
 match ipv4 destination address
 match ip protocol
 match transport source-port
 match transport destination-port
 collect counter bytes
 collect counter packets
 collect transport tcp flags
flow monitor SAFEAI-MON
 record SAFEAI-IPV4
 exporter SAFEAI-EXPORT
! Apply on each L3 interface you want traffic for:
interface Ethernet1/1
 ip flow monitor SAFEAI-MON input

! --- 8. Clock + save ------------------------------------------------------
ntp server <SAFEAI-IP> use-vrf management        ! or your NTP server
end
copy running-config startup-config

Cisco IOS XR

! ============================================================================
!  SafeAI onboarding — Cisco IOS XR (ASR9k / NCS / XRv)
!  SafeAI is READ-ONLY: show reads over SSH, plus syslog, NetFlow/IPFIX and SNMP.
!  It never changes the router. Scoped to SafeAI's address. Paste, then commit.
!
!  Fill in:
!    <SAFEAI-IP>     SafeAI's address                              (lab: 10.100.0.61)
!    <READONLY-PW>   strong password for the SafeAI read account
!    <SNMP-AUTH-PW>  SNMPv3 auth passphrase
!    <SNMP-PRIV-PW>  SNMPv3 privacy passphrase
!    <SRC-INTF>      interface SafeAI reaches you on (e.g. MgmtEth0/RP0/CPU0/0)
! ============================================================================

! --- 1. Least-privilege read-only account (built-in read-only-tg) ---------
username safeai
 group read-only-tg
 secret <READONLY-PW>
!
! --- 2. Restrict management with an ingress ACL on the mgmt interface -----
ipv4 access-list SAFEAI-MGMT
 10 permit ipv4 host <SAFEAI-IP> any
 20 deny ipv4 any any
!
interface <SRC-INTF>
 ipv4 access-group SAFEAI-MGMT ingress
!
! --- 3. Harden SSH --------------------------------------------------------
ssh server v2
ssh server rate-limit 10
ssh timeout 60
!
! --- 4. Send device logs to SafeAI ----------------------------------------
logging <SAFEAI-IP> vrf default severity info
logging source-interface <SRC-INTF>
logging suppress duplicates
!
! --- 5. SNMPv3 read-only, SafeAI-only -------------------------------------
snmp-server view SAFEAI-RO 1.3.6 included
snmp-server group SAFEAI-RO v3 priv read SAFEAI-RO
snmp-server user safeai-snmp SAFEAI-RO v3 auth sha <SNMP-AUTH-PW> priv aes 128 <SNMP-PRIV-PW>
!
! --- 6. NetFlow / IPFIX export to SafeAI:2055 -----------------------------
flow exporter-map SAFEAI-EXPORT
 version v9
  template timeout 60
 !
 transport udp 2055
 source <SRC-INTF>
 destination <SAFEAI-IP>
!
flow monitor-map SAFEAI-MON
 record ipv4
 exporter SAFEAI-EXPORT
 cache timeout active 60
 cache timeout inactive 15
!
sampler-map SAFEAI-SMP
 random 1 out-of 100
!
interface <SRC-INTF>
 flow ipv4 monitor SAFEAI-MON sampler SAFEAI-SMP ingress
!
! --- 7. Clock + commit ----------------------------------------------------
ntp server <SAFEAI-IP>
commit
end

Cisco ASA

! ============================================================================
!  SafeAI onboarding — Cisco ASA (9.x)
!  SafeAI is READ-ONLY: it runs show/more over SSH and reads syslog, NSEL
!  (NetFlow) and SNMP. 'show running-config' needs privilege 15 on the ASA, so
!  use a TACACS+ account limited to show/enable, or the local account below with
!  command authorization left to your AAA. Scoped to SafeAI's address.
!
!  Fill in:
!    <SAFEAI-IP>     SafeAI's address                              (lab: 10.100.0.61)
!    <READONLY-PW>   strong password for the SafeAI read account
!    <SNMP-AUTH-PW>  SNMPv3 auth passphrase
!    <SNMP-PRIV-PW>  SNMPv3 privacy passphrase
!    <MGMT-IF>       the nameif SafeAI reaches you on (e.g. management)
! ============================================================================

! --- 1. Read account (privilege 5; your AAA limits it to show/more) --------
username safeai password <READONLY-PW> privilege 5

! --- 2. SSH only, from SafeAI only, hardened ------------------------------
ssh <SAFEAI-IP> 255.255.255.255 <MGMT-IF>
ssh version 2
ssh key-exchange group dh-group14-sha256
ssh cipher encryption high
ssh cipher integrity high
ssh timeout 10
aaa authentication ssh console LOCAL

! --- 3. Send device logs to SafeAI ----------------------------------------
logging enable
logging timestamp
logging host <MGMT-IF> <SAFEAI-IP>
logging trap informational

! --- 4. SNMPv3 read-only, SafeAI-only -------------------------------------
snmp-server group SAFEAI-RO v3 priv
snmp-server user safeai-snmp SAFEAI-RO v3 auth sha <SNMP-AUTH-PW> priv aes 128 <SNMP-PRIV-PW>
snmp-server host <MGMT-IF> <SAFEAI-IP> version 3 safeai-snmp

! --- 5. NetFlow Secure Event Logging (NSEL) to SafeAI:2055 -----------------
flow-export destination <MGMT-IF> <SAFEAI-IP> 2055
flow-export template timeout-rate 1
policy-map global_policy
 class class-default
  flow-export event-type all destination <SAFEAI-IP>

! --- 6. Clock + save ------------------------------------------------------
ntp server <SAFEAI-IP>
write memory

Cisco Firepower (FTD)

! ============================================================================
!  SafeAI onboarding — Cisco Firepower Threat Defense (FTD)
!  SafeAI is READ-ONLY. It reads the data-plane config over the FTD CLI
!  ('show running-config' at the > prompt, ASA syntax). Management-plane items
!  (SSH access, syslog, SNMP, NetFlow) are set in FMC or FDM, not on the CLI.
!
!  Fill in:  <SAFEAI-IP> SafeAI's address (lab: 10.100.0.61); <READONLY-PW> a strong password.
! ============================================================================

! --- 1. Read-only CLI user (on the FTD CLI, as admin) ---------------------
!  'basic' users can run show commands only; they cannot enter configure mode.
configure user add safeai basic
! (enter <READONLY-PW> when prompted)

! --- 2. Allow SSH from SafeAI only ----------------------------------------
!  FMC:  Devices > Platform Settings > Secure Shell — add host <SAFEAI-IP> on the mgmt interface.
!  FDM:  Device > System Settings > Management Access — add <SAFEAI-IP>.

! --- 3. Send syslog to SafeAI ---------------------------------------------
!  FMC:  Devices > Platform Settings > Syslog — add server <SAFEAI-IP>, UDP 514, severity Informational.

! --- 4. SNMPv3 read-only --------------------------------------------------
!  FMC:  Devices > Platform Settings > SNMP — v3 user 'safeai-snmp', auth SHA, priv AES-128, read-only,
!        host <SAFEAI-IP>.

! --- 5. NetFlow (per-application traffic) ---------------------------------
!  FMC:  Devices > Platform Settings > NetFlow — enable, collector <SAFEAI-IP>:2055, and add a
!        traffic class to export. Deploy the platform settings to the device.

Arista EOS

! ============================================================================
!  SafeAI onboarding — Arista EOS
!  SafeAI is READ-ONLY: show reads over SSH (eAPI optional), plus syslog, IPFIX
!  and SNMP. It never changes the switch. Scoped to SafeAI's address.
!
!  Fill in:
!    <SAFEAI-IP>     SafeAI's address                              (lab: 10.100.0.61)
!    <READONLY-PW>   strong password for the SafeAI read account
!    <SNMP-AUTH-PW>  SNMPv3 auth passphrase
!    <SNMP-PRIV-PW>  SNMPv3 privacy passphrase
!    <MGMT-INTF>     interface SafeAI reaches you on (e.g. Management1)
! ============================================================================

! --- 1. Least-privilege read-only account (built-in network-operator) -----
!  privilege 15 lets it reach 'show running-config'; the role still refuses config.
username safeai privilege 15 role network-operator secret <READONLY-PW>

! --- 2. Restrict management to SafeAI -------------------------------------
ip access-list SAFEAI-MGMT
 10 permit ip host <SAFEAI-IP> any
 20 deny ip any any log
!
management ssh
 ip access-group SAFEAI-MGMT in
 idle-timeout 10

! --- 3. Send device logs to SafeAI ----------------------------------------
logging host <SAFEAI-IP> 514 protocol udp
logging source-interface <MGMT-INTF>
logging trap informational
aaa accounting commands all default start-stop logging

! --- 4. SNMPv3 read-only, SafeAI-only -------------------------------------
snmp-server view SAFEAI-RO iso included
snmp-server group SAFEAI-RO v3 priv read SAFEAI-RO
snmp-server user safeai-snmp SAFEAI-RO v3 auth sha <SNMP-AUTH-PW> priv aes <SNMP-PRIV-PW>

! --- 5. IPFIX export to SafeAI:2055 ---------------------------------------
flow tracking hardware
 tracker SAFEAI
  record export on inactive timeout 15000
  record export on interval 60000
  exporter SAFEAI-EXPORT
   collector <SAFEAI-IP> port 2055
   local interface <MGMT-INTF>
   format ipfix version 10
  no shutdown
!
! Apply on each interface you want traffic for:
interface Ethernet1
 flow tracker hardware SAFEAI

! --- 6. Clock + save ------------------------------------------------------
ntp server <SAFEAI-IP>
end
write memory

Juniper Junos

# ============================================================================
#  SafeAI onboarding — Juniper Junos (MX / EX / SRX / QFX)
#  SafeAI is READ-ONLY: a read-only login class (view + view-configuration),
#  plus syslog, inline IPFIX and SNMP. It never changes the device. Scoped to
#  SafeAI's address. Paste in configuration mode, then 'commit and-quit'.
#
#  Fill in:
#    <SAFEAI-IP>     SafeAI's address                              (lab: 10.100.0.61)
#    <READONLY-PW>   strong password for the SafeAI read account
#    <SNMP-AUTH-PW>  SNMPv3 auth passphrase
#    <SNMP-PRIV-PW>  SNMPv3 privacy passphrase
#    <MGMT-INTF>     interface SafeAI reaches you on (e.g. fxp0.0 / ge-0/0/0.0)
# ============================================================================

# --- 1. Least-privilege read-only class + account -------------------------
set system login class safeai-ro permissions [ view view-configuration ]
set system login class safeai-ro idle-timeout 10
set system login user safeai class safeai-ro authentication plain-text-password
# (enter <READONLY-PW> when prompted)

# --- 2. Restrict SSH to SafeAI only + harden ------------------------------
set system services ssh protocol-version v2
set system services ssh ciphers [ aes256-ctr aes256-gcm@openssh.com ]
set system services ssh macs [ hmac-sha2-256 hmac-sha2-512 ]
set system services ssh key-exchange [ ecdh-sha2-nistp256 group14-sha256 ]
set system services ssh connection-limit 5
set firewall family inet filter SAFEAI-MGMT term allow from source-address <SAFEAI-IP>/32
set firewall family inet filter SAFEAI-MGMT term allow then accept
set firewall family inet filter SAFEAI-MGMT term drop then discard
set interfaces <MGMT-INTF> family inet filter input SAFEAI-MGMT

# --- 3. Send device logs to SafeAI (commits log as UI_COMMIT) -------------
set system syslog host <SAFEAI-IP> any notice
set system syslog host <SAFEAI-IP> interactive-commands info
set system syslog time-format year millisecond

# --- 4. SNMPv3 read-only, SafeAI-only -------------------------------------
set snmp view SAFEAI-RO oid .1 include
set snmp v3 usm local-engine user safeai-snmp authentication-sha authentication-key <SNMP-AUTH-PW>
set snmp v3 usm local-engine user safeai-snmp privacy-aes128 privacy-key <SNMP-PRIV-PW>
set snmp v3 vacm security-to-group security-model usm security-name safeai-snmp group SAFEAI-RO
set snmp v3 vacm access group SAFEAI-RO default-context-prefix security-model usm security-level privacy read-view SAFEAI-RO

# --- 5. Inline IPFIX export to SafeAI:2055 --------------------------------
set services flow-monitoring version-ipfix template SAFEAI-T ipv4-template
set forwarding-options sampling instance SAFEAI input rate 100
set forwarding-options sampling instance SAFEAI family inet output flow-server <SAFEAI-IP> port 2055
set forwarding-options sampling instance SAFEAI family inet output flow-server <SAFEAI-IP> version-ipfix template SAFEAI-T
# Apply the sampler on each interface you want traffic for:
set interfaces ge-0/0/0 unit 0 family inet sampling input

# --- 6. Clock + commit ----------------------------------------------------
set system ntp server <SAFEAI-IP>
commit and-quit

Fortinet FortiOS

# ============================================================================
#  SafeAI onboarding — Fortinet FortiGate (FortiOS 7.0 / 7.2 / 7.4)
#  SafeAI is READ-ONLY: get/show/diagnose reads over SSH, plus syslog, NetFlow
#  and SNMP. It never changes the firewall. Scoped to SafeAI's address only.
#
#  Fill in:
#    <SAFEAI-IP>     SafeAI's address                              (lab: 10.100.0.61)
#    <READONLY-PW>   strong password for the SafeAI read account
#    <SNMP-AUTH-PW>  SNMPv3 auth passphrase
#    <SNMP-PRIV-PW>  SNMPv3 privacy passphrase
#    <MGMT-INTF>     the interface SafeAI reaches you on (e.g. port1 / mgmt)
#    <NTP>           your NTP server
# ============================================================================

# --- 1. Harden management crypto (TLS / SSH), global ----------------------
config system global
    set strong-crypto enable
    set admin-https-ssl-versions tlsv1-2 tlsv1-3
    set ssh-enc-algo chacha20-poly1305@openssh.com aes256-ctr aes256-gcm@openssh.com
    set ssh-mac-algo hmac-sha2-256 hmac-sha2-512
    set ssh-kex-algo ecdh-sha2-nistp256 ecdh-sha2-nistp384 diffie-hellman-group14-sha256
    set admin-lockout-threshold 3
end

# --- 2. Least-privilege read-only profile ---------------------------------
config system accprofile
    edit "safeai-ro"
        set secfabgrp read
        set ftviewgrp read
        set authgrp read
        set sysgrp read
        set netgrp read
        set loggrp read
        set fwgrp read
        set vpngrp read
        set utmgrp read
        set wanoptgrp read
        set wifi read
    next
end

# --- 3. SafeAI read account, allowed ONLY from SafeAI's address -----------
#  trusthost1 limits every GUI/SSH/API login for this admin to SafeAI.
config system admin
    edit "safeai-ro"
        set accprofile "safeai-ro"
        set trusthost1 <SAFEAI-IP> 255.255.255.255
        set password <READONLY-PW>
    next
end

# --- 4. Allow SSH + SNMP on the management interface ----------------------
config system interface
    edit "<MGMT-INTF>"
        set allowaccess ping https ssh snmp
    next
end

# --- 5. Send device logs to SafeAI (syslog) -------------------------------
config log syslogd setting
    set status enable
    set server "<SAFEAI-IP>"
    set port 514
    set facility local7
end
config log syslogd filter
    set severity information
end

# --- 6. SNMPv3 read-only, SafeAI-only -------------------------------------
config system snmp sysinfo
    set status enable
end
config system snmp user
    edit "safeai-snmp"
        set security-level auth-priv
        set auth-proto sha256
        set auth-pwd <SNMP-AUTH-PW>
        set priv-proto aes256
        set priv-pwd <SNMP-PRIV-PW>
        set queries enable
        set notify-hosts <SAFEAI-IP>
    next
end

# --- 7. NetFlow / IPFIX export to SafeAI:2055 -----------------------------
config system netflow
    set collector-ip <SAFEAI-IP>
    set collector-port 2055
    set active-flow-timeout 60
    set inactive-flow-timeout 15
end
# Apply on each interface you want traffic for (both directions):
config system interface
    edit "<MGMT-INTF>"
        set netflow-sampler both
    next
end

# --- 8. Clock (FortiOS saves automatically) -------------------------------
config system ntp
    set ntpsync enable
    set type custom
    config ntpserver
        edit 1
            set server "<NTP>"
        next
    end
end

FRRouting (Linux)

#!/bin/sh
# ============================================================================
#  SafeAI onboarding — FRRouting on Linux (SD-WAN edges, routers)
#  SafeAI is READ-ONLY: it reads FRR config (vtysh, group frrvty) and the host,
#  and receives syslog and (optional) NetFlow. It never changes the device.
#  Run as root.   usage:  SAFEAI=<SafeAI address> sh frrouting-linux.sh
#  Lab: SAFEAI=10.100.0.61
# ============================================================================
set -eu
: "${SAFEAI:?set SAFEAI to the SafeAI server's address}"

# --- 1. Read-only account (no shell changes allowed) -----------------------
id safeai >/dev/null 2>&1 || useradd -m -s /bin/sh safeai 2>/dev/null || adduser -D -s /bin/sh safeai
echo "Set the SafeAI account password (or install SafeAI's public key in ~safeai/.ssh/authorized_keys):"
passwd safeai

# --- 2. Let it read FRR's configuration (group frrvty) ---------------------
getent group frrvty >/dev/null && { usermod -aG frrvty safeai 2>/dev/null || addgroup safeai frrvty; }

# --- 3. WireGuard tunnels (optional) — display only; keys are never shown ---
command -v wg >/dev/null && {
  echo "safeai ALL=(root) NOPASSWD: $(command -v wg) show all" > /etc/sudoers.d/safeai
  chmod 440 /etc/sudoers.d/safeai
}

# --- 4. Harden sshd for this account (key-only, no root) --------------------
if [ -d /etc/ssh/sshd_config.d ]; then
  cat > /etc/ssh/sshd_config.d/60-safeai.conf <<EOF
PermitRootLogin no
Match User safeai
    PasswordAuthentication yes
    X11Forwarding no
    AllowTcpForwarding no
    PermitTTY yes
EOF
  systemctl reload sshd 2>/dev/null || service ssh reload || true
fi

# --- 5. Send device logs to SafeAI (rsyslog) -------------------------------
if [ -d /etc/rsyslog.d ]; then
  echo "*.notice;authpriv.* @${SAFEAI}:514" > /etc/rsyslog.d/60-safeai.conf
  systemctl restart rsyslog 2>/dev/null || service rsyslog restart
fi

# --- 6. NetFlow / IPFIX (optional, per-application bandwidth) ---------------
#   softflowd -i <iface> -n ${SAFEAI}:2055 -v 9       # install softflowd first

# --- 7. Keep the clock synced ----------------------------------------------
command -v timedatectl >/dev/null && timedatectl set-ntp true || true

echo "Done: 'safeai' can read FRR and the host. Nothing it runs can change the device.\"

Nokia SR Linux

# ============================================================================
#  SafeAI onboarding — Nokia SR Linux (7220 / 7250)
#  SafeAI is READ-ONLY: a read-only role over SSH/gNMI, plus remote syslog and
#  (where supported) sampled export. It never changes the switch. Scoped to the
#  management network-instance. Enter candidate mode, paste, then 'commit now'.
#
#  Fill in:  <SAFEAI-IP> SafeAI's address (lab: 10.100.0.61); <READONLY-PW> a strong password.
# ============================================================================

# --- 1. Read-only role + account ------------------------------------------
set / system aaa authorization role safeai-ro services [ cli gnmi ]
set / system configuration role safeai-ro rule / action read
set / system aaa authentication user safeai password <READONLY-PW> role [ safeai-ro ]

# --- 2. Restrict mgmt SSH to SafeAI (ACL on the mgmt network-instance) -----
set / acl ipv4-filter safeai-mgmt entry 10 match source-ip prefix <SAFEAI-IP>/32
set / acl ipv4-filter safeai-mgmt entry 10 action accept
set / acl ipv4-filter safeai-mgmt entry 20 action drop log true
set / network-instance mgmt interface mgmt0.0 ipv4 filter input safeai-mgmt

# --- 3. Send device logs to SafeAI ----------------------------------------
set / system logging remote-server <SAFEAI-IP> transport udp remote-port 514 facility local6 priority match-above notice

# --- 4. Sampled export (if your release exports IPFIX; else sFlow) ---------
set / system sflow admin-state enable
set / system sflow collector 1 collector-address <SAFEAI-IP> network-instance mgmt port 2055

# --- 5. Clock + commit ----------------------------------------------------
set / system ntp admin-state enable network-instance mgmt
set / system ntp server <SAFEAI-IP>
commit now

pfSense / OPNsense

# ============================================================================
#  SafeAI onboarding — pfSense / OPNsense
#  SafeAI is READ-ONLY. It reads the firewall over SSH (config.xml) and receives
#  syslog (and optional NetFlow). It never writes. Most of this is in the web UI;
#  a shell-only read account is created for the config read.
#
#  Fill in:  <SAFEAI-IP> SafeAI's address (lab: 10.100.0.61); <READONLY-PW> a strong password.
# ============================================================================

# --- 1. Turn on SSH -------------------------------------------------------
#   System > Advanced > Admin Access > Secure Shell — Enable Secure Shell,
#   SSHd Key Only = "Public Key Only" if you install SafeAI's key (recommended).

# --- 2. Read-only shell account -------------------------------------------
#   System > User Manager > Users > Add:
#     Username: safeai   Password: <READONLY-PW>
#     Group membership: (none that grants WebCfg write)
#     Effective Privileges: add ONLY "User - System: Shell account access"
#   SafeAI reads /conf/config.xml and runs read-only shell commands; it cannot
#   open the web configurator and cannot change settings.

# --- 3. Restrict SSH to SafeAI --------------------------------------------
#   Firewall > Rules > (the interface mgmt sits on) > Add:
#     Action Pass, Protocol TCP, Source <SAFEAI-IP>, Destination "This firewall",
#     Dest port 22. Add a block rule for TCP/22 from any other source above the
#     default allow, or place the firewall mgmt on an out-of-band interface.

# --- 4. Send device logs to SafeAI ----------------------------------------
#   pfSense:  Status > System Logs > Settings > Remote Logging —
#     Enable, Remote log servers = <SAFEAI-IP>:514, tick System events,
#     Firewall events and VPN/Authentication.
#   OPNsense: System > Settings > Logging / targets — add <SAFEAI-IP>:514 (UDP).

# --- 5. NetFlow (optional, per-application bandwidth) ----------------------
#   pfSense:  install the "softflowd" package — collector <SAFEAI-IP>:2055, NetFlow v9.
#   OPNsense: Reporting > NetFlow — add destination <SAFEAI-IP>:2055, version 9.

# --- 6. SNMP (optional, read-only) ----------------------------------------
#   Services > SNMP — enable, bind to the mgmt interface, community read-only, or
#   on OPNsense use the net-snmp plugin with an SNMPv3 read-only user.
#   Restrict with the same source rule as step 3.

HPE Aruba CX (AOS-CX)

! ============================================================================
!  SafeAI onboarding — HPE Aruba CX (AOS-CX)
!  SafeAI is READ-ONLY: 'operators' group over SSH, plus syslog, SNMPv3 and
!  (optional) sFlow. It never changes the switch. Scoped to SafeAI + mgmt VRF.
!
!  Fill in:
!    <SAFEAI-IP>     SafeAI's address                              (lab: 10.100.0.61)
!    <READONLY-PW>   strong password for the SafeAI read account
!    <SNMP-AUTH-PW>  SNMPv3 auth passphrase
!    <SNMP-PRIV-PW>  SNMPv3 privacy passphrase
! ============================================================================

! --- 1. Read-only account (built-in operators group) ----------------------
user safeai group operators password plaintext <READONLY-PW>

! --- 2. SSH on the mgmt VRF + restrict to SafeAI --------------------------
ssh server vrf mgmt
aaa authentication login ssh local
access-list ip SAFEAI-MGMT
 10 permit tcp <SAFEAI-IP>/255.255.255.255 any eq ssh
 20 deny tcp any any eq ssh count

! --- 3. Send device logs to SafeAI ----------------------------------------
logging <SAFEAI-IP> vrf mgmt severity info

! --- 4. SNMPv3 read-only, SafeAI-only -------------------------------------
snmpv3 user safeai-snmp auth sha auth-pass plaintext <SNMP-AUTH-PW> priv aes priv-pass plaintext <SNMP-PRIV-PW>
snmp-server vrf mgmt
snmp-server host <SAFEAI-IP> trap version v3 user safeai-snmp vrf mgmt

! --- 5. sFlow (optional, per-application bandwidth) -----------------------
sflow
 collector <SAFEAI-IP> 6343 vrf mgmt
 agent-interface vrf mgmt mgmt
 sampling 4096
 polling 30

! --- 6. Clock + save ------------------------------------------------------
ntp server <SAFEAI-IP>
ntp enable
end
write memory

Dell OS10

! ============================================================================
!  SafeAI onboarding — Dell EMC OS10 (PowerSwitch)
!  SafeAI is READ-ONLY: 'netoperator' role over SSH, plus syslog and SNMPv3.
!  It never changes the switch. Scoped to SafeAI's address.
!
!  Fill in:
!    <SAFEAI-IP>     SafeAI's address                              (lab: 10.100.0.61)
!    <READONLY-PW>   strong password for the SafeAI read account
!    <SNMP-AUTH-PW>  SNMPv3 auth passphrase
!    <SNMP-PRIV-PW>  SNMPv3 privacy passphrase
! ============================================================================

! --- 1. Read-only account (built-in netoperator role) ---------------------
username safeai password <READONLY-PW> role netoperator

! --- 2. Restrict mgmt SSH to SafeAI ---------------------------------------
ip access-list SAFEAI-MGMT
 seq 10 permit tcp host <SAFEAI-IP> any eq 22
 seq 20 deny tcp any any eq 22
control-plane
 ip access-group SAFEAI-MGMT in

! --- 3. Send device logs to SafeAI ----------------------------------------
logging server <SAFEAI-IP> udp 514
logging severity informational

! --- 4. SNMPv3 read-only, SafeAI-only -------------------------------------
snmp-server view SAFEAI-RO 1.3.6.1 included
snmp-server group SAFEAI-RO 3 priv read SAFEAI-RO
snmp-server user safeai-snmp SAFEAI-RO 3 auth sha <SNMP-AUTH-PW> priv aes128 <SNMP-PRIV-PW>

! --- 5. Clock + save ------------------------------------------------------
ntp server <SAFEAI-IP>
end
write memory

Ruckus ICX (FastIron)

! ============================================================================
!  SafeAI onboarding — Ruckus ICX (FastIron)
!  SafeAI is READ-ONLY: privilege-5 (read-only) over SSH, plus syslog, SNMPv3
!  and optional sFlow. It never changes the switch. Scoped to SafeAI's address.
!
!  Fill in:
!    <SAFEAI-IP>     SafeAI's address                              (lab: 10.100.0.61)
!    <READONLY-PW>   strong password for the SafeAI read account
!    <SNMP-AUTH-PW>  SNMPv3 auth passphrase
!    <SNMP-PRIV-PW>  SNMPv3 privacy passphrase
! ============================================================================

! --- 1. Read-only account (privilege 5 = read-only) -----------------------
username safeai privilege 5 password <READONLY-PW>

! --- 2. SSH only + restrict management to SafeAI --------------------------
crypto key generate rsa modulus 2048
ip ssh version 2
ip ssh timeout 60
access-list 10 permit host <SAFEAI-IP>
access-list 10 deny any log
ssh access-group 10
telnet server suppress-reject-message

! --- 3. Send device logs to SafeAI ----------------------------------------
logging host <SAFEAI-IP>
logging facility local7

! --- 4. SNMPv3 read-only, SafeAI-only -------------------------------------
snmp-server view SAFEAI-RO 1.3.6.1 included
snmp-server group SAFEAI-RO v3 priv read SAFEAI-RO
snmp-server user safeai-snmp SAFEAI-RO v3 auth sha <SNMP-AUTH-PW> priv aes <SNMP-PRIV-PW>

! --- 5. sFlow (optional, per-application bandwidth) -----------------------
sflow destination <SAFEAI-IP> 6343
sflow sample 4096
sflow enable

! --- 6. Clock + save ------------------------------------------------------
ntp
 server <SAFEAI-IP>
end
write memory

Firewalls — read over API

Palo Alto PAN-OS

# ============================================================================
#  SafeAI onboarding — Palo Alto Networks PAN-OS (firewall or Panorama)
#  SafeAI is READ-ONLY. It reads the config through the XML API over HTTPS (no
#  SSH), and receives syslog. Add it under Devices (vendor panos). Scoped to
#  SafeAI's address on the management interface.
#
#  Fill in:  <SAFEAI-IP> SafeAI's address (lab: 10.100.0.61); <READONLY-PW> a strong password.
# ============================================================================

# --- 1. Read-only admin role ----------------------------------------------
#   Device > Admin Roles > Add:  name "safeai-ro", role type Device.
#     Web UI: set everything to Disable (or Read Only).
#     XML API: Configuration = Enable, Operational Requests = Enable; the rest Disable.
#     Command Line: None.
#   (Or use the built-in "Superuser (read-only)" role.)

# --- 2. Read-only administrator -------------------------------------------
#   Device > Administrators > Add:  name "safeai-ro", Authentication Profile None,
#     Administrator Type = Role Based, Profile = safeai-ro, Password = <READONLY-PW>.  Commit.

# --- 3. Restrict management access to SafeAI ------------------------------
#   Device > Setup > Interfaces > Management > Permitted IP Addresses: add <SAFEAI-IP>/32.
#   Services: leave HTTPS and SSH enabled on mgmt; everything else off.

# --- 4. Send device logs to SafeAI ----------------------------------------
#   Device > Server Profiles > Syslog > Add:  name "SafeAI", server <SAFEAI-IP>, UDP 514, BSD.
#   Device > Log Settings > Configuration AND System: add a Log Forwarding match -> SafeAI.  Commit.

# --- 5. NetFlow (optional, per-application bandwidth) ----------------------
#   Device > Server Profiles > NetFlow > Add:  server <SAFEAI-IP>:2055, template 1 min.
#   Network > Interfaces > (each data interface) > Advanced > NetFlow Profile = that profile.  Commit.

# --- 6. Certificate pinning -----------------------------------------------
#   The mgmt cert is self-signed by default; SafeAI shows its SHA-256 fingerprint after the
#   first read — set the device option tls_sha256=<fingerprint> in SafeAI to pin it.

SonicWall (SonicOS 7)

# ============================================================================
#  SafeAI onboarding — SonicWall SonicOS 7 (Gen 7)
#  SafeAI is READ-ONLY. It reads through the SonicOS API over HTTPS (GET only)
#  and receives syslog. Add it under Devices (vendor sonicwall). Scoped to SafeAI.
#
#  Fill in:  <SAFEAI-IP> SafeAI's address (lab: 10.100.0.61); <READONLY-PW> a strong password.
# ============================================================================

# --- 1. Enable the SonicOS API --------------------------------------------
#   Device > Settings > Administration > Audit / SonicOS API:
#     Enable SonicOS API; RFC-7616 HTTP Digest Auth = on (Basic optional).

# --- 2. Read-only admin account -------------------------------------------
#   Device > Users > Local Users & Groups > Local Users > Add:
#     Name "safeai-ro", password <READONLY-PW>; add to group "SonicWALL Read-Only Admins".

# --- 3. Restrict HTTPS management to SafeAI -------------------------------
#   Manage from the LAN, or add an access rule allowing HTTPS to the mgmt interface
#   only from <SAFEAI-IP>, and disable HTTPS mgmt from WAN.

# --- 4. Send device logs to SafeAI ----------------------------------------
#   Device > Log > Syslog > Syslog Servers > Add:  <SAFEAI-IP>, port 514.
#   Log > Settings: set the categories you want (System, Security, Firewall) to Report/Log.

# --- 5. Notes -------------------------------------------------------------
#   SafeAI signs in, sends GET requests only, and signs out after each read — it never
#   takes configuration mode. The mgmt cert is self-signed by default; set tls_sha256=<fp>
#   in SafeAI after the first read to pin it.

Sophos Firewall (SFOS)

# ============================================================================
#  SafeAI onboarding — Sophos Firewall (SFOS)
#  SafeAI is READ-ONLY. It reads through the XML API over HTTPS (port 4444,
#  <Get> requests only) and receives syslog. Add it under Devices (vendor sophos).
#
#  Fill in:  <SAFEAI-IP> SafeAI's address (lab: 10.100.0.61); <READONLY-PW> a strong password.
# ============================================================================

# --- 1. Read-only device-access profile -----------------------------------
#   Profiles > Device access > Add:  name "SafeAI read-only", set every area to Read-Only.

# --- 2. Read-only administrator -------------------------------------------
#   Authentication > Users > Add:  username "safeai-ro", User type = Administrator,
#     Profile = "SafeAI read-only", password <READONLY-PW>.

# --- 3. Turn on the API and allow SafeAI ----------------------------------
#   Backup & firmware > API:  enable "API Configuration", add <SAFEAI-IP> to Allowed IP.

# --- 4. Send device logs to SafeAI ----------------------------------------
#   System services > Log settings > Syslog servers > Add:  name "SafeAI",
#     IP <SAFEAI-IP>, port 514, facility Local7, severity Information; tick the log types you want.

# --- 5. Notes -------------------------------------------------------------
#   SafeAI sends <Get> requests only; it never changes the firewall.

WatchGuard Firebox (Fireware)

# ============================================================================
#  SafeAI onboarding — WatchGuard Firebox (Fireware)
#  SafeAI is READ-ONLY. It reads the configuration over the Fireware CLI (SSH,
#  port 4118, "export config to console") and receives syslog. Add it under
#  Devices (vendor watchguard, port 4118). Scoped to SafeAI's address.
#
#  Fill in:  <SAFEAI-IP> SafeAI's address (lab: 10.100.0.61); <READONLY-PW> a strong passphrase.
# ============================================================================

# --- 1. Read-only account -------------------------------------------------
#   Use the built-in "status" account (Device Monitor, read-only) with a new strong
#   passphrase <READONLY-PW>, OR System > Users and Roles > add "safeai-ro" with the
#   Device Monitor role.

# --- 2. Restrict the WatchGuard management policy to SafeAI ----------------
#   Firewall > the "WatchGuard" and "WG-Firebox-Mgmt" policies (TCP 4105, 4117, 4118):
#   set From = <SAFEAI-IP> only (not Any-External).

# --- 3. Send device logs to SafeAI ----------------------------------------
#   System > Logging > Syslog Server:  enable, server <SAFEAI-IP>, port 514,
#     syslog format, tick the log categories you want.

# --- 4. Notes -------------------------------------------------------------
#   SafeAI runs "export config to console" and nothing else. Alternatively you can upload
#   the exported configuration file (System > Configuration File) into SafeAI in Review.

Check Point

# ============================================================================
#  SafeAI onboarding — Check Point (Security Management Server / Smart-1 Cloud)
#  SafeAI is READ-ONLY. It reads the policy through the Management API over HTTPS
#  with show-* commands, signing out after each read. Add the management server
#  under Devices (vendor checkpoint). Scoped to SafeAI's address.
#
#  Fill in:  <SAFEAI-IP> SafeAI's address (lab: 10.100.0.61); <READONLY-PW> a strong password.
# ============================================================================

# --- 1. Allow the Management API from SafeAI ------------------------------
#   SmartConsole > Manage & Settings > Blades > Management API > Advanced Settings:
#     "Accept API calls from" = all IP addresses that can be used by GUI clients
#     (or add <SAFEAI-IP>).  Publish, then restart the API:  api restart (on the mgmt CLI).

# --- 2. Read-only administrator -------------------------------------------
#   Manage & Settings > Permissions & Administrators > Administrators > New:
#     name "safeai-ro", permission profile = "Read Only All",
#     Authentication = Check Point Password, password <READONLY-PW>.  Publish.
#   (Or create an API key for that admin and use user name "api-key" with the key as the password.)

# --- 3. Reach the management server ---------------------------------------
#   Allow HTTPS (443) from <SAFEAI-IP> to the management server / Smart-1 Cloud tenant.

# --- 4. SafeAI options ----------------------------------------------------
#   layer=<access layer>  (default Network)
#   package=<policy package>  (default Standard)
#   domain=<domain>  (Multi-Domain only)
#
#   SafeAI signs in read-only, sends show-* calls only, and logs out after each read.

Servers & endpoints

Linux (Debian/Ubuntu, RHEL, Alpine)

#!/bin/sh
# ============================================================================
#  SafeAI onboarding — Linux servers
#  Two ways: (A) the SafeAI Agent (recommended) or (B) a read-only SSH account,
#  no sudo. SafeAI is READ-ONLY: it runs one fixed display-only script and reads
#  syslog. It never changes the host. Run as root.
#  usage:  SAFEAI=<SafeAI address> sh linux-server.sh     (lab: SAFEAI=10.100.0.61)
# ============================================================================
set -eu
: "${SAFEAI:?set SAFEAI to the SafeAI server's address}"

# --- (A) SafeAI Agent (recommended) ----------------------------------------
#   Installs read-only, reports in, and can harden (root SSH login off, empty SSH
#   passwords refused):
#     curl -fsSL https://${SAFEAI}/agent/install.sh | sh -s -- --server ${SAFEAI} --read-only

# --- (B) Read-only SSH account (no sudo) -----------------------------------
id safeai >/dev/null 2>&1 || useradd -m -s /bin/sh safeai 2>/dev/null || adduser -D -s /bin/sh safeai
echo "Install SafeAI's public key in ~safeai/.ssh/authorized_keys (preferred), or set a password:"
passwd safeai

# Harden sshd for this account (no root login; this account gets a restricted shell):
if [ -d /etc/ssh/sshd_config.d ]; then
  cat > /etc/ssh/sshd_config.d/60-safeai.conf <<EOF
PermitRootLogin no
Match User safeai
    X11Forwarding no
    AllowTcpForwarding no
    PermitTunnel no
EOF
  systemctl reload sshd 2>/dev/null || service ssh reload || true
fi

# --- Send device logs to SafeAI (rsyslog) ----------------------------------
if [ -d /etc/rsyslog.d ]; then
  echo "*.notice;authpriv.* @${SAFEAI}:514" > /etc/rsyslog.d/60-safeai.conf
  systemctl restart rsyslog 2>/dev/null || service rsyslog restart
fi

# --- Keep the clock synced -------------------------------------------------
command -v timedatectl >/dev/null && timedatectl set-ntp true || true
echo "Done: 'safeai' can read the host. Nothing it runs can change it.\"

Windows Server / 10 / 11

# ============================================================================
#  SafeAI onboarding — Windows   (run in an elevated PowerShell)
#  Two ways: (A) the SafeAI Agent (recommended) or (B) WinRM over HTTPS with a
#  least-privilege reader. SafeAI is READ-ONLY: a fixed read-only PowerShell
#  script; it never changes the host.
#  Fill in:  $ip = SafeAI's address   (lab: 10.100.0.61)
# ============================================================================
$ip = "<SAFEAI-IP>"

# --- (A) SafeAI Agent (recommended) ----------------------------------------
#   Read-only; can harden (SMBv1 off, RDP requires NLA, Windows Firewall on, Defender on):
#     msiexec /i \\$ip\agent\safeai-agent.msi SERVER=$ip MODE=readonly /qn

# --- (B) WinRM over HTTPS, least-privilege reader --------------------------
# 1) HTTPS listener with a self-signed cert:
$c = New-SelfSignedCertificate -DnsName $env:COMPUTERNAME -CertStoreLocation Cert:\LocalMachine\My
winrm create winrm/config/Listener?Address=*+Transport=HTTPS ("@{Hostname=""$env:COMPUTERNAME"";CertificateThumbprint=""$($c.Thumbprint)""}")

# 2) Firewall: allow WinRM-HTTPS (5986) from SafeAI only:
New-NetFirewallRule -DisplayName "WinRM HTTPS from SafeAI" -Direction Inbound -Protocol TCP `
  -LocalPort 5986 -RemoteAddress $ip -Action Allow

# 3) Read-only local account (no admin): Remote Management Users + Event Log Readers:
$pw = Read-Host -AsSecureString "Password for the safeai account"
New-LocalUser -Name "safeai" -Password $pw -PasswordNeverExpires -AccountNeverExpires
Add-LocalGroupMember -Group "Remote Management Users" -Member "safeai"
Add-LocalGroupMember -Group "Event Log Readers"       -Member "safeai"

# 4) Time sync (so events line up):
w32tm /config /manualpeerlist:"<NTP>" /syncfromflags:manual /update
#   SafeAI reads over WinRM (or via the agent) and forwards events; it never changes the host.

macOS

# ============================================================================
#  SafeAI onboarding — macOS   (run as an administrator)
#  macOS is read by the SafeAI Agent (no inbound ports). SafeAI is READ-ONLY: it
#  reads system configuration and, on developer machines, watches local AI tools.
#  It never changes the Mac without a rule saying so.
#  Fill in:  <SAFEAI-IP> SafeAI's address   (lab: 10.100.0.61)
# ============================================================================

# --- Install and enroll the agent (read-only) ------------------------------
sudo installer -pkg SafeAI-Agent.pkg -target /
sudo /usr/local/safeai/agent --server <SAFEAI-IP> --read-only --enroll

# The agent can harden (firewall on) and, for developer machines, keeps Claude Code and
# Codex asking before acting and keeps Codex in its sandbox. Nothing is changed without
# your rule saying so.

Cloud & virtualization

VMware vCenter / ESXi

# ============================================================================
#  SafeAI onboarding — VMware vCenter / ESXi
#  SafeAI is READ-ONLY. It reads the vSphere API (HTTPS 443) with the built-in
#  Read-only role. Add vCenter under Devices (vendor vmware). It never changes
#  anything. Fill in:  <SAFEAI-IP> (lab: 10.100.0.61); <READONLY-PW> a strong password.
# ============================================================================

# --- 1. Service account ----------------------------------------------------
#   vCenter > Administration > Single Sign On > Users and Groups > Add:
#     user "safeai-ro" in your SSO domain, password <READONLY-PW>.  (Or an existing AD account.)

# --- 2. Grant the built-in Read-only role ---------------------------------
#   vCenter > Administration > Access Control > Global Permissions > Add:
#     user safeai-ro, Role = "Read-only", Propagate to children = on.
#   Read-only cannot change any object.

# --- 3. Reach vCenter ------------------------------------------------------
#   Allow HTTPS (443) from <SAFEAI-IP> to vCenter.

# --- 4. SafeAI options -----------------------------------------------------
#   host=<vcenter-fqdn>, user=safeai-ro, password=<READONLY-PW> (VCENTER_PASSWORD).
#   The vCenter cert fingerprint is shown after the first read — set tls_sha256=<fp> to pin it.

AWS

# ============================================================================
#  SafeAI onboarding — AWS
#  SafeAI is READ-ONLY. It reads with the AWS-managed SecurityAudit policy (no
#  write permissions). Prefer a role SafeAI assumes; access keys are the fallback.
#  Fill in:  <ACCOUNT-ID>, <EXTERNAL-ID> (a random string you choose).
# ============================================================================

# --- Option A: IAM role for SafeAI to assume (recommended) -----------------
#   IAM > Roles > Create role:
#     Trusted entity = the SafeAI account/instance principal; add a condition
#       sts:ExternalId = <EXTERNAL-ID>.
#     Permissions: attach AWS managed policy "SecurityAudit".
#     Name: "safeai-ro".
#   In SafeAI set:  role_arn = arn:aws:iam::<ACCOUNT-ID>:role/safeai-ro,  external_id = <EXTERNAL-ID>.

# --- Option B: IAM user with access keys -----------------------------------
#   IAM > Users > Create user "safeai-ro" (no console access) > attach "SecurityAudit"
#   > Security credentials > Create access key (Application running outside AWS).
#   In SafeAI set:  AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY.

# SafeAI reads configuration and security posture only; it never changes resources.
# For organization-wide reads, deploy the role to each account (StackSets) with the same name.

Microsoft Azure

# ============================================================================
#  SafeAI onboarding — Microsoft Azure
#  SafeAI is READ-ONLY. It reads with the built-in Reader role (add Security Reader
#  for deeper posture). No write permissions.
#  Fill in:  <TENANT-ID>, <SUBSCRIPTION-ID>.
# ============================================================================

# --- 1. App registration ---------------------------------------------------
#   Entra ID > App registrations > New registration: "safeai-ro".
#   Note the Application (client) ID and Directory (tenant) ID.

# --- 2. Client secret ------------------------------------------------------
#   App > Certificates & secrets > New client secret.  Put the value in SafeAI as AZURE_CLIENT_SECRET.

# --- 3. Grant Reader at the scope you want --------------------------------
#   Subscription (or Management Group) > Access control (IAM) > Add role assignment:
#     Role = "Reader"; Members = the safeai-ro app.  (Add "Security Reader" for identity/posture.)

# --- 4. SafeAI options -----------------------------------------------------
#   tenant_id=<TENANT-ID>, client_id=<app id>, subscription_id=<SUBSCRIPTION-ID>.
#   SafeAI reads configuration only; it never changes resources.

Google Cloud

# ============================================================================
#  SafeAI onboarding — Google Cloud
#  SafeAI is READ-ONLY. It reads with roles/viewer and roles/iam.securityReviewer.
#  No write permissions.
#  Fill in:  <PROJECT-OR-ORG-ID>.
# ============================================================================

# --- 1. Service account ----------------------------------------------------
gcloud iam service-accounts create safeai-ro --display-name "SafeAI read-only"

# --- 2. Grant read-only roles at the project (or organization) level -------
gcloud projects add-iam-policy-binding <PROJECT-OR-ORG-ID> \
  --member "serviceAccount:safeai-ro@<PROJECT-OR-ORG-ID>.iam.gserviceaccount.com" \
  --role   "roles/viewer"
gcloud projects add-iam-policy-binding <PROJECT-OR-ORG-ID> \
  --member "serviceAccount:safeai-ro@<PROJECT-OR-ORG-ID>.iam.gserviceaccount.com" \
  --role   "roles/iam.securityReviewer"

# --- 3. Credentials --------------------------------------------------------
#   Create a JSON key and give it to SafeAI (GOOGLE_APPLICATION_CREDENTIALS), or use
#   Workload Identity Federation from the SafeAI host (no long-lived key).
gcloud iam service-accounts keys create safeai-ro.json \
  --iam-account safeai-ro@<PROJECT-OR-ORG-ID>.iam.gserviceaccount.com

# SafeAI reads configuration and security posture only; it never changes resources.

Identity

Microsoft Entra ID

# ============================================================================
#  SafeAI onboarding — Microsoft Entra ID
#  SafeAI is READ-ONLY. It reads directory, sign-in and policy data through
#  Microsoft Graph with application permissions (read-only). No write access.
#  Fill in:  <TENANT-ID>.
# ============================================================================

# --- 1. App registration ---------------------------------------------------
#   Entra ID > App registrations > New registration: "safeai-ro".

# --- 2. Read-only Graph application permissions (then Grant admin consent) --
#   App > API permissions > Add > Microsoft Graph > Application permissions:
#     Directory.Read.All, Policy.Read.All, AuditLog.Read.All, UserAuthenticationMethod.Read.All,
#     RoleManagement.Read.Directory.
#   > Grant admin consent.

# --- 3. Client secret ------------------------------------------------------
#   App > Certificates & secrets > New client secret.  Put the value in SafeAI as GRAPH_CLIENT_SECRET.

# --- 4. SafeAI options -----------------------------------------------------
#   tenant_id=<TENANT-ID>, client_id=<app id>.  SafeAI never writes to the directory.

Okta

# ============================================================================
#  SafeAI onboarding — Okta
#  SafeAI is READ-ONLY. It reads users, groups, apps, policies and sign-in logs.
#  Prefer an OAuth service app with read-only scopes; an API token is the fallback.
#  Fill in:  <ORG>.okta.com.
# ============================================================================

# --- Option A: OAuth 2.0 service app (recommended) -------------------------
#   Admin > Applications > Create App Integration > API Services.
#   Grant read-only scopes:  okta.users.read, okta.groups.read, okta.apps.read,
#     okta.policies.read, okta.logs.read.
#   Use a public/private key pair (JWK).  In SafeAI set the client_id and private key.

# --- Option B: API token ---------------------------------------------------
#   Create a read-only service account (no admin role beyond "Read Only Administrator"),
#   sign in as it, Security > API > Tokens > Create Token.  In SafeAI set OKTA_TOKEN.

# SafeAI reads only; it makes no changes to the org.  Base URL: https://<ORG>.okta.com

Google Workspace

# ============================================================================
#  SafeAI onboarding — Google Workspace
#  SafeAI is READ-ONLY. It reads directory, devices and audit via the Admin SDK
#  with a service account using domain-wide delegation (read-only scopes).
#  Fill in:  <ADMIN-EMAIL> (a super-admin to impersonate for read).
# ============================================================================

# --- 1. Service account + key ----------------------------------------------
#   In a Google Cloud project: enable the Admin SDK API; create service account
#   "safeai-ro" and a JSON key.  Note its OAuth2 client ID.

# --- 2. Domain-wide delegation with read-only scopes -----------------------
#   Admin console > Security > Access and data control > API controls > Domain-wide delegation > Add:
#     Client ID = the service account's client ID; OAuth scopes:
#       https://www.googleapis.com/auth/admin.directory.user.readonly,
#       https://www.googleapis.com/auth/admin.directory.group.readonly,
#       https://www.googleapis.com/auth/admin.directory.device.mobile.readonly,
#       https://www.googleapis.com/auth/admin.reports.audit.readonly

# --- 3. SafeAI options -----------------------------------------------------
#   Give SafeAI the JSON key and GWS_ADMIN=<ADMIN-EMAIL> to impersonate.  Read-only throughout.

Microsoft Intune

# ============================================================================
#  SafeAI onboarding — Microsoft Intune
#  SafeAI is READ-ONLY. It reads device and compliance state through Microsoft
#  Graph (read-only). Reuse the Entra "safeai-ro" app, or create one.
#  Fill in:  <TENANT-ID>.
# ============================================================================

# --- 1. Read-only Graph application permissions (then Grant admin consent) --
#   App > API permissions > Add > Microsoft Graph > Application permissions:
#     DeviceManagementManagedDevices.Read.All,
#     DeviceManagementConfiguration.Read.All,
#     DeviceManagementApps.Read.All.
#   > Grant admin consent.

# --- 2. SafeAI options -----------------------------------------------------
#   tenant_id=<TENANT-ID>, client_id=<app id>; shares GRAPH_CLIENT_SECRET with Entra ID.
#   SafeAI never changes device policy.

Cisco ISE

# ============================================================================
#  SafeAI onboarding — Cisco ISE
#  SafeAI is READ-ONLY. It reads policy, endpoints and admin config through the
#  ISE ERS / Open APIs (read-only). Scoped to SafeAI's address.
#  Fill in:  <SAFEAI-IP> (lab: 10.100.0.61); <READONLY-PW> a strong password; <ISE-PAN-FQDN>.
# ============================================================================

# --- 1. Turn on the APIs ---------------------------------------------------
#   Administration > System > Settings > API Settings:
#     ERS (Read) = Enable;  Open API = Enable.

# --- 2. Read-only admin account -------------------------------------------
#   Administration > System > Admin Access > Administrators > Admin Users > Add:
#     name "safeai-ro", password <READONLY-PW>, assign a custom RBAC admin group whose
#     Menu Access and Data Access are View-only (or the built-in read-only group).

# --- 3. Reach the PAN ------------------------------------------------------
#   Allow HTTPS (443 and ERS 9060) from <SAFEAI-IP> to the ISE Primary Admin Node.

# --- 4. SafeAI options -----------------------------------------------------
#   host=<ISE-PAN-FQDN>, user=safeai-ro, password=<READONLY-PW> (ISE_PASSWORD).
#   SafeAI reads only; it makes no policy changes.

Wi-Fi & cloud-managed

Cisco Meraki (Dashboard)

# ============================================================================
#  SafeAI onboarding — Cisco Meraki
#  SafeAI is READ-ONLY. It reads the Meraki Dashboard API (networks, devices,
#  clients, radio, and MX security appliances) with a read-only key.
#  Fill in:  <ORG-ID>.
# ============================================================================

# --- 1. Enable the Dashboard API ------------------------------------------
#   Dashboard > Organization > Settings > Dashboard API access: Enable access to the API.

# --- 2. Read-only admin + API key -----------------------------------------
#   Organization > Administrators > Add admin:  Organization access = Read-only.
#   Sign in as that admin > My profile > API access > Generate API key.

# --- 3. SafeAI options -----------------------------------------------------
#   MERAKI_API_KEY=<key>, org_id=<ORG-ID>.
#   SafeAI sends GET requests only; with the Meraki connector it also reads MX
#   security-appliance configuration. Nothing in the dashboard is changed.

Cisco Catalyst 9800 WLC

! ============================================================================
!  SafeAI onboarding — Cisco Catalyst 9800 WLC (IOS-XE)
!  SafeAI is READ-ONLY. It reads over a read-only account via NETCONF/RESTCONF
!  (or SSH), plus syslog and SNMPv3. It never changes the controller. Scoped to
!  SafeAI's address.
!  Fill in:  <SAFEAI-IP> (lab: 10.100.0.61); <READONLY-PW>; <SNMP-AUTH-PW>; <SNMP-PRIV-PW>.
! ============================================================================

! --- 1. Read-only account (privilege 5; model reads only) -----------------
username safeai privilege 5 algorithm-type scrypt secret <READONLY-PW>

! --- 2. Enable model-driven read interfaces -------------------------------
netconf-yang
restconf
ip http secure-server
ip http authentication local

! --- 3. Restrict management to SafeAI -------------------------------------
ip access-list standard SAFEAI-MGMT
 permit host <SAFEAI-IP>
 deny   any log
line vty 0 15
 access-class SAFEAI-MGMT in
 transport input ssh

! --- 4. Send device logs to SafeAI + SNMPv3 -------------------------------
logging host <SAFEAI-IP> transport udp port 514
logging trap informational
snmp-server view SAFEAI-RO iso included
snmp-server group SAFEAI-RO v3 priv read SAFEAI-RO access SAFEAI-MGMT
snmp-server user safeai-snmp SAFEAI-RO v3 auth sha <SNMP-AUTH-PW> priv aes 256 <SNMP-PRIV-PW>

! --- 5. Allow HTTPS/NETCONF (443/830) from SafeAI only, then save ----------
ntp server <SAFEAI-IP>
end
write memory

Aruba Central

# ============================================================================
#  SafeAI onboarding — Aruba Central (cloud)
#  SafeAI is READ-ONLY. It reads the Central API (sites, devices, radio, clients)
#  with a Viewer-role OAuth client.
#  Fill in:  <CENTRAL-BASE-URL> (your cluster), <CUSTOMER-ID>.
# ============================================================================

# --- 1. Viewer account -----------------------------------------------------
#   Central > Global Settings > Users and Roles > add a user with the predefined
#   "Viewer" (read-only) role for the group/scope SafeAI should see.

# --- 2. API client + token -------------------------------------------------
#   Central > Global Settings > API Gateway > System Apps & Tokens > Add:
#     create an API client under the Viewer account; note client_id and client_secret.
#   Generate an OAuth token (read-only) for that client.

# --- 3. SafeAI options -----------------------------------------------------
#   base_url=<CENTRAL-BASE-URL>, client_id, client_secret, token (ARUBA_CENTRAL_TOKEN),
#   customer_id=<CUSTOMER-ID>.  SafeAI reads only.

Juniper Mist

# ============================================================================
#  SafeAI onboarding — Juniper Mist (cloud)
#  SafeAI is READ-ONLY. It reads the Mist API (sites, APs, radio, clients, events)
#  with an Observer-role token.
#  Fill in:  <ORG-ID>, <API-BASE> (e.g. api.mist.com).
# ============================================================================

# --- 1. Observer account / token ------------------------------------------
#   Mist > Organization > Admins: add a user with the "Observer" (read-only) role, OR
#   Organization > Settings > Create Token under an Observer account.

# --- 2. SafeAI options -----------------------------------------------------
#   MIST_API_TOKEN=<token>, api_base=<API-BASE>, org_id=<ORG-ID>.
#   SafeAI reads only; it makes no changes to the org.

FortiGate with FortiAPs

# ============================================================================
#  SafeAI onboarding — FortiGate with FortiAPs
#  Wi-Fi is read through the managing FortiGate (no separate controller). SafeAI
#  reads managed FortiAPs, radios and clients via the FortiOS API — using the same
#  read-only account as the Fortinet FortiOS guide above.
# ============================================================================

# --- 1. Reuse the FortiOS read-only setup ----------------------------------
#   Follow "Fortinet FortiOS" above (read-only profile + admin locked to SafeAI).
#   The profile already grants  set wifi read , which is what the AP read needs.

# --- 2. Nothing extra ------------------------------------------------------
#   No additional account is required — SafeAI reads FortiAP state through the
#   FortiGate's API. Confirm the managing FortiGate is onboarded in SafeAI.

eero

# ============================================================================
#  SafeAI onboarding — eero   (preview — eero's API is unofficial)
#  SafeAI is READ-ONLY. It reads eero networks, devices and clients via a
#  read-only session token.
# ============================================================================

# --- 1. One-time login -----------------------------------------------------
#   In SafeAI, add the eero network under Devices (vendor eero) and complete the
#   login the way the eero app does: enter the account email or phone, then the
#   one-time code eero sends. SafeAI stores the resulting read-only session token.

# --- 2. Notes --------------------------------------------------------------
#   EERO_TOKEN is read-only. Because the API is unofficial, treat this as
#   best-effort and expect an occasional re-login.

Ubiquiti UniFi

# ============================================================================
#  SafeAI onboarding — Ubiquiti UniFi (Network controller)
#  SafeAI is READ-ONLY. It reads the UniFi Network API with a View-Only account
#  or API key. Scoped to SafeAI's address.
#  Fill in:  <CONTROLLER> (host/IP), <SAFEAI-IP> (lab: 10.100.0.61), <READONLY-PW>.
# ============================================================================

# --- 1. View-Only account --------------------------------------------------
#   UniFi Network > Settings > Admins & Users > Add Admin:
#     name "safeai-ro", Role = "View Only", password <READONLY-PW>.

# --- 2. API key (UniFi Network API) ---------------------------------------
#   Settings > Control Plane > Integrations (or the account's API keys): create an
#   API key under the View-Only account.

# --- 3. Reach the controller ----------------------------------------------
#   Allow HTTPS (443 / 8443) from <SAFEAI-IP> to the UniFi controller.

# --- 4. SafeAI options -----------------------------------------------------
#   host=<CONTROLLER>, and either the API key or UNIFI_USER=safeai-ro / UNIFI_PASSWORD.
#   SafeAI reads only.