Mono and SharePoint

One of my friends today asked me why he couldn’t run SharePoint on Linux because in a variety of times when I blog or write, I allude to the fact that SharePoint is basically an ASP.NET 2.0 application, which should be provided by Mono. While this is the case, I can think of several reasons why SharePoint in its current state just won’t work. I think the most compelling is the amount of Platform Invokes (PInvokes) that SharePoint calls. For the administrators reading this, a Platform Invoke is when you are from managed code calling the native Win32 API functions. One of the easiest ways to demonstrate an example invoke is using the little beep function that you can make the computer do a chirp with, which just takes two simple integers as parameters to control the beeping:


public static extern bool Beep(int frequency, int duration);

[/csharp]So, what are some examples of some of the platform invokes that it makes? From the Microsoft.SharePoint namespace we can see that following being called:


So, let’s take a quick example, so that I feel like I did a good explanation of this. The assembly in that list that is most attractive to me is the crypt32.dll (Crypto API32), which most notably is responsible for encryption, decryption, and certificate manipulation. So, why is it called from Microsoft.SharePoint? Well, it is used by Microsoft.SharePoint.Utilities.CertificateManager, specifically the CreateSelfSignedSslCertificate method (which a lot of people have told me can cause invalid handle errors within the Shared Services provider related to search, which if you do run into can be solved by just giving the appropriate access to the C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys folder), which from my little understanding of it does what the method name implies, creates a X509 compliant self-signed certificate.

There are a variety of other minor reasons I don’t think it will fly, such as missing methods in the Mono framework and ones that just aren’t implemented, however if someone can get SharePoint to run on Linux (while staying legal), sign me up!


SELinux Permissions Management and Creation

SELinux Permission Management and Creation

As stated in other articles, there are two main concepts that exist in MAC architectures, subjects and objects, both of which are intrinsic to understanding the aggregate concept of SELinux architecture. Objects are simply assets that exist on the system, such as files. For each of these objects, there are permission sets that are associated with them that control the access and actions that subjects have in relation to those specific objects.

In SELinux, objects are grouped into the concept of object classes, and all objects that exist in an object class are of a type. Just like in OOP programming in the .NET framework that SharePoint builds on, an object class allows the instantiation of objects, and each instantiation represents an individual object. For administrators of SharePoint, it is easiest to think of this in terms of the file system as opposed to that of a programmatic object model, where you might have a folder of related files, which is the object class, for each file in that folder that you can individually instantiate, is an object. For access to the various objects, there are rules that are applied when access to the object is demanded to subjects, and these rules are constructed by the overall security policy. Although, it is important to understand that the concept of object classes extends to networking assets such as sockets, any type of communication that would in turn expose resources that exist at the OS kernel level. Ergo, the important thing to grasp is that for each object, it is typically grouped into a relevant object class, and for each of the object classes there are rules that are applied which build into the parent concept of SELinux security policies.

Permissions to objects are in an easy to read and create syntax. First we have to define whether the process is allowed or denied, the subject that the rule applies too, the object class file, and the permission rules that will generate the rules that define the access control in the object / subject relationship (this relates to the concept of type enforcement access control). With type enforcement access control, you define the source, target, object, and the permissions, which we can see translate to the above concept nicely.

Making new object classes in SELinux is fairly straightforward, and similar to how one constructs classes within .NET compliant languages. As stated previously, it is important to realize that several of the OOP rules that we see within such languages as C# still exists in SELinux since the concept of classes and objects is somewhat, if not, identical.

To declare a new object class names (which is known as a class declaration statement), for example declaring an object class sharepointsecurity, we can simply execute:

Class sharepointsecurity

We can see that the declaring a new class for consumption entails using the keyword class and then stating what the class name is, keeping in mind that the class name must be of ASCII characters and numerical standards. Unlike C# though, there is no terminating character to the class creation statement. But like C# and .NET OOP programming practice in general, there are individual namespaces that are made for relevant classes.

Defining SELinux security policies means building the structures that will build the permission sets related to the object classes. The object classes are typically already defined by the file system, however in order to construct and apply the relevant security policies to the hybrid SharePoint environment it is necessary to research and analyze the object classes that exist within the environment.

Now we have the object classes that are relevant to the policies that we are construct in our environment, either specific or not specific to our SharePoint implementation. Now that we have objects and objects classes, it is necessary for one to declare the permissions that are related to those objects by defining the sets. Similar to group and individual groups within Active Directory within a Windows Based environment (i.e. you can compile an AD group in windows and bind it to an object, or declare a domain account that has access to that object), SELinux offers two main methods of binding relevant permissions to an object within the system. The first of these is known as common permissions.

Common permissions can easily be thought of as associating permissions with a group in relation to an object class.  When creating common permissions, we are creating permissions that are associated instead with a more than one class, as opposed to specific permissions which are bound to a specific class. Declaring common permissions is a relatively simple class and resembles class declaration in C#. The structure is easy to follow, we declare that we are stating common permissions, declaring the set name, and then declaring the object classes that the permissions apply to. The important thing to grasp with common permissions is just that they apply to more than one object class.

Common myexamplepermissionset








In the above example we are declaring the common permission name by using the common keyword and stating what the common permission set name is. The common name can be ASCII characters, numbers, dashes, or periods, and the permission set can be ASCII characters, numbers, dashes, or periods as well.

Now that we have seen that we can declare a permission set that is common, they have to be bound to a specific object class. The way that this is done is by using an access vector statement. We must associate it with an object class because although we have declared the permission set it is simply an asset that can be associated with an object class, however this is not implied. Meaning, once we associate the common permission set with the object class is when we truly see the effect that they can have, until then they simply exist and have no real effect on the overall hybrid SharePoint environment.

To associate the permission set with the object class is a relatively simple task, we have to declare the object class, and then define the permission set that we wish to bind to the object class. To create an access vector statement that would cause the sharepointsecurity object class to have class myexamplepermissionset permission would look like the following:

Class  sharepointsecurity {  myexamplepermissionset }

We are basically defining the object class and the permission set that we wish to bind, in essence this looks very similar to the C# syntax, the only difference is that there is no terminating character present.

The concept of inheritance is well known is C#, and it is no different in SELinux. Indeed, permission sets are also subject to the concept of inheritance.

Class sharepointsecurity

Inherits myexamplepermissionset





If we instigate the following example of inheritance, we are easily associating the shared permission set myexamplepermissionset with the object class sharepointsecurity, along with the custom permission set that we are defining inbetween the brackets. So, we can inherit an already defined permission set, and extend the permission set with any custom permissions that we wish to define by placing them in the ending statement parameters. This doesn’t mean that you have to extend an object class when inheriting a custom permission set, you can easily just inherit a permission set to an object class after its creation by excluding the statement as defined between the brackets. In the above example, we could modify it to look like:

Class sharepointsecurity inherits myexamplepermissionset

In this, we are simply inheriting the permission of myexamplepermissionset and not including any other custom permission such as execute or mkdir.


Hybrid SharePoint With SElinux Theory of Operation

Multi-Level Security Domain SharePoint

To promote apposite security implementation of security centric SharePoint environments (those which are focused on sheltered implementations) it is necessary to build an environment that implements multi-security domain access along with diverse security mechanisms that will provide a basis to procure the concepts provided in the CIA triad. Like researched in previous articles, there is an overall concept in computing security architecture known as the CIA triad which procures the subjects of Confidentiality, Integrity, and Availability (CIA) which afford the underlying basis for security conceptualization. Within an environment that promotes multi-level security domain access, there are other minor objectives that are introduced to build the aggregate CIA concepts since the environment becomes more finely tuned and the overall level of security system awareness becomes more robust and detailed. Throughout this article, I will present the Theory of Operation of building a such environment, and the considerations and implementation concerns that are presented with such a solution.

Introduction to the Theory of Operation

The Theory of Operation behind a Hybrid SELinux / SharePoint scheme provides the basis for procuring a proper implementation that conforms to the CIA triad while providing the mechanisms that are necessary for data carry over, while maintaining globally maintainable security policies that conform to a classification (an environment that inherits sensitivity labels) based environmental standards. This initial introduction to the Theory of Operation presents solely the basis for developing the environment, and in subsequent sections the exact compilation and deployment will be presented and examined. Several portions of the Theory of Operation may prove theoretical and touch on concepts not immediately available within an arbitrary technology; however the aggregate presentation will procure a concrete, usable solution.

Introduction to Machine Virtualization, and the need for Machine Virtualization

Virtual machines are increasingly common throughout enterprise environments for obvious hardware consolidation benefits; however, one of the most overlooked benefits that virtual machines can provide is that of security considerations. The Hybrid environment presented is excursively based on such a concept, since virtualization will build the option to use Windows Server 2003 on SElinux hooked Redhat / Fedora Core 3 kernel.

The most obvious benefit that is received when implementing virtual machines is that of complete data isolation, since, in essence, all data stored within an arbitrary virtual machine is considered to be segregated from the other environmental assets unless otherwise bound. The isolation also extends out to services and processes on the machine, in that there can be specified running of the services that are contained, in which services can be manipulated at runtime without affecting other various services.

Whereas the most secure environments are those whose domains are segregated because of the physical separation of machines, these are also the most difficult to transverse data through. In essence, when separating the machines physically, we are establishing multiple security zones within an environment. In order to achieve this otherwise, it would require separate processing mechanisms for each domain. Using virtual machines however, a SharePoint administrator can instead setup various security zones based on requirements that exist on the same hardware, whereas various domain security zones can exist in complete isolation, although procured on the same physical machine. For each security zone that is implemented, a separate security policy can and should be implemented which provides overall control in relation to the security domain. The security policies that are implemented are structured around the concept of Mandatory Access Control principles, so that they are not only applied for the objects that exist on a specific virtual machine, but the processes that exist within a specific virtual machine. By implementing this concept of MAC, one can be assured that between two various SharePoint environments, data cannot be transverse between the two, unless stated within the MAC based global security policy.

Although this all sounds great for federal and highly regulated enterprise environments, a rather rudimentary, be at although important, question remains. The concept of MAC was invented a very long time ago, why hasn’t it been implemented in rudimentary Windows based environment previously? There are two major answers to this question. The first is that direct hooks that would otherwise override the DAC controls that predominantly dominate the Windows security architecture are forbidden and would be a legal problem (discussed more exhaustively in a subsequent section), and secondly, MAC can become increasingly difficult to implement and maintain, and security policies tend to can be complex for an administrator to understand with granular training in such.

SELinux, although considered somewhat complicated, can alleviate a majority of these issues, particularly with the use of virtual technology. This is the reason for this particular choice of technology. In a separate article, I will detail how another technology, AppArmor, can be used for somewhat of the same purpose.

Carrying Over the CIA Triad Concepts

The three subjects from the CIA triad are carried over when leveraging a MAC worthy technology such as SELinux. These are availability, where the SharePoint assets are accessible to the requesting parties in a timely manner, confidentiality where the information that is stored in SharePoint is available only to the properly authenticated SharePoint users, and integrity where SharePoint information can only be modified or altered by entities that are authorized are all still relevant goals to achieve. However within a multi-security environment a few more minor security concepts introduced, namely the following three, which although relate to the CIA triad, deserve individual mention:

Authentication ensuring that subjects are appropriately identified by the collaboration system and that their passed identity is not a fictious one

Authorization ensuring that subjects are authorized to perform their relevant requested actions on the system and that they have proper access rights to do so

Domain Separation For proper SharePoint information assurance, it is necessary to package SharePoint data into various domains that procure specific levels of security and assurance. Preventing leaking of information across these security domains is a very important concept to ensure, and all information that transverses between domains be scrubbed by appropriate mechanisms.

What Types of Exploitations Can Be Mitigated?

There are several types of exploitations that can be mitigated when implementing a multi-level domain access architecture. The first of these is a global privilege escalation, by which a user will execute an application that will run under privileges that it normally wouldn’t have the option of running under. The second is the Assumption of Atomicity, in which a security check is basically bypassed. Typically this is during a sliding window when the check is executed, when the exploit is called directly during that sliding window down time which would otherwise cause that check to detect the user interaction. Programs can also be trusting of the execution environment, so that all children application of a parent application will immediately inherit the permissions of their parent. These programs could also be accessing resources that are leveraging shared libraries which could in turn infect users across a variety of parent applications.

As stated in several other articles, the main purpose in a multi-level security environment is to procure an environment where there can be properly structured Mandatory Access Control.

Why Mandatory Access Control and The Mandatory Access Control Theory of Operation

The entire theory of operation for using a hybrid environment of SharePoint and SELinux is based upon the concept of procuring an environment that allows the birthing of Mandatory Access Control. The reason that Mandatory Access Control is at the heart of the theory of operation for the SELinux / SharePoint architecture is that conventional methods of DAC have proved to provide lower levels of unusable levels of object security. For a collaborative environment to be truly secure, it is necessary for it instead to have the option of not binding an identity to a system object but in effect provide segregation of various pieces of information in order to highlight the Confidentiality present within the CIA triad. This in turn would al the birthing of more effective measures that would promote the concept of integrity of the overall, aggregate system. The failure in DAC that ensues is due to the fact that DAC allows system decisions to be executed with the presence of simply an identity of a user, as well as the ownership of arbitrary files and objects that exist within the system. The concept of DAC is easily built up conceptually within the Windows Server architecture, the root account, typically a system account which has in essence the permissions that are granted to the local administrators security group, owns the system, whereas there are subsequent child users that can mimic this role, as well as sub users that are assigned arbitrarily to other roles within the server system. This is a faulty concept in that it allows various users to execute an N number of arbitrary programs and applications that might prove malicious to the collaboration environment, as well as it empowers various users (which can become somewhat impossible to track the granted permissions) power to give an N number of users access to the environment, and in this access to the objects and files that are housed within that system and all subsequent chains. Beyond this, there can always exist a power user, or a malicious root user, whom may corrupt a system needlessly for whatever intents and purposes. The concept of CAS (Code Access Security) also begins to take a small role because in code access security where are examining what foreign assemblies a specific binary may touch during run time execution, and within a DAC sponsored environment it is typical that the execution of relevant processes will simply inherit the permissions that are sponsored by the user (or, in effect, how the arbitrary process is tripped). This leads to inherit flaws within the environment since once the malicious process is tripped it can manipulate other objects permissions, its own permissions, or other subjects within the system’s permissions. This can easily lead to corruption of permissions within the environment, and in effect circumvent the granular permissions that are typically set within a network regarding the user of processes and objects. The inherent flow of DAC is that because of the sponsorship that is given to users they are allowed free reign within the enforcement of a possible corporate policy (not taking into consideration DRM such as IRM which can enforce somewhat global policy enforcement through a system but typically targeted for offline client access).

The largest goal that we seek to implement with a MAC based system is an overall security policy implementation that will enforce global rules across an environment. By using a detailed security policy that conforms to corporate goals and security requirements that assimilate regulatory and legal compliance requirements, we can ensure:

  • Secured Applications Are Protected
  • Separation of Privileges That Promote Sandboxed, Untrusted Application Execution
  • Vital and Essential Processes Are Assured Processing Space
  • Partitioning of Permissions Between Various Applications
  • Controlling Processing Limits
  • Control Privileges and Prevent Various Types of Privileges Escalation

The last of these are a significant security enhancement as opposed to DAC which is prime for an attack that would otherwise allow the concept of privilege escalation. DAC may immediately prove the first line of defense against attacks (in that objects and the system will still be bound to an identity.

This is not typically present within the OS’s that are provided by Microsoft since Windows Server is a closed kernel product, and to procure this type of security would require that there be direct hooks into the kernel, in effect negating the option for a developer to provide a hardened version of Windows that would otherwise be MAC compliant. Active support from the kernel is required at run-time for proper MAC to operate, since application layer mechanisms would could easily be circumvented because they are just that, assets that exist at the application level. However, by using Trusted Computing Mechanisms that are rather hooked into the hardware interface, one can provide the goals that we seek the building out a classified SharePoint environment, that of confidentiality most importantly, integrity of the data that is being stored within SharePoint, and the necessary separation of domains that will complete the CIA triad to provide assurance.

Transfer Data between SharePoint Security Domains

Within an arbitrary SELinux/SharePoint environment, there will eventually be the need for the option of traversing of data between various security domains, such as those that are classified and those that are unclassified. These is especially true when establishing an environment in SharePoint where a certain instance on a virtual machine that is deemed classified is transferring data to another that is deemed unclassified by definition. Since the overall Theory of Operation of a Hybrid SharePoint environment is that which utilizes various virtual machines in order to procure an environment that allows true classification of data, this is a present and substantial argument. This domain crossing can at times prove to be a hardware device, such as a perimeter based security device, perhaps something like a rudimentary firewall, however regardless of mechanisms of transfer, it is necessary to establish a data transfer functionality that will allow data to flow through defined, finely tuned, processing stages. This highly relates in the CIA triad to the concept of confidentiality, whereby the need for information to be secured throughout the entire information flow process is assured from start to finish. This is a built in concept within SELinux, which helps us to easily facilitate this.

Example of Security Based Enhancements Real World Application

A tangible example is often helpful when attempting to conceptualize the security benefits that SELinux provides. Assume that there is user A, which intends to trip a certain process, let’s assume a copy of a binary from unclassified SharePoint environment A to classified SharePoint environment B. The copy process, should, in essence, only have access to the specific binary it needs, not all binaries that exist within a computer, a typically problem that exists when leveraging a service account. In effect, the ownership of the assemblies should be properly separated, as opposed to universal access to what may be potentially unsafe information to share. By leveraging the concept of MAC, the copy process that is executed would provide a sandbox that allows the copy process to only touch and execute within its limits and permissions, it will only be allowed to perform the actions as defined with a security policy. Therefore, the copy process would become exploited by a malicious user, the only process that the malicious user could perform would be those that are deemed necessary be the service, regardless of the user account that the process is running under. This is regardless of as well if it is a service account that is offered root privileges on the environment. All objects are given a security policy defined sensitivity label that will determine how the process will interact with the system and the actions that are allowed on those arbitrary objects, allowing a tuned mechanism of control. The security context as presented with the copy argument can as well be presented to the networking concepts that may be related to a collaboration environment such as relevant ports, which can be bound to a security context as defined by a security policy. One of the largest reasons that an overall web server becomes compromised is that they are exploited initially through a port that is considered benign, whereas later the attacker once comprising the initial port will following open another port on the web server to execute further attacks on the SharePoint environment. In regards to the UNIX permissions that are existent within the SELinux environment, those permission still exist (the UNIX read/write, etc. permissions), however they are instead subject to the same security policies as discussed in the above section. The flow of access/denial is relatively straightforward and simple to follow the standard access / deny concepts exist. Since the deny UNIX will not allow any interaction, this does not require the consultation of the SELinux security policy, whatever it may be. However, if a successful access attempt is made, then the SELinux policy is consulted before access is granted.