Guards and Walls of Software Fortresses
At first glance, guards and walls seem to have paradoxical functions. Walls are designed to block access to the fortress. Guards are designed to allow access to the fortress. These two functions, however, are actually complementary. The efficacy of the walls is what makes the guard's job necessary. After all, if outsiders could send requests into the fortress any which way they wanted, there wouldn't be much incentive to use approved and guarded drawbridges.
Although charged with allowing access to the fortress, the guard is very selective. The fortress architect is responsible for deciding just how selective the guard will be and which technologies can be used to implement this selectivity.
In this chapter I discuss some of the issues involved with designing and implementing walls and guards. I will focus on three main fortress types: presentation fortresses, Web service fortresses, and business application fortresses. These three fortress types represent a good cross section of available guard and wall design and implementation strategies.
For the purposes of this discussion, I will assume a simple configuration of two fortresses wanting to communicate over a drawbridge and a bad guy who is up to no good. Shown in Figure 7.1, this setup consists of the following characters:
Ed, the envoy in the donor fortress
Gwen, the guard in the receiving fortress
Bart, the bad guy
Figure 7.1. Two-Fortress Configuration
There are eight security issues we generally worry about when planning our fortress walls and guards:
I'll go through these one by one, discussing each problem more fully and offering some likely solutions.
Fortification refers to the ability of the fortress walls to prevent entry into the fortress (except, of course, through the drawbridge). If the fortress is well fortified, then the only way Bart the bad guy is going to get into it is by somehow tricking Gwen the guard into letting him in. Figure 7.2 illustrates the concept of fortification.
Figure 7.2. Fortress Fortification
In the case of an Internet fortress (Web service or presentation), Bart will attempt to break into the fortress using an unexpected entry point, such as FTP or remote login. Once Bart has penetrated the Internet fortress, he may be able to erase or modify binaries, reboot the system, copy sensitive files, or set up his own privileged accounts, depending on the authorization level he manages to gain.
The most common way of fortifying the Internet fortress walls is with firewalls. Firewalls are a common fortification technology for many fortresses, but especially those connected to the Internet. Firewalls can restrict all but a select group of users from remote access. This small, select group is part of the fortress community (remember, a fortress is a group of people as well as a group of systems). Bart, needless to say, is not part of this select group.
Bart might also try to break into the fortress through the data strongbox. Data strongboxes are usually implemented with databases. If Bart can gain direct access to the database, he has effectively circumvented Gwen and can access all of the critical fortress data.
The database should be configured so that only user IDs associated with the owning software fortress are allowed to read, write, or modify data. Those user IDs, as trusted members of the fortress, should be allowed to do pretty much whatever they want.
Although proper configuration of the database is an important part of the fortress fortification, that configuration is much less complex for the software fortress architecture than for most N-tier architectures. N-tier architectures often require sophisticated database security configurations, with specific users allowed to access specific tables in specific ways that change as implementations of the business logic change. For a software fortress, database configuration boils down to a simple rule: If you are a member of the fortress, you can do what you want; if not, you can't. The configuration is very simple, it is easy to set up, and it doesn't change as implementations inside the fortress change.
Although all fortresses can avail themselves of firewalls and database security, business application fortresses have another trick up their sleeves: a mechanism called role-based security.
As I will discuss in Chapter 11 (Business Application Fortresses), business application fortress infrastructures are based on a technology that I refer to as component-oriented middleware (COMWare). COMWare is a technology closely associated with components, which I have discussed in the context of synchronous drawbridges.
Component systems transmit requests from a caller (the client) to a callee (the component instance) as a remote method invocation. The client lives in one process (the client process) and the component instance lives in another process (the component process).
Don't confuse the idea of a caller and client with a drawbridge. When we're looking at components as used within a business application fortress, the caller and the callee are part of the same fortress (although probably not part of the same process). As part of the same fortress, they do not go through drawbridges to get to each other, even though the technology is similar to some of the drawbridge technology.
Both the caller and callee processes have a specific associated user ID. In role-based security, each of these user IDs is assigned one or more roles by a component administrator. Examples of roles could be company managers or bank tellers.
Once the component administrator has given each client user ID one or more roles, that same component administrator sets up component access rights. The administrator decides which roles can access which methods in which components. For example, it might be appropriate to give either tellers or managers access to the updateAccounts method but only managers access to the addNewAccount method.
Role-based security was originally designed to deal with two security issues: authorization and authentication (I will discuss these issues in more detail later in the chapter). When role-based security was first introduced, it received a flurry of interest. It seemed attractive because it was an administrative model (one that can be totally managed by an administrator) rather than a code-based model (one that requires a programmer). All things being equal, administrative models are always preferable over coding models because they are easier to maintain. Besides, nobody believes that coders care all that much about security anyway.
However, role-based security turned out not to live up to its promise. The reason is that relatively few problems can be dealt with through role-based authorization. Let me give an example of a common problem that is not amenable to a role-based solution.
Consider a bank wanting to let clients check their balances online. The bank wants to make sure the clients are authorized to access the requested balances. This is a two-part problem. First, the clients must be authenticated (we know who they really are). Second, the bank is going to let clients access only their own bank balances. Using role-based security, we can say that only users in the client role can access the checkBalance method, but there is no way to specify that they can do so only when requesting to check their own account balances.
The problem we run into here is that limiting a client to only a specific account means that authorization is based not only on a specific method, but also on specific parameters to that method (e.g., accountID). Even the parameters don't give the full story. To really verify the user's access right, we probably need to check information in the database to be sure this particular account ID is associated with this particular client. Such a task is way beyond the capabilities of role-based security.
Why, you might ask, am I spending so much time on role-based security if it is so limited? It turns out that fortress architectures may be the redemption of role-based security. Although role-based security is relatively useless in run-of-the-mill authorization problems, it can provide one important capability for software fortresses: fortification.
In the same way that we can fortify the fortress by locking foreign users, such as Bart the bad guy, out of the database, we can also fortify the fortress by locking foreign users out of the components. We do this by using role-based security. We define each process in the fortress as being a member of the role of, say, this-fortress. All components that are part of the fortress are then configured to allow access by members of the this-fortress role. If your user ID is associated with this-fortress, then you can ask any of your fortressmates to do whatever you want. If your user ID is not associated with this-fortress, then don't even bother asking for the time of day. And that includes you, Bart!