SlideShare a Scribd company logo
Mohammed Farragmfarrag@freebsd.orghttp://wiki.freebsd.org/MohammedFarrag
Security Types
Encryption and Decryption. Symmetric and Asymmetric. Security Topics
FreeBSD Security Categories
UFS: implement special filesystem flags on files. flags enforce the same behavior for all users. kernel is responsible for enforcing these controls, depending on your kernel securelevel. Filesystem Protections
UFS2:  use Access Control Lists producing fine-grained control over permissions. Different users can be given different sets of permissions without relying on traditional Unix groups.
Turn off the flag     Specifying 0 in place of a flag name will turn off all the flags on a file. It's an inelegant little shortcut, but it works. For example, chflags 0foo will turn off all the flags on the file foo.
Use –o option of ls command Example:  /var/log -rw------- 1 root wheel sappnd 1862 Sep 30 22:39 auth.log  -rw------- 1 root wheel sappnd 38374 Sep 30 22:45 cron -rw------- 1 root wheel nodump 3157 Sep 30 03:06 dmesg.today -rw-r--r-- 1 root wheel sappnd 28056 Sep 30 22:39 lastlog -rw-r--r-- 1 root wheel     -               0   Jun 4 21:57 lpd-errs  -rw-r----- 1 root wheel sappnd 2160 Sep 30 03:06 maillog -rw-r--r-- 1 root wheel sappnd 15547 Sep 30 22:47 messages  -rw-r----- 1 root mail sappnd 628 Sep 30 03:06 sendmail.st  -rw-r----- 1 root mail schg 3455 Sep 29 22:00 sendmail.st.0  -rw-r----- 1 root mail schg 5543 Jun 4 21:57 sendmail.st.1 View active flags on a file
schg, is derived from "system change," it is universally referred to as the "immutable" flag. When the system immutable flag is set on a file, nothing can modify any part of it. Its metadata (modification times, permissions, owner, group, and so on) cannot be changed, nor can its contents. It cannot be renamed, unlinked (i.e., deleted), or moved, either.  Only root can unset at zero kernel security level. System immutable flag (schg)
The user immutable flag is a kinder, gentler immutable flag that is not affected by the kernel securelevel.  Users can set and unset this on their own files and directories, just as root can.  Unlike the system immutable flag, this one can be unset at any time.  In order to be able to set this flag, you must be either the file's owner or root.  A user with write access via Unix groups or ACLs, for example, still cannot set this flag. User immutable flag (uchg)
Normally all files in a filesystem are backed up when the dump(8) program runs. The nodump flag tells the backup system not to include the given file in the dumps. To tell dump to honor the nodump flag, specify -h on the dump command line.  If you want files to be omitted from backups entirely (i.e., not even included on full dumps), then you need to specify -h 0 on the command line. Nodump flag (nodump)
The append-only flag prevents files from being modified, much like the immutable flag, with one exception: data can be appended at the end of the file. The archetypal use of the append-only flag is for logfiles on secured servers or perhaps for root's .history file to help catch unwary hackers (see "Candidates for append-only," later in this chapter). System append-only flag (sappnd)
The user append-only flag performs exactly as the system append-only flag described above. The only difference is that this flag can be unset by both the owner and root at any time, regardless of the kernel securelevel. User append-only flag (uappnd)
This flag is a little weaker than the schg flag. It simply prevents the deletion of a file. It is arguably most useful in its "user" version, uunlnk.  It does not prevent truncation of the file or modification of its contents, its permissions, or any other aspect. It merely prevents the file from being removed. Like other "system" flags, it can only be set by root, and it cannot be unset when the kernel security level is greater than 0.  This flag exists only in FreeBSD System no unlink flag (sunlnk)
This flag allows a user to indicate that a file may not be deleted, regardless of the actual Unix permissions on its parent directory. Normally, if a user has permissions (through user, group, or ACLs) on the parent directory, she can delete any file in the directory—even files she does not own. That's because, in Unix filesystems such as UFS, the permission for deleting a file is a function of modifying the directory, not the file itself. User no unlink flag (uunlnk)
Opaque flags are used on directories or files that are involved in unionfs mounts. Union mounts allow one directory or filesystem to be mounted over the top of another directory while retaining visibility into the underlying directory. Thus, when you look in the top-level directory, you see the union of the two directories. A file that exists in one place but not the other (XOR) will be visible. If there are files or directories of the same name in both places, the "uppermost" one is the one that is accessible. Opaque flag (opaque)
When a directory is marked opaque with the opaque flag, it only shows files that actually exist in its level. That is, it makes the union mount act like a regular mount; files in the corresponding directory of a lower layer will be invisible. Opaque flag (opaque) – cont’d
The find command understands flags if you give it the -flags argument.  For instance, this command finds all files that have the uunlnk flag set in user paco's home directory:     find /home/paco -flags +uunlnk -print.  File Flags Searching
/etc/fstab file  Tagging the superblock directly Enable ACLs
/etc/fstab Enable ACL Option for /home directory
Preferable. Can be used in two ways ,[object Object]
unmount idle filesystemwith the following steps
umount it.
  run tunefs -a /home.ACLs in the superblock
% setfacl -b book.pdf # Erase any existing ACLs # Add ahmed’s access % setfacl -m u:ahmed:rw book.pdf # Nobody else gets any permission at all setfacl -m o:: book.pdf Setting ACLs for Files File name User/Group/Others User/Group name Access Rights
getfacl book.pdf    #file:book.pdf    #owner:1001    #group:100    user::rw- user:ahmed:rw-    mask::rw-    other::--- Viewing ACLs for Files
We can modify the kernel security architecture using Sysctl’s. We have 5 levels of kernel security (-1 .. 3). Enable Kernel Security: ,[object Object]
   In the shell, sysctlkern.securelevel=2
 Secure the kernel permanently.
In /etc/sysctl.conf, sysctlkern.securelevel=2Kernel
chroot Jail User Process Control
The principles behind chroot are simple.    A process running in a chrooted environment sees a normal filesystem, but it in fact has a virtual root directory. The goal is to prevent the process from accessing files outside its sandbox.  chroot
If ntpd runs in a chrooted environment, for example, and an exploit is discovered that causes it to overwrite a file, files in the real filesystem should be protected. The daemon perceives a / directory and will write relative to that directory, but on the real filesystem, the directory is something like /var/ntpd, and the daemon cannot actually reach the real / directory.
Jails expand this model by virtualizing not only access to the file system, but also the set of users, the networking subsystem of the FreeBSD kernel and a few other things. FreeBSD Jail
A directory subtree -- the starting point from which a jail is entered. Once inside the jail, a process is not permitted to escape outside of this subtree.  A hostname -- the hostname which will be used within the jail. Jails are mainly used for hosting network services, therefore having a descriptive hostname for each jail can really help the system administrator. An IP address -- this will be assigned to the jail and cannot be changed in any way during the jail's life span.  A command -- the path name of an executable to run inside the jail.  Jail Characteristics
# setenv D /here/is/the/jail # mkdir -p $D  # cd /usr/src # make buildworld # make installworld DESTDIR=$D  # make distribution DESTDIR=$D  # mount -t devfsdevfs $D/dev  Creating Jails
Selecting a location for a jail is the best starting point. This is where the jail will physically reside within the file system of the jail's host.  A good choice can be /usr/jail/jailname, where jailname is the hostname identifying the jail.  # mkdir -p $D
The distribution target for make installs every needed configuration file. In simple words, it installs every installable file of /usr/src/etc/ to the /etc directory of the jail environment: $D/etc/.  make distribution DESTDIR=$D
Mounting the devfs file system inside a jail is not required.  It is very important to control access to devices from inside a jail, as improper settings could permit an attacker to do nasty things in the jail. Control over devfs(8) is managed through rulesets which are described in the devfs(8) and devfs.conf(5) manual pages. # mount -t devfsdevfs $D/dev
/etc/rc.conf since it will replicate the startup sequence of a real FreeBSD system. For a service jail, it depends on the service or application that will run within the jail. Jail Enabling
Jail Configuration
From Host System # /etc/rc.d/jail start www # /etc/rc.d/jail stop www The best way to shut down a jail is: ,[object Object]
 using the jexecutility from outside the jail.Jail Starting & Stopping
Among the many third-party utilities for jail administration, one of the most complete and useful is sysutils/jailutils. It is a set of small applications that contribute to jail management. Please refer to its web page for more information. Jail High-level administrative tools
Fighting Buffer Overflows Cryptography. Inherent Protection
The goal of W^X is to make a program crash if it attempts to write to an execute-only page or execute code on a write-only page. The kernel and the loader try to make sure that a program's instructions are always allocated on pages marked executable, and data (e.g., the program's stack and heap) is always allocated to pages that are writable but not executable
maxusers  make it 0 to turn control to physical RAM. Increasing Maximum Values. For example, kern.ipc.somaxconn. Network Buffering For example, net.inet.tcp.sendspace Optimizations (OS Tuning)

More Related Content

What's hot

Alexander rodchenko
Alexander rodchenkoAlexander rodchenko
Alexander rodchenko
Daniela Castro
 
Kübizm-kübizm nedir?
Kübizm-kübizm nedir?Kübizm-kübizm nedir?
Kübizm-kübizm nedir?
Suzan Postallı
 
Pop Art - Seminário
Pop Art - SeminárioPop Art - Seminário
Pop Art - Seminário
Bianca Gurgel
 
Cubismo
Cubismo Cubismo
Cubismo
Sarinha Silva
 
El surrealismo
El surrealismoEl surrealismo
El surrealismo
papefons Fons
 
Carta Gantt Y Plan De Rodaje
Carta Gantt  Y Plan De RodajeCarta Gantt  Y Plan De Rodaje
Carta Gantt Y Plan De Rodaje
audiovisiones
 
Arte Argentino
Arte ArgentinoArte Argentino
Arte Argentino
Maria Jose Barrios
 
Publicidad en radio
Publicidad en radioPublicidad en radio
Publicidad en radio
Betirita
 
Tema 10. gouache
Tema 10. gouacheTema 10. gouache
Tema 10. gouache
Paula Iglesias
 
Tema 22.El Expresionismo abstracto. El Informalismo. El Minimal Art, ...
Tema 22.El Expresionismo abstracto. El Informalismo. El Minimal Art, ...Tema 22.El Expresionismo abstracto. El Informalismo. El Minimal Art, ...
Tema 22.El Expresionismo abstracto. El Informalismo. El Minimal Art, ...
Junta de Castilla y León
 
Repaso 2 eva imagenes evau
Repaso 2 eva imagenes evauRepaso 2 eva imagenes evau
Repaso 2 eva imagenes evau
María José Gómez Redondo
 
Neo dadaísmo
Neo dadaísmo Neo dadaísmo
Neo dadaísmo
Belen Lopez Romero
 
Contrapublicidad
ContrapublicidadContrapublicidad
Contrapublicidad
colegiohelicon
 
Presentacion arte conceptual
Presentacion arte conceptualPresentacion arte conceptual
Presentacion arte conceptual
Cosaco Llorme
 
Los inicios del cine y el lenguaje cinematográfico
Los inicios del cine y el  lenguaje cinematográficoLos inicios del cine y el  lenguaje cinematográfico
Los inicios del cine y el lenguaje cinematográfico
papefons Fons
 
Codes and Conventions of Interviews
Codes and Conventions of InterviewsCodes and Conventions of Interviews
Codes and Conventions of Interviews
tomeskins
 
John Singer Sargent
John Singer SargentJohn Singer Sargent
John Singer Sargent
Jerry Daperro
 
Arte Pop
Arte PopArte Pop
Arte Pop
Jhojanna3112
 
Cubismo
CubismoCubismo
Andy warhol [1186335]
Andy warhol [1186335]Andy warhol [1186335]
Andy warhol [1186335]
miriam divendra
 

What's hot (20)

Alexander rodchenko
Alexander rodchenkoAlexander rodchenko
Alexander rodchenko
 
Kübizm-kübizm nedir?
Kübizm-kübizm nedir?Kübizm-kübizm nedir?
Kübizm-kübizm nedir?
 
Pop Art - Seminário
Pop Art - SeminárioPop Art - Seminário
Pop Art - Seminário
 
Cubismo
Cubismo Cubismo
Cubismo
 
El surrealismo
El surrealismoEl surrealismo
El surrealismo
 
Carta Gantt Y Plan De Rodaje
Carta Gantt  Y Plan De RodajeCarta Gantt  Y Plan De Rodaje
Carta Gantt Y Plan De Rodaje
 
Arte Argentino
Arte ArgentinoArte Argentino
Arte Argentino
 
Publicidad en radio
Publicidad en radioPublicidad en radio
Publicidad en radio
 
Tema 10. gouache
Tema 10. gouacheTema 10. gouache
Tema 10. gouache
 
Tema 22.El Expresionismo abstracto. El Informalismo. El Minimal Art, ...
Tema 22.El Expresionismo abstracto. El Informalismo. El Minimal Art, ...Tema 22.El Expresionismo abstracto. El Informalismo. El Minimal Art, ...
Tema 22.El Expresionismo abstracto. El Informalismo. El Minimal Art, ...
 
Repaso 2 eva imagenes evau
Repaso 2 eva imagenes evauRepaso 2 eva imagenes evau
Repaso 2 eva imagenes evau
 
Neo dadaísmo
Neo dadaísmo Neo dadaísmo
Neo dadaísmo
 
Contrapublicidad
ContrapublicidadContrapublicidad
Contrapublicidad
 
Presentacion arte conceptual
Presentacion arte conceptualPresentacion arte conceptual
Presentacion arte conceptual
 
Los inicios del cine y el lenguaje cinematográfico
Los inicios del cine y el  lenguaje cinematográficoLos inicios del cine y el  lenguaje cinematográfico
Los inicios del cine y el lenguaje cinematográfico
 
Codes and Conventions of Interviews
Codes and Conventions of InterviewsCodes and Conventions of Interviews
Codes and Conventions of Interviews
 
John Singer Sargent
John Singer SargentJohn Singer Sargent
John Singer Sargent
 
Arte Pop
Arte PopArte Pop
Arte Pop
 
Cubismo
CubismoCubismo
Cubismo
 
Andy warhol [1186335]
Andy warhol [1186335]Andy warhol [1186335]
Andy warhol [1186335]
 

Viewers also liked

Denial of Service Mitigation Tactics in FreeBSD
Denial of Service Mitigation Tactics in FreeBSDDenial of Service Mitigation Tactics in FreeBSD
Denial of Service Mitigation Tactics in FreeBSD
Steven Kreuzer
 
Rewriting the Rules for DDoS Protection in 2015
Rewriting the Rules for DDoS Protection in 2015Rewriting the Rules for DDoS Protection in 2015
Rewriting the Rules for DDoS Protection in 2015
Stephanie Weagle
 
FreeBSD and Drivers
FreeBSD and DriversFreeBSD and Drivers
FreeBSD and Drivers
Kernel TLV
 
02) dr. cabrera sã­ndrome de hiperfunciã³n hipofisiaria
02) dr. cabrera   sã­ndrome de hiperfunciã³n hipofisiaria02) dr. cabrera   sã­ndrome de hiperfunciã³n hipofisiaria
02) dr. cabrera sã­ndrome de hiperfunciã³n hipofisiaria
Anchi Hsu XD
 
Un arbre Tempovision
Un arbre TempovisionUn arbre Tempovision
Un arbre Tempovision
SAMSAV
 
Pvprod v7 20111125
Pvprod v7 20111125Pvprod v7 20111125
Pvprod v7 20111125
Philippe Guelpa-Bonaro
 
How to improve your teaching using emerging technology
How to improve your teaching using emerging technologyHow to improve your teaching using emerging technology
How to improve your teaching using emerging technology
Mike Pascoe
 
INTERNET
INTERNETINTERNET
INTERNET
Ivan Jimenez
 
Alimentos funcionales
Alimentos funcionalesAlimentos funcionales
Alimentos funcionales
Javier Cuerda Fernández
 
Claro De Luna Beethoven
Claro De Luna   BeethovenClaro De Luna   Beethoven
Claro De Luna Beethoven
Julio Mendoza
 
Blackout Task Force Highlights SCADA System Woes
Blackout Task Force Highlights SCADA System WoesBlackout Task Force Highlights SCADA System Woes
Blackout Task Force Highlights SCADA System Woes
ARC Advisory Group
 
Copia de el rio guadalquivir
Copia de el rio guadalquivirCopia de el rio guadalquivir
Copia de el rio guadalquivir
mjluquino
 
Earth's Biomes
Earth's BiomesEarth's Biomes
Earth's Biomes
thompsonj1064
 
Manual de kicad
Manual de kicadManual de kicad
Manual de kicad
ULEAM
 
zootropo
 zootropo zootropo
zootropo
dantes68
 
Software para Agencias de Colocación
Software para Agencias de ColocaciónSoftware para Agencias de Colocación
Software para Agencias de Colocación
iformalia
 
Ecografía 3D
Ecografía 3DEcografía 3D
Ecografía 3D
josemanuelmolina
 
SAS Customer Decision Hub: migliora l’engagement con i tuoi clienti analizzan...
SAS Customer Decision Hub: migliora l’engagement con i tuoi clienti analizzan...SAS Customer Decision Hub: migliora l’engagement con i tuoi clienti analizzan...
SAS Customer Decision Hub: migliora l’engagement con i tuoi clienti analizzan...
SAS Italy
 
Semana 8 comercio
Semana 8 comercioSemana 8 comercio
Semana 8 comercio
almacecilia
 

Viewers also liked (20)

Denial of Service Mitigation Tactics in FreeBSD
Denial of Service Mitigation Tactics in FreeBSDDenial of Service Mitigation Tactics in FreeBSD
Denial of Service Mitigation Tactics in FreeBSD
 
Rewriting the Rules for DDoS Protection in 2015
Rewriting the Rules for DDoS Protection in 2015Rewriting the Rules for DDoS Protection in 2015
Rewriting the Rules for DDoS Protection in 2015
 
FreeBSD and Drivers
FreeBSD and DriversFreeBSD and Drivers
FreeBSD and Drivers
 
02) dr. cabrera sã­ndrome de hiperfunciã³n hipofisiaria
02) dr. cabrera   sã­ndrome de hiperfunciã³n hipofisiaria02) dr. cabrera   sã­ndrome de hiperfunciã³n hipofisiaria
02) dr. cabrera sã­ndrome de hiperfunciã³n hipofisiaria
 
Un arbre Tempovision
Un arbre TempovisionUn arbre Tempovision
Un arbre Tempovision
 
Pvprod v7 20111125
Pvprod v7 20111125Pvprod v7 20111125
Pvprod v7 20111125
 
How to improve your teaching using emerging technology
How to improve your teaching using emerging technologyHow to improve your teaching using emerging technology
How to improve your teaching using emerging technology
 
INTERNET
INTERNETINTERNET
INTERNET
 
Alimentos funcionales
Alimentos funcionalesAlimentos funcionales
Alimentos funcionales
 
Claro De Luna Beethoven
Claro De Luna   BeethovenClaro De Luna   Beethoven
Claro De Luna Beethoven
 
Deweis Bast 070509
Deweis Bast 070509Deweis Bast 070509
Deweis Bast 070509
 
Blackout Task Force Highlights SCADA System Woes
Blackout Task Force Highlights SCADA System WoesBlackout Task Force Highlights SCADA System Woes
Blackout Task Force Highlights SCADA System Woes
 
Copia de el rio guadalquivir
Copia de el rio guadalquivirCopia de el rio guadalquivir
Copia de el rio guadalquivir
 
Earth's Biomes
Earth's BiomesEarth's Biomes
Earth's Biomes
 
Manual de kicad
Manual de kicadManual de kicad
Manual de kicad
 
zootropo
 zootropo zootropo
zootropo
 
Software para Agencias de Colocación
Software para Agencias de ColocaciónSoftware para Agencias de Colocación
Software para Agencias de Colocación
 
Ecografía 3D
Ecografía 3DEcografía 3D
Ecografía 3D
 
SAS Customer Decision Hub: migliora l’engagement con i tuoi clienti analizzan...
SAS Customer Decision Hub: migliora l’engagement con i tuoi clienti analizzan...SAS Customer Decision Hub: migliora l’engagement con i tuoi clienti analizzan...
SAS Customer Decision Hub: migliora l’engagement con i tuoi clienti analizzan...
 
Semana 8 comercio
Semana 8 comercioSemana 8 comercio
Semana 8 comercio
 

Similar to Lecture 4 FreeBSD Security + FreeBSD Jails + MAC Security Framework

Unix Security
Unix SecurityUnix Security
Unix Security
replay21
 
Solaris basics
Solaris basicsSolaris basics
Solaris basics
Ashwin Pawar
 
Ch12 system administration
Ch12 system administration Ch12 system administration
Ch12 system administration
Raja Waseem Akhtar
 
Tutorial 2
Tutorial 2Tutorial 2
Tutorial 2
tech2click
 
Root file system for embedded systems
Root file system for embedded systemsRoot file system for embedded systems
Root file system for embedded systems
alok pal
 
Chroot Protection and Breaking
Chroot Protection and BreakingChroot Protection and Breaking
Chroot Protection and Breaking
Anton Chuvakin
 
Linux security
Linux securityLinux security
Linux security
trilokchandra prakash
 
18 LINUX OS.pptx Linux command is basic isma
18 LINUX OS.pptx Linux command is basic isma18 LINUX OS.pptx Linux command is basic isma
18 LINUX OS.pptx Linux command is basic isma
perweeng31
 
Unix Administration
Unix AdministrationUnix Administration
Unix Administration
Nishant Munjal
 
1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx
 1 CMPS 12M Data Structures Lab Lab Assignment 1  .docx 1 CMPS 12M Data Structures Lab Lab Assignment 1  .docx
1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx
joyjonna282
 
1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx
1 CMPS 12M Data Structures Lab Lab Assignment 1  .docx1 CMPS 12M Data Structures Lab Lab Assignment 1  .docx
1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx
tarifarmarie
 
CIT173_Ch15_Mnstr_23.pdf
CIT173_Ch15_Mnstr_23.pdfCIT173_Ch15_Mnstr_23.pdf
CIT173_Ch15_Mnstr_23.pdf
LilyMorningstar1
 
Restricting unix users
Restricting unix usersRestricting unix users
Restricting unix users
Muqthiyar Pasha
 
1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx
1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx
1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx
tarifarmarie
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
Dr. C.V. Suresh Babu
 
Host security
Host securityHost security
Host security
Nguyen Tam
 
Host security
Host securityHost security
Host security
Nguyen Tam
 
A character device typically transfers data to and from a user appli.pdf
A character device typically transfers data to and from a user appli.pdfA character device typically transfers data to and from a user appli.pdf
A character device typically transfers data to and from a user appli.pdf
aptind
 
A character device typically transfers data to and from a user appli.pdf
A character device typically transfers data to and from a user appli.pdfA character device typically transfers data to and from a user appli.pdf
A character device typically transfers data to and from a user appli.pdf
aptind
 
File system discovery
File system discovery File system discovery
File system discovery
MOHAMED Elshawaf
 

Similar to Lecture 4 FreeBSD Security + FreeBSD Jails + MAC Security Framework (20)

Unix Security
Unix SecurityUnix Security
Unix Security
 
Solaris basics
Solaris basicsSolaris basics
Solaris basics
 
Ch12 system administration
Ch12 system administration Ch12 system administration
Ch12 system administration
 
Tutorial 2
Tutorial 2Tutorial 2
Tutorial 2
 
Root file system for embedded systems
Root file system for embedded systemsRoot file system for embedded systems
Root file system for embedded systems
 
Chroot Protection and Breaking
Chroot Protection and BreakingChroot Protection and Breaking
Chroot Protection and Breaking
 
Linux security
Linux securityLinux security
Linux security
 
18 LINUX OS.pptx Linux command is basic isma
18 LINUX OS.pptx Linux command is basic isma18 LINUX OS.pptx Linux command is basic isma
18 LINUX OS.pptx Linux command is basic isma
 
Unix Administration
Unix AdministrationUnix Administration
Unix Administration
 
1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx
 1 CMPS 12M Data Structures Lab Lab Assignment 1  .docx 1 CMPS 12M Data Structures Lab Lab Assignment 1  .docx
1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx
 
1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx
1 CMPS 12M Data Structures Lab Lab Assignment 1  .docx1 CMPS 12M Data Structures Lab Lab Assignment 1  .docx
1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx
 
CIT173_Ch15_Mnstr_23.pdf
CIT173_Ch15_Mnstr_23.pdfCIT173_Ch15_Mnstr_23.pdf
CIT173_Ch15_Mnstr_23.pdf
 
Restricting unix users
Restricting unix usersRestricting unix users
Restricting unix users
 
1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx
1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx
1 CMPS 12M Data Structures Lab Lab Assignment 1 .docx
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
 
Host security
Host securityHost security
Host security
 
Host security
Host securityHost security
Host security
 
A character device typically transfers data to and from a user appli.pdf
A character device typically transfers data to and from a user appli.pdfA character device typically transfers data to and from a user appli.pdf
A character device typically transfers data to and from a user appli.pdf
 
A character device typically transfers data to and from a user appli.pdf
A character device typically transfers data to and from a user appli.pdfA character device typically transfers data to and from a user appli.pdf
A character device typically transfers data to and from a user appli.pdf
 
File system discovery
File system discovery File system discovery
File system discovery
 

More from Mohammed Farrag

Resume for Mohamed Farag
Resume for Mohamed FaragResume for Mohamed Farag
Resume for Mohamed Farag
Mohammed Farrag
 
Mum Article Recognition for Mohamed Farag
Mum Article Recognition for Mohamed FaragMum Article Recognition for Mohamed Farag
Mum Article Recognition for Mohamed Farag
Mohammed Farrag
 
Create 2015 Event
Create 2015 EventCreate 2015 Event
Create 2015 Event
Mohammed Farrag
 
Artificial Intelligence Programming in Art by Mohamed Farag
Artificial Intelligence Programming in Art by Mohamed FaragArtificial Intelligence Programming in Art by Mohamed Farag
Artificial Intelligence Programming in Art by Mohamed Farag
Mohammed Farrag
 
The practices, challenges and opportunities of board composition and leadersh...
The practices, challenges and opportunities of board composition and leadersh...The practices, challenges and opportunities of board composition and leadersh...
The practices, challenges and opportunities of board composition and leadersh...
Mohammed Farrag
 
Confirmation letter info tech 2013(1)
Confirmation letter info tech 2013(1)Confirmation letter info tech 2013(1)
Confirmation letter info tech 2013(1)
Mohammed Farrag
 
[ArabBSD] Unix Basics
[ArabBSD] Unix Basics[ArabBSD] Unix Basics
[ArabBSD] Unix Basics
Mohammed Farrag
 
Google APPs and APIs
Google APPs and APIsGoogle APPs and APIs
Google APPs and APIs
Mohammed Farrag
 
Lecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports DevelopmentLecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports Development
Mohammed Farrag
 
Lecture 5 Kernel Development
Lecture 5 Kernel DevelopmentLecture 5 Kernel Development
Lecture 5 Kernel Development
Mohammed Farrag
 
FreeBSD Jail Complete Example
FreeBSD Jail Complete ExampleFreeBSD Jail Complete Example
FreeBSD Jail Complete Example
Mohammed Farrag
 
FreeBSD Handbook
FreeBSD HandbookFreeBSD Handbook
FreeBSD Handbook
Mohammed Farrag
 
Lecture 3 Perl & FreeBSD administration
Lecture 3 Perl & FreeBSD administrationLecture 3 Perl & FreeBSD administration
Lecture 3 Perl & FreeBSD administration
Mohammed Farrag
 
Lecture2 process structure and programming
Lecture2   process structure and programmingLecture2   process structure and programming
Lecture2 process structure and programming
Mohammed Farrag
 
Lecture1 Introduction
Lecture1  IntroductionLecture1  Introduction
Lecture1 Introduction
Mohammed Farrag
 
Master resume
Master resumeMaster resume
Master resume
Mohammed Farrag
 
Mohammed Farrag Resume
Mohammed Farrag ResumeMohammed Farrag Resume
Mohammed Farrag Resume
Mohammed Farrag
 

More from Mohammed Farrag (17)

Resume for Mohamed Farag
Resume for Mohamed FaragResume for Mohamed Farag
Resume for Mohamed Farag
 
Mum Article Recognition for Mohamed Farag
Mum Article Recognition for Mohamed FaragMum Article Recognition for Mohamed Farag
Mum Article Recognition for Mohamed Farag
 
Create 2015 Event
Create 2015 EventCreate 2015 Event
Create 2015 Event
 
Artificial Intelligence Programming in Art by Mohamed Farag
Artificial Intelligence Programming in Art by Mohamed FaragArtificial Intelligence Programming in Art by Mohamed Farag
Artificial Intelligence Programming in Art by Mohamed Farag
 
The practices, challenges and opportunities of board composition and leadersh...
The practices, challenges and opportunities of board composition and leadersh...The practices, challenges and opportunities of board composition and leadersh...
The practices, challenges and opportunities of board composition and leadersh...
 
Confirmation letter info tech 2013(1)
Confirmation letter info tech 2013(1)Confirmation letter info tech 2013(1)
Confirmation letter info tech 2013(1)
 
[ArabBSD] Unix Basics
[ArabBSD] Unix Basics[ArabBSD] Unix Basics
[ArabBSD] Unix Basics
 
Google APPs and APIs
Google APPs and APIsGoogle APPs and APIs
Google APPs and APIs
 
Lecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports DevelopmentLecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports Development
 
Lecture 5 Kernel Development
Lecture 5 Kernel DevelopmentLecture 5 Kernel Development
Lecture 5 Kernel Development
 
FreeBSD Jail Complete Example
FreeBSD Jail Complete ExampleFreeBSD Jail Complete Example
FreeBSD Jail Complete Example
 
FreeBSD Handbook
FreeBSD HandbookFreeBSD Handbook
FreeBSD Handbook
 
Lecture 3 Perl & FreeBSD administration
Lecture 3 Perl & FreeBSD administrationLecture 3 Perl & FreeBSD administration
Lecture 3 Perl & FreeBSD administration
 
Lecture2 process structure and programming
Lecture2   process structure and programmingLecture2   process structure and programming
Lecture2 process structure and programming
 
Lecture1 Introduction
Lecture1  IntroductionLecture1  Introduction
Lecture1 Introduction
 
Master resume
Master resumeMaster resume
Master resume
 
Mohammed Farrag Resume
Mohammed Farrag ResumeMohammed Farrag Resume
Mohammed Farrag Resume
 

Recently uploaded

RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 

Recently uploaded (20)

RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 

Lecture 4 FreeBSD Security + FreeBSD Jails + MAC Security Framework

  • 3. Encryption and Decryption. Symmetric and Asymmetric. Security Topics
  • 5. UFS: implement special filesystem flags on files. flags enforce the same behavior for all users. kernel is responsible for enforcing these controls, depending on your kernel securelevel. Filesystem Protections
  • 6. UFS2: use Access Control Lists producing fine-grained control over permissions. Different users can be given different sets of permissions without relying on traditional Unix groups.
  • 7. Turn off the flag Specifying 0 in place of a flag name will turn off all the flags on a file. It's an inelegant little shortcut, but it works. For example, chflags 0foo will turn off all the flags on the file foo.
  • 8. Use –o option of ls command Example: /var/log -rw------- 1 root wheel sappnd 1862 Sep 30 22:39 auth.log -rw------- 1 root wheel sappnd 38374 Sep 30 22:45 cron -rw------- 1 root wheel nodump 3157 Sep 30 03:06 dmesg.today -rw-r--r-- 1 root wheel sappnd 28056 Sep 30 22:39 lastlog -rw-r--r-- 1 root wheel - 0 Jun 4 21:57 lpd-errs -rw-r----- 1 root wheel sappnd 2160 Sep 30 03:06 maillog -rw-r--r-- 1 root wheel sappnd 15547 Sep 30 22:47 messages -rw-r----- 1 root mail sappnd 628 Sep 30 03:06 sendmail.st -rw-r----- 1 root mail schg 3455 Sep 29 22:00 sendmail.st.0 -rw-r----- 1 root mail schg 5543 Jun 4 21:57 sendmail.st.1 View active flags on a file
  • 9. schg, is derived from "system change," it is universally referred to as the "immutable" flag. When the system immutable flag is set on a file, nothing can modify any part of it. Its metadata (modification times, permissions, owner, group, and so on) cannot be changed, nor can its contents. It cannot be renamed, unlinked (i.e., deleted), or moved, either. Only root can unset at zero kernel security level. System immutable flag (schg)
  • 10. The user immutable flag is a kinder, gentler immutable flag that is not affected by the kernel securelevel. Users can set and unset this on their own files and directories, just as root can. Unlike the system immutable flag, this one can be unset at any time. In order to be able to set this flag, you must be either the file's owner or root. A user with write access via Unix groups or ACLs, for example, still cannot set this flag. User immutable flag (uchg)
  • 11. Normally all files in a filesystem are backed up when the dump(8) program runs. The nodump flag tells the backup system not to include the given file in the dumps. To tell dump to honor the nodump flag, specify -h on the dump command line. If you want files to be omitted from backups entirely (i.e., not even included on full dumps), then you need to specify -h 0 on the command line. Nodump flag (nodump)
  • 12. The append-only flag prevents files from being modified, much like the immutable flag, with one exception: data can be appended at the end of the file. The archetypal use of the append-only flag is for logfiles on secured servers or perhaps for root's .history file to help catch unwary hackers (see "Candidates for append-only," later in this chapter). System append-only flag (sappnd)
  • 13. The user append-only flag performs exactly as the system append-only flag described above. The only difference is that this flag can be unset by both the owner and root at any time, regardless of the kernel securelevel. User append-only flag (uappnd)
  • 14. This flag is a little weaker than the schg flag. It simply prevents the deletion of a file. It is arguably most useful in its "user" version, uunlnk. It does not prevent truncation of the file or modification of its contents, its permissions, or any other aspect. It merely prevents the file from being removed. Like other "system" flags, it can only be set by root, and it cannot be unset when the kernel security level is greater than 0. This flag exists only in FreeBSD System no unlink flag (sunlnk)
  • 15. This flag allows a user to indicate that a file may not be deleted, regardless of the actual Unix permissions on its parent directory. Normally, if a user has permissions (through user, group, or ACLs) on the parent directory, she can delete any file in the directory—even files she does not own. That's because, in Unix filesystems such as UFS, the permission for deleting a file is a function of modifying the directory, not the file itself. User no unlink flag (uunlnk)
  • 16. Opaque flags are used on directories or files that are involved in unionfs mounts. Union mounts allow one directory or filesystem to be mounted over the top of another directory while retaining visibility into the underlying directory. Thus, when you look in the top-level directory, you see the union of the two directories. A file that exists in one place but not the other (XOR) will be visible. If there are files or directories of the same name in both places, the "uppermost" one is the one that is accessible. Opaque flag (opaque)
  • 17. When a directory is marked opaque with the opaque flag, it only shows files that actually exist in its level. That is, it makes the union mount act like a regular mount; files in the corresponding directory of a lower layer will be invisible. Opaque flag (opaque) – cont’d
  • 18. The find command understands flags if you give it the -flags argument. For instance, this command finds all files that have the uunlnk flag set in user paco's home directory: find /home/paco -flags +uunlnk -print. File Flags Searching
  • 19. /etc/fstab file Tagging the superblock directly Enable ACLs
  • 20. /etc/fstab Enable ACL Option for /home directory
  • 21.
  • 22. unmount idle filesystemwith the following steps
  • 24. run tunefs -a /home.ACLs in the superblock
  • 25. % setfacl -b book.pdf # Erase any existing ACLs # Add ahmed’s access % setfacl -m u:ahmed:rw book.pdf # Nobody else gets any permission at all setfacl -m o:: book.pdf Setting ACLs for Files File name User/Group/Others User/Group name Access Rights
  • 26. getfacl book.pdf #file:book.pdf #owner:1001 #group:100 user::rw- user:ahmed:rw- mask::rw- other::--- Viewing ACLs for Files
  • 27.
  • 28. In the shell, sysctlkern.securelevel=2
  • 29. Secure the kernel permanently.
  • 31.
  • 32. chroot Jail User Process Control
  • 33. The principles behind chroot are simple. A process running in a chrooted environment sees a normal filesystem, but it in fact has a virtual root directory. The goal is to prevent the process from accessing files outside its sandbox. chroot
  • 34. If ntpd runs in a chrooted environment, for example, and an exploit is discovered that causes it to overwrite a file, files in the real filesystem should be protected. The daemon perceives a / directory and will write relative to that directory, but on the real filesystem, the directory is something like /var/ntpd, and the daemon cannot actually reach the real / directory.
  • 35. Jails expand this model by virtualizing not only access to the file system, but also the set of users, the networking subsystem of the FreeBSD kernel and a few other things. FreeBSD Jail
  • 36. A directory subtree -- the starting point from which a jail is entered. Once inside the jail, a process is not permitted to escape outside of this subtree. A hostname -- the hostname which will be used within the jail. Jails are mainly used for hosting network services, therefore having a descriptive hostname for each jail can really help the system administrator. An IP address -- this will be assigned to the jail and cannot be changed in any way during the jail's life span. A command -- the path name of an executable to run inside the jail. Jail Characteristics
  • 37. # setenv D /here/is/the/jail # mkdir -p $D # cd /usr/src # make buildworld # make installworld DESTDIR=$D # make distribution DESTDIR=$D # mount -t devfsdevfs $D/dev Creating Jails
  • 38. Selecting a location for a jail is the best starting point. This is where the jail will physically reside within the file system of the jail's host. A good choice can be /usr/jail/jailname, where jailname is the hostname identifying the jail. # mkdir -p $D
  • 39. The distribution target for make installs every needed configuration file. In simple words, it installs every installable file of /usr/src/etc/ to the /etc directory of the jail environment: $D/etc/. make distribution DESTDIR=$D
  • 40. Mounting the devfs file system inside a jail is not required. It is very important to control access to devices from inside a jail, as improper settings could permit an attacker to do nasty things in the jail. Control over devfs(8) is managed through rulesets which are described in the devfs(8) and devfs.conf(5) manual pages. # mount -t devfsdevfs $D/dev
  • 41. /etc/rc.conf since it will replicate the startup sequence of a real FreeBSD system. For a service jail, it depends on the service or application that will run within the jail. Jail Enabling
  • 43.
  • 44. using the jexecutility from outside the jail.Jail Starting & Stopping
  • 45. Among the many third-party utilities for jail administration, one of the most complete and useful is sysutils/jailutils. It is a set of small applications that contribute to jail management. Please refer to its web page for more information. Jail High-level administrative tools
  • 46. Fighting Buffer Overflows Cryptography. Inherent Protection
  • 47. The goal of W^X is to make a program crash if it attempts to write to an execute-only page or execute code on a write-only page. The kernel and the loader try to make sure that a program's instructions are always allocated on pages marked executable, and data (e.g., the program's stack and heap) is always allocated to pages that are writable but not executable
  • 48. maxusers make it 0 to turn control to physical RAM. Increasing Maximum Values. For example, kern.ipc.somaxconn. Network Buffering For example, net.inet.tcp.sendspace Optimizations (OS Tuning)
  • 49.
  • 50. Safety Liveness. … System Security Requirements
  • 52.
  • 53. desribes how to apply the policy Mechanism
  • 54.
  • 55. Decision Making.
  • 57. Snort. Snorby. Intrusion Detection Common Ports