hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : VPS Hosting : VPS Tutorials : authentication script fail
Reply

VPS Tutorials Tutorials related to VPS.
Forum Jump

authentication script fail

Reply Post New Thread In VPS Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 09-12-2011, 02:33 AM
eric6630 eric6630 is offline
Newbie
 
Join Date: Mar 2011
Posts: 20

authentication script fail


Quote:
#!/bin/bash
### Database Informations
DBUSER='user'
DBPASS='pass'
DBHOST='localhost' #use ip kng external ang mysql server nyo if not localhost lng
DBNAME='dbase'

user_name=`head -n1 $1 | tail -1` #first line -> Username
pass_word=`head -n2 $1 | tail -1 ` #second line -> Password

user_query=`mysql -u $DBUSER -p$DBPASS -D $DBNAME -h $DBHOST --skip-column-name -e "SELECT username FROM user WHERE ( (active = '1') AND (username = '$user_name') AND (password = PASSWORD('$pass_word')) );" $DBNAME`

if [ "$user_query" == "$user_name" ]; then
exit 0
else
exit 1
fi
hi

im using this kind of script for authentication process
the problem is, no one could connect authentication failed
does anyone know what was the problem?

in using ubuntu 10.10, mysql and phpmyadmin

i hope someone could help me

thank you

Reply With Quote


Sponsored Links
  #2  
Old 09-12-2011, 03:21 AM
almanox almanox is offline
Temporarily Suspended
 
Join Date: Sep 2011
Location: UK
Posts: 161
Maybe try
"$user_name" instead of '$user_name'
"$pass_word" instead of '$pass_word'
in the query so that the variables get substituted.

Reply With Quote
  #3  
Old 09-12-2011, 03:32 AM
eric6630 eric6630 is offline
Newbie
 
Join Date: Mar 2011
Posts: 20
Hi

Still not working i change from single to double quote

do i need to put
Quote:
user is my table name on database
Quote:
username one of my column
do i need to put user.username = "$user_name" ????

but i tried nothing happened.
do i need to put table?

how?

Reply With Quote
Sponsored Links
  #4  
Old 09-12-2011, 04:30 AM
almanox almanox is offline
Temporarily Suspended
 
Join Date: Sep 2011
Location: UK
Posts: 161
First try to check from command line if the credentials are OK for example
DBHOST=localhost; DBNAME=root; DBPASS=xxx; mysql -u $DBNAME -p$DBPASS -h $HOST $DBNAME

if you can connect then continue with the query in your script or from command line

DBHOST=localhost; DBNAME=root; DBPASS=xxx; mysql -u $DBNAME -p$DBPASS -h $HOST --skip-column-name -e "SELECT username FROM user WHERE active = 1 AND username = \"$user_name\" AND password = PASSWORD(\"$pass_word\");" $DBNAME

Reply With Quote
  #5  
Old 09-12-2011, 04:51 AM
eric6630 eric6630 is offline
Newbie
 
Join Date: Mar 2011
Posts: 20
Hi

ok sir ill try it now

for clarification
Quote:
username = \"$user_name\"
and

Quote:
password = PASSWORD(\"$pass_word\")
do i need to put close parenthesis on username?


Last edited by eric6630; 09-12-2011 at 05:00 AM.
Reply With Quote
  #6  
Old 09-12-2011, 05:30 AM
eric6630 eric6630 is offline
Newbie
 
Join Date: Mar 2011
Posts: 20
Hi

same problem

but if im using this

Quote:
plugin /etc/openvpn/openvpn-auth-pam.so openvpn
Quote:
auth sufficient pam_mysql.so \
user=user passwd=pass host=localhost db=openvpn \
table=user usercolumn=username passwdcolumn=password \
where=active>online sqllog=0 crypt=1

account required pam_mysql.so \
user=user passwd=pass host=localhost db=openvpn \
table=user usercolumn=username passwdcolumn=password \
where=active>online sqllog=0 crypt=1
successfully login if i created on root sql

but if on phpmyadmin created successfully but auth failed.

if im using this

Quote:
auth-user-pass-verify "/etc/openvpn/auth_vpn.sh" via-file
Quote:
#!/bin/bash
### Database Informations
DBPASS=xxxx;
DBHOST=localhost;
DBNAME=root;


user_name=`head -n1 $1 | tail -1` #first line -> Username
pass_word=`head -n2 $1 | tail -1 ` #second line -> Password

user_query=mysql -u $DBNAME -p$DBPASS -h $DBHOST --skip-column-name -e "SELECT username FROM user WHERE active = 1 AND username = (\"$user_name\") AND password = PASSWORD(\"$pass_word\");" $DBNAME

if [ "$user_query" == "$user_name" ]; then
exit 0
else
exit 1
fi
authentication failed both created on sql and phpmyadmin.

is there anything i missed?

Reply With Quote
  #7  
Old 09-12-2011, 06:02 AM
almanox almanox is offline
Temporarily Suspended
 
Join Date: Sep 2011
Location: UK
Posts: 161
In the previous examples DBNAME was used for DBUSER. Let's separate them
to avoid confusion.

Make sure you are using valid MySQL username and password
i.e. replace root, xxx and mydb with your values
and try connecting in simplest form
DBNAME=mydb; DBHOST=localhost; DBUSER=root; DBPASS=xxx; mysql -u $DBUSER -p$DBPASS -h $DBHOST $DBNAME

You may also skip host parameter to use default socket connection like
DBNAME=mydb; DBUSER=root; DBPASS=xxx; mysql -u $DBUSER -p$DBPASS $DBNAME

or even provide password interactively like
DBNAME=mydb; DBUSER=root; mysql -u $DBUSER -p $DBNAME

Only if the above succeed you can try debugging the script.

Reply With Quote
  #8  
Old 09-12-2011, 06:47 AM
eric6630 eric6630 is offline
Newbie
 
Join Date: Mar 2011
Posts: 20
Hi

all parameter's working ok even try to insert using .php

when i trying to execute it was perfectly fine

why i got always auth failed

Quote:
saslauthd[3745]: do_auth : auth failure: [user=test] [service=smtp] [realm=xxxx.com] [mech=pam] [reason=PAM auth error]
got this error

dont know how to fixed it.

im noob

did you know how to fix that error?

Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Contact US script fail? SpaciousHost Programming Discussion 9 07-23-2009 03:36 PM
Problem registering domain - Error: 2 IP authentication fail e[X]treme[Z] Hosting Software and Control Panels 0 07-20-2009 01:25 AM
Blocking IP's that Fail Authentication? ryanb Hosting Security and Technology 6 11-21-2004 08:40 PM
php authentication and BB script?? drhoades Programming Discussion 4 10-20-2003 12:08 PM
Advanced authentication and access management script Alan Wasser Other Offers & Requests 5 10-18-2003 05:46 PM

Related posts from TheWhir.com
Title Type Date Posted
Edgewebhosting Partners with Duo Security to Add Two-Factor Authentication Web Hosting News 2012-12-21 09:37:37
Parallels Integrates CertiVox SkyPin Multi-Factor Authentication Across Plesk, Automation Web Hosting News 2012-09-24 17:00:37
Q&A: Brian Trzupek on Authentication Solution Trustwave MyIdentity Web Hosting News 2011-12-20 16:20:44
Trustwave Launches Cloud-Based Authentication Solution MyIdentity Web Hosting News 2011-12-06 21:03:44
Stonesoft Releases Secure Authentication Portal for Cloud Environments Web Hosting News 2011-09-30 17:51:25


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?