peri .signature

Christos Ricudis ricudis at paiko.gr
Sun Jul 29 13:07:43 EEST 2001


Hello Stelios!

  On 24 Jul 01, Stelios Bounanos wrote to All with subject "Re: peri
.signature":

 >> An 8es na apofygeis ton atermona vrogxo pou 8a trexei sto
 >> background (kai ton opoio 8a prepei na frontiseis na ekteleitai 
 >> ka8e fora pou 8a kaneis login) mporeis na kaneis ena file sto 
 >> /proc filesystem. px /proc/signature (Exei sxetikh 
 >> documentation se ena prosfato teyxos tou magaz) 
 >> H synarthsh pou 8a kaleitai otan 8a diavazetai to
 >> /proc/signature 8a kanei invoke to fortune mesw mias synarthshs 
 >> ths oikogeneias "exec". 
 >> Meta dhlwneis gia signature ston mailer to /proc/signature
 >> 
 SB> Epishs mporeis na ftiakseis mia dikh soy ekdosh ths fopen(3), h
 SB> opoia 8a kanei dlopen(3) thn libc kai 8a kalei kateu8eian thn kanonikh
 SB> fopen apo ekei, ektos an to path exei substring ".signature", opote 8a
 SB> kanei prwta exec kati poy na grefei ekei mesa.
 SB> Ayton ton kwdika ton bazeis se ena shared object kai orizeis
 SB> katallhlo LD_PRELOAD prin trekseis ton mailer.

Mpa, ayto kai h giagia moy to kanei. 

Enas pragmatikos antras 8a allaze thn open() system call ston kernel,
sygkrinontas thn prwth parametro me to epi8ymhto regexp. Se periptwsh match,
ena special kernel thread epikoinwnei me ton user level daemon mesw toy /proc
filesystem, kai pairnei to device:inode pair toy fortune arxeiou. Ystera, o
kernel koitazei sto sygkekrimeno inode, diabazei ta block numbers toy fortune
arxeiou, dialegei ena sthn tyxh afou prwta bebaiw8ei oti einai arketa aykshmenh
h entropia sto /dev/urandom gia logous asfaleias, kai diabazei mexri na brei to
epomeno %, kratwntas to apotelesma se ena endiameso buffer, o opoios
epistrefetai me thn epomenh klhsh ths read() system call.  

--
Christos Ricudis

In God we trust.
All others must present a valid X.509 certificate.



More information about the Linux-greek-users mailing list