Article View: news.software.nntp
Article #72372Re: Authentication advice
From: Jeffrey M. Vinocur
Date: Mon, 03 Oct 2005 14:18
Date: Mon, 03 Oct 2005 14:18
102 lines
5314 bytes
5314 bytes
In article <v3a0f.104385$qY1.71720@bgtnsc04-news.ops.worldnet.att.net>,
John F. Morse <xanadu.bbs@invalid.net> wrote:
>
>This shows "Last spun 2005-06-07 from POD modified 2005-06-06" which
>must be Russ' version ($Id: ckpasswd.pod 7215 2005-04-11 20:43:21Z rra $).
Okay, ignore my comment -- I was looking at an outdated ckpasswd
manpage that I assumed was newer than yours. (Apparently
somebody moved ckpasswd from man1 to man8 ages ago, and my man
managed to find the old one!)
>I ran it, but received "ckpasswd: pam_authenticate failed:
>Authentication failure" and can find no way to force it to use crypt
>instead of pam, if possible.
Are we talking about using -u and -p here? As long as you
provide a -f on the commandline also, I think it should work...
>You are using a single quote (the apostrophe) for the $user and $pass
>variables, then using an acute accent diphthong (ligature) as a
>different "single quote"?
Right... single quotes (') are a way to make strings without
interpreting the contents. Double quotes (") are similar to
single quotes, but allow $variables to be interpolated into them.
Backticks (`) are very different despite the graphical
similarity, and indicate that the string inside of them should be
run as a command and the output of that command substituted in
for the whole backtick expression. So like this:
> echo Now it is `date` but soon it will be later.
Now it is Mon Oct 3 09:58:37 EDT 2005 but soon it will be later.
But backticks allow interpretation by default, so compare the
commands below and it should become more clear. I'm using the -p
flag to get plaintext outputs so you can see what is actually
getting fed to htpasswd.
Semicolon tells the shell to run two separate commands (ampersand
is similar to semicolon but runs the first command in the
background and starts the second without waiting for the first to
finish, in this case I think it would just confuse the issue --
but that's why your passwords with ampersand were trouble).
> echo My password file line is `htpasswd -ndbp jeff xy`
My password file line is jeff:xy
# Works fine with no special characters in the password
> echo My password file line is `htpasswd -ndbp jeff xy;blahblah`
My password file line is jeff:xy
blahblahblah: Command not found.
# Uh oh, that semicolon made the shell run the password
> echo My password file line is `htpasswd -ndbp jeff xy;date`
My password file line is jeff:xy
Mon Oct 3 10:03:10 EDT 2005
# But with a real command, it could even work!
> echo My password file line is `htpasswd -ndbp jeff "xy;date"`
My password file line is jeff:xy;date
# Double quotes fix some metacharacters
> echo My password file line is `htpasswd -ndbp jeff "xy$shell"`
My password file line is jeff:xy/bin/tcsh
# But dollar signs still get interpreted as variables
> echo My password file line is `htpasswd -ndbp jeff "xy$blah"`
blah: Undefined variable.
My password file line is
# Oops
> echo My password file line is `htpasswd -ndbp jeff 'xy$blah;date'`
My password file line is jeff:xy$blah;date
# Finally it works
# ...unless there's a single quote in the password
>Perhaps I should inform (new) users to avoid using the ampersand and
>dollar sign in their password selection? Any other possible
>trouble-makers come to mind?
Well, the trouble is that people like to use punctuation to make
strong passwords, but almost all the punctuation can be
misinterpreted by the shell. Definitely any of these could give
you trouble `~!#$&*()[]{}|\'";?<> depending on circumstances, and
I've probably missed some. So realistically you have to let
people use punctuation within reason -- I should have gotten that
script right with the quotes in the first place. For this
application, you should avoid whitespace in passwords, and avoid
single quotes, I guess, and everything else should now be okay.
--
Jeffrey M. Vinocur
jeff@litech.org
Technical Details
Message-ID:
<dhrekd$8nb$1@puck.litech.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!news.litech.org!not-for-mailReferences:
<2b9f5$4335ae05$4097152a$18719@EVERESTKC.NET> <7MJ%e.353849$5N3.165070@bgtnsc05-news.ops.worldnet.att.net> <dhpbmh$va2$3@puck.litech.org> <v3a0f.104385$qY1.71720@bgtnsc04-news.ops.worldnet.att.net>Show Full Headers
Complete Article Headers
Message-ID: <dhrekd$8nb$1@puck.litech.org> Subject: Re: Authentication advice Date: Mon, 03 Oct 2005 14:18:53 +0000 From: jeff@litech.org (Jeffrey M. Vinocur) References: <2b9f5$4335ae05$4097152a$18719@EVERESTKC.NET> <7MJ%e.353849$5N3.165070@bgtnsc05-news.ops.worldnet.att.net> <dhpbmh$va2$3@puck.litech.org> <v3a0f.104385$qY1.71720@bgtnsc04-news.ops.worldnet.att.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!news.litech.org!not-for-mail Newsgroups: news.software.nntp Organization: Litech Systems Design Lines: 102 Sender: jeff@litech.org NNTP-Posting-Host: puck.litech.org X-Trace: puck.litech.org 1128349133 8939 66.218.0.75 (3 Oct 2005 14:18:53 GMT) X-Complaints-To: usenet@litech.org NNTP-Posting-Date: Mon, 3 Oct 2005 14:18:53 +0000 (UTC) X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Originator: jeff@litech.org (Jeffrey M. Vinocur)