Security Concepts and Definitions


The following table describes the different types of security illustrated in this chapter and how they can relate to real-world scenarios:

Open table as spreadsheet

Security Type

Related Concept in Security.Permissions Namespace or Utility

Purpose

NTFS

None

Allows for detailing of object rights, e.g., locking down of specific files

Security Policies

Caspol.exe utility, PermView.exe utility

Set up overall security policy for a machine or user from an operating system level

Cryptographic

Strong name and assembly, generation, SignCode.exe utility

Use of public key infrastructure and certificates

Programmatic

Groups and permission sets

For use in pieces of code that are being called into. Provides extra security to prevent users of calling code from violating security measures implemented by the program that are not provided for on a machine level.

There are many approaches to providing security on your machines where your shared code is hosted. If multiple shared code applications are on one machine, each piece of shared code can be called from many front-end applications. Each piece of shared code will have its own security requirements for accessing environment variables - such as the registry, the file system, and other items - on the machine that it is running on. From an NTFS perspective, the administrator of your server can only lock down those items on the machine that are not required to be accessed from any piece of shared code running on it. Therefore, some applications will need additional security built in to prevent any calling code from doing things it is not supposed to do.

The machine administrator can further assist the programmers by using the utilities provided with .NET to establish additional machine and/or user policies that programs can implement. Toward that end, the .NET environment provides programmatic security through code access security, role-based security, and identity security. As a final security measure, you can use the cryptographic methods provided to require the use of certificates in order to execute your code.

Security in the .NET infrastructure uses some basic concepts that are discussed here. Code security is managed and accessed in the .NET environment through the use of security policies. Security policies have a relationship that is fundamentally tied to either the machine that the code is running on, or to particular users under whose context the code is running. To this end, any modifications to the policy are done either at the machine level or the user level.

You establish the security policy on a given set of code by associating it with an entity called a group. A group is created and managed within each of the machine- and user-based policies. These group classifications are set up so that you can place code into categories. You want to establish new code groups when you are ready to categorize the pieces of code that would run on a machine, and assign the permissions that users will have to access the code. For instance, if you wanted to group all Internet applications and then group all non-Internet applications, you would establish two groups and associate each of your applications with its respective group.

Once you have the code separated into groups, you can define different permission sets for each group. If you wanted to limit your Internet applications’ access to the local file system, you could create a permission set that limits that access and associates the Internet application group with the new permission set. By default, the .NET environment provides one code group named All Code that is associated with the FullTrust permission set.

Permission sets are unique combinations of security configurations that determine what each user with access to a machine can do on that machine. Each set determines what a user has access to - for instance, whether they can read environment variables, the file system, or execute other portions of code. Permission sets are maintained at the machine and user levels through the utility Caspol.exe. Through this utility, you can create your own permission sets, though the following seven permission sets that ship with the .NET infrastructure are also useful:

Open table as spreadsheet

Permission Set

Explanation

FullTrust

Allows full access to all resources; adds assembly to a special list that has FullTrust access

Everything

Allows full access to everything covered by default named permission sets, but differs from FullTrust in that the group is not added to the FullTrust assembly list

Nothing

Denies all access including Execution

Execution

Allows execution-only access

SkipVerification

Allows objects to bypass all security verification

Internet

Grants default rights that are normal for Internet applications

LocalInternet

Grants rights that are not as restricted as Internet, but not full trust

Security that is used within the programming environment also makes use of permission sets. Through code you can control access to files in a file system, environment variables, file dialogs, isolated storage, reflections, registry, sockets, and UI. Isolated storage and virtual file systems are new operating systemlevel storage locations that can be used by programs and are governed by the machine security policies. These file systems keep a machine safe from file system intrusion by designating a regulated area for file storage. The main access to these items is controlled through code access permissions.

Although many methods that we use in Visual Basic 2005 give an identifiable return value, the only return value we get from security methods is when the method fails. If a security method succeeds, it does not provide a return value. If it fails, then it returns an exception object reflecting the specific error that occurred.




Professional VB 2005 with. NET 3. 0
Professional VB 2005 with .NET 3.0 (Programmer to Programmer)
ISBN: 0470124709
EAN: 2147483647
Year: 2004
Pages: 267

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net