[linux-support] Apache und root-cgi

Reto Stalder retstald at ee.ethz.ch
Mon Jan 5 22:54:27 CET 2004


Hallo Chrigu,

jup so läufts. Vielen Dank für die Hilfe!

Gruss,
Reto


Am 05.01.2004 um 17:44 schrieb Christian Schweingruber:

> Christian Schweingruber schrieb:
>> Hallo Reto
> [...]
>> 2. Sauber(er):
>> Win kurzes wrapper-programm (zB. in C) schreiben, und dieses mit suid 
>> ausrüsten. Darin muss die authenzitität und berechtigung des requests 
>> genau geprüft werden.
> Hier noch ein Gerüst, so eines wrappers:
> /* begin wrapper.c */
> #include <stdio.h>
> #include <syslog.h>
> main()
> {
>  char stringa[255];
>  int uid=0;
>  if( setuid(uid) != 0 )
>  {
>      printf("setuid failed \n");
>
>      }
>
>      else
>
>      {
>             strcpy(stringa,"/sbin/iptables -L");
>             if (system(stringa)< 0)
>             {
>                 syslog(LOG_ERR, "can't exec %s: %m",stringa);
>                 return(0);
>             }
>     }
>     return 0;
> }
> /* end wrapper.c */
>
> Gruess Chrigu
>




More information about the Linux-support mailing list