From 56fa7965d82f66e5e4608d53e6781e8441ad16b9 Mon Sep 17 00:00:00 2001 From: "jrayhawk+piny.be@omgwallhack.org" Date: Sun, 9 Jan 2011 21:09:14 -0800 Subject: Move cgi-bin resources into cgi-bin/piny/ and cgi-bin/piny/auth --- pinyconfigs/etc/apache2/sites-available/piny | 6 +++--- pinyweb/Makefile | 5 +++-- pinyweb/cgi-bin/auth/newrepo.cgi | 29 ++++++++++++++++++++++++++++ pinyweb/cgi-bin/newuser.cgi | 29 ++++++++++++++++++++++++++++ pinyweb/cgi-bin/piny-newuser.cgi | 29 ---------------------------- pinyweb/cgi-bin/piny/newrepo.cgi | 29 ---------------------------- 6 files changed, 64 insertions(+), 63 deletions(-) create mode 100755 pinyweb/cgi-bin/auth/newrepo.cgi create mode 100644 pinyweb/cgi-bin/newuser.cgi delete mode 100644 pinyweb/cgi-bin/piny-newuser.cgi delete mode 100755 pinyweb/cgi-bin/piny/newrepo.cgi diff --git a/pinyconfigs/etc/apache2/sites-available/piny b/pinyconfigs/etc/apache2/sites-available/piny index 6dbbf87..0904ea6 100644 --- a/pinyconfigs/etc/apache2/sites-available/piny +++ b/pinyconfigs/etc/apache2/sites-available/piny @@ -48,7 +48,7 @@ Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch - + AuthPAM_Enabled on AuthGROUP_Enabled on AuthPAM_FallThrough off @@ -59,8 +59,8 @@ ScriptAlias /cgit /usr/lib/cgi-bin/cgit.cgi - ScriptAlias /piny-newuser /usr/lib/cgi-bin/piny-newuser.cgi - ScriptAlias /piny/ /usr/lib/cgi-bin/piny/ + ScriptAlias /piny-newuser /usr/lib/cgi-bin/piny/newuser.cgi + ScriptAlias /auth/ /usr/lib/cgi-bin/piny/auth/ Include /etc/apache2/piny-enabled diff --git a/pinyweb/Makefile b/pinyweb/Makefile index 52c3dcf..4c0055d 100644 --- a/pinyweb/Makefile +++ b/pinyweb/Makefile @@ -2,8 +2,9 @@ build: $(MAKE) -C suid install: - install -o root -g root -m 755 -d $(DESTDIR)/usr/lib/cgi-bin $(DESTDIR)/usr/sbin - install -o root -g root -m 755 cgi-bin/* $(DESTDIR)/usr/lib/cgi-bin + install -o root -g root -m 755 -d $(DESTDIR)/usr/lib/cgi-bin/piny $(DESTDIR)/usr/sbin + install -o root -g root -m 755 cgi-bin/newuser.cgi $(DESTDIR)/usr/lib/cgi-bin/piny + install -o root -g root -m 755 cgi-bin/auth/* $(DESTDIR)/usr/lib/cgi-bin/piny/auth install -o root -g shadow -m 4754 suid/piny-suid $(DESTDIR)/usr/sbin # FIXME: this should really be www-data somehow clean: diff --git a/pinyweb/cgi-bin/auth/newrepo.cgi b/pinyweb/cgi-bin/auth/newrepo.cgi new file mode 100755 index 0000000..450fa82 --- /dev/null +++ b/pinyweb/cgi-bin/auth/newrepo.cgi @@ -0,0 +1,29 @@ +#!/usr/bin/perl +$| = 1; + +use warnings; + +use CGI; + +use IPC::Open2; + +$q = CGI->new; + +print( "Content-type: text/plain\n\n"); + +if( $q->param('n') && $q->param('d') ) { + unless( open2( OUT, IN, '/usr/sbin/piny-suid', $ENV{'REMOTE_USER'}, 'newrepo', $q->param('n') ) ) { + print 'could not execute newrepo'; + die; + }; + # make things flushier + select( (select(IN), $| = 1)[0] ); + select( (select(OUT), $| = 1)[0] ); + print( IN $q->param('d') . "\n" ); + close( IN ); + while( ) { + print; + }; +} else { + print 'Missing parameters.'; +}; diff --git a/pinyweb/cgi-bin/newuser.cgi b/pinyweb/cgi-bin/newuser.cgi new file mode 100644 index 0000000..002d2be --- /dev/null +++ b/pinyweb/cgi-bin/newuser.cgi @@ -0,0 +1,29 @@ +#!/usr/bin/perl +$| = 1; + +use warnings; + +use CGI; + +use IPC::Open2; + +$q = CGI->new; + +print( "Content-type: text/plain\n\n" ); + +if( $q->param('n') && $q->param('a') && $q->param('p') ) { + unless( open2( OUT, IN, '/usr/bin/sudo', '/usr/sbin/newuser', '--batch', $q->param('a'), $q->param('n') ) ) { + print 'could not execute newrepo'; + die; + }; + # make things flushier + select((select(IN), $| = 1)[0]); + select((select(OUT), $| = 1)[0]); + print( IN $q->param('p') . "\n" ); + close( IN ); + while( ) { + print; + }; +} else { + print 'Missing parameters.'; +}; diff --git a/pinyweb/cgi-bin/piny-newuser.cgi b/pinyweb/cgi-bin/piny-newuser.cgi deleted file mode 100644 index 002d2be..0000000 --- a/pinyweb/cgi-bin/piny-newuser.cgi +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/perl -$| = 1; - -use warnings; - -use CGI; - -use IPC::Open2; - -$q = CGI->new; - -print( "Content-type: text/plain\n\n" ); - -if( $q->param('n') && $q->param('a') && $q->param('p') ) { - unless( open2( OUT, IN, '/usr/bin/sudo', '/usr/sbin/newuser', '--batch', $q->param('a'), $q->param('n') ) ) { - print 'could not execute newrepo'; - die; - }; - # make things flushier - select((select(IN), $| = 1)[0]); - select((select(OUT), $| = 1)[0]); - print( IN $q->param('p') . "\n" ); - close( IN ); - while( ) { - print; - }; -} else { - print 'Missing parameters.'; -}; diff --git a/pinyweb/cgi-bin/piny/newrepo.cgi b/pinyweb/cgi-bin/piny/newrepo.cgi deleted file mode 100755 index 450fa82..0000000 --- a/pinyweb/cgi-bin/piny/newrepo.cgi +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/perl -$| = 1; - -use warnings; - -use CGI; - -use IPC::Open2; - -$q = CGI->new; - -print( "Content-type: text/plain\n\n"); - -if( $q->param('n') && $q->param('d') ) { - unless( open2( OUT, IN, '/usr/sbin/piny-suid', $ENV{'REMOTE_USER'}, 'newrepo', $q->param('n') ) ) { - print 'could not execute newrepo'; - die; - }; - # make things flushier - select( (select(IN), $| = 1)[0] ); - select( (select(OUT), $| = 1)[0] ); - print( IN $q->param('d') . "\n" ); - close( IN ); - while( ) { - print; - }; -} else { - print 'Missing parameters.'; -}; -- cgit v1.2.3