Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 24th, 2003, 07:31 PM
Authorized User
 
Join Date: Sep 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to TnTandyO Send a message via Yahoo to TnTandyO
Default data base security question

Is this an ok way to connect

Dim objConn, DSNtemp
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString="Provider=Microsoft.Jet.O LEDB.4.0;" &_
"Data Source= "& Server.MapPath ("dbTest.mdb")
 
Old September 25th, 2003, 01:12 AM
Authorized User
 
Join Date: Sep 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to TnTandyO Send a message via Yahoo to TnTandyO
Default

I was told that you could go to http://www.yoursite.com/yourpath/dbTest.mdb and down load my databse, is this a real concern....
 
Old September 25th, 2003, 02:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:Originally posted by TnTandyO
 I was told that you could go to http://www.yoursite.com/yourpath/dbTest.mdb and down load my databse, is this a real concern....
Yes it is a concern. Ideally you need to put the database outside the webroot. Just make sure that the anonymous user (IUSR_machineName) has permissions to wherever you put the db.
 
Old January 26th, 2004, 10:11 PM
Authorized User
 
Join Date: Nov 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to eapsokha
Default

I am really interested with this one. Could you please give me more detail?

Thank you.

Quote:
quote:Originally posted by pgtips
 
Quote:
quote:Originally posted by TnTandyO
Quote:
 I was told that you could go to http://www.yoursite.com/yourpath/dbTest.mdb and down load my databse, is this a real concern....
Yes it is a concern. Ideally you need to put the database outside the webroot. Just make sure that the anonymous user (IUSR_machineName) has permissions to wherever you put the db.
 
Old January 27th, 2004, 06:00 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

What other detail is there? If you put an Access database inside your web folders then it can be downloaded simply by typing in the path to the db as a url. The web server knows nothing about mdb files, so if a request is submitted to get the mdb file then the web server will just send it to the browser.
 
Old January 27th, 2004, 10:43 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

<s>Here's a working hack to this problem...

- Go into the website property in IIS manager.
- Go to "Home Directory" tab, "Configuration..."
- Under "Application Mappings", click "Add"
- Choose an executable, it could be notepad.exe. The one you choose will be irrelevant because it will never run.
- Put in the database file extension: ".mdb"
- Under "Verbs", choose "Limit To:" and enter "PUT"
- Click "OK", "OK", "OK"

This is tells the web server how to handle .mdb files. It tells the server that .mdb files are limited to a PUT request (which you hardly ever see, most likely it's used with front page for PUTting files onto a remote site). The likelyhood of someone trying to PUT a .mdb file onto your site is pretty slim, but more importantly it eliminates the possibility of people GETting it. The result will be a HTTP 403.1 Forbidden error in the browser.</s>

Answer withdrawn because it's "dumb". (Despite being disclaimed as a hack.)
 
Old January 28th, 2004, 02:13 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There is a far better way of doing this. Put all the files you don't want downloaded into a single directory. In the IIS MMC Snapin, remove the "read" permission for that folder. IIS will not serve content from that folder.

In a hosting situation (where you host your website with a hosting provider), they will provide you with such a "secured" directory for placing your Access .mdb files.

Mapping .mdb files to notepad.exe is a dumb idea IMHO. WHat happens if you map it to something which ends up opening a dozen different copies of that program on the server?

Cheers
Ken

Microsoft MVP - Windows Server (IIS)
www.adOpenStatic.com
 
Old January 28th, 2004, 04:28 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

In addition to what Ken said (which is by far the most secure and clean way to do it), you can also set Integrated Security on the database and / or folder.

In IIS, open the Properties dialog for your folder (for example, /Databases) switch to the Security tab and click the Edit button. Clear Anonymous access and set Integrated Windows authentication.

Next, make sure that NTFS security settings are set on the (physical) folder. The IUSR account needs change permissions on the folder. Add any other account (like yourself), and remove other "general groups" like Users.

Now when you try to download the database, you'll be prompted for a user name and password. This allows you, the site's owner, to download the database over the Internet, for example for maintenance tasks.

Please note, allowing the database to be downloaded by anyone at all, is a security risk. It's usually much better to prevent the database from being downloaded at all. To do that, use Ken's advice, or move the database to a folder outside the Web scope, like C:\Databases. You'll then need to provide other mechanisms to content managers to edit the database. (Secure) FTP or the local network are good candidates for this.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 12th, 2004, 03:54 AM
Authorized User
 
Join Date: Nov 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to eapsokha
Default

Your message is very interting. How can we update that database with the newer version, I mean suppose we want to add more fields?

Many thanks
Sokha
 
Old February 13th, 2004, 02:11 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I have my databases in a folder named 'x%' and it returns a bad request when you try to download the .mdb file within it.

Does anybody know if there is a work around or hack to bypass this 'security'?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Data base Format virus220 ASP.NET 2.0 Professional 0 August 10th, 2007 09:37 AM
Data base connectivity watashi C# 2005 8 July 18th, 2007 08:05 PM
how to protect data base Rajesh Pachouri Pro VB 6 1 September 23rd, 2006 03:33 AM
Transfering data from csv file to data base g_vamsi_krish ASP.NET 1.0 and 1.1 Professional 2 May 16th, 2006 11:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.