|
From: rinberg\@libero\.it <ri...@li...> - 2007-08-30 17:18:13
|
Hi. Thanks for the detailed answer of my previous email.
I'm trying to manually measure a configuration file with this code:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
struct measure_request {
int fd;
u_int16_t label;
};
int fd_mreq, fd_config;
struct measure_request mr;
int main (int argc, char **argv)
{
fd_mreq =3D open("/sys/kernel/security/ima/measurereq", O_WRONLY);
fd_config =3D open(argv[1], O_RDONLY);
if (fd_mreq <=3D 0) printf("non apro mreq");
if (fd_config <=3D 0) printf("non apro il file da misurare");
mr.fd =3D fd_config; /* file descriptor of the file that shall be measu=
red */
mr.label=3D3134; /* any label/tag; it only appears in the measurement e=
ntry */
if (write(fd_mreq, mr, sizeof(struct measure_request)))
printf("ERROR\n");
close(fd_config);
close(fd_mreq);
return 0;
}
It still prints ERROR so no write to the /sys/kernel/security/ima/measure=
req that is still loaded with:
sudo mount -t securityfs none /sys/kernel/security && sudo chmod +r /sys/=
kernel/security/ima/*
Any help would be appreciated.
Thak you. Best Regards,
Rinaldo Bergamini
|