AFP548 Changing the world one server at a time.

best pracitces to add wifi network to user’s login.keychain?

Home › Forums › OS X Server and Client Discussion › Questions and Answers › best pracitces to add wifi network to user’s login.keychain?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #381230
    tlarkin
    Participant

    I am thinking about deploying a launch agent that runs as the user logs in, as the user to add our wifi network to the keychain. Thoughts?

     #!/bin/bash
    
    # set user's login.keychain to have our wifi passsword
    # run this as the user, via user agent
    
    /usr/bin/security find-generic-password -a usd500_wpa
    
    case `/bin/echo $?` in
    
      0 )) hasloginkeychain=yes;;
    
      * )) hasloginkeychain=no;;
    
    esac
    
    if [[ $hasloginkeychain -eq yes ]]
    
      then /usr/bin/security add-generic-password -a usd500_wpa -s AirPort -D "AirPort network password" -l usd500_wpa -w mypasskey -T /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -T /usr/libexec/airportd -U ~/Library/Keychains/login.keychain
    
      else /usr/bin/security add-generic-password -a usd500_wpa -s AirPort -D "AirPort network password" -l usd500_wpa -w mypasskey -T /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -T /usr/libexec/airportd -A ~/Library/Keychains/login.keychain
    
    fi
    
    exit 0 

    Thoughts, suggestions, pointers, better methods all welcome.

    Thanks in advance!

    Tom

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.