[linux-support] Apache und root-cgi

Christian Schweingruber chrigul at lorraine.ch
Mon Jan 5 17:44:54 CET 2004


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