Problème

Un processus indeterminé efface le fichier /root/.my.cnf, problématique : identifier ce processus

#!/usr/sbin/dtrace -s

syscall::unlink:entry
/ ((file = copyinstr(arg0)) == "/root/.my.cnf" || cwd == "/root" && file == ".my.cnf") /
{
        self->y = 1;
}

syscall::unlink:return
/ self->y && arg0 == 0 /
{
        printf("%s\n", stringof(curthread->t_procp->p_user.u_psargs));
        printf("zone %s UID %d PPID %d %s\n",
                stringof(curthread->t_procp->p_parent->p_cred->cr_zone->zone_name),
                curthread->t_procp->p_parent->p_cred->cr_uid,
                ppid,
                curthread->t_procp->p_parent->p_user.u_comm);
}

Quelques petites explications :

/ ((file = copyinstr(arg0)) == "/root/.my.cnf" || cwd == "/root" && file == ".my.cnf") /

Ce prédicat n’est vrai que si l’argument de la fonction unlink (delete) est “/root/.my.cnf” ou “.my.cnf” tandis que le path courant est “/root”.

Retour

 
docs/dtrace/exemple1.txt · Dernière modification: 17/02/2006 07:54