Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Web Design Lobby Forum for general web design issues not specific to scripting or graphics.

   

Reply
 
LinkBack Thread Tools Display Modes
Old 10-28-2003, 11:35 AM   #1 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,821
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
?custom admin script - server folders and files questions?

OK a client want's a way to log in and edit their site.
I can do some PHP file manipulation, but I want to know about the security of the stored passwords and the ones being transmitted.

If I had a PHP script that takes the password (for the first time) encrypts it, then stores it in a file.

Then I have the logon script that takes the password and encrypts it, then compares it to the stored encrypted password.
[1]Would the correct password match?

[2]Where on the server can I store the password file so that no-one can access the (encripted) stored password?

[3]How should the files containing the content that will be altered by the admins by chmod'd?
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-28-2003, 01:00 PM   #2 (permalink)
Inactive
 
Join Date: 10-13-03
Posts: 51
iTrader: 0 / 0%
Latest Blog:
None

WickedSkySoftware is liked by many
not sure if this is the best way but you can use the md5 function to encrypt passwords.

Here is some more info:
http://us2.php.net/manual/en/function.md5.php
WickedSkySoftware is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-28-2003, 01:12 PM   #3 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,821
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
thanks, md5 was part of the plan anyway, the issue is with the files on the server and how they could be acessed/altered.

Cheers for the link, taking a look at it now.
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-29-2003, 06:29 PM   #4 (permalink)
Inactive
 
Join Date: 10-22-03
Location: Minnesota
Posts: 12
iTrader: 0 / 0%
Latest Blog:
None

lslars31 is liked by many
Send a message via AIM to lslars31
can't you just use the .htaccess or .htpassword files?
lslars31 is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-29-2003, 06:53 PM   #5 (permalink)
Inactive
 
Join Date: 10-12-03
Location: Cranberry Township
Posts: 275
iTrader: 0 / 0%
niceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really nice
Send a message via ICQ to niceguyeddie
md5 just saves the hash, and then you compare the hash of the entered password against the hash that is saved. you can't really unencrypt something that has been stored against the md5 function.
niceguyeddie is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-29-2003, 07:26 PM   #6 (permalink)
Inactive
 
Join Date: 10-13-03
Location: Baltimore, Maryland
Posts: 18
iTrader: 0 / 0%
Latest Blog:
None

hughitt1 is liked by many
I would normaly use a database to store the password, but if you have none available what your trying should be fine.

1) Make a file to store the info and put it in a protected folder (can use htaccess to protect folders with apache, but not sure exactly how to write file. should be simple. )

* One other thing you could do if you want a little extra security is make the file you are going to store the passwords in a .php file, then save the user/pws inside of php comments. that way if by any way someone did load the page over the net, the php parser would take out the comments and they would just see a blank page. I have not done this for password storage but i do use it for include files

2) Save the pw as md5

3) compare md5() version of the pass the user enters against the md5 version stored in the file.


this should work fine. I don't have too much experience with storing and retrieving from files as i use mostly mysql, but i can't imagine you would have any probelms doing this.

Keith
hughitt1 is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-30-2003, 02:23 AM   #7 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,821
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
OK cheers, so the passwords should be safe.


now if I write a script to update content of the site, and the content is stored in plain-text/html/xml files, then I must have to give the files write access, is there a safe way to do this?
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-30-2003, 04:04 AM   #8 (permalink)
Inactive
 
Join Date: 10-12-03
Location: Cranberry Township
Posts: 275
iTrader: 0 / 0%
niceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really nice
Send a message via ICQ to niceguyeddie
put the files below the web root.
niceguyeddie is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-30-2003, 04:20 AM   #9 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,821
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
It's a cheap host, not my own server, can I still do that?
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-30-2003, 05:39 AM   #10 (permalink)
No Longer Here
 
Join Date: 09-27-03
Location: State College, PA
Posts: 9,354
iTrader: 0 / 0%
Latest Blog:
None

Jazzee is liked by somebodyJazzee is liked by somebodyJazzee is liked by somebodyJazzee is liked by somebodyJazzee is liked by somebody
You should still be able to.
Jazzee is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-30-2003, 06:59 AM   #11 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,821
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
OK, how?
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-30-2003, 07:01 AM   #12 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,821
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
Or maybe as someone mentioned I could make a new folder and use .htaccess to block it from the web.
And then, I hope, it can be accessed only from my .php scripts outside that folder?
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-30-2003, 07:10 AM   #13 (permalink)
Inactive
 
Join Date: 10-12-03
Location: Cranberry Township
Posts: 275
iTrader: 0 / 0%
niceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really nice
Send a message via ICQ to niceguyeddie
Quote:
Originally Posted by LazyJim
OK, how?
ssh in,

mkdir passwords
chmod 777 passwords

if you don't have ssh the same can be done via ftp. Then just use the absolute paths to write to the directory.

Cheap webhosts are still just using *nix more than likely, so the same rules apply here as they would when paying more $ a month with your own *nix box.
niceguyeddie is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-30-2003, 07:12 AM   #14 (permalink)
Inactive
 
Join Date: 10-12-03
Location: Cranberry Township
Posts: 275
iTrader: 0 / 0%
niceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really nice
Send a message via ICQ to niceguyeddie
Quote:
Originally Posted by LazyJim
Or maybe as someone mentioned I could make a new folder and use .htaccess to block it from the web.
And then, I hope, it can be accessed only from my .php scripts outside that folder?
still would need some way of administering the passwords, unless you just plan on giving one out.

A DB would be a better way to go, along with using sessions, etc, but it depends on how much control you need.
niceguyeddie is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-30-2003, 07:22 AM   #15 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,821
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
cant I still use a php script to set the passwords in a file that's in a protectd folder?
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-30-2003, 07:30 AM   #16 (permalink)
Inactive
 
Join Date: 10-12-03
Location: Cranberry Township
Posts: 275
iTrader: 0 / 0%
niceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really nice
Send a message via ICQ to niceguyeddie
Yes, but once again, it would be the same methods. Put it below the root, etc.
niceguyeddie is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-30-2003, 07:59 AM   #17 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,821
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
ok it's the "below the root" bit I don't undersdand.

Quote:
Originally Posted by niceguyeddie
Quote:
Originally Posted by LazyJim
OK, how?
ssh in,

mkdir passwords
chmod 777 passwords

if you don't have ssh the same can be done via ftp. Then just use the absolute paths to write to the directory.

Cheap webhosts are still just using *nix more than likely, so the same rules apply here as they would when paying more $ a month with your own *nix box.
If I make a directory, and set it to rwxrwxrwx how does that make it secure?

Sorry I'm not a serv-side sort of person
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-30-2003, 09:28 AM   #18 (permalink)
Inactive
 
Join Date: 10-12-03
Location: Cranberry Township
Posts: 275
iTrader: 0 / 0%
niceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really niceniceguyeddie is just really nice
Send a message via ICQ to niceguyeddie
IE, you do not want to make it accessible from the web. Whenever you log into either via ssh or ftp, generally you are below the web root. you probably see /public_html, /www, etc. It is best to not have writable directories in these level of folders, but instead better to have them non-accessible to a browser.

So create a directory on the same level as these folders, and then just use the absolute path to call them.

You probably aren't going to break anything throwing the folder into the web root if you take further precautions, but you asked about the safest way to read from a file on the web.
niceguyeddie is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-30-2003, 09:44 AM   #19 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,821
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
Do i do absolute path by starting with a forward slash?
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-30-2003, 09:55 AM   #20 (