Gestion d'Inventaire App Store sur macOS
Gérez et suivez efficacement les applications App Store sur vos appareils MacFleet avec des outils d'inventaire complets. Ce tutoriel couvre la découverte d'applications, la conformité des licences, l'analyse d'utilisation et les rapports de niveau entreprise pour les applications Mac App Store.
Comprendre la Gestion des Applications App Store
Les applications App Store sur macOS contiennent des identifiants uniques et des reçus qui permettent le suivi d'entreprise :
Composants Principaux
- Reçus MAS - Reçus numériques stockés dans les bundles d'applications pour vérification
- Identifiants Bundle - Identification unique d'application dans l'écosystème App Store
- Suivi Version - Gestion version d'application et conformité mise à jour
- Gestion Licence - Surveillance allocation et conformité licence d'entreprise
- Analyse Utilisation - Modèles d'utilisation d'application et métriques d'adoption
Avantages Entreprise
- Gestion Actifs Logiciels - Inventaire complet des applications App Store
- Conformité Licence - Suivi licences et allocations d'applications d'entreprise
- Surveillance Sécurité - Identifier applications non autorisées ou non conformes
- Optimisation Coûts - Optimiser dépenses App Store et utilisation licences
- Application Politique - Assurer conformité avec politiques d'applications d'entreprise
Découverte Basique des Applications App Store
Liste Simple Applications App Store
#!/bin/bash
# Découverte basique applications App Store
echo "📱 Découverte Applications App Store"
echo "===================================="
echo ""
app_store_apps=$(find /Applications -path '*Contents/_MASReceipt/receipt' -maxdepth 4 -print | \
sed 's#.app/Contents/_MASReceipt/receipt#.app#g; s#/Applications/##')
if [[ -n "$app_store_apps" ]]; then
echo "Applications App Store Trouvées :"
echo "$app_store_apps" | sort
local app_count=$(echo "$app_store_apps" | wc -l | xargs)
echo ""
echo "Total applications App Store : $app_count"
else
echo "Aucune application App Store trouvée dans /Applications"
fi
Découverte Améliorée avec Détails
#!/bin/bash
# Découverte complète applications App Store avec métadonnées
discover_app_store_apps() {
echo "🔍 Découverte Complète Applications App Store"
echo "============================================="
echo ""
local apps_found=0
local total_size=0
# Trouver toutes applications App Store avec reçus
while IFS= read -r -d '' app_path; do
if [[ -n "$app_path" ]]; then
local app_name=$(basename "$app_path" .app)
local app_bundle_id=""
local app_version=""
local app_size=""
local install_date=""
# Obtenir identifiant bundle
if [[ -f "$app_path/Contents/Info.plist" ]]; then
app_bundle_id=$(defaults read "$app_path/Contents/Info.plist" CFBundleIdentifier 2>/dev/null || echo "Inconnu")
app_version=$(defaults read "$app_path/Contents/Info.plist" CFBundleShortVersionString 2>/dev/null || echo "Inconnue")
fi
# Obtenir taille application
if [[ -d "$app_path" ]]; then
app_size=$(du -sh "$app_path" 2>/dev/null | cut -f1 || echo "Inconnue")
# Convertir taille en octets pour totalisation
local size_bytes=$(du -s "$app_path" 2>/dev/null | cut -f1 || echo "0")
total_size=$((total_size + size_bytes))
fi
# Obtenir date installation/modification
if [[ -f "$app_path/Contents/_MASReceipt/receipt" ]]; then
install_date=$(stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S" "$app_path/Contents/_MASReceipt/receipt" 2>/dev/null || echo "Inconnue")
fi
echo "App : $app_name"
echo " ID Bundle : $app_bundle_id"
echo " Version : $app_version"
echo " Taille : $app_size"
echo " Date Installation : $install_date"
echo " Chemin : $app_path"
echo ""
((apps_found++))
fi
done < <(find /Applications -name "*.app" -path '*Contents/_MASReceipt/receipt' -exec dirname {} \; 2>/dev/null | \
sed 's|/Contents/_MASReceipt||' | sort -u | tr '\n' '\0')
# Statistiques résumé
echo "=== Résumé Découverte ==="
echo "Total applications App Store trouvées : $apps_found"
echo "Espace disque total utilisé : $(echo "scale=2; $total_size / 1024 / 1024" | bc 2>/dev/null || echo "Inconnu") MB"
echo "Taille moyenne application : $(echo "scale=2; $total_size / $apps_found / 1024 / 1024" | bc 2>/dev/null || echo "Inconnue") MB"
echo "Scan terminé : $(date)"
return $apps_found
}
# Exécuter découverte
discover_app_store_apps
Gestion d'Inventaire d'Applications d'Entreprise
Script d'Inventaire Complet
#!/bin/bash
# Gestion inventaire App Store d'entreprise
generate_app_store_inventory() {
local output_format="${1:-json}"
local include_metadata="${2:-true}"
local export_path="${3:-/tmp}"
echo "📊 Génération Inventaire App Store d'Entreprise"
echo "==============================================="
echo "Format sortie : $output_format"
echo "Inclure métadonnées : $include_metadata"
echo ""
local timestamp=$(date +"%Y%m%d_%H%M%S")
local hostname=$(hostname)
local report_file="$export_path/app_store_inventory_${hostname}_${timestamp}"
# Informations système
local device_info=$(system_profiler SPHardwareDataType | grep -E "(Model Name|Serial Number)" | \
awk -F': ' '{print $2}' | xargs | tr ' ' '_')
local macos_version=$(sw_vers -productVersion)
local current_user=$(stat -f%Su /dev/console 2>/dev/null || echo "$USER")
# Initialiser structure données inventaire
local inventory_data=""
local app_count=0
local total_size_bytes=0
echo "Scan applications..."
# Découvrir toutes applications App Store
while IFS= read -r -d '' app_path; do
if [[ -d "$app_path" && -f "$app_path/Contents/_MASReceipt/receipt" ]]; then
local app_name=$(basename "$app_path" .app)
local bundle_id=""
local version=""
local build_version=""
local size_bytes=0
local size_human=""
local install_date=""
local last_modified=""
local executable_path=""
local app_category=""
local developer_name=""
local app_store_url=""
# Extraire métadonnées application
if [[ -f "$app_path/Contents/Info.plist" ]]; then
bundle_id=$(defaults read "$app_path/Contents/Info.plist" CFBundleIdentifier 2>/dev/null || echo "inconnu")
version=$(defaults read "$app_path/Contents/Info.plist" CFBundleShortVersionString 2>/dev/null || echo "inconnue")
build_version=$(defaults read "$app_path/Contents/Info.plist" CFBundleVersion 2>/dev/null || echo "inconnue")
executable_path=$(defaults read "$app_path/Contents/Info.plist" CFBundleExecutable 2>/dev/null || echo "inconnu")
app_category=$(defaults read "$app_path/Contents/Info.plist" LSApplicationCategoryType 2>/dev/null || echo "inconnue")
fi
# Obtenir taille application
size_bytes=$(du -sk "$app_path" 2>/dev/null | cut -f1 || echo "0")
size_bytes=$((size_bytes * 1024)) # Convertir KB en octets
size_human=$(du -sh "$app_path" 2>/dev/null | cut -f1 || echo "inconnue")
total_size_bytes=$((total_size_bytes + size_bytes))
# Obtenir horodatages
install_date=$(stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S" "$app_path/Contents/_MASReceipt/receipt" 2>/dev/null || echo "inconnue")
last_modified=$(stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S" "$app_path" 2>/dev/null || echo "inconnue")
# Essayer d'extraire métadonnées supplémentaires si demandé
if [[ "$include_metadata" == "true" ]]; then
# Chercher identifiant équipe
local team_id=""
if command -v codesign >/dev/null 2>&1; then
team_id=$(codesign -dv "$app_path" 2>&1 | grep "TeamIdentifier" | awk -F'=' '{print $2}' || echo "inconnu")
fi
# Vérifier si application en cours d'exécution
local is_running="false"
if pgrep -f "$app_name" >/dev/null 2>&1; then
is_running="true"
fi
# Obtenir permissions application (vérification simplifiée)
local has_camera_permission="inconnue"
local has_microphone_permission="inconnue"
local has_location_permission="inconnue"
if [[ -f "$app_path/Contents/Info.plist" ]]; then
if defaults read "$app_path/Contents/Info.plist" NSCameraUsageDescription >/dev/null 2>&1; then
has_camera_permission="demandee"
else
has_camera_permission="non_demandee"
fi
if defaults read "$app_path/Contents/Info.plist" NSMicrophoneUsageDescription >/dev/null 2>&1; then
has_microphone_permission="demandee"
else
has_microphone_permission="non_demandee"
fi
if defaults read "$app_path/Contents/Info.plist" NSLocationUsageDescription >/dev/null 2>&1; then
has_location_permission="demandee"
else
has_location_permission="non_demandee"
fi
fi
fi
# Formater sortie basée sur format demandé
case "$output_format" in
"json")
local app_json="{
\"nom_app\": \"$app_name\",
\"bundle_id\": \"$bundle_id\",
\"version\": \"$version\",
\"version_build\": \"$build_version\",
\"taille_octets\": $size_bytes,
\"taille_humaine\": \"$size_human\",
\"date_installation\": \"$install_date\",
\"derniere_modification\": \"$last_modified\",
\"chemin_app\": \"$app_path\",
\"chemin_executable\": \"$executable_path\",
\"categorie\": \"$app_category\""
if [[ "$include_metadata" == "true" ]]; then
app_json="$app_json,
\"id_equipe\": \"$team_id\",
\"en_cours_execution\": $is_running,
\"permission_camera\": \"$has_camera_permission\",
\"permission_microphone\": \"$has_microphone_permission\",
\"permission_localisation\": \"$has_location_permission\""
fi
app_json="$app_json}"
if [[ $app_count -gt 0 ]]; then
inventory_data="$inventory_data,$app_json"
else
inventory_data="$app_json"
fi
;;
"csv")
if [[ $app_count -eq 0 ]]; then
# En-tête CSV
if [[ "$include_metadata" == "true" ]]; then
inventory_data="Nom App,Bundle ID,Version,Version Build,Taille (Octets),Taille (Humaine),Date Installation,Dernière Modification,Chemin App,Catégorie,ID Équipe,En Cours Exécution,Permission Caméra,Permission Microphone,Permission Localisation"
else
inventory_data="Nom App,Bundle ID,Version,Version Build,Taille (Octets),Taille (Humaine),Date Installation,Dernière Modification,Chemin App,Catégorie"
fi
fi
local csv_line="\"$app_name\",\"$bundle_id\",\"$version\",\"$build_version\",$size_bytes,\"$size_human\",\"$install_date\",\"$last_modified\",\"$app_path\",\"$app_category\""
if [[ "$include_metadata" == "true" ]]; then
csv_line="$csv_line,\"$team_id\",$is_running,\"$has_camera_permission\",\"$has_microphone_permission\",\"$has_location_permission\""
fi
inventory_data="$inventory_data\n$csv_line"
;;
"text"|*)
inventory_data="$inventory_data
App : $app_name
Bundle ID : $bundle_id
Version : $version ($build_version)
Taille : $size_human ($size_bytes octets)
Date Installation : $install_date
Dernière Modification : $last_modified
Chemin : $app_path
Catégorie : $app_category"
if [[ "$include_metadata" == "true" ]]; then
inventory_data="$inventory_data
ID Équipe : $team_id
Actuellement En Cours : $is_running
Permission Caméra : $has_camera_permission
Permission Microphone : $has_microphone_permission
Permission Localisation : $has_location_permission"
fi
inventory_data="$inventory_data
"
;;
esac
((app_count++))
fi
done < <(find /Applications -name "*.app" -type d -print0 2>/dev/null)
# Générer rapport final
local total_size_human=$(echo "scale=2; $total_size_bytes / 1024 / 1024 / 1024" | bc 2>/dev/null || echo "inconnue")
case "$output_format" in
"json")
local final_report="{
\"metadonnees_rapport\": {
\"horodatage\": \"$(date -u +"%Y-%m-%dT%H:%M:%SZ")\",
\"nom_hote\": \"$hostname\",
\"info_appareil\": \"$device_info\",
\"version_macos\": \"$macos_version\",
\"utilisateur_actuel\": \"$current_user\",
\"total_apps\": $app_count,
\"taille_totale_octets\": $total_size_bytes,
\"taille_totale_gb\": \"$total_size_human GB\"
},
\"applications\": [$inventory_data]
}"
echo "$final_report" > "${report_file}.json"
echo "✅ Rapport JSON sauvegardé dans : ${report_file}.json"
;;
"csv")
echo -e "$inventory_data" > "${report_file}.csv"
echo "✅ Rapport CSV sauvegardé dans : ${report_file}.csv"
;;
"text"|*)
{
echo "Rapport d'Inventaire App Store MacFleet"
echo "======================================="
echo "Généré : $(date)"
echo "Nom d'hôte : $hostname"
echo "Appareil : $device_info"
echo "Version macOS : $macos_version"
echo "Utilisateur Actuel : $current_user"
echo "Total Apps : $app_count"
echo "Taille Totale : $total_size_human GB"
echo ""
echo "Applications :"
echo "============="
echo "$inventory_data"
} > "${report_file}.txt"
echo "✅ Rapport texte sauvegardé dans : ${report_file}.txt"
;;
esac
# Sortie résumé
echo ""
echo "=== Résumé Inventaire ==="
echo "Apps découvertes : $app_count"
echo "Taille totale : $total_size_human GB"
echo "Format rapport : $output_format"
echo "Emplacement rapport : $report_file"
echo ""
return $app_count
}
# Exemples d'utilisation
echo "📊 Gestion d'Inventaire App Store d'Entreprise"
echo ""
echo "1. Générer inventaire JSON avec métadonnées"
generate_app_store_inventory "json" "true" "/tmp"
echo ""
echo "2. Générer inventaire CSV (basique)"
generate_app_store_inventory "csv" "false" "/tmp"
echo ""
echo "3. Générer inventaire texte avec métadonnées"
generate_app_store_inventory "text" "true" "/tmp"
Analyse Conformité et Sécurité Applications
#!/bin/bash
# Analyse conformité et sécurité applications App Store
analyze_app_compliance() {
echo "🔒 Analyse Conformité Applications App Store"
echo "==========================================="
echo ""
local compliance_issues=0
local security_concerns=0
local policy_violations=0
# Définir règles politique d'entreprise
local blocked_apps=("Jeux" "Réseaux Sociaux" "Rencontres") # Exemples catégories
local required_apps=("Microsoft Word" "Microsoft Excel" "Slack") # Exemples apps requises
local max_app_age_days=365 # Apps plus anciennes que 1 an signalées
local min_security_permissions=("Caméra" "Microphone" "Localisation")
echo "Analyse applications App Store pour conformité..."
echo ""
# Suivre applications requises
local found_required_apps=()
local missing_required_apps=()
# Analyser chaque application App Store
while IFS= read -r -d '' app_path; do
if [[ -d "$app_path" && -f "$app_path/Contents/_MASReceipt/receipt" ]]; then
local app_name=$(basename "$app_path" .app)
local bundle_id=""
local version=""
local category=""
local install_date=""
local days_since_install=""
echo "Analyse : $app_name"
# Obtenir métadonnées application
if [[ -f "$app_path/Contents/Info.plist" ]]; then
bundle_id=$(defaults read "$app_path/Contents/Info.plist" CFBundleIdentifier 2>/dev/null || echo "inconnu")
version=$(defaults read "$app_path/Contents/Info.plist" CFBundleShortVersionString 2>/dev/null || echo "inconnue")
category=$(defaults read "$app_path/Contents/Info.plist" LSApplicationCategoryType 2>/dev/null || echo "inconnue")
fi
# Obtenir date installation et calculer âge
if [[ -f "$app_path/Contents/_MASReceipt/receipt" ]]; then
install_date=$(stat -f "%Sm" -t "%Y-%m-%d" "$app_path/Contents/_MASReceipt/receipt" 2>/dev/null || echo "inconnue")
if [[ "$install_date" != "inconnue" ]]; then
local install_epoch=$(date -j -f "%Y-%m-%d" "$install_date" "+%s" 2>/dev/null || echo "0")
local current_epoch=$(date "+%s")
days_since_install=$(( (current_epoch - install_epoch) / 86400 ))
fi
fi
# Vérifier contre applications/catégories bloquées
local is_blocked=false
for blocked_category in "${blocked_apps[@]}"; do
if [[ "$category" =~ "$blocked_category" ]] || [[ "$app_name" =~ "$blocked_category" ]]; then
echo " ❌ VIOLATION POLITIQUE : Catégorie app '$category' est bloquée"
is_blocked=true
((policy_violations++))
break
fi
done
# Vérifier âge application
if [[ -n "$days_since_install" && "$days_since_install" -gt "$max_app_age_days" ]]; then
echo " ⚠️ CONFORMITÉ : App plus ancienne que $max_app_age_days jours ($days_since_install jours)"
((compliance_issues++))
fi
# Vérifier permissions sécurité
local permission_count=0
if [[ -f "$app_path/Contents/Info.plist" ]]; then
if defaults read "$app_path/Contents/Info.plist" NSCameraUsageDescription >/dev/null 2>&1; then
echo " 🔒 SÉCURITÉ : App demande accès caméra"
((permission_count++))
fi
if defaults read "$app_path/Contents/Info.plist" NSMicrophoneUsageDescription >/dev/null 2>&1; then
echo " 🔒 SÉCURITÉ : App demande accès microphone"
((permission_count++))
fi
if defaults read "$app_path/Contents/Info.plist" NSLocationUsageDescription >/dev/null 2>&1; then
echo " 🔒 SÉCURITÉ : App demande accès localisation"
((permission_count++))
fi
if [[ "$permission_count" -gt 2 ]]; then
echo " ⚠️ PRÉOCCUPATION SÉCURITÉ : App demande permissions sensibles multiples"
((security_concerns++))
fi
fi
# Vérifier contre applications requises
for required_app in "${required_apps[@]}"; do
if [[ "$app_name" =~ "$required_app" ]]; then
found_required_apps+=("$required_app")
fi
done
# Vérification signature code
if command -v codesign >/dev/null 2>&1; then
if ! codesign -v "$app_path" >/dev/null 2>&1; then
echo " ❌ SÉCURITÉ : Signature code invalide"
((security_concerns++))
fi
fi
echo " ✅ Analyse terminée"
echo ""
fi
done < <(find /Applications -name "*.app" -type d -print0 2>/dev/null)
# Vérifier applications requises manquantes
for required_app in "${required_apps[@]}"; do
local found=false
for found_app in "${found_required_apps[@]}"; do
if [[ "$found_app" == "$required_app" ]]; then
found=true
break
fi
done
if [[ "$found" == "false" ]]; then
missing_required_apps+=("$required_app")
fi
done
# Générer rapport conformité
echo "=== Rapport Analyse Conformité ==="
echo "Violations politique : $policy_violations"
echo "Problèmes conformité : $compliance_issues"
echo "Préoccupations sécurité : $security_concerns"
echo ""
if [[ ${#missing_required_apps[@]} -gt 0 ]]; then
echo "Applications requises manquantes :"
for missing_app in "${missing_required_apps[@]}"; do
echo " - $missing_app"
done
echo ""
fi
if [[ ${#found_required_apps[@]} -gt 0 ]]; then
echo "Applications requises trouvées :"
for found_app in "${found_required_apps[@]}"; do
echo " ✅ $found_app"
done
echo ""
fi
# Score conformité global
local total_issues=$((policy_violations + compliance_issues + security_concerns + ${#missing_required_apps[@]}))
if [[ "$total_issues" -eq 0 ]]; then
echo "🎉 STATUT CONFORMITÉ : ENTIÈREMENT CONFORME"
elif [[ "$total_issues" -le 3 ]]; then
echo "⚠️ STATUT CONFORMITÉ : PROBLÈMES MINEURS ($total_issues problèmes)"
else
echo "❌ STATUT CONFORMITÉ : PROBLÈMES MAJEURS ($total_issues problèmes)"
fi
return $total_issues
}
# Exécuter analyse conformité
analyze_app_compliance
Gestion Flotte et Rapports
Gestion Applications Flotte d'Entreprise
#!/bin/bash
# Gestion App Store flotte d'entreprise
manage_fleet_app_inventory() {
local operation="${1:-discover}" # discover, report, compliance, update
local fleet_config_file="${2:-/etc/macfleet/app_config.json}"
local output_dir="${3:-/var/log/macfleet}"
echo "🚀 Gestion App Store Entreprise MacFleet"
echo "======================================="
echo "Opération : $operation"
echo "Fichier config : $fleet_config_file"
echo "Répertoire sortie : $output_dir"
echo ""
# Assurer que répertoire sortie existe
mkdir -p "$output_dir"
# Identification appareil
local device_id=$(system_profiler SPHardwareDataType | grep "Serial Number" | awk -F': ' '{print $2}' | xargs)
local device_name=$(hostname)
local timestamp=$(date +"%Y%m%d_%H%M%S")
local report_file="$output_dir/fleet_app_report_${device_id}_${timestamp}.json"
case "$operation" in
"discover")
echo "🔍 Mode Découverte Flotte"
echo "========================="
# Générer inventaire application complet
local app_data=$(generate_comprehensive_app_data)
# Créer rapport flotte
local fleet_report="{
\"info_appareil\": {
\"id_appareil\": \"$device_id\",
\"nom_appareil\": \"$device_name\",
\"horodatage\": \"$(date -u +"%Y-%m-%dT%H:%M:%SZ")\",
\"version_macos\": \"$(sw_vers -productVersion)\",
\"utilisateur_actuel\": \"$(stat -f%Su /dev/console 2>/dev/null || echo "$USER")\"
},
\"inventaire_apps\": $app_data,
\"operation\": \"decouverte_flotte\"
}"
echo "$fleet_report" > "$report_file"
echo "✅ Rapport découverte flotte sauvegardé : $report_file"
;;
"compliance")
echo "📋 Vérification Conformité Flotte"
echo "================================="
# Exécuter analyse conformité
local compliance_result=$(analyze_fleet_compliance)
# Créer rapport conformité
local compliance_report="{
\"info_appareil\": {
\"id_appareil\": \"$device_id\",
\"nom_appareil\": \"$device_name\",
\"horodatage\": \"$(date -u +"%Y-%m-%dT%H:%M:%SZ")\"
},
\"resultats_conformite\": $compliance_result,
\"operation\": \"verification_conformite\"
}"
echo "$compliance_report" > "$report_file"
echo "✅ Rapport conformité sauvegardé : $report_file"
;;
"report")
echo "📊 Mode Rapports Flotte"
echo "======================="
# Générer tous formats rapport
echo "Génération rapports flotte complets..."
generate_app_store_inventory "json" "true" "$output_dir"
generate_app_store_inventory "csv" "true" "$output_dir"
generate_app_store_inventory "text" "true" "$output_dir"
echo "✅ Tous rapports flotte générés dans : $output_dir"
;;
"update")
echo "🔄 Vérification Mise à Jour Flotte"
echo "==================================="
# Vérifier mises à jour applications
check_app_store_updates
;;
*)
echo "❌ Opération inconnue : $operation"
echo "Opérations disponibles : discover, report, compliance, update"
return 1
;;
esac
return 0
}
# Fonction auxiliaire pour générer données applications complètes
generate_comprehensive_app_data() {
local apps_json="["
local first_app=true
while IFS= read -r -d '' app_path; do
if [[ -d "$app_path" && -f "$app_path/Contents/_MASReceipt/receipt" ]]; then
local app_name=$(basename "$app_path" .app)
local bundle_id=$(defaults read "$app_path/Contents/Info.plist" CFBundleIdentifier 2>/dev/null || echo "inconnu")
local version=$(defaults read "$app_path/Contents/Info.plist" CFBundleShortVersionString 2>/dev/null || echo "inconnue")
local size_bytes=$(du -sk "$app_path" 2>/dev/null | cut -f1 || echo "0")
size_bytes=$((size_bytes * 1024))
if [[ "$first_app" == "false" ]]; then
apps_json="$apps_json,"
fi
apps_json="$apps_json{
\"nom\": \"$app_name\",
\"bundle_id\": \"$bundle_id\",
\"version\": \"$version\",
\"taille_octets\": $size_bytes,
\"chemin\": \"$app_path\"
}"
first_app=false
fi
done < <(find /Applications -name "*.app" -type d -print0 2>/dev/null)
apps_json="$apps_json]"
echo "$apps_json"
}
# Vérifier mises à jour App Store
check_app_store_updates() {
echo "Vérification mises à jour App Store disponibles..."
# Utiliser softwareupdate pour vérifier mises à jour disponibles
local updates_available=$(softwareupdate -l 2>/dev/null | grep -i "app store" || echo "")
if [[ -n "$updates_available" ]]; then
echo "📦 Mises à jour App Store disponibles :"
echo "$updates_available"
else
echo "✅ Toutes applications App Store sont à jour"
fi
# Vérifier aussi Mac App Store directement si disponible
if command -v mas >/dev/null 2>&1; then
echo ""
echo "Vérification avec mas-cli..."
mas outdated 2>/dev/null || echo "mas-cli non disponible ou aucune mise à jour trouvée"
fi
}
# Exemples d'utilisation
echo "Exemples Gestion Flotte :"
echo "========================="
echo ""
echo "1. Mode découverte :"
manage_fleet_app_inventory "discover"
echo ""
echo "2. Vérification conformité :"
manage_fleet_app_inventory "compliance"
echo ""
echo "3. Générer tous rapports :"
manage_fleet_app_inventory "report"
Intégration App Store Connect
Gestion Applications d'Entreprise avec App Store Connect
#!/bin/bash
# Intégration App Store Connect d'entreprise pour gestion licences
manage_app_store_licenses() {
echo "📄 Gestion Licences App Store Connect"
echo "====================================="
echo ""
# Note : Ceci nécessite accès App Store Connect d'entreprise
# et configuration appropriée identifiants API
local license_report_file="/tmp/app_store_licenses_$(date +%Y%m%d_%H%M%S).json"
echo "Analyse licences applications App Store..."
echo ""
# Suivre applications nécessitant potentiellement licences business
local business_apps=()
local consumer_apps=()
local unknown_apps=()
while IFS= read -r -d '' app_path; do
if [[ -d "$app_path" && -f "$app_path/Contents/_MASReceipt/receipt" ]]; then
local app_name=$(basename "$app_path" .app)
local bundle_id=$(defaults read "$app_path/Contents/Info.plist" CFBundleIdentifier 2>/dev/null || echo "inconnu")
# Catégories nécessitant typiquement licences business
local business_categories=("Outils Développeur" "Business" "Productivité" "Graphisme & Design")
local is_business_app=false
# Vérifier si application est orientée business
if [[ -f "$app_path/Contents/Info.plist" ]]; then
local category=$(defaults read "$app_path/Contents/Info.plist" LSApplicationCategoryType 2>/dev/null || echo "inconnue")
for biz_cat in "${business_categories[@]}"; do
if [[ "$category" =~ "$biz_cat" ]]; then
is_business_app=true
break
fi
done
# Vérifier aussi modèles applications business communes
if [[ "$app_name" =~ (Microsoft|Adobe|Slack|Zoom|Teams|Office) ]]; then
is_business_app=true
fi
fi
if [[ "$is_business_app" == "true" ]]; then
business_apps+=("$app_name ($bundle_id)")
echo "💼 Application business détectée : $app_name"
else
# Applications consommateur potentiellement acceptables
if [[ "$app_name" =~ (Calculatrice|TextEdit|Safari|Mail|Photos) ]]; then
consumer_apps+=("$app_name ($bundle_id)")
echo "👤 Application consommateur : $app_name"
else
unknown_apps+=("$app_name ($bundle_id)")
echo "❓ Catégorie inconnue : $app_name"
fi
fi
fi
done < <(find /Applications -name "*.app" -type d -print0 2>/dev/null)
# Générer rapport conformité licence
{
echo "{"
echo " \"analyse_licence\": {"
echo " \"horodatage\": \"$(date -u +"%Y-%m-%dT%H:%M:%SZ")\","
echo " \"id_appareil\": \"$(system_profiler SPHardwareDataType | grep "Serial Number" | awk -F': ' '{print $2}' | xargs)\","
echo " \"apps_business\": ["
local first=true
for app in "${business_apps[@]}"; do
if [[ "$first" == "false" ]]; then echo ","; fi
echo " \"$app\""
first=false
done
echo " ],"
echo " \"apps_consommateur\": ["
first=true
for app in "${consumer_apps[@]}"; do
if [[ "$first" == "false" ]]; then echo ","; fi
echo " \"$app\""
first=false
done
echo " ],"
echo " \"apps_inconnues\": ["
first=true
for app in "${unknown_apps[@]}"; do
if [[ "$first" == "false" ]]; then echo ","; fi
echo " \"$app\""
first=false
done
echo " ],"
echo " \"resume\": {"
echo " \"total_apps_business\": ${#business_apps[@]},"
echo " \"total_apps_consommateur\": ${#consumer_apps[@]},"
echo " \"total_apps_inconnues\": ${#unknown_apps[@]},"
echo " \"necessite_revision_licence\": $([[ ${#business_apps[@]} -gt 0 || ${#unknown_apps[@]} -gt 0 ]] && echo "true" || echo "false")"
echo " }"
echo " }"
echo "}"
} > "$license_report_file"
echo ""
echo "=== Résumé Analyse Licence ==="
echo "Applications business trouvées : ${#business_apps[@]}"
echo "Applications consommateur trouvées : ${#consumer_apps[@]}"
echo "Applications inconnues trouvées : ${#unknown_apps[@]}"
echo ""
if [[ ${#business_apps[@]} -gt 0 || ${#unknown_apps[@]} -gt 0 ]]; then
echo "⚠️ Révision licence requise pour applications business/inconnues"
echo "📄 Rapport licence sauvegardé : $license_report_file"
else
echo "✅ Aucune préoccupation licence business détectée"
fi
return 0
}
# Exécuter gestion licence
manage_app_store_licenses
Notes Importantes
Fonctionnalités Gestion Entreprise
- Inventaire Complet - Découverte et suivi complets applications App Store
- Surveillance Conformité - Application politique et analyse sécurité
- Gestion Licence - Intégration App Store Connect d'entreprise
- Rapports Flotte - Rapports multi-format (JSON, CSV, texte) avec métadonnées
- Analyse Sécurité - Audit permissions et vérification signature code
- Gestion Mise à Jour - Détection et gestion mises à jour App Store
Système Reçu App Store
- Reçus MAS - Preuve numérique achat App Store située dans
Contents/_MASReceipt/receipt
- Identification Bundle - Suivi application unique via CFBundleIdentifier
- Suivi Version - Gestion version application et numéro build
- Métadonnées Installation - Suivi date installation et modification
- Vérification Licence - Conformité et allocation licence d'entreprise
Sécurité et Conformité
- Audit Permissions - Surveillance accès caméra, microphone, localisation
- Vérification Signature Code - Valider intégrité et authenticité application
- Application Politique - Validation catégories applications bloquées et applications requises
- Analyse Âge - Identifier applications obsolètes nécessitant mises à jour
- Suivi Identifiant Équipe - Identification équipe développeur pour politiques entreprise
Exemples d'Utilisation
# Découverte basique applications App Store
find /Applications -path '*Contents/_MASReceipt/receipt' -maxdepth 4 -print | \
sed 's#.app/Contents/_MASReceipt/receipt#.app#g; s#/Applications/##'
# Inventaire entreprise avec sortie JSON
generate_app_store_inventory "json" "true" "/tmp"
# Analyse conformité
analyze_app_compliance
# Gestion flotte - mode découverte
manage_fleet_app_inventory "discover"
# Gestion licence
manage_app_store_licenses