1 #!/usr/local/plan9/bin/rc
12 secstore -i -g $1 <_password
16 secstore -i -p $1 <_password
21 echo >[1=2] ipso: aescbc requires fully qualified pathname
24 aescbc -i -d < $1 > `{basename $1} <[3] _password
28 aescbc -i -e > $1 < `{basename $1} <[3] _password
34 if(ls -tr | sed '1,/^_timestamp$/d' | grep -s '^'^`{basename $i}^'$')
38 ls -tr | sed '1,/^_timestamp$/d'
54 echo >[2=1] 'usage: ipso [-a -f -e -l] [-s] [file ...]'
60 if(~ $flush no && ~ $edit no && ~ $load no){
66 if(~ $flush yes && ~ $edit no && ~ $load no){
67 echo flushing old keys
68 echo delkey | 9p write factotum/ctl
72 if(~ $get aesget && ~ $#* 0){
73 echo >[2=1] ipso: must specify a fully qualified file name for aescbc '(-a)'
78 cd /tmp || exit $status
79 tmp=`{df | awk '$1=="tmpfs" {print $NF}'}
81 cd $tmp(1) || exit $status
83 chmod 700 ipso.$user || exit $status
92 if ( ~ $edit yes ) echo '
93 Warning: The editor will display the secret contents of
94 your '$name' files in the clear, and they will
95 be stored temporarily in '^$dir^'
96 in the clear, along with your password.
99 # get password and remember it
100 readcons -s $name^' password' >_password
104 if(! secstore -G . -i < _password > _listing){
105 echo 'secstore read failed - bad password?'
109 files=`{sed 's/[ ]+.*//' _listing}
114 # copy the files to local ramfs
117 echo $name ' read failed - bad password?'
122 sleep 2; date > _timestamp # so we can find which files have been edited.
126 B `{for(i in $files) basename $i}
127 readcons 'type enter when finished editing' >/dev/null
130 echo flushing old keys
131 echo delkey | 9p write factotum/ctl
134 echo loading factotum keys
135 if (~ factotum $files) cat factotum | 9p write -l factotum/ctl
138 # copy the files back
139 for(i in `{editedfiles}){
140 prompt='copy '''^`{basename $i}^''' back? [y/n/x]'
141 switch(`{readcons $prompt}){
144 echo $name ' read failed - bad password?'
148 echo ''''$i'''' copied to $name
149 if(~ $i factotum && ! ~ $load yes){ # do not do it twice
150 cat $i | 9p write -l factotum/ctl
155 echo ''''$i'''' skipped