# The Phex Security Concept

#### for Phex 0.X

### Requirements

The Phex Security Concepts trys to address the following issues:

- Blocking of IPs from different areas of the program (connection, download, upload, searchResults, chat, browseHost)
- Blocking words out of different views (search results, monitor)
- Providing a XML import and export interface to exchange rules with Phex users.
- Providing a import of Shareaza rules.

### General Rule

Through any of these rules Phex MUST not filter any searches or search results of the Gnutella network.

- A rule has a ID to identify it on import and export.
- A rule has a name to describe it.
- A rule defines if access should be DENIED or ALLOWED.
- A rule has a counter that indicates how often it was triggered.
- A rule has a set expiry time. This can be a fixed lifetime, or indefinite.
- A rule can be enabled or disabled.
- When a rule expires it can be deleted or disabled.

### IP Based Rule

- Contains a IP and a subnetmask used to define IP ranges.
  The GUI should be able to present the ranges created by the used subnetmask to assist the user to enter the range.
- The IP can be selectivly blocked for network connections, downloads, uploads, search results, chat, browse host and all of these.

### Port Based Rule

- Contains a Port range ( from - to ).
- The Port can be selectivly blocked for network connections, downloads, uploads, search results, chat, browse host and all of these.

### Content Based Rule

Content based rules define which content is displayed or hidden from display ( search, search result ) or causes hosts to be rejected ( download file name ). Through any of these rules Phex MUST not filter any searches or search results of the Gnutella network.

- Contains strings tokenized by space.
- Contains a choice to match all or any to be triggered.

### Business Logic

- A User is able to define a list of the above rules.
- A rule defines if access should be denied or allowed. When access is denyed all checks that are matched with the rule will fail. When access is allowed all checks that do not match the rule will fail. When checking a rule list and a check fails the process of checking a rule can be aborted since it can be considered as failed.

### Implementation

The security framework will be implemented in the package 'phex.security'. Required classes are:

- phex.security.SecurityManager
  The SecurityManager is a singleton class that gives framework access to the security concept and implements the base logic.
- phex.security.SecurityRule
  Represents the base class of a securety rule, defined in the 'General Rule' section.
- phex.security.IPAccessRule
  Represents the ip securety rule, defined in the 'IP Based Rule' section.
- phex.security.ContentRule
  Represents the content securety rule, defined in the 'Content Based Rule' section.
- phex.security.PortRestrictionRule
  Represents the port restriction rule, defined in the 'Port Based Rule' section.

### Future Improvements

Java is a trademark of Sun Microsystems, Inc.

Copyright © 2001, 2006 The Phex Team, License: GPL-2 or later.