37
Security and Integrity in Linux Filesystems. Alejandro Sanchez Acosta [email protected]

Integrity and Security in Filesystems

Embed Size (px)

Citation preview

Page 1: Integrity and Security in Filesystems

Security and Integrity in Linux

Filesystems.

Alejandro Sanchez [email protected]

Page 2: Integrity and Security in Filesystems

Linux Introduction.

Page 3: Integrity and Security in Filesystems

Introduction.

● What's free software?● What is the Linux kernel?● A little story about the Linux kernel.● Architecture portability.● Linux maintainment.● General ideas.

Page 4: Integrity and Security in Filesystems

Filesystem Sources.

Page 5: Integrity and Security in Filesystems

Filesystem sources.

● Fs/● Superblock, aio, acls, file, file_table, inode, attr, quota..● Binfmt*● Adfs, affs, afs, autofs, befs, bfs, coda, cramfs, ramfs, devfs, devpts, hfs, hpfs, qnx4, umsdos, vfat, xfs, jfs, isofs, hugetlbfs, minix, romfs, ....

Page 6: Integrity and Security in Filesystems

Filesystem Introduction.

Page 7: Integrity and Security in Filesystems

Filesystem Introduction.

● What's a Filesystem?● Management with VFS layer.● Proc fs.● Sysfs.● Relayfs.● Udev y hotplugging.

Page 8: Integrity and Security in Filesystems

What's a Filesystem?

● A place to storage data on disk.● Superblock.● Inodes.● Directory entries.● Files.

Page 9: Integrity and Security in Filesystems

Filesystem Form with VFS

● Superblock and sb_ops.● Inode and inode_ops.● File and file_operations.● Register_filesystem● Mounting a filesystem● Accesing data filesystem via defined syscalls.

Page 10: Integrity and Security in Filesystems

More Known Filesystems.

● ext2/ext3● Jfs● Reiser3 y reiser4.● XFS● NTFS● UDF● Distributed filesystems: NFS, Coda, SMB, AFS.

Page 11: Integrity and Security in Filesystems

The future of filesystems.

● More oriented-object or more oo.● Modularity via plugins.● Fasters searching data.● Encryption and compression support.● More robusted used algorithms.● Better storage.

Page 12: Integrity and Security in Filesystems

Reiserfs4 Overview.

Page 13: Integrity and Security in Filesystems

Basic semantics.

● Files.● Names and objects.● Namespaces and interfaces.● Directories.● Security attributes.

Page 14: Integrity and Security in Filesystems

Trees concepts.

● Set of nodes.● Fanout.● Finited and infinited trees. ● Keys to identify objects.● Node structure.● Items structure.

Page 15: Integrity and Security in Filesystems

Trees design.

● Height or space balanced.● B and b+ trees.● Htrees.● Positional trees.● Dancing trees.● Cache design.

Page 16: Integrity and Security in Filesystems

Nodes.

● Identified by a key.● Formatted and unformatted.● Leaf and twig nodes.● Items: nodes collection to storage data.● Units: data that we put in the whole item.

Page 17: Integrity and Security in Filesystems

Storing Data.

● Graphs and dancing trees.● Separate layers: semantic and storage.● BLOB's and extents.

Page 18: Integrity and Security in Filesystems

Atomic filesystem

● Brief history about fs crashing.● Filesystem checkers.● Reducing the damage with atomic op.● Journaled location.● Commiting allocation.

Page 19: Integrity and Security in Filesystems

Repacker.

● 80% remain unchanged on disk.● Ordering the tree.● Sort the tree and pack perfectly.● Eliminates posible fragmentation.

Page 20: Integrity and Security in Filesystems

Journaling.

● Location on disk: journal/log.● Commited area.● Problem: twice write data.● Metadata journaling.● Solution: Wandering logging.● Commiting and transactional layer.● Copy-on-capture and steal-on-capture.

Page 21: Integrity and Security in Filesystems

Distributed Filesystem.

Page 22: Integrity and Security in Filesystems

WAFL.

● Distributed Filesystem● Used in network appliances.● Snapshots.● Copy-on-write.● Large files, NFS, high performance and a quickly restart.

Page 23: Integrity and Security in Filesystems

Plugins design.

● File, directory and hash.● Security.● Item● Key assignment.● Node and item search.● Still not dinamically loaded.

Page 24: Integrity and Security in Filesystems

Reiser future.

● Cryptography and compression.● Quotas support.● Dynamic plugins.● Distributed filesystem.● Encryption on commit.

Page 25: Integrity and Security in Filesystems

Seguridad en sistemas de ficheros.

Page 26: Integrity and Security in Filesystems

Basic Polices.

● Credentials.● Capabilities.● ACL's● Attributes.● Metadata.

Page 27: Integrity and Security in Filesystems

Security in filesystems.

● Filesystem and swap crypto.● CryptoAPI support.● LSM hooks for the file access.● File capabilities.

Page 28: Integrity and Security in Filesystems

CryptoAPI.

Page 29: Integrity and Security in Filesystems

● Criptografiia en kernel space.● Uso de scatterlists.● Implementación de criptografía de clave privada y hashing (ciphers y digests)● Ejemplos: MD4, MD5, DES, AES, Blowfish, Twofish, ..● Patent-free (IDEA en el 2011? :-) y estandarizados.● Necesidad por ipv6, packet encryption.● Firma de módulos.

Page 30: Integrity and Security in Filesystems

#include <linux/crypto.h> struct scatterlist sg[2]; char result[128]; struct crypto_tfm *tfm; tfm = crypto_alloc_tfm("md5", 0); if (tfm == NULL) fail(); /* Rellenar scatterlists */ crypto_digest_init(tfm); crypto_digest_update(tfm, &sg, 2); crypto_digest_final(tfm, result); crypto_free_tfm(tfm);

Page 31: Integrity and Security in Filesystems

Cryptoloop.

● Inicializamos pool con dd.● Cargar cipher.● Losetup -e twofish /dev/loop0 /pool● Keysize and password.● Crear sistema de ficheros para loop.● Montamos sobre loop.● Desmontamos loop y filesystem.

Page 32: Integrity and Security in Filesystems

Benchmarking.

● Contest.● LTT.● Linux Test Project.● Classics benchmarks.

Page 33: Integrity and Security in Filesystems

Linux Security Modules.

Page 34: Integrity and Security in Filesystems

LSM.

● NSA, SELinux, SGI, Inmunix y Janus.● Capabilities.● sys_security y security_operations.● register_security● selinux_plug_init● netfilter.

Page 35: Integrity and Security in Filesystems

Referencias.

● Nucleo desarrollo: listas.hispalinux.es● Kernelnewbies-es y kernelnewbies.● Kerneljanitors.● LKML.● Posthalloween 2.5.x● Artículos en www.lwn.net sobre Drivers Porting.● Traducciones en es.gnu.org/~alejandro.

Page 36: Integrity and Security in Filesystems

¿¿¿Preguntas???

Page 37: Integrity and Security in Filesystems

Security and Integrity in Linux

Filesystems.Alejandro Sanchez Acosta

[email protected]