From: Edward Shushkin <edward@namesys.com>
To: Hans Reiser <reiser@namesys.com>
Cc: Valdis.Kletnieks@vt.edu, reiserfs-list@namesys.com,
reiserfs-dev@namesys.com
Subject: Re: Proposal for keying encrypted filesystem
Date: Mon, 07 Apr 2003 22:38:19 +0400 [thread overview]
Message-ID: <3E91C59B.3823865C@namesys.com> (raw)
In-Reply-To: 3E8DD2C6.2040106@namesys.com
Hans Reiser wrote:
>
> Edward Shushkin wrote:
> > On the
> >other hand, on the last seminar we made a conclusion to check key validness in
> >oredr to avoid a possible security hole when read() first looks for uptodate
> >(decrypted!) pages in memory before reading encrypted data from disk..
> >
> So how about making a key of 0 be a special case which gets you the file
> in its encrypted form?
>
Let's rather use special flags of reiser4_open() system call, or something
else instead of new special keys.
So everyone want:
1) To make cheap backup (without decryption/encryption been involved)
of ciphertext possible.
2) To make this backup possible for everyone who has appropriate
permissions but doesn't have a secret key.
I think that read/write methods for crypto files may ignore page cache which
contains decrypted data, if the appropriate reiser4-specific flag O_SDIRECT
is present, so read() will copy the ciphertext to user right from leaf nodes,
and write() will insert the ciphertext from user right to the balanced tree.
Thus, perhaps (1) is possible, *BUT* don't forget that file is stored on disk
as a set of compressed clusters, so all the data clustering issues which was
invisible in kernel will go to user's hassle, so in order to backup file user
will need to do something very unusual like the following:
/* cheap backup routine (draft without key management) */
int fd_src, fd_dst, i, bytes;
off_t fsize, cluster_size;
struct crypt_key * src_key, dst_key;
struct stat * fstat;
char * buf;
/* open the file we want to backup */
fd_src = reiser4_open(src_filename, O_RDONLY | O_SDIRECT, src_key);
/* get src file attributes */
fstat(fd_src, fstat);
fsize = fstat->st_size;
cluster_size = fstat->st_cluster; /* reiser4 specific attribute */
/* create a new crypto-file with the same cluster_size for backup */
fd_dst = reiser4_open(dst_filename, O_CREAT | O_WRONLY | O_SDIRECT, dst_key, cluster_size);
buf = malloc(cluster_size);
for (i = 0; i <= fsize/cluster_size; i++) {
bytes = read(fd_src, buf, cluster_size);
if (bytes == -1) {
perror("read failed");
exit();
}
if (write(fd_dst, buf, bytes) != bytes){
perror("write failed");
exit();
}
lseek(fd_dst, cluster_size - bytes, SEEK_CUR);
}
free(buf);
close(fd_src);
close(fd_dst);
Basically the usage of all file syscalls will be senseless for the
files opened with O_SDIRECT flag (it can be applied only in some
operations which are going per cluster), moreover it will be easy to
corrupt this files if they are not readonly. So (1) is possible with
additional kernel support and inflated user's hassle.
The (2) remains to be impossible, since after the file was opened with
O_SDIRECT flag, its *decrypted* data can be mapped into memory by mmap()
which looks to the page cache, so anyway cheap backup can be done only
by secret/share key owner.
Suggestions?
Edward.
next prev parent reply other threads:[~2003-04-07 18:38 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-29 1:26 Proposal for keying encrypted filesystem Pierre Abbat
2003-03-29 16:46 ` Edward Shushkin
2003-03-29 16:55 ` Pierre Abbat
2003-03-29 18:17 ` Edward Shushkin
2003-03-29 20:49 ` Pierre Abbat
2003-03-30 10:12 ` Hendrik Visage
2003-03-30 17:00 ` Pierre Abbat
2003-03-31 9:15 ` Hendrik Visage
2003-03-30 16:30 ` Pierre Abbat
2003-03-31 11:21 ` Edward Shushkin
2003-03-31 12:09 ` Edward Shushkin
2003-03-31 13:36 ` Hendrik Visage
2003-03-31 13:54 ` Pierre Abbat
2003-03-31 16:35 ` Hendrik Visage
2003-03-31 20:11 ` Pierre Abbat
2003-03-31 21:31 ` Hendrik Visage
2003-03-31 22:40 ` Pierre Abbat
2003-04-01 9:31 ` Hendrik Visage
2003-03-31 13:58 ` Edward Shushkin
2003-03-31 16:45 ` Hendrik Visage
2003-04-01 12:28 ` Edward Shushkin
2003-04-01 16:06 ` Hans Reiser
2003-04-01 16:16 ` Anders Widman
2003-04-01 16:21 ` Hans Reiser
2003-04-02 2:56 ` Pierre Abbat
2003-04-02 6:06 ` Hans Reiser
2003-04-02 13:05 ` Pierre Abbat
2003-04-02 15:11 ` Edward Shushkin
2003-04-03 16:14 ` Valdis.Kletnieks
2003-04-03 19:43 ` Hans Reiser
2003-04-03 20:08 ` Valdis.Kletnieks
2003-04-03 19:44 ` Hans Reiser
2003-04-03 23:22 ` Pierre Abbat
2003-04-04 0:25 ` Russell Coker
2003-04-04 14:01 ` Valdis.Kletnieks
2003-04-04 14:30 ` Pierre Abbat
2003-04-04 14:47 ` Valdis.Kletnieks
2003-04-04 14:57 ` Pierre Abbat
2003-04-04 16:36 ` Edward Shushkin
2003-04-04 16:45 ` Valdis.Kletnieks
2003-04-04 15:25 ` Edward Shushkin
2003-04-04 16:50 ` Hans Reiser
2003-04-04 17:19 ` Edward Shushkin
2003-04-04 18:45 ` Hans Reiser
2003-04-05 0:01 ` Pierre Abbat
2003-04-07 0:44 ` Valdis.Kletnieks
2003-04-07 1:14 ` Pierre Abbat
2003-04-07 4:52 ` Valdis.Kletnieks
2003-04-07 16:55 ` Hans Reiser
2003-04-07 18:38 ` Edward Shushkin [this message]
2003-04-07 19:46 ` Hans Reiser
2003-04-07 22:36 ` Pierre Abbat
2003-04-08 10:10 ` Edward Shushkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3E91C59B.3823865C@namesys.com \
--to=edward@namesys.com \
--cc=Valdis.Kletnieks@vt.edu \
--cc=reiser@namesys.com \
--cc=reiserfs-dev@namesys.com \
--cc=reiserfs-list@namesys.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.