Date post: | 07-Apr-2018 |
Category: |
Documents |
Upload: | sweidan-omar |
View: | 226 times |
Download: | 0 times |
of 124
8/3/2019 Unix 5 Solaris
1/124
8/3/2019 Unix 5 Solaris
2/124
Men
Bevezet ZFS file rendszer DTrace
Znk Privilege rendszer BART
Egyb security gyngyszemek SMF
8/3/2019 Unix 5 Solaris
3/124
Bevezet
8/3/2019 Unix 5 Solaris
4/124
Solaris 10
Minden idk egyik legkomplexebbopercis rendszere s projektje a Sun-
nl A feladat mrete meghaladja a Solaris7-et (az els 64-bites kernel)
700+ alprojekt Ingyenes!!! (Nincs tmogats) OpenSolaris
8/3/2019 Unix 5 Solaris
5/124
Nagyobb projektek
JDS 3 integrci 64-bites AMD64/EM64T kernel Linux emulcis alrendszer j TCP/IP stack - FireEngine (ez nem
tl aprcska) 64k page base size
8/3/2019 Unix 5 Solaris
6/124
s kisebbek... IP6to4 router USB szalagmeghajtk
Anonm memria lapmret kontroll Aszinkron socket-ek CMT temez
Koherens konzol j CPU performancia szmll projekt
8/3/2019 Unix 5 Solaris
7/124
s kisebbek...
Dinamikus erforrs pool-ok Felhasznl szint mount
Oracle DHCP modul File event monitoring FS-VM szeparls
Teljes fizikai memria HAT mapping GNU Zebra (OSPF, RIP, BGP) Interrupt targetting
8/3/2019 Unix 5 Solaris
8/124
s kisebbek...
iSCSI hooks Kernel cage megszntetse Kernel crypto framework SVM javtsok (multiTB metadevice,
resource configuration) Virtualizlt Layer 2 networking
8/3/2019 Unix 5 Solaris
9/124
s kisebbek...
Memory DR MPxIO integrci MultiTB UFS s diszk NCA multiszerver
NFSv4 NIS/NIS+2LDAP NUMA optimalizci
8/3/2019 Unix 5 Solaris
10/124
s kisebbek...
PAM bvtsek Packet filter hook rcapd fizikai memria menedzsment Wheel mouse
USB mass storage WAN boot
8/3/2019 Unix 5 Solaris
11/124
ZFS
8/3/2019 Unix 5 Solaris
12/124
ZFS
A diszk VM-je, nincs szksg ktet kezelre Tranzakcionlis Teljesen integrits vdett
128-bites (256 quadrilli zettaB) Dinamikus metaadatok Beptett tmrts, titkosts Diszk scrubbing Replikci Minden mvelet copy-on-write Gyors snapshot, verzizs
8/3/2019 Unix 5 Solaris
13/124
COW1. Az eredeti 2. Adat blokk COW
4. berblock mdosts
(atomi)
3. Indirekt blokk COW
8/3/2019 Unix 5 Solaris
14/124
Checksum
Data Data
AddressChecksum
Checksum
AddressBit rotPhantom writesMisdirected reads and writesDMA parity errorsDriver bugsAccidental overwrite
AddressChecksu
m
Checksu
m
Address
8/3/2019 Unix 5 Solaris
15/124
njavts
Application
ZFS mirror
Application
ZFS mirror
Application
ZFS mirror
8/3/2019 Unix 5 Solaris
16/124
Snapshot
Snapshot
berblokk
Aktulis
berblokk
8/3/2019 Unix 5 Solaris
17/124
Parancsok
zpool A ktetkezel create, destroy, add, import, export, df, iostat, vdevs,
devices, config zfs
A fjlrendszer kezel create, destroy, rollback, ls, mount, unmount
zvol Emulcis ktetkezel create, destroy, ls
8/3/2019 Unix 5 Solaris
18/124
DTrace
8/3/2019 Unix 5 Solaris
19/124
8/3/2019 Unix 5 Solaris
20/124
Hibakeress in vivo
Invaziv technikk Binris instrumentls Forrs szint instrumentls Interposer library-k Debug library-k Debug kernel ltalban durva beavatkozsok ltalban lass ltalban nagy az additv hibk injekcijnak
eslye
8/3/2019 Unix 5 Solaris
21/124
Elvrsok
Az idelis dinamikus hibakeresrendszer Kpes informci gyjtsre Az adatszerkezetek mdostsa Mindezt les rendszereken is
Teljesen biztonsgosan Teljestmny vesztesg nlkl
8/3/2019 Unix 5 Solaris
22/124
DTrace
Interpretlt probe alap nyelv, prdiktumokkal sakcikkal
Dinamikus fggvny be- s kilpsi pont
instrumentcis rendszer Jellemzk: User s Kernel rtegben is mkdik 40000+ probe egy tlagos Solaris 10 rendszeren Alapllapotban csak root-knt mkdik 3 privilgiumot ignyel: dtrace_kernel, dtrace_proc
s dtrace_user
410 oldalas dokumentci
8/3/2019 Unix 5 Solaris
23/124
8/3/2019 Unix 5 Solaris
24/124
Provider-ek Szp szmban akadnak
fbt szintem minden entry s return a kernelben(~39000 db)
syscall syscall tbla (~450 db) profile lockstat proc sysinfo vminfo
sched io fpuinfo sdt (~190 db) mib TCP/IP-hez kapcsold fggvnyek (~430 db)
8/3/2019 Unix 5 Solaris
25/124
DTrace fogyasztk
Gyakorlatilag nincs fels korltja, aDTrace multiplexel
dtrace(1M) a command line fogyaszt Vannak programozott fogyasztk is
8/3/2019 Unix 5 Solaris
26/124
8/3/2019 Unix 5 Solaris
27/124
Szkriptek
dtrace(1M) tmogatja a szkripteket#! /usr/sbin/dtrace s Szkript szintaktikaprovider:module:function:name[,provider:module:function:name]*/predicate/{
action;[action;]*}
8/3/2019 Unix 5 Solaris
28/124
Beptett vltozk
pid aktulis processz ID execname az aktulis programnv
timestamp a bootols ta eltelt id[ns]
probemod, probefunc, probename
a probe adatai...
8/3/2019 Unix 5 Solaris
29/124
Vltozk
Skalr Szoksos tpusok (char, short, int, long, long
long, float, double, long double) NINCS FLOAT ARITHMETIKA!
Asszociatv array-ek Tovbbfejlesztett Perl hash
A kulcs egy 'n'-es, de mindig azonosszignatrj (!!) Pl. array[execname, timestamp]
8/3/2019 Unix 5 Solaris
30/124
Akcik
trace() az argumentum rtkt a tracepufferbe helyezi
tracemem() az argumentumban megadott
memriacmtl adott hosszig ment rtkt atrace pufferbe stack() a kernel stack trace-t a trace
pufferbe helyezi
ustack() a user stack trace-t a tracepufferbe helyezi exit() a DTrace fogyasztt kilpsre
knyszerti
...
8/3/2019 Unix 5 Solaris
31/124
Destruktv akcik
A w flag-gel engedlyezni kell stop() meglltja az aktulis processzt
raise() szignlt kld az adott processznek panic() kernel pnik chill() adott idre lelltja a processzt
copyout() s copyoutstr() adottvltozbl adott szm adatot egy memriahelyre msol
8/3/2019 Unix 5 Solaris
32/124
8/3/2019 Unix 5 Solaris
33/124
Thread loklis vltozk
Azonos nv, de per thread adat Jellse: self-> A nem definilt vltozknak nulla az
rtkk Ha nullzunk egy thread loklis
vltozt, avval deallokljuk (!!)
8/3/2019 Unix 5 Solaris
34/124
Aggregcik
Natv DTrace tpus Egy aggregci olyan f(x) fggvny, ahol x
egy tetszleges n elem adathalmaz s:f(f(x
0)
f(x
1)
...
f(x
n)) = f(x
0 x
1 ...
x
n)
Ilyenek a count, a sum, az avg, a max s amin (pl. a median nem az ppen ezrt nincs
is ilyen) Specilis aggregci a quantize s azlquantize
8/3/2019 Unix 5 Solaris
35/124
Aggregcik 1.syscall::write:entry{@counts[execname] = count();
}
dtrace: script './cnt.d' m atched 1 probe^C
dtrace 1csh 1xscreensaver 2
dtwm 12ls 14sdtperfm eter 22dtterm 67gnom e-cd 279
8/3/2019 Unix 5 Solaris
36/124
Aggregcik 2.syscall::write:entry{self->start=timestamp;
}
syscall::write:return/self->start/{@counts[execname] = quantize(timestamp-self->start);
self->start=0;}
8/3/2019 Unix 5 Solaris
37/124
Aggregcik 2.dtrace: script './cnt2.d' m atched 2 probes
C
sdtperfm eter
value ------------- Distribution ------------- count
8192 | 0
16384 |@@@@@@@@@@@@@@@@@@ 8
32768 |@@@@@@@@@@@@@@@@@@@@@@ 10
65536 | 0
dtwm
value ------------- Distribution ------------- count
8192 | 0
16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2132768 |@@@@@@@@ 5
65536 | 0
dtterm
value ------------- Distribution ------------- count
4096 | 0
8192 |@ 3
16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@ 61
32768 |@@@@@@@@@@@ 25
65536 |@@@ 6
131072 | 0
gnome-cd
value ------------- Distribution ------------- count
4096 | 0
8192 | 1
16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 212
32768 |@@@ 15
65536 | 0
8/3/2019 Unix 5 Solaris
38/124
Normalizls
Az aggregcik konstanssal normlhatak Ez az adatokat nem vltoztatja megdtrace:::BEGIN
{start=timestamp;
}syscall::write:entry{@counts[execname] = count();
}
dtrace:::END
{
normalize(@counts, (timestamp - start) / 1000000000);
}
8/3/2019 Unix 5 Solaris
39/124
8/3/2019 Unix 5 Solaris
40/124
Mveletek normkkal
clear(@aggr) adott norma trlse trunc(@aggr, n) adott normlt
aggregci els n elemnekmegtartsa
8/3/2019 Unix 5 Solaris
41/124
Pragmk
#pragma D option [=] Alapveten hangolhat paramter
belltsok Specilis kapcsolk belltsa#pragma D option destructive
#pragma D option quiet
8/3/2019 Unix 5 Solaris
42/124
8/3/2019 Unix 5 Solaris
43/124
Znk
8/3/2019 Unix 5 Solaris
44/124
Znk
Egyetlen kernel megosztsa tbbvirtualizlt applikcis kontner kztt
Processz bedobozols erforrs s biztonsgi izolci lthatsg s kontrol (globlis, nem globlis)
Virtualizlt hardver (!), de nem virtulis
gp Kintrl nll opercis rendszernek
tnik
8/3/2019 Unix 5 Solaris
45/124
Znk blokk diagramm
8/3/2019 Unix 5 Solaris
46/124
Znk virtualizci
Rejtett fizikai szint /devices, mknod csak globlis znban /dev, loopback s konstrult (zero, log, ..)
nll IP cm(ek), multiplexelt kommunikci hme0, hme0:1 (globlis zna ltal definilva, plumb csak globlis
znban) Snoop csak globlis znban Globlis zna mindent, helyi zna csak csak sajt IP forgalmt ltja
nll cmtr s cmtr Loklisan megadott DNS/LDAP/NIS v. file
nll IPC tr Zna kztt hlzati (sw loopback), v. megosztott filerendszerrel
Ketts syslog Ketts pkg, patch adminisztrci
8/3/2019 Unix 5 Solaris
47/124
Znk virtualizci Virtualizlt /proc, /etc/mnttab
ps, mount csak a zna adatait mutatja nll fjlrendszer Privt filerendszer pontok (/, /var, /etc)
Bizonyos fjlrendszerek read-only mdon beszrmazhatnak egy znba(pl. /usr)
Korltozott mount/umount lehetsgek NFS mount znnknt
Korltozott privilgiumok (globlis, nem globlis) kill, pkill chmod, chown, setuid link, unlink nem engedlyezett
8/3/2019 Unix 5 Solaris
48/124
Znk file rendszer virtualizci
8/3/2019 Unix 5 Solaris
49/124
Zna llapotok
Konfigurlt (Configured) Teljes s elmentett konfigurci (verifiklt) /etc/zones/{SUNWdefault.xml, XYZ.xml} /etc/zones/index
Teleptett (Installed) A zna gykerben teleptett opercis rendszer
csomagok Nem teljes: sysidcfg
Ksz (Ready)
A hlzat, a fjl rendszer s a virtualizlt eszkzkrendelkezsre llnak (/dev) Mkd (Running)
Felhasznli processzek futnak a znban Incomplete, Shutting Down, Down
tmeneti llapotok
8/3/2019 Unix 5 Solaris
50/124
Zna llapotok
8/3/2019 Unix 5 Solaris
51/124
Zna alap parancsok zonecfg:
Zna konfigurci ltrehozsa, mdostsa. zoneadm
Zna adminisztrlsa zlogin
Znba lps, nem hlzat! zlogin C zona => mintha hw konzol, suninstall els
belpskor zlogin l user zone parancssor
zonename
Znanv lekrdezs (zlogin utn)
8/3/2019 Unix 5 Solaris
52/124
Zna ltrehozs Globlis znbl hozhatk ltre j znk mintk:
/etc/zones/{SUNWdefault.xml, SUNWblank.xml} zonecfg z highzone f config.txt Kulcs szavak:
zonepath, autoboot, pool inherit-pkg-dir, fs
net, device, rctl attr verify, commit, export delete
8/3/2019 Unix 5 Solaris
53/124
Zna minta, DEFAULT
8/3/2019 Unix 5 Solaris
54/124
Zna minta, config.txtcreate -F
set zonepath=/opt/test_fs/zones/highzoneset autoboot=falseadd inherit-pkg-dirset dir=/opt/XXXendadd net
set address=129.159.190.204set physical=hme0endadd rctlset name=zone.cpu-sharesadd value
(priv=privileged,limit=75,action=none)end
add fs
set dir=/mntset special=/dev/dsk/c1t2d0s0set raw=/dev/rdsk/c1t2d0s0set type=ufsendadd fsset dir=/opt/localset special=/usr/localset type=lofsendadd device
set match=/dev/dsk/c1t2*endverifyinfocommit
8/3/2019 Unix 5 Solaris
55/124
Zna minta, parancssor
global# zonecfg -z highzone
highzone: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:highzone>create
zonecfg:highzone>set zonepath=/opt/test_fs/zones/highzone
zonecfg:highzone>add net
zonecfg:highzone:net>set physical=hme0
zonecfg:highzone:net>set address=192.9.200.55/24
zonecfg:highzone:net>end
zonecfg:highzone>verify
zonecfg:highzone>commitzonecfg:highzone>^D
global# zonecfg -z highzone info zonepath
zonepath: /export/home/highzone
global#
8/3/2019 Unix 5 Solaris
56/124
Zna minta, parancssor
global#mkdir /usr/local
global# zonecfg -z highzone
zonecfg:highzone>add fs
zonecfg:highzone:fs>set dir=/usr/local
zonecfg:highzone:fs>set special=/data/local/highzone
zonecfg:highzone:fs>set type=lofs
zonecfg:highzone:fs>end
zonecfg:highzone>^D
global# zonecfg -z highzone info fs
fs:
dir: /usr/localspecial: /data/local/highzone
type: lofs
options: []
global#
8/3/2019 Unix 5 Solaris
57/124
Zna ltrehozs
IP cm IPv4 automatikusan lehet, IPv6 manulisan Netmask automatikusan a globlis znbl
rkls SUNWdefault template alapjn inherit-pkg-dir /usr, /sbin, /platform, /lib /opt is javasolt
Device Fizikai eszkz is rkltethet, krltekintssel Globlis root definilja, loclis csak hasznl
8/3/2019 Unix 5 Solaris
58/124
Zna adminisztrci
zoneadm z zona ... install, uninstall
ready boot, reboot, halt list (-c, -cv)
zlogin C zona alternativa:
${zonapath}/root/etc/sysidcfg
8/3/2019 Unix 5 Solaris
59/124
Zna installci
global#zoneadm -z highzone install
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize packages on the zone.
Initialized packages on zone.
Successfully initialized zone .
8/3/2019 Unix 5 Solaris
60/124
Zna listzs, ellenrzs
Listzsglobal% zoneadm list -cv
ID NAME STATUS PATH
0 global running /
- drop installed /drop-dir
8 fracture running /zones/fracture
- highzone installed /export/home/highzone
Ellenrzs (Verify)global# zoneadm -z drop verify
/drop-dir must not be group readable.
/drop-dir must not be group executable./drop-dir must not be world readable.
/drop-dir must not be world executable.
could not verify zonepath /drop-dir because of the above errors.
zoneadm: zone drop failed to verify
8/3/2019 Unix 5 Solaris
61/124
Interaktv els boot
sysidtool(1M)[NOTICE: zone booting up]
SunOS Release 5.10 Version s10_52 32-bit
Copyright 1983-2004 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Hostname: twilight
The system is coming up. Please wait.
Select a Language
0. English
1. French
2. Japanese
3. Simplified Chinese
4. Traditional Chinese
Please make a choice (0 - 4), or press h or ? for help:
8/3/2019 Unix 5 Solaris
62/124
Inicializls ms mdon
sysidcfg(4) file editls, alternatva
global# cat /export/home/highzone/root/etc/sysidcfg
system_locale=C
terminal=xtermnetwork_interface=primary {
hostname=highhost
}
security_policy=NONE
name_service=NIS {
domain_name=engineering
}
timezone=CET
root_password=MWQxNuo89EjI2
8/3/2019 Unix 5 Solaris
63/124
Zna adminisztrci
Minden pkg: globlis => loklis zna Minden patch: globlis => loklis zna
Globlis root gyakorlatilag brmit mdosthat,globlis user csak olvashat Editlhat csomagok: pkgmap, pkginfo
Nem editlhatak az inherit-pkg-dir alatti
csomagok (csak metadata msolt) Hagyomnyos sysadmin tevkenysg
8/3/2019 Unix 5 Solaris
64/124
Zna adminisztrci
-z zonename ifconfig, ps, prstat, pkill, pgrep -Z
ps, prstat, df
netstat: zna kapcsolatait mutatja Loklis znban nem mkdik: Prtdiag, prtconf, eeprom, snoop, sysdef NFS szerver, znakzi NFS mount
DHCP discover Defaultrouter vltoztats Kernel modul betlts, kitrls Hlzati interfsz csatols
8/3/2019 Unix 5 Solaris
65/124
Izolci, plda
# zonenamehighzone# ls /proc18332 18359 18389 18427 18437 18444 18459 18491 18546 19777
18335 18386 18398 18433 18443 18456 18464 18545 18549 20243
# zonenamesmallzone# ls /proc
19959 19986 20018 20056 20066 20073 20088 20120 20177 2018019962 20015 20027 20062 20068 20085 20093 20176 20178 20240
8/3/2019 Unix 5 Solaris
66/124
Znk erforrs menedzsment
A Solaris 9 tovbbfejlesztett erforrs menedzsmentje Erforrs limitek definilhatk a znkhoz
Globlis dinamikusan vltoztathat Egy erforrs pool-ra tbb zna is multiplexelhet
Automatikusan, zna konfigurciban Loklis zna virtulis informcit lt a pool-rl Loklis zna csak a hozzrendelt pool-t adminisztrlhatja
A projekt adatbzis virtualizlt, znnknt
Minden zna nll rcapd-t futtat Globlis zna bellts csak a globlisra rvnyes
Kt szint FSS, kt szint model Global => share2zone, local => share2project
8/3/2019 Unix 5 Solaris
67/124
Erforrs menedzsment
j elemek IPC erforrsok: project.max-shm-ids, ..max-msg-ids, ..max-sem-ids project.max-shm-memory, process.max-sem-nsems process.max-sem-ops, process.max-msg-qbytes
Port, device: project.max-device-locked-memory project.max-port-ids, process.max-port-events
Titkosts (cryptographic resource control): project.max-crypto-memory
Egyb: project.max-lwps, project.max-tasks project.max-contracts
8/3/2019 Unix 5 Solaris
68/124
Znk, Pool-ok
cpu1
big small
DBglobal
cpu2 cpu3 cpu4
cpu5 cpu6 cpu7 cpu8
default
DW Apps
8/3/2019 Unix 5 Solaris
69/124
Resource Poolok
global%poolstatpset
id pool size used load4 tide 2 0.00 0.09
0 pool_default 2 0.00 0.093 whirl 4 0.00 0.00
highzone%poolstat
psetid pool size used load4 tide 2 0.00 0.09
8/3/2019 Unix 5 Solaris
70/124
Znk erforrs menedzsment
8/3/2019 Unix 5 Solaris
71/124
Krds!
Hny zna vanTarkovszkij Stalker c.filmjben?
Sorolja fel aZna llapotait......
8/3/2019 Unix 5 Solaris
72/124
ipfilter
8/3/2019 Unix 5 Solaris
73/124
ipfilter
Nylt forrskd csomagszr 1.0 1993-ban
Darren Reed fejleszti http://coombs.anu.edu.au/~avalon/ip-
filter.html
8/3/2019 Unix 5 Solaris
74/124
ipfilter jellemzk
Text fjl konfigurci IPv6 (egyelre kikapcsolt)
Pici s csak pr csomag Nincs titkosts Nincs lopakod zemmd NAT s port transzlci Nincs I18N Nincs CMG vagy HA
8/3/2019 Unix 5 Solaris
75/124
ipfilter jellemzk
Stateful s stateless csomag vizsglat Kernel alap szrs
Protokol proxik ( TCP, UDP , FTP,rcmds etc.)
Naplzs
8/3/2019 Unix 5 Solaris
76/124
ipfilter szablyok
Csomag blokkols, trengeds vagynaplzs
Interfsz, irny, IP cm, protokol, port,IP opci alapjn Mindig az utols szably rvnyes
IP cm csoportok: ippools Klnll fjlok a csomagszrsre s aNAT-ra
8/3/2019 Unix 5 Solaris
77/124
Tipikus szably fjl
block in allpass in log quick on ce0 proto tcp from 129.159.190.0/8 to any port = 80block out allpass out log quick on ce0 proto tcp from any to 129.159.190.0/8 to any port = 80
i fil k k
8/3/2019 Unix 5 Solaris
78/124
ipfilter komponensek
Kernel modulok ipf csomagszr pfil STREAMS driver
Adminisztratv eszkzk ipf(1M) csomagszr konfigurci ipnat(1M) NAT konfigurci ipmon(1M) Napl nzeget ipfstat(1M) Statisztika ippool(1M) ippools konfigurtor
Szkriptek /etc/init.d/pfil pfil modul /etc/init.d/ipfboot csomagszr, NAT s ippools indt
k
8/3/2019 Unix 5 Solaris
79/124
Csomagok
SUNWipfr - IP Filter Utilities, (Root) SUNWipfu - IP Filter Utilities
lj
8/3/2019 Unix 5 Solaris
80/124
Teljestmny
~11% svszlessg vesztesg (netperf2mrs)
Nincs boot id hats, ha nemkonfigurlt (default) < 1s boot id nvekeds, ha konfigurlt
J
8/3/2019 Unix 5 Solaris
81/124
Jv
IPv6 IPMP
Loopback csomagszrs (zonk,Trusted Solaris)
Jobb FireEngine integrci
8/3/2019 Unix 5 Solaris
82/124
Privilege rendszer
Ki i
8/3/2019 Unix 5 Solaris
83/124
Kicsi, srga, csnya s nagyonveszlyes. Mi az?
Ki i
8/3/2019 Unix 5 Solaris
84/124
Kicsi, srga, csnya s nagyonveszlyes. Mi az?
root123
A rt kiskacsa aroot password-del....
RBAC
8/3/2019 Unix 5 Solaris
85/124
RBAC
Solaris 8 ta az opercis rendszerrsze
tlagos felhasznl, de csak su-val
kzelthet meg A szerepek 4 fjlban definildnak sparancs szinten konfigurlhatak
A Solaris 10-tl privilgiumkiegsztst is kaptak
P i il l d l t
8/3/2019 Unix 5 Solaris
86/124
Privileges - alapgondolat
Least privilege A mindenhat root jogainak sztszedse
apr darabokra Egyenknt elvenni vagy odaadni
Sok minden fut root-knt, aminek nemkellene Pl. alacsony portokra bindol web szerver
Meg alsts
8/3/2019 Unix 5 Solaris
87/124
Megvalsts
A kernel nem UID==0-ra vizsgl,hanem az ppen szksges privilege-re
47 egyedileg ki-bekapcsolhat priv Bvthet RBAC integrci Kompatibilits: root minden priv-vel
rendelkezik Privilege aware programozs
8/3/2019 Unix 5 Solaris
88/124
47 Privilege"cpc_cpu Access to per-CPU perf counters"dtrace_kernel" DTrace kernel tracing"dtrace_proc" DTrace process-level tracing"dtrace_user" DTrace user-level tracing"file_chown" Change file's owner/group IDs"file_chown_self Give away (chown) files"file_dac_execute Override file's execute perms"file_dac_read" Override file's read perms"file_dac_search Override dir's search perms
"file_dac_write" Override (non-root) file's write perms"file_link_any" Create hard links to diff uid files"file_owner" Non-owner can do misc owner ops"file_setdac" Non-owner can set file perms (no seuid)"file_setid" Set uid/gid (non-root) to diff id"ipc_dac_read" Override read on IPC, Shared Mem perms"ipc_dac_write" Override write on IPC, Shared Mem perms"ipc_owner" Override set perms/owner on IPC"net_icmpaccess Send/Receive ICMP packets
"net_privaddr" Bind to privilege port (
8/3/2019 Unix 5 Solaris
89/124
Privilege sets
Effective (E) set Ami ppen szmt P-bl bvthet
Permitted (P) set Ezt csak cskkenteni lehet Amit innen elveszek, az E-bl is elmegy
Inheritable (I) set rklhet exec-en keresztl
Limit (L) set I fels korltja (exec) Amit innen elveszek, az nem mdostja P-t s E-t
Exec szablyok
8/3/2019 Unix 5 Solaris
90/124
Exec szablyok
Limit nem vltozik I=IL azaz L limitlja I-t
E=I; P=I , azaz rkli az L-lelszktett I-t
Alapbelltsok
8/3/2019 Unix 5 Solaris
91/124
Alapbelltsok
Basic set Nem mdosthat
file_link_any, proc_exec, proc_fork, proc_info,proc_session E: basic
I: basic P: basic L: all
Parancsok
8/3/2019 Unix 5 Solaris
92/124
Parancsok
process priv belltsappriv s
mirt nem mkdik azadott parancs????
ppriv -eD
az adott process priv set-
jeinek [rszletes]listzsa
ppriv [-v]
az sszes priv [rszletes]listzsappriv -l [-v]
Kivtelek privilege escalation
8/3/2019 Unix 5 Solaris
93/124
Kivtelek privilege escalationellen Bizonyos esetekben nem az rintettpriv-t vrja el a rendszer, hanem az
All priv kszletet (hacsak nem vagyokroot) root ltal tulajdonolt file mdostsa
root ltal tulajdonolt process mdostsa stb., pl: file_dac_write: file rsa jogoktl fggetlenl
Adminisztrci
8/3/2019 Unix 5 Solaris
94/124
Adminisztrci
RBAC sszefonds /etc/security: exec_attr, prof_attr,
/etc: user_attr useradd, usermod roleadd, rolemod, /usr/sadm/bin/smrole
/usr/sadm/bin/smprofile
8/3/2019 Unix 5 Solaris
95/124
BART: Basic Audit ReportingTool
Mire val?
8/3/2019 Unix 5 Solaris
96/124
Mire val?
Mi vltozott a rendszeren? Mi az eltrs kt rendszer kztt?
(Ugye nem trtk fel a gpet...)
Mit tehettnk eddig?
8/3/2019 Unix 5 Solaris
97/124
Mit tehettnk eddig?
sidekick.sh md5 signatures
sfpDB Keress a Sun adatbzisban MINDEN benne van, amit a Sun valaha is
szlltott
Verzispecifikus adatok Brmely Solaris verzira hasznlhat
File integrits vizsglat
8/3/2019 Unix 5 Solaris
98/124
File integrits vizsglat
MD5: Letlthet toolkit 16 byte-os hash generlsa File mdostsakor vltozik a hash Ellenrzs:Sajt adatbzis (install utn, read-only mdira)Solaris Fingerprint Database (http://
sunsolve.sun.com) Krds: hogyan generljuk?
MD5 signatures
http://sunsolve.sun.com/http://sunsolve.sun.com/http://sunsolve.sun.com/http://sunsolve.sun.com/http://sunsolve.sun.com/8/3/2019 Unix 5 Solaris
99/124
MD5 signatures
MD5 (/usr/bin/at) = 3e34ddd03c87125902c824e0c58b5a68MD5 (/usr/bin/awk) = d6451529b2172c6de71032d0de2ee3dcMD5 (/usr/bin/banner) = 250e4b9590499246b14997990ca45bdfMD5 (/usr/bin/bash) = c784b19d0034235fbf6de2accc6e86b6MD5 (/usr/bin/cal) = 7f5f841d2ab9d3a0e0263bd66f403442MD5 (/usr/bin/cancel) = b8dbf22d06f08f9938c270e73c371bdaMD5 (/usr/bin/cat) = 30f26ab47fd473a1ac0b63f8e62d609bMD5 (/usr/bin/chgrp) = 8d0234c0770a255c52158df887c1d941MD5 (/usr/bin/chkey) = 34c38ea44768f50ba3b7ec4b203b624b
MD5 (/usr/bin/chmod) = dbba839836ac12f1b19c2397493fbd84MD5 (/usr/bin/chown) = 9f857e3b38d457c176575afc437dedccMD5 (/usr/bin/cp) = 420a9823e777812cad0c56b40d0a1524MD5 (/usr/bin/su) = 8b98fb9c314bd5b378d9436b1617d014
Solaris Fingerprint Database
8/3/2019 Unix 5 Solaris
100/124
Solaris Fingerprint Database
8b98fb9c314bd5b378d9436b1617d014 -(/usr/bin/su) - 1 match(es)
canonical-path: /usr/bin/su
package: SUNWcsuversion: 11.8.0,REV=2000.01.08.18.12architecture: sparcsource: Solaris 8/SPARC
BART: Basic Audit and Reporting
8/3/2019 Unix 5 Solaris
101/124
BART: Basic Audit and ReportingTool
Baseline rgzts Komparls (vs. baseline vagy msik
gp) File rendszeren belli szrs Wildcard alap exclude/include Spec karakterek Tvoli mount-okat nem kvet
Els lps: control manifest
8/3/2019 Unix 5 Solaris
102/124
Els lps: control manifest
File rendszer llapotnak rgztse acl contents : md5 dest : symlink hova mutat
devnode : device node, csak char s block device dirmtime, lnmtime, mtime : modification time uid, gid : ownership mode : file permissions
size type : tpus, pl. file, block device, socket, pipe stb. all : a fentiek mindegyike
Eltr filerendszert nem kvet, pl NFS mount
Manifest formtum
8/3/2019 Unix 5 Solaris
103/124
Manifest formtum ! Version 1.0 ! Thursday, December 04, 2003 (16:17:39) # Format: #fname D size mode acl dirmtime uid gid #fname P size mode acl mtime uid gid #fname S size mode acl mtime uid gid #fname F size mode acl mtime uid gid contents #fname L size mode acl lnmtime uid gid dest #fname B size mode acl mtime uid gid devnode #fname C size mode acl mtime uid gid devnode / D 1024 40755 user::rwx,group::r-x,mask:r-x,other:r-x 3fd9ea47 0 0
/.java D 512 40755 user::rwx,group::r-x,mask:r-x,other:r-x 3f8dc04d 0 10 /.java/.userPrefs D 512 40700 user::rwx,group::---,mask:--- other:--- 3f8dc06b 010 /.java/.userPrefs/.user.lock.root F 0 100600 user::rwgroup::---, mask:---,other:--- 3f8dc06b 0 10 - /.java/.userPrefs/.userRootModFile.root F 0 100600 user::rw-,
Msodik lps: test manifest s
8/3/2019 Unix 5 Solaris
104/124
Msodik lps: test manifest sriporting Kt manifest sszehasonltsa, eltrsek
riportolsa
Ugyanaz a rendszer, idben eltr manifest Kt rendszer stb.
Msodik lps: test manifest s
8/3/2019 Unix 5 Solaris
105/124
Msodik lps: test manifest sriporting
/su:gid control:3 test:1
/ypcat:mtime control:3fd72511 test:3fd9eb23/vfstab:
mode control:100644 test:100777aclcontrol:user::rw-,group::r--,mask:r--,other:r--test:user::rwx,
Rule file
8/3/2019 Unix 5 Solaris
106/124
Rule file
Mely knyvtrakban, mely file-okra mitkell nzni Global
CHECK allIGNORE acl
Tovbbi blokkok
[filters]
CHECK/IGNORE
Parancsok
8/3/2019 Unix 5 Solaris
107/124
Parancsok bart create
-R : indul directory, ha nem /
-I : file lista specifiklsa
-r : rule file megadsa
-n : md5 checking kikapcsolsa (gyorst) bart compare -r : rule file megadsa-p : programmatic output
Amire figyelni kell
8/3/2019 Unix 5 Solaris
108/124
Amire figyelni kell
Jogosultsgok Csak ha van jogom olvasni a file-t, ill. keresni adirectory-ban
Vagy ha root vagyok Vagy ha van file_dac_read s file_dac_search
De az eredmny biztonsgi szempontblrzkeny!
BART rendszer integritsa????
8/3/2019 Unix 5 Solaris
109/124
Egyb biztonsgikiegsztsek
Kriptogrfiai keretrendszer
8/3/2019 Unix 5 Solaris
110/124
Kriptogrfiai keretrendszer
User s kernel egyarnt digest, mac, encrypt, decrypt funkcik Algoritmusok
User: DES, 3DES, AES, RC4, RSA, DSA, D-H,SHA-1, MD5
Kernel: DES, 3DES, AES, Blowfish, SHA-1,
MD5 Signzott elf (!) Hardver RNG tmogats Hardver accelerator tmogats
Password kiegsztsek
8/3/2019 Unix 5 Solaris
111/124
Password kiegsztsek
Password history Password ellenrzs (cracklib) s
integrlt komplexits ellenrzs Tiltott password lista Cserlhet crypt(3c) Account zrols
Egyb fontosabb biztonsgi
8/3/2019 Unix 5 Solaris
112/124
Egyb fontosabb biztonsgiaprsgok Minimalizlt opercis rendszer,
167MB, 81 csomag, 28 suid, 11 guid
C2 audit syslog integrci Kerberos 1.3.2 OpenSSH 3.6p2
8/3/2019 Unix 5 Solaris
113/124
SMFService Management Facility
Solaris 10 SMF
8/3/2019 Unix 5 Solaris
114/124
Solaris 10 SMF
A teljes OS infrastruktra egysgestse /etc/rc*.d, /etc/inetd.conf s milli ms
szolgltats indit/konfigurl hely halla Automatikus, fggsgeket is figyelembe
vev szolgltats indts j szolgltats azonosts:FMRI: Fault Management Resource Identifier
svc://gp/alrendszer/szolgltats:
Solaris 10 SMF
8/3/2019 Unix 5 Solaris
115/124
Solaris 10 SMF
XML repository Egyszer s knnyen bvthet
Alapveten ngy parancs svcs, svcadm, svccfg, inetadm Szolgltats ki s bekapcsols
svcadm disable system/cron:default svcadm enable network/ssh:default
Profilok
Solaris 10 SMF
8/3/2019 Unix 5 Solaris
116/124
Solaris 10 SMF
Lnyegesen jobb diagnosztika# svcs -xsvc:/network/ntp:default (Network Time Protocol
(NTP).)
State: maintenance since Mon Oct 18 13:58:42 2004Reason: Start method exited with
$SMF_EXIT_ERR_CONFIG.
See: http://sun.com/msg/SMF-8000-KS
See: ntpq(1M)See: ntpdate(1M)
See: xntpd(1M)
Impact: 0 services are not running.
Solaris 10 SMF
8/3/2019 Unix 5 Solaris
117/124
Solaris 10 SMF
Lnyegesen jobb diagnosztika# svcs -x -vsvc:/application/print/server:default (LP Print Service)
State: disabled since Mon Oct 18 16:17:27 2004
Reason: Disabled by an administrator.See: http://sun.com/msg/SMF-8000-05
See: man -M /usr/share/man -s 1M lpsched
Impact: 1 service is not running:
svc:/application/print/rfc1179:default
Service llapotok
8/3/2019 Unix 5 Solaris
118/124
Service llapotok
degraded disabled
legacy_run maintenance offline online uninitialized
Solaris 10 SMF
8/3/2019 Unix 5 Solaris
119/124
Solaris 10 SMF
Lnyegesen jobb diagnosztika% svcs -d network/smtp:sendmailSTATE STIME FMRI
online 18:20:14 svc:/system/identity:domain
online 18:20:26 svc:/network/service:default
online 18:20:27 svc:/system/filesystem/local:default
online 18:20:27 svc:/milestone/name-services:default
online 18:20:27 svc:/system/system-log:default
online 18:20:30 svc:/system/filesystem/autofs:default
% svcs -D network/smtp:sendmailSTATE STIME FMRI
online 18:20:32 svc:/milestone/multi-user:default
Contract alrendszer
8/3/2019 Unix 5 Solaris
120/124
Contract alrendszer
A SMF egyik httere Garantlja az szerzdtt
alkalmazsok szerzdsnekbetartst A szerzds az elrhetsgre s a
mkds alapvet paramtereirevonatkozik
Contract alrendszer
8/3/2019 Unix 5 Solaris
121/124
Contract alrendszer
Tetszleges felhasznli programszerzdhet ctrun(1) Milyen esemnyekre kell jraindts: core, exit,
hwerr Mi legyen a gyermek processzekkel Hny jraindtsi problkozs trtnjen Pl.
ctrun r 0 t f core,exit,hwerr httpd
Contract alrendszer
8/3/2019 Unix 5 Solaris
122/124
Contract alrendszer
ctstat(1) szerzds statisztika
ctstat -aCTID ZONEID TYPE STATE HOLDER EVENTS QTIME NTIME
1 0 process owned 0 0 - -4 0 process owned 1 0 - -41 0 process owned 7 0 - -51 0 process owned 7 0 - -71 0 process orphan - 0 - -73 0 process orphan - 0 - -75 0 process orphan - 0 - -
78 0 process orphan - 0 - -81 0 process owned 260 0 - -83 0 process owned 260 0 - -87 0 process dead - 0 - -99 0 process dead - 0 - -
Contract alrendszer
8/3/2019 Unix 5 Solaris
123/124
Contract alrendszer
Rszletes statisztikactstat -avCTID ZONEID TYPE STATE HOLDER EVENTS QTIME NTIME75 0 process orphan - 0 - -
cookie: 0
informative event set: core signalcritical event set: hwerr emptyfatal event set: hwerrparameter set: nonemember processes: 221 234 235 242 477 478 479 480 498 515 521
567 569 571 631 632 639 640 641 642 643 645 653 654 722 735 736738 739 741 746 747 749 750 752 757 758 760 761 763 771 772 774775 777 782 783 785 786 788 793 794 796 797 799 804 805 807 808810 2526 18355 18357
inherited contracts: none
8/3/2019 Unix 5 Solaris
124/124
Ksznjk a figyelmet.
erik.fischertamas.zsemlye @sun.com