36

I'm working on an external web site (in DMZ) that needs to get data from our internal production database.

All of the designs that I have come up with are rejected because the network department will not allow a connection of any sort (WCF, Oracle, etc.) to come inside from the DMZ.

The suggestions that have come from the networking side generally fall under two categories -

1) Export the required data to a server in the DMZ and export modified/inserted records eventually somehow, or

2) Poll from inside, continually asking a service in the DMZ whether it has any requests that need serviced.

I'm averse to suggestion 1 because I don't like the idea of a database sitting in the DMZ. Option 2 seems like a ridiculous amount of extra complication for the nature of what's being done.

Are these the only legitimate solutions? Is there an obvious solution I'm missing? Is the "No connections in from DMZ" decree practical?

Edit: One line I'm constantly hearing is that "no large company allows a web site to connect inside to get live production data. That's why they send confirmation emails". Is that really how it works?

Juanal
  • 4,344
  • 3
  • 19
  • 18
aehiilrs
  • 1,245
  • 1
  • 11
  • 20
  • Isn't this supposed to be asked on www.serverfault.com, because it's an admin question. But due to bounty it' can't be closed... – Robert Koritnik Nov 24 '10 at 09:50
  • 2
    "no large company allows a web site to connect inside to get live production data" is complete garbage – Marc Gravell Nov 24 '10 at 11:48
  • I strongly suggest, as do a few others via mod-flags, that this would be better served by the Server Fault community. I can migrate it if you would like. – Marc Gravell Nov 24 '10 at 11:49
  • 2
    @Marc I had trouble picking which site to ask it on. The reason that I chose SO instead of SF is because I felt this site was more likely to get me actual implementation details from programmers with experience in these systems rather than theoretical talk about the point of DMZs and connections. If you feel it should be moved off of SO, though, I won't complain (much ;). – aehiilrs Nov 24 '10 at 16:44
  • Hmm... Now that a bounty has been awarded that would be awkward. Maybe re-ask on SF, noting the SO question for reference? – Marc Gravell Nov 24 '10 at 16:54
  • Ah geez, sorry, I didn't realize awarding the bounty would make it tough. I will do that, though. Thanks! – aehiilrs Nov 24 '10 at 16:59
  • @Marc - the "No large company..." example I was given (with no references) was TicketMaster. Not going to take that one as gospel without a white paper or implementation document or something. heh – aehiilrs Nov 24 '10 at 17:33
  • @aehiilrs - even if tru, that merely indicates *at least one company doesn't*. It says nothing about the overall population of companies. – Marc Gravell Nov 24 '10 at 17:44
  • @Marc Yeah, I know. Believe me, over the last week I've been on the phone a lot regarding this. Just figured you'd like a bit of humour. :) – aehiilrs Nov 24 '10 at 17:53
  • I am running into the same situation and apologize for posting this so late after the initial post. However, I cannot find an answer either. Have you found any best practice documents/information you can refer me to on this? Thank You. –  Jul 19 '12 at 18:16
  • I got some pretty good suggestions from here: http://serverfault.com/questions/205662/securing-internal-data-accessed-by-a-website-on-the-big-bad-internet Sadly in my situation a compromise was never reached. I hope yours goes better. – aehiilrs Jul 19 '12 at 21:44

7 Answers7

50

I'm sorry, but your networking department are on crack or something like that - they clearly do not understand what the purpose of a DMZ is. To summarize - there are three "areas" - the big, bad outside world, your pure and virginal inside world, and the well known, trusted, safe DMZ.

The rules are:

  1. Connections from outside can only get to hosts in the DMZ, and on specific ports (80, 443, etc);
  2. Connections from the outside to the inside are blocked absolutely;
  3. Connections from the inside to either the DMZ or the outside are fine and dandy;
  4. Only hosts in the DMZ may establish connections to the inside, and again, only on well known and permitted ports.

Point four is the one they haven't grasped - the "no connections from the DMZ" policy is misguided.

Ask them "How does our email system work then?" I assume you have a corporate mail server, maybe exchange, and individuals have clients that connect to it. Ask them to explain how your corporate email, with access to internet email, works and is compliant with their policy.

Sorry, it doesn't really give you an answer.

Ken Ray
  • 2,500
  • 3
  • 21
  • 28
  • 2
    Yeah, I tried to convince the top guy of that yesterday. The reasoning it was bad is because if someone hacks through the three servers and two firewalls in front of the db then nothing prevents them from getting at the prod db. – aehiilrs Nov 09 '10 at 21:42
  • 2
    @aehiilrs: unfortunately, this is also a reason for not having a website to begin with. I mean, they could hack the site and the dmz and get to your local lan anyway... – NotMe Nov 23 '10 at 22:04
  • 3
    Apparently @sysadmin1138 (in a previous "Server Fault" discussion, that took place during march 2010) has the opposite understanding of Ken Ray on "Point four". See http://serverfault.com/questions/125881/should-a-webserver-in-the-dmz-be-allowed-to-access-mssql-in-the-lan where sysadmin1138 says the following: "_Proper network security states that DMZ servers shouldn't have any access into the 'Trusted' network. The Trusted network can get to the DMZ, but not the other way around. For DB backed web-servers like yours this can be a problem, which is why database servers end up in DMZs._". – ricmarques May 30 '13 at 16:41
18

I am a security architect at a fortune 50 financial firm. We had these same conversations. I don't agree with your network group. I understand their angst, and I understand that they would like a better solution but most places don't opt with the better choices (due to ignorance on their part [ie the network guys not you]).

Two options if they are hard set on this: You can use a SQL proxy solution like greensql (I don't work for them, just know of them) they are just greensql dot com.

The approach they refer to that most "Large orgs" use is a tiered web model. Where you have a front end web server (accessed by the public at large), a mid-tier (application or services layer where the actual processes occurs), and a database tier. The mid-tier is the only thing that can talk to the database tier. In my opinion this model is optimal for most large orgs. BUT that being said, most large orgs will run into either a vendor provided product that does not support a middle tier, they developed without a middle tier and the transition requires development resources they dont have to spare to develop the mid-tier web services, or plain outright there is no priorty at some companies to go that route.

Its a gray area, no solid right or wrong in that regard, so if they are speaking in finality terms then they are clearly wrong. I applaud their zeal, as a security professional I understand where they are coming from. BUT, we have to enable to business to function securely. Thats the challange and the gauntlet I always try and throw down to myself. how can I deliver what my customer (my developers, my admins, my dbas, business users) what they want (within reason, and if I tell someone no I always try to offer an alternative that meets most of their needs).

Honestly it should be an open conversation. Here's where I think you can get some room, ask them to threat model the risk they are looking to mitigate. Ask them to offer alternative solutions that enable your web apps to function. If they are saying they cant talk, then put the onus on them to provide a solution. If they can't then you default to it working. Site that you open connections from the dmz to the db ONLY for the approved ports. Let them know that DMZ is for offering external services. External services are not good without internal data for anything more than potentially file transfer solutions.

Just my two cents, hope this comment helps. And try to be easy on my security brethren. We have some less experienced misguided in our flock that cling to some old ways of doing things. As the world evolves the threat evolves and so does our approach to mitigation.

Matthew Murdoch
  • 30,874
  • 30
  • 96
  • 127
Felix
  • 181
  • 1
  • 2
4

Why don't you replicate your database servers? You can ensure that the connection is from the internal servers to the external servers and not the other way.

One way is to use the ms sync framework - you can build a simple windows service that can synchronize changes from internal database to your external database (which can reside on a separate db server) and then use that in your public facing website. Advantage is, your sync logic can filter out sensitive data and keep only things that are really necessary. And since the entire control of data will be in your internal servers (PUSH data out instead of pull) I dont think IT will have an issue with that.

The connection formed is never in - it is out - which means no ports need to be opened.

Roopesh Shenoy
  • 3,389
  • 1
  • 33
  • 50
  • Replication is not allowed because (their words) if someone hacks the web server and inserts crap/deletes data, it will be immediately replicated to the internal db. That said, I'm going to look in to the MS Sync framework you suggested and see if that could solve our issues. Thanks! – aehiilrs Nov 09 '10 at 21:06
  • Another downside is that there is some data that could be considered both a) sensitive and b) necessary. – aehiilrs Nov 09 '10 at 21:11
  • 1
    @aehiilrs Roopesh is talking about PUSH replication where the data on the web server is never updated back to the original database, data is only pushed to it. But you are correct about the sensitive data issue – Waleed Al-Balooshi Nov 09 '10 at 21:33
  • If you use sync framework to synchronize databases, then it is possible to both filter data that goes out, as well as ensure that data flows only one way. That should solve your problem. Mail me at roopesh.shenoy@vagsons.com if you need any help on this. – Roopesh Shenoy Nov 10 '10 at 05:31
4

I'm mostly with Ken Ray on this; however, there appears to be some missing information. Let's see if I get this right:

  1. You have a web application.
  2. Part of that web application needs to display data from a different production server (not the one that normally backs your site).
  3. The data you want/need is handled by a completely different application internally.
  4. This data is critical to the normal flow of your business and only a limited set needs to be available to the outside world.

If I'm on track, then I would have to say that I agree with your IT department and I wouldn't let you directly access that server either.

Just take option 1. Have the production server export the data you need to a commonly accessible drop location. Have the other db server (one in the DMZ) pick up the data and import it on a regular basis. Finally, have your web app ONLY talk to the db server in the dmz.

Given how a lot of people build sites these days I would also be loath to just open a sql port from the dmz to the web server in question. Quite frankly I could be convinced to open the connection if I was assured that 1. you only used stored procs to access the data you need; 2. the account information used to access the database was encrypted and completely restricted to only running those procs; 3. those procs had zero dynamic sql and were limited to selects; 4. your code was built right.

A regular IT person would probably not be qualified to answer all of those questions. And if this database was from a third party, I would bet you might loose support if you were to start accessing it from outside it's normal application.

NotMe
  • 87,343
  • 27
  • 171
  • 245
  • Ok, trying a reply again. 1) Yes. 2) No, this web app is the public-facing part of the internal application. Same data. 3) see 2. 4) Yes, but there are situations where internal and external machines are competing for first come, first serve spots. – aehiilrs Nov 23 '10 at 21:53
  • 1
    As for the SQL connection - sadly, this whole thing came up when we tried to change away from doing exactly that (said app was implemented that way years ago). We wanted to hit an internal web service instead, which would allow us to do more validation on a server that is more trusted than the web server while allowing us to get rid of the direct database connection completely. We were rather surprised when the reaction was "No, change everything completely and roll your own data transfer code." Is it really reasonable to constantly poll from the inside to service requests from the outside? – aehiilrs Nov 23 '10 at 21:57
  • 1
    @aehiilrs: In that case your IT staff is on crack. If it helps, I dealt with an IT guy like this a few years ago. I spent 2 months of repeatedly going to our shared boss with, "I'd love to implement this, but I can't because of bozo's restrictions" to no avail. Finally, boss+bozo were fired and all of a sudden we were able to get our work done. Not an answer I know, just saying I feel your pain. – NotMe Nov 23 '10 at 22:03
  • 5
    @aehiilrs: oh, and one more pain story: a few years before that I was at a huge company with other draconian policies. One day the IT staff decided that dev's couldn't have admin access to their local machines. The side effect was that we were unable to debug or apps as admin access is required for that in visual studio. That took 4 months of 100+ dev's complaining and almost no work getting done until the offending people were fired. Good times. – NotMe Nov 23 '10 at 22:07
3

Before talking about your particular problem I want to deal with the Update that you provided.

I haven't worked for a "large" company - though large is hard to judge without a context, but I have built my share of web applications for the non profit and university department that I used to work for. In both situations I have always connected to the production DB that is on the internal Network from the Web server on the DMZ. I am pretty sure many large companies do this too; think for example of how Sharepoint's architecture is setup - back-end indexing, database, etc. servers, which are connected to by front facing web servers located in the DMZ.

Also the practice of sending confirmation e-mails, which I believe you are referring to confirmations when you register for a site don't usually deal with security. They are more a method to verify that a user has entered a valid e-mail address.

Now with that out of the way, let us look at your problem. Unfortunately, other than the two solutions you presented, I can't think of any other way to do this. Though some things that you might want to think about:

Solutions 1:

Depending on the sensitivity of the data that you need to work with, extracting it onto a server on the DMZ - whether using a service or some sort of automatic synchronization software - goes against basic security common sense. What you have done is move the data from a server behind a firewall to one that is in front of it. They might as well just let you get to the internal db server from the DMZ.

Solution 2:

I am no networking expert, so please correct me if I am wrong, but a polling mechanism still requires some sort of communication back from the web server to inform the database server that it needs some data back, which means a port needs to be open, and again you might as well tell them to let you get to the internal database without the hassle, because you haven't really added any additional security with this method.

So, I hope that this helps in at least providing you with some arguments to allow you to access the data directly. To me it seems like there are many misconceptions in your network department over how a secure database backed web application architecture should look like.

Waleed Al-Balooshi
  • 6,318
  • 23
  • 21
  • 1
    The issue isn't the fact that there is communication, it's where the communication channel is opened from. – aehiilrs Nov 09 '10 at 21:43
2

Here's what you could do... it's a bit of a stretch, but it should work...

Write a service that sits on the server in the DMZ. It will listen on three ports, A, B, and C (pick whatever port numbers make sense). I'll call this the DMZ tunnel app.

Write another service that lives anywhere on the internal network. It will connect to the DMZ tunnel app on port B. Once this connection is established, the DMZ tunnel app no longer needs to listen on port B. This is the "control connection".

When something connects to port A of the DMZ tunnel app, it will send a request over the control connection for a new DB/whatever connection. The internal tunnel app will respond by connecting to the internal resource. Once this connection is established, it will connect back to the DMZ tunnel app on port C.

After possibly verifying some tokens (this part is up to you) the DMZ tunnel app will then forward data back and forth between the connections it received on port A and C. You will effectively have a transparent TCP proxy created from two services running in the DMZ and on the internal network.

And, for the best part, once this is done you can explain what you did to your IT department and watch their faces as they realize that you did not violate the letter of their security policy, but you are still being productive. I tell you, they will hate that.

cdhowie
  • 158,093
  • 24
  • 286
  • 300
  • 2
    Yes, but then they say we can't do that, it's back to the drawing board, and the budget is blown. You can't be tricky when someone has outright veto power. – aehiilrs Nov 09 '10 at 20:32
  • 7
    Then you might want to go to the higher-ups and say "look, this application needs access to this data source... there's no way around that. We can play security games with IT all day, but do you want this project completed or not?" – cdhowie Nov 09 '10 at 20:34
  • 2
    Then you go to your supervisor and explain the catch 22 that you're in. You've been asked to do a job, and IT is preventing you. Leave it on someone else's plate to figure out how to make it happen... heck you're just the developer... you develop software. – Chase Florell Nov 09 '10 at 20:34
  • Ideally that would work. Realistically we get an awful "compromise". It's... frustrating. – aehiilrs Nov 09 '10 at 20:36
  • 2
    If it wasn't frustrating then IT wouldn't be doing their job right. ;) – cdhowie Nov 09 '10 at 20:39
  • 1
    @cdhowie [snarky comment redacted] – aehiilrs Nov 09 '10 at 20:49
1

If all development solutions cannot be applied because of system engineering restriction in DMZ then give them the ball.

Put your website in intranet, and tell them 'Now I need inbound HTTP:80 or HTTPS:443 connections to that applications. Set up what you want : reverse proxies, ISA Server, protocols break, SSL... I will adapt my application if necessary.'

About ISA, I guess they got one if you have exchange with external connections.

Lot of companies are choosing this solution when a resource need to be shared between intranet and public.

Setting up a specific and intranet network with high security rules is the best way to make the administration, integration and deployment easier. What is easier is well known, what is known is masterized : less security breach.

More and more system enginers (like mines) prefer to maintain an intranet network with small 'security breach' like HTTP than to open other protocols and ports.

By the way, if they knew WCF services, they would have accepted this solution. This is the most secure solution if well designed.

Personnaly, I use this two methods : TCP(HTTP or not) Services and ISA Server.

JoeBilly
  • 3,057
  • 29
  • 35