PDA

View Full Version : User Password Change Script


BeDa
22-05-2005, 11:19
Please note: THIS IS A FIRST BETA, I HAVE TRIED TO FILTER ALL VARIABLES, THIS SCRIPT COMES WITH NO WARRANTY. IT IS POSSIBLE THAT THIS SCRIPT HAVE A LOT OF HEAVY BUGS.

What was my problem:
Users can't change their password on my Teamspeak Server. I doesn't find anything in the forum. So i take a look at the manage Port.

The solution:
A Normal User can't login to the manage port but if he try with the correct password there comes "Error, invalid permissions".
Check the error that comes when user tries to login. If "OK" or "Error, invalid permissions" the user password is correct (*i hope so, if not please write a message).
Then you can login with slogin and change users password.

How to use?
Download it, place it under the cgi-bin directory of your webserver.
Change Superadmin / Password / ServerIP / Manage / Port in the script. Make a chmod +x and note that no Script should run with root :-)
Then go to yourserver/cgi-bin/filename and write me a message if you think it is usefull or not.

Where can i check the source / download from?
http://bk99.de/Members/BeDa/dokumente/teamspeak/teamspeak_pwchange.txt/file_view

BeDa

##############################################

Unbedingt beachten: DAS IST DIE ERSTE BETA, ICH HABE VERSUCHT ALLE VARIABLEN ZU FILTERN, KEINE GARANTIE FÜR DIESES SKRIPT. ES IST MÖGLICH DAS ES SCHWERWIEGENDE FEHLER ENTHÄLT.

Mein Problem:
Registrierte Nutzer könne Ihr Passwort nicht ändern. Im Forum habe ich leider nicht gefunden. Also habe ich versucht es über den Manageport zu lösen.

Meine Lösung
Ein registrierter Benutzer kann sich nicht über login am Managementport anmelden wenn er es aber mit dem richtigen Kennwort versucht, kommt die Meldung "Error, invalid permissions".
Überprüfe die Fehlermeldung die vom Server kommt, wenn "OK" oder "Error invalid permissions" zurückgeliefert wird, war das Passwort richtig (*Ich hoffe dem ist so, wenn nicht bitte eine Nachricht schreiben).
Danach als Superuser anmelden und Nutzerpasswort ändern.

Wie installieren und benutzen?
Runterladen, ins cgi-bin Verzeichniss deines Webservers legen.
Die Variablen Superadmin / Password / ServerIP / Manage / Port im Skript anpassen. chmod +x dateiname.pl und daran denken das kein Skript mit root Rechten laufen sollte :-)
Dann auf http[s]://DeinServerName/cgi-bin/dateiname.pl gehen und es benutzen. Schreibt eine Nachricht wenn Ihr es nützlich findet oder nicht.

Wo kann ich den Quellcode lesen / es runterladen?
http://bk99.de/Members/BeDa/dokumente/teamspeak/teamspeak_pwchange.txt/file_view

MfG BeDa

BeDa
03-06-2005, 20:09
Has anybody test/read this script?

###########################

Hat das Script schon jemand getestet/gelesen?

MfG BeDa

Tyeson
03-06-2005, 22:25
Error 500 Internal Server Error ?

BeDa
04-06-2005, 00:26
post a little bit more (a part of your webserverlog) sounds like a permisson problem.

sledgi
06-06-2005, 16:23
moin moin,

ich habs mal auf meinem lokalen apache/ts2 mit mysql getestet und funzt einwandfrei.

allerdings sollte man zusätzlich zur installationshilfe erwähnen, daß "dateinname.pl" auch im script selbst abgeändert werden sollte. :rolleyes:

gruß gerd

BeDa
07-06-2005, 05:55
Change the Scriptname to pwchange.pl or edit this line: print startform('POST', 'pwchange.pl', 'application/x-www-form-urlencoded');.

######################

Uppss :-D das erklärt auch den 500 Fehler. Danke für den Hinweis. Im Zweifelsfall das Script einfach pwchange.pl nennen.
Oder print startform('POST', 'pwchange.pl', 'application/x-www-form-urlencoded'); die betreffende Zeile anpassen. Werde das noch ändern.
vielen Dank für das ausprobieren.

MfG BeDa

Chupa
29-07-2005, 00:50
When i run the script with my web browser, I get the form and can enter data. When submitting, the script runs for several minutes without doing anything and then quits with an Internal Server Error.

Error log:

[Fri Jul 29 00:26:14 2005] [error] [client xxx.xxx.xxx.xxx] Premature end of script headers: pwchange.cgi, referer: http://[domain]/cgi-bin/pwchange.cgi

I run Apache 2.0.40 / Red Hat.

The script is chmodded to 755 and chowned to the ftp-user. In that same directory, i got several other perl scripts for testing purposes with the same settings for chmod and chown and they all work fine.

I also tried this:
perl -c pwchange.cgi
Result:
pwchange.cgi syntax OK

Any suggestions?

BeDa
01-08-2005, 01:26
Change the Scriptname to pwchange.pl or edit this line: print startform('POST', 'pwchange.pl', 'application/x-www-form-urlencoded');.

Your Scriptname is "pwchange.cgi".

Variables set correct?

my $susername = "admin";
my $spasswort = "password";

my $server_adress = "127.0.0.1";
my $server_manage_port = "51234";


NOTE: No Spaces are allowed in Username/Password

Are all Perl Modules installed?

use strict;
use warnings;
use diagnostics;
use IO::Socket;
use CGI qw( :standard);


If nothing helps, activate my $debug = 1; and look at comment lines in the html source.

Try to remove -T (tainted mode)

#!/usr/bin/perl -T

change to

#!/usr/bin/perl


or contact me with ICQ.

BeDa

Chupa
06-08-2005, 14:55
I thought, in

my $server_manage_port = "51234";

"51234" was a dummy number and replaced it with the port number in the URL of the admin interface. Changing it back to "51234" solved the problem :D

Thanks BeDa for your kind assistance :D

mrdeath
08-08-2005, 13:14
I get a "Internal Server Error" .. I think I got all app. installed ok..

Premature end of script headers: /usr/local/www/cgi-bin/pwchange.pl
Can't locate warnings.pm in @INC (@INC contains: /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503) at /usr/local/www/cgi-bin/pwchange.pl line 4.
BEGIN failed--compilation aborted at /usr/local/www/cgi-bin/pwchange.pl line 4.
Premature end of script headers: /usr/local/www/cgi-bin/pwchange.pl



And "debug" mode don't seen to work :confused:

ScP
08-08-2005, 15:15
Premature end of script headers: ... You need the following line: print header();

Can't locate warnings.pm ... The warnings module isn't installed for perl. Remove this: use warnings;

Set file- and directory-permissions to 755 and take a look at your suexec.log (maybe in /var/log/apache2/)...

mrdeath
09-08-2005, 02:08
Thx it worked, got it to run..

but now I get a pop-up that ask for "Confirm password change" when trying to change a password, but its only listing superadmins, and no users :-s

BeDa
10-08-2005, 15:38
There is no pop-up (user list) in this script. Use http://bk99.de/Members/BeDa/dokumente/teamspeak/teamspeak_pwchange.txt/file_view, install "warnings.pm" to your Perl Modules and have fun ;).

MfG BeDa