detect-tpm-capabilities.sh
1 #!/bin/bash 2 3 # detect-tpm-capabilities.sh 4 # Detect and report TPM hardware capabilities 5 6 echo "=== TPM Hardware Detection ===" 7 8 # Check for TPM devices 9 echo "TPM Devices:" 10 ls -la /dev/tpm* 2>/dev/null || echo " No TPM devices found" 11 12 # Check TPM version if available 13 if command -v tpm2_getcap >/dev/null 2>&1; then 14 echo "" 15 echo "TPM Capabilities:" 16 tpm2_getcap properties-fixed 2>/dev/null || echo " Cannot query TPM capabilities" 17 fi 18 19 # Check systemd-tpm status 20 if systemctl is-active systemd-tpm2-generator >/dev/null 2>&1; then 21 echo "" 22 echo "systemd TPM2 support: Active" 23 else 24 echo "" 25 echo "systemd TPM2 support: Not active" 26 fi 27 28 # Check kernel TPM support 29 echo "" 30 echo "Kernel TPM Support:" 31 if [ -d "/sys/class/tpm" ]; then 32 ls -la /sys/class/tpm/ 33 else 34 echo " No kernel TPM support detected" 35 fi