60
Linux File Systems Linux File System Hierarchy General Security Information Linux File System Security Yiğit Cansın Hekimci Can Dereli

Disk Organisations

  • Upload
    elda

  • View
    36

  • Download
    0

Embed Size (px)

DESCRIPTION

Disk Organisation Linux File Systems Linux File System Hierarchy General Security Information Linux File System Security Yiğit Cansın Hekimci Can Dereli. Disk Organisations. What is a hard disk?. A hard disk drive ( HDD , also commonly shortened to hard drive and formerly - PowerPoint PPT Presentation

Citation preview

Page 1: Disk Organisations

Disk OrganisationLinux File Systems

Linux File System HierarchyGeneral Security InformationLinux File System Security

Yiğit Cansın HekimciCan Dereli

Page 2: Disk Organisations

Disk Organisations

Page 3: Disk Organisations

What is a hard disk? A hard disk drive (HDD, also commonly shortened to hard drive and formerly

known as a fixed disk) is a digitally encoded non volatile storage device which

stores data on rapidly rotating platters with magnetic surfaces.

In the simplest of forms , they give computers the ability to remember things when the power goes out.

Page 4: Disk Organisations

Hard disk contents

Page 5: Disk Organisations

How hard disk works?

• Sectors(256,512) and Tracks

• O/S or hard disk groups them as clusters

• Low level formatting (beginning and end points)

• High level formatting– File storage scheme

– Order of sector and tracks

• After HLF platters are ready to read/write

A sector

A track

Page 6: Disk Organisations

Organization of Disks...

1. Positioning the headto the sector

2. Sector is under the head

Low speed readingHigh positioning speed

High speed readingLow positioning speed

Page 7: Disk Organisations

Organization of Disks...

2. Positioning of the sector is under the head

The amount of time passed to position the sector under the head is the same inside and outside.But because of having less sectors inside the amount of time passed to position the sector is relatively less.

Page 8: Disk Organisations

Organization of Disks...

2. Positioning the Sector under the head..

Practically

%5-10

lesser.

Outside of the disk is always

Faster.

Result in practice

Page 9: Disk Organisations

SCSI vs. IDE...

SCSI

Better driver electronicBetter optimized sectorsMuch faster head move.

Tag Sorting..The most important factor

that reduces the search time forthe sector.

SCSI Systems, are indispensable for Applications

that need High Speed

High Databus speed.. Much faster transfer More device to the same databus - RAID

Page 10: Disk Organisations

Linux File Systems

Page 11: Disk Organisations

Linux EXT2

File location informations are scattered througout the disk.

The pointer to the file (inode) and file info are kept close.

First location to show inode table is called SUPERBLOCK.

Superblock is kept on the disk with 3-4 copies.

Privileges can be given to each of User, Group, Others.

Backs Hard/Symbolic Link.

On-the-fly Compress, immutable files vs..

Page 12: Disk Organisations

Linux EXT2 - Metadata

Page 13: Disk Organisations

EXT3

It is basicly the same as EXT2 but added journal property.

EXT2 FS, can be easily converted to EXT3:tune2fs -j /dev/hda5 ...

Journal is kept on a file.

System can be used as EXT2 in case of a journal error.

Page 14: Disk Organisations

Reiser-FS

Metadata Journal. File System InformationOn Demand, 3. Partu DATA Journal Support

Balanced B* tree. High Performance.

2 G File in directories without loss of performance..

It can hold small files in one block.

Namesys Compatibility

Page 15: Disk Organisations

SGI-XFS

Enterprise is a file system for systems.

Many extra properties.File system backup, POSIX 1003.1e ACL,Extended Attributes vs. vs. vs.

64 Bit .. No limit for the near future..

DMAPI for Hierarchical Data Storing..

Page 16: Disk Organisations

SGI-XFS

XFS don’t aim for the highest performance.

Strong, extendible FS..

POSIX 1003.6 Compatibility, ACL, MAC, Audit..

%100 data loss free Journal..

More than one Storing unit..

On high level applications guaranteed levelAdequate performance..

Page 17: Disk Organisations

Ext2

1000

500

50 100% Fullness rate

KB/sec

1K Blocs

4K Blocs

Page 18: Disk Organisations

1000

500

50 100% Fullness rate

KB/sec

ReiserFS

Page 19: Disk Organisations

2000

1000

50 100% Fullness rate

KB/sec

ReiserFS (mount -o notail)

Page 20: Disk Organisations

1000

500

50 100

KB/sec

XFS

% Fullness rate

Page 21: Disk Organisations

Any access method isn’t suitablefor every time..

Small but many files.Particion vastnessLarge filesKernel I/O mechanismPrograms disk access..

WHY ?

Page 22: Disk Organisations

Real Life...

Programs may reach very different places at the same time..

There are no queued Requests on the system..

No one can know what the programs will want on the next step..

Page 23: Disk Organisations

Real Life...

Adequently efficient if 4K blocks are used

It is a system which proved itself.

Can journal with ext3.

Fullness of the disk or defragmentation doesn’t effect speed.

Page 24: Disk Organisations

Real Life...

Relatively small but for many files..

Very good on performance

Not so trustworty.

Reiser4 comes on September/November 2002..

Page 25: Disk Organisations

Real Life...

Optimal performance is aimed.

Good on performance

Look strong, can have interesting conflicts ..not included in Kernel code..

SGI ? Promises alot with design targets

Page 26: Disk Organisations

For people who don’t like mathematics...

We tested 3 different systems.

486 DX2 32 MB RAM, 4.3 GB HDD

CEL 433 128 MB RAM, 8.4 GB HDD

PIII 1000, 512 MB RAM, 40 GB HDD..

Page 27: Disk Organisations

For people who don’t like mathematics...

On Desktop...

486 DX2 32 MB RAM, 4.3 GB HDD

CEL 433 128 MB RAM, 8.4 GB HDD

PIII 1000, 512 MB RAM, 40 GB HDD..

XFS slowest, Reiser FS average, Ext2 good..

XFS and Ext2 never got down, Reiser FS :((

XFS and Ext2 never got down, Reiser FS :((

XFS slowest, ReiserFS fast, Ext2 average

XFS and Ext2 never got down, Reiser FS :((XFS - ReiserFS same, Ext2 :((

Page 28: Disk Organisations

For people who don’t like mathematics...

We set up a network (Always been there...)

22 PIII 64..128 MB RAM, 6.4..20 GB HDDWindows 98 and Mandrake 8.0

PIII 1000 CPU512/1024 MB RAM2x40 GB SoftRAID0 HDDSuse 7.1, Linux 2.4.18 KernelApache 1.3, Samba 2.2.3aSendmail + ipop3d23 GB MP315 GB ISO Image..3 100 Mbit Ethernet

Page 29: Disk Organisations

For people who don’t like mathematics...

With Windows 98 :Using Explorer, streaming music..Copied ISO’s to the disk..We sent CD’s to the main machine with FTP..

With Linux:Watched clips through NFS.Got ISO’s through FTP.Downloaded MP3’s with Konqueror.On every machine we ran STMP and POP3

with 150 processes..

Page 30: Disk Organisations

For people who don’t like mathematics...

Performance

For Web Server:ReiserFS -> Very goodXFS -> Goodext2 -> Goodext3 -> average..

FTP/SMB/NFS:ReiserFS -> GoodXFS -> Very goodext2 -> Acceptable.ext3 -> Acceptable.

Page 31: Disk Organisations

For people who don’t like mathematics...

Stability:

ReiserFS:Make at least two UPS avaible.Don’t forget to back up.Can go down without sortege.

XFS:Don’t necessarily pay for UPS.Again don’t neglect back up.Didn’t go down without sortege.Could not be saved with Journal.

EXT2/EXT3:Having UPS is a good thing.Again don’t neglect back uping.Didn’t go down without sortege.

Page 32: Disk Organisations

For people who don’t like mathematics...

General recommendation:

For small,desktops ext2/ext3..

For people who want to be fast and furious, ReiserFS

For ReiserFs you should wait Raiser 4..

Larger machines, servers XFS..

Page 33: Disk Organisations

Understanding The Linux File System Hierarchy

Page 34: Disk Organisations
Page 35: Disk Organisations
Page 36: Disk Organisations
Page 37: Disk Organisations
Page 38: Disk Organisations

Mounting a device on the file system

Sample.tar.z – index.html – Makefile – binutils-2.15.92.0.2-5. – vsftpd_2.0.3-1.deb

Page 39: Disk Organisations

General Security Informations

Page 40: Disk Organisations

Cert/CC Incidents Reported Throughout the Years

6 132 252 406 773 1334 2340 2412 2573 2134 3734

9859

21756

52658

0

10000

20000

30000

40000

50000

60000

1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001

Page 41: Disk Organisations

Threat Types

Internal Threat Elements

– Ignorant and unconcious usage

– Bad intended actions

~ % 80

External Threat Elements

– Attacks that are aimed

– Attacks that are loose

~ % 20

Page 42: Disk Organisations

Internal Threat Elements

• Ignorent and Unconcious Usage– Unplugging of the Server by the cleaner– Database deletion by an uneducated employee

• Bad Intended Actions– A fired employee changing the corporate web site– An employee who runs a “Sniffer” under the network

and reading E-Mails– An executive selling a plan for a developed product to

the rivals

Page 43: Disk Organisations

External Threat Elements

• Attacks that are aimed– An attacker changing the corporate web site– An attacker changing corporate accounting registers– Multiple attackers accessing the corporate web server

and stolling it for service

• Attacks that are loose– Virus Attacks (Melissa, CIH – Chernobyl, Vote)– Worm Attackers (Code Red, Nimda)– Trojan Back Doors (Netbus, Subseven, Black Orifice)

Page 44: Disk Organisations

Attacker Types

• Professional Criminals

• Young generation attackers

• Corporate employees

• Industry and Technology spies

• Outside Government Administrations

Page 45: Disk Organisations

Quality of attack and the evolution of attackers abilities (CERT/CC)

Page 46: Disk Organisations

Quality of Attackes and Their Guessed Numbers

Very Dangerous

Predator

Mid-Level

Entry Level

Hundreds

Thousands

Tens of Thousans

MillionsCarnegie Mellon University

(1998-1999-2000)

Page 47: Disk Organisations

Attacker Motivation

• Financial Benefits• Rivalry Advantage

– Political– Economical/Commercial

• Desire to Gain Extra Resources• Personal Anger or Revenge• Curiosity or Desire to Learn• Reckless Behaviour

Page 48: Disk Organisations

Systems That Are on a Network And Have Potential Risks

Local Network

Security Wall

Internet

Other Networks

Router

Web Server that is left on the conjectural

corporation

E-Mail server that allow Relay

Client that belongs to

the secretary

Client that belongs to

the administrat

orSecurity Wall that

neglects divided packeges

Router that can channel source or

Spoof

Page 49: Disk Organisations

Spoofing

• Basicly it can be defined as misleading the source.

• Usually it is used to gain extra rights from the targer, diverting the guilt to other people’s/corporations responsibility, hide itself or arrange disorganized attacks.

• It can be used in various protocols, verifiying systems , applying special processes.

Page 50: Disk Organisations

Spoofing Tecniques

• MAC Spoofing can be made through changing of MAC addresses psically or with the changes in the ethernet packeges

• ARP Spoofing can be made through misleading the matching of ARP protocol packeges and IP/MAC addresses

• IP Spoofing can be made through changing the source IP address in IP packeges

• DNS Spoofing can be made through taking over DNS servers or sending fake replies to the requests

• Identity diversion can be made through copying cookies that are taken from Web server

• It can be done in finger print systems with previously gotten finger print

Page 51: Disk Organisations

Spoofing – Example Spoofing Process

System to be attackedSystem to Take Over

Attacker

Stay outI am “it”

1 2

Page 52: Disk Organisations

Spoofing – Preventing Methods

• Using external verifying systems• Ousting services that uses verifying through

IP,DNS,ARP,MAC addresses• Using static ARP tables, matching every port one

Switches with a MAC address and protecting Switches from table overflows

• Activating reverse request (RDNS, RARP vb.)• Stopping verifying informations (passwords,files etc.)

being stored on client system

Page 53: Disk Organisations

Prevention Methods of Virus, Worm and Trojan’s

• Anti-Virus systems should be used to protect all clients and servers

• To stop Worm attacks,precautions should be taken through Intrusion Detection Systems (if possible Security Wall)

• Packages that come through Internet to the corporate Network with protocols like FTP,HTTP,STMP,POP3 and IMAP should be scanned by Anti-Virus systems and if possible an Anti-Virus Network Bridge should be used

Page 54: Disk Organisations

The Linux File System Security

Page 55: Disk Organisations

File System Security Types

1. Secure file deletion

2. Access control lists (ACL’s)

3. File encryption

4. Filesystem encryption

5. Hiding data

• vipe - fwipe

•NSA SELinux - RSBAC

• PGP - GnuPG

• TCFS - BestCrypt - PPDD

• StegHide - OutGuess - RubberHose

Page 56: Disk Organisations

GnuPGWith GPG, you can create your public and private key pair, encrypt filesusing your key, and also digitally sign a message to authenticate that it’s

really from you.

Page 57: Disk Organisations

GnuPG

Page 58: Disk Organisations

Some Problems and Solutions with GnuPG

1- Encrypting Directories Problem:You want to encrypt an entire directory tree. Solution:To produce a single encrypted file containing all files in the directory, with symmetric encryption:

$ tar cf - name_of_directory | gpg -c > files.tar.gpg

or key-based encryption:$ tar cf - name_of_directory | gpg -e > files.tar.gpg

To encrypt each file separately:$ find name_of_directory -type f -exec gpg -e '{}' \;

Page 59: Disk Organisations

The Source Books

• For Dummies – Linux All in One Desk Reference For Dummies May 2006

• Hack Proofing Linux• For Dummies - Linux For Dummies 7th Edition May 2006• Prentice Hall PTR - Real World Linux Security• O'Reilly - Linux Security Cookbook• O’Reilly - Running Linux 5th Edition - 2005 Dec

• For Dummies – Linux All in One Desk Reference For Dummies May 2006

• Hack Proofing Linux• For Dummies - Linux For Dummies 7th Edition May 2006• Prentice Hall PTR - Real World Linux Security• O'Reilly - Linux Security Cookbook• O’Reilly - Running Linux 5th Edition - 2005 Dec

Page 60: Disk Organisations

• http://www.informatik.uni-frankfurt.de/~loizides/reiserfs/• http://www.tldp.org/HOWTO/HOWTO-INDEX/os.html#OSPARTITIONS• http://www.namesys.com• http://en.wikipedia.org/wiki/Linux• http://www.oreilly.com/catalog/runlinux5/index.html• http://www.oreilly.com/catalog/linuxsckbk/• http://www.amazon.com/Real-World-Linux-Security-Prevention/dp/0130281

875• http://www.dummies.com/WileyCDA/DummiesTitle/productCd-0471752827.

html• http://www.amazon.com/Hack-Proofing-Linux-Source-Security/dp/19289943

42• http://www.dummies.com/WileyCDA/DummiesTitle/productCd-0471752622.

html• http://web.mit.edu/tytso/www/linux/ext2.html• http://uranus.it.swin.edu.au/~jn/explore2fs/es2fs.htm• http://www.ing.umu.se/~bosse/

The Source Links