Fwd: tar, compress, split and then encrypt a list of files
Helmut Waitzmann
ml.throttle at xoxy.net
Sun Dec 18 00:27:51 CET 2016
Felipe Vieira <fmv1992 at gmail.com>:
> right now I have a working workstream that gets paths from a text file and:
>
> tar -> compress -> encrypt -> split (over each line/entry)
>
> Probably there is a security issue here as some of the paths are dozens of
> gigabytes in size.
>
> I would like to swap the 'encrypt -> split' part but I'm unable to do so
> using the GNU split functionality.
I suppose, the problem is, that “split” can't split to stdout.
Maybe “dd” could be a replacement for “split” for getting chunks
of data and then using the shell to compute file names with
sequence numbers?
tar ... | compress |
(
# put a block size and number of blocks per file of your choice here:
bs=1024k
count=1024
# number of digits to be used for the sequence number:
suffixlength=3
# put a filename prefix of your choice here:
prefix=
seqnum=0
test=test
until
{
if ! "$test" "${#seqnum}" -le "${suffixlength:=1}"
then
printf >&2 '%s\n' 'The sequence numbers excede the suffix length.'
test=:
fi
file="$( printf "%s%.${suffixlength}d" "$prefix" "$seqnum" )"
{
LC_ALL=POSIX dd ${bs:+bs="$bs"} ${count:+count="$count"} 3>&- |
encrypt > "${file}" 2>&3 3>&-
} 3>&2 2>&1 |
{ grep -F -q -x -e '0+0 records in' && cat ; } > /dev/null
}
do
seqnum="$(( ${seqnum} + 1 ))"
done
)
As this problem is more one of split/dd/shell than of gpg, how
about discussing this in the usenet group “comp.unix.shell” rather
than in the “gnupg-users” mailinglist?
More information about the Gnupg-users
mailing list