Remplacement des scripts C setuid par des scripts perl, AlternC is now arch indep \!

This commit is contained in:
Benjamin Sonntag 2006-05-11 10:52:23 +00:00
parent 933dd9e476
commit da63874904
12 changed files with 12 additions and 433 deletions

7
.gitattributes vendored
View File

@ -352,16 +352,9 @@ po/fr/LC_MESSAGES/alternc-admintools.po -text
src/.cvsignore -text
src/Makefile -text
src/basedir_prot.sh -text
src/db_create.c -text
src/du.pl -text
src/mail_add.c -text
src/mail_del.c -text
src/mem_add.c -text
src/mem_del.c -text
src/quota_delete -text
src/quota_edit.c -text
src/quota_edit.sh -text
src/quota_get.c -text
src/quota_get.sh -text
src/quota_init -text
src/rawstat.daily -text

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
alternc (0.9.6) stable; urgency=low
* Replacing C setuid scripts by perl-suid one. AlternC is now arch-indep !
-- Benjamin Sonntag <benjamin@alternc.org> Thu, 11 May 2006 12:40:56 +0200
alternc (0.9.5) stable; urgency=low
* maintenance release to fix packaging and security bugs

8
debian/control vendored
View File

@ -3,12 +3,12 @@ Section: admin
Priority: optional
Maintainer: Benjamin Sonntag <benjamin@alternc.org>
Uploader: Antoine Beaupre <anarcat@koumbit.org>
Build-Depends: debhelper (>= 4.0.2), findutils (>= 4.1.7), gcc (>= 2:2.95.4), gettext (>= 0.10.40-5), po-debconf
Standards-Version: 3.6.2.2
Build-Depends-Indep: debhelper (>= 4.0.2), findutils (>= 4.1.7), gcc (>= 2:2.95.4), gettext (>= 0.10.40-5), po-debconf
Standards-Version: 3.7.2.0
Package: alternc
Architecture: any
Depends: debianutils (>= 1.13.1), debconf (>= 0.5.00) | debconf-2.0, libapache-mod-php4 | libapache-mod-php5, apache, apache-ssl, courier-ssl, courier-imap-ssl, courier-pop-ssl, mysql-server, php5-mysql | php4-mysql, phpmyadmin, proftpd-mysql, squirrelmail, postfix, postfix-tls, bind9, wget, libapache-mod-gzip, rsync, quota, courier-authmysql, ca-certificates, locales, perl-suid, perl, postfix-mysql, wwwconfig-common, sasl2-bin, libsasl2-modules, php4-cli | php5-cli, php4-mysql | php5-mysql, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), pdksh (>= 5.2.14-6), adduser
Architecture: all
Depends: debianutils (>= 1.13.1), debconf (>= 0.5.00) | debconf-2.0, libapache-mod-php4 | libapache-mod-php5, apache, apache-ssl, courier-ssl, courier-imap-ssl, courier-pop-ssl, mysql-server, php5-mysql | php4-mysql, phpmyadmin, proftpd-mysql, squirrelmail, postfix, postfix-tls, bind9, wget, libapache-mod-gzip, rsync, quota, courier-authmysql, ca-certificates, locales, perl-suid, perl, postfix-mysql, wwwconfig-common, sasl2-bin, libsasl2-modules, php4-cli | php5-cli, php4-mysql | php5-mysql, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), pdksh (>= 5.2.14-6), adduser, perl-suid
Conflicts: alternc-admintools, alternc-awstats (<= 0.3.2), alternc-webalizer (<= 0.9.4)
Provides: alternc-admintools
Replaces: alternc-admintools

2
debian/rules vendored
View File

@ -22,7 +22,6 @@ export DH_OPTIONS
build: build-stamp
build-stamp:
dh_testdir
(cd src && $(MAKE))
/usr/bin/msgfmt po/fr/LC_MESSAGES/alternc-admintools.po -o po/fr/LC_MESSAGES/alternc-admintools.mo
touch build-stamp
@ -30,7 +29,6 @@ clean:
dh_testdir
dh_testroot
rm -f build-stamp
(cd src/ && $(MAKE) clean)
dh_clean
install: DH_OPTIONS=

View File

@ -25,21 +25,12 @@
# Purpose of file: Makefile des binaires de /usr/lib/alternc
# ----------------------------------------------------------------------
#
CC?=cc
CC+=$(CFLAGS)
PROGS=mail_add mail_del quota_edit quota_get mem_add mem_del db_create
SETUID=mail_add mail_del quota_edit quota_get mem_add mem_del
SCRIPTS=quota_edit.sh quota_get.sh basedir_prot.sh sqlbackup.sh rawstat.daily quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php
BIN=$(DESTDIR)/usr/lib/alternc/
all: $(PROGS)
install: all
chown root:www-data $(BIN)
chmod 755 $(BIN)
install -o root -g www-data -m4750 $(PROGS) du.pl $(BIN)
install -o root -g www-data -m4750 $(SETUID) du.pl $(BIN)
install -o root -g www-data -m0750 $(SCRIPTS) $(BIN)
clean:
-rm -f *.o *~
-rm -f $(PROGS)

View File

@ -1,59 +0,0 @@
/*
$Id: db_create.c,v 1.1 2003/03/27 00:42:19 benjamin Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag - 2002/06/22
Purpose of file: Change the owner / mod of a newly created db
----------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/quota.h>
int main(int argc,char *argv[])
{
unsigned int uid,size;
int i;
char res[255];
struct dqblk addr;
if (argc!=3)
{
printf("Utilisation : %s uid login\n ",argv[0]);
printf("Change le possesseur et le groupe de la base mysql 'login' pour le groupe 'uid'\n");
exit(-1);
}
uid=atoi(argv[1]);
if (!uid)
exit(-1);
setuid(geteuid());
/*************************/
/* WARNING : ROOT ZONE ! */
/*************************/
chown(argv[2],-1,uid);
chmod(argv[2],02770);
exit(0);
}

View File

@ -1,83 +0,0 @@
/*
$Id: mail_add.c,v 1.1 2003/03/27 00:42:19 benjamin Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag - 2002/02/01
Purpose of file: Creation d'un dossier email.
TODO: vérifier que seuls les caractères autorisés sont présents dans le mail.
----------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char *argv[])
{
char mail[256],s[255];
unsigned int uid;
if (argc!=3)
{
printf("Utilisation : %s mailname uid\n ",argv[0]);
printf("Cree la boite mail 'mailname' pour l'utilisateur 'uid'\n");
exit(-1);
}
strncpy(mail,argv[1],255);
mail[255]=0;
uid=atoi(argv[2]);
if (!uid)
exit(-1);
setuid(geteuid());
/*************************/
/* WARNING : ROOT ZONE ! */
/*************************/
sprintf(s,"/var/alternc/mail/%c/%s",mail[0],mail);
mkdir(s);
chown(s,33,uid);
chmod(s,02770);
sprintf(s,"/var/alternc/mail/%c/%s/Maildir",mail[0],mail);
mkdir(s);
chown(s,33,uid);
chmod(s,02770);
sprintf(s,"/var/alternc/mail/%c/%s/Maildir/cur",mail[0],mail);
mkdir(s);
chown(s,33,uid);
chmod(s,02770);
sprintf(s,"/var/alternc/mail/%c/%s/Maildir/new",mail[0],mail);
mkdir(s);
chown(s,33,uid);
chmod(s,02770);
sprintf(s,"/var/alternc/mail/%c/%s/Maildir/tmp",mail[0],mail);
mkdir(s);
chown(s,33,uid);
chmod(s,02770);
exit(0);
}

View File

@ -1,54 +0,0 @@
/*
$Id: mail_del.c,v 1.1 2003/03/27 00:42:19 benjamin Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag - 2002/02/01
Purpose of file: Destruction d'un dossier email.
TODO: vérifier que seuls les caractères autorisés sont présents dans le mail.
----------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char *argv[])
{
char mail[64],s[255];
if (argc!=2)
{
printf("Utilisation : %s mailname \n ",argv[0]);
printf("Detruit la boite mail 'mailname'\n");
exit(-1);
}
strncpy(mail,argv[1],64);
mail[64]=0;
sprintf(s,"/bin/rm -rf '/var/alternc/mail/%c/%s'",mail[0],mail);
setuid(geteuid());
/*************************/
/* WARNING : ROOT ZONE ! */
/*************************/
system(s);
exit(0);
}

View File

@ -1,60 +0,0 @@
/*
$Id: mem_add.c,v 1.1 2003/03/27 00:42:19 benjamin Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag - 2002/02/01
Purpose of file: Création d'un dossier membre.
----------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char *argv[])
{
char mail[256],s[255];
unsigned int uid;
if (argc!=3)
{
printf("Utilisation : %s member-name uid\n ",argv[0]);
printf("Cree le compte membre 'member-name' pour l'utilisateur 'uid'\n");
exit(-1);
}
strncpy(mail,argv[1],255);
mail[255]=0;
uid=atoi(argv[2]);
if (!uid)
exit(-1);
setuid(geteuid());
/*************************/
/* WARNING : ROOT ZONE ! */
/*************************/
sprintf(s,"/var/alternc/html/%c/%s",mail[0],mail);
mkdir(s);
chown(s,33,uid);
chmod(s,02770);
exit(0);
}

View File

@ -1,53 +0,0 @@
/*
$Id: mem_del.c,v 1.1 2003/03/27 00:42:19 benjamin Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag - 2002/02/01
Purpose of file: Destruction d'un dossier membre.
----------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char *argv[])
{
char mail[64],s[255];
if (argc!=2)
{
printf("Utilisation : %s member-name \n ",argv[0]);
printf("Detruit le membre 'member-name'\n");
exit(-1);
}
strncpy(mail,argv[1],64);
mail[64]=0;
sprintf(s,"/bin/rm -rf '/var/alternc/html/%c/%s'",mail[0],mail);
setuid(geteuid());
/*************************/
/* WARNING : ROOT ZONE ! */
/*************************/
system(s);
exit(0);
}

View File

@ -1,50 +0,0 @@
/*
$Id: quota_edit.c,v 1.1 2003/03/27 00:42:19 benjamin Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag - 2002/02/01
Purpose of file: Edition des quotas disque, fronted securise a quotatool.
----------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char *argv[]) {
unsigned int uid,size;
int i,c;
char res[255];
if (argc<3) {
printf("Usage : quota_edit uid size\n");
exit(-1);
}
i=atoi(argv[1]);
if (i<1000) {
printf("uid must be > 1000 !\n");
exit(-1);
}
c=atoi(argv[2]);
setuid(geteuid());
sprintf(res,"/usr/lib/alternc/quota_edit.sh %d %d",i,c);
system(res);
exit(0);
}

View File

@ -1,50 +0,0 @@
/*
$Id: quota_get.c,v 1.1 2003/03/27 00:42:19 benjamin Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag - 2002/02/01
Purpose of file: Obtention des quotas disque, fronted securise a quota.
----------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char *argv[]) {
unsigned int uid,size;
int i,c;
char res[255];
if (argc<2) {
printf("Usage : quota_get uid\n");
exit(-1);
}
i=atoi(argv[1]);
if (i<1000) {
printf("uid must be > 1000 !\n");
exit(-1);
}
setuid(geteuid());
sprintf(res,"/usr/lib/alternc/quota_get.sh %d",i);
system(res);
exit(0);
}