Changeset 64206d3


Ignore:
Timestamp:
02/09/15 10:35:01 (6 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, enter/10, releng/10.1.2
Children:
d2a8554
Parents:
ed0d172
Message:

Update personacrypt, have it remove passphrase file in case of
failures in "mount", also do cleanup of users old $HOME directory
after moving to personacrypt stick

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-sh/pcbsd-utils/personacrypt/personacrypt

    r6d2f407 r64206d3  
    9696    exit_err "Username: ${UNAME} is too long! Needs to be less than 12 char" 
    9797 fi 
     98 if [ -z "${HDIR}" -o "${HDIR}" = "/" ] ; then 
     99    exit_err "Invalid HOME directory ${HDIR}" 
     100 fi 
    98101 LABEL="p_${UNAME}" 
    99102 UID=`cat /etc/passwd | grep "^$UNAME:" | cut -d ':' -f 3` 
     
    135138 fi 
    136139 sync ; sleep 0.5 
     140 
     141 # Remove the old HOMEDIR data 
     142 rc_halt "rm -rf ${HDIR}" 
     143 rc_halt "mkdir ${HDIR}" 
     144 rc_halt "chown -R ${UID}:${GID} ${HDIR}" 
     145 rc_halt "touch ${HDIR}/.personacrypt-enabled" 
     146 
     147 # Unmount and cleanup 
    137148 rc_halt "umount ${TMPMNT}" 
    138149 rc_halt "rmdir ${TMPMNT}" 
     
    163174 # Get the disk name for the alias 
    164175 DISK="`glabel status | grep -w label/p_${UNAME} | awk '{print $3}'`" 
    165  if [ -z "$DISK" ] ; then exit_err "No PersonaCrypt device for user: $UNAME" ; fi 
    166  if [ ! -e "${PCDBDIR}/${UNAME}.key" ] ; then exit_err "No saved key for ${UNAME}" ; fi 
    167  
    168  rc_halt "geli attach -k ${PCDBDIR}/${UNAME}.key -j ${PASSFILE} ${DISK}p1" 
     176 if [ -z "$DISK" ] ; then rm ${PASSFILE} ; exit_err "No PersonaCrypt device for user: $UNAME" ; fi 
     177 if [ ! -e "${PCDBDIR}/${UNAME}.key" ] ; then rm ${PASSFILE} ; exit_err "No saved key for ${UNAME}" ; fi 
     178 
     179 geli attach -k ${PCDBDIR}/${UNAME}.key -j ${PASSFILE} ${DISK}p1 
     180 if [ $? -ne 0 ] ; then 
     181   rm ${PASSFILE} 
     182   exit_err "Failed to attach to GELI device.. Wrong password / key file?" 
     183 fi 
     184 rc_halt "rm ${PASSFILE}" 
    169185 rc_halt "zpool import persona_${UNAME}" 
    170186 exit 0 
Note: See TracChangeset for help on using the changeset viewer.