Zorp 3.4 LTS Reference Guide

This guide is published under the Creative Commons Attribution-Noncommercial-No Derivative Works (by-nc-nd) 3.0 license. See ??? for details. The latest version is always available at http://www.balabit.com/support/documentation.

This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/). This product includes cryptographic software written by Eric Young (eay@cryptsoft.com)

This documentation and the product it describes are considered protected by copyright according to the applicable laws.

The Zorp™ name and the Zorp™ logo are registered trademarks of BalaBit.

The BalaBit Shell Control Box™ name and the BalaBit Shell Control Box™ logo are registered trademarks of BalaBit.

The syslog-ng™ name and the syslog-ng™ logo are registered trademarks of BalaBit.

The BalaBit™ name and the BalaBit™ logo are registered trademarks of BalaBit.

Linux™ is a registered trademark of Linus Torvalds.

Debian™ is a registered trademark of Software in the Public Interest Inc.

Windows™ 95, 98, ME, 2000, XP, Server 2003, Vista, Server 2008 and 7 are registered trademarks of Microsoft Corporation.

CryptoCARD™ is a registered trademark of CryptoCARD Corporation.

ClamAV™ and Clam AntiVirus™ are registered trademarks of Tomasz Kojm (http://clamav.net).

VirusBuster™ is a registered trademark of VirusBuster Ltd. (http://vbuster.hu).

Nod32™ is a registered trademark of ESET, LLC (http://www.eset.com).

All other product names mentioned herein are the trademarks of their respective owners.

Some rights reserved.

May 16, 2012

Abstract

This document is a detailed reference guide for Zorp Gateway administrators.


Table of Contents

Preface
1. Summary of contents
2. Terminology
1. How Zorp works
1.1. Zorp startup and initialization
1.2. Handling incoming connections
1.2.1. Handling packet-filtering services
1.2.2. Handling application-level services
1.3. Proxy startup and the server-side connection
2. Configuring Zorp proxies
2.1. Policies for requests and responses
2.1.1. Default actions
2.1.2. Response codes
2.2. Secondary sessions
2.3. Embedded protocol analysis
2.3.1. Proxy stacking
2.3.2. Program stacking
2.4. List of the proxies available in Zorp
3. The Zorp SSL framework
3.1. The SSL protocol
3.1.1. The SSL handshake
3.2. Configuring TLS and SSL encrypted connections
3.2.1. Behavior of the SSL framework
3.2.2. Handshake callbacks
3.2.3. X.509 Certificates
3.2.4. Setting the allowed SSL/TLS protocol
3.2.5. SSL cipher selection
3.2.6. Enabling STARTTLS
3.2.7. Keybrigding certificates
3.3. Related standards
3.4. SSL options reference
4. Proxies
4.1. General information on the proxy modules
4.2. Attribute values
4.3. Examples
4.4. List of the proxies available in Zorp
4.5. Module Finger
4.5.1. The Finger protocol
4.5.2. Proxy behavior
4.5.3. Related standards
4.5.4. Classes in the Finger module
4.5.5. Class AbstractFingerProxy
4.5.6. Class FingerProxy
4.6. Module Ftp
4.6.1. The FTP protocol
4.6.2. Proxy behavior
4.6.3. Related standards
4.6.4. Classes in the Ftp module
4.6.5. Class AbstractFtpProxy
4.6.6. Class FtpProxy
4.6.7. Class FtpProxyAnonRO
4.6.8. Class FtpProxyAnonRW
4.6.9. Class FtpProxyRO
4.6.10. Class FtpProxyRW
4.7. Module Http
4.7.1. The HTTP protocol
4.7.2. Proxy behavior
4.7.3. Related standards
4.7.4. Classes in the Http module
4.7.5. Class AbstractHttpProxy
4.7.6. Class HttpProxy
4.7.7. Class HttpProxyNonTransparent
4.7.8. Class HttpProxyURIFilter
4.7.9. Class HttpProxyURIFilterNonTransparent
4.7.10. Class HttpWebdavProxy
4.7.11. Class NontransHttpWebdavProxy
4.8. Module Imap
4.8.1. The IMAP protocol
4.8.2. Proxy behavior
4.8.3. Related standards
4.8.4. Classes in the Imap module
4.8.5. Class AbstractImapProxy
4.8.6. Class ImapProxy
4.8.7. Class ImapProxyStrict
4.9. Module Ldap
4.9.1. The LDAP protocol
4.9.2. Proxy behavior
4.9.3. Configuring policies for LDAP requests
4.9.4. Simple Authentication and Security Layer (SASL) on LDAP messages
4.9.5. Related standards
4.9.6. Classes in the Ldap module
4.9.7. Class AbstractLdapProxy
4.9.8. Class LdapProxy
4.9.9. Class LdapProxyRO
4.10. Module Lp
4.10.1. The LPD protocol
4.10.2. Proxy behavior
4.10.3. Related standards
4.10.4. Classes in the Lp module
4.10.5. Class AbstractLpProxy
4.10.6. Class LpProxy
4.11. Module Mime
4.11.1. The MIME protocol
4.11.2. Proxy behavior
4.11.3. Related standards
4.11.4. Classes in the Mime module
4.11.5. Class AbstractMimeProxy
4.11.6. Class MimeProxy
4.12. Module MSRpc
4.12.1. The RPC protocol
4.12.2. Proxy behavior
4.12.3. Classes in the MSRpc module
4.12.4. Class AbstractMSRpcProxy
4.12.5. Class MSRpcProxy
4.13. Module Nntp
4.13.1. The NNTP Protocol
4.13.2. Proxy behavior
4.13.3. Related standards
4.13.4. Classes in the Nntp module
4.13.5. Class AbstractNntpProxy
4.13.6. Class NntpProxy
4.13.7. Class NntpProxyGroupFilter
4.13.8. Class NntpProxyRO
4.13.9. Class NntpProxyStrict
4.14. Module Plug
4.14.1. Proxy behavior
4.14.2. Related standards
4.14.3. Classes in the Plug module
4.14.4. Class AbstractPlugProxy
4.14.5. Class PlugProxy
4.15. Module Pop3
4.15.1. The POP3 protocol
4.15.2. Proxy behavior
4.15.3. Related standards
4.15.4. Classes in the Pop3 module
4.15.5. Class AbstractPop3Proxy
4.15.6. Class Pop3Proxy
4.16. Module Radius
4.16.1. The RADIUS protocol
4.16.2. Proxy behavior
4.16.3. Related standards
4.16.4. Classes in the Radius module
4.16.5. Class AbstractRadiusProxy
4.16.6. Class RadiusProxy
4.16.7. Class RadiusProxyStrict
4.17. Module Rdp
4.17.1. The Remote Desktop Protocol protocol
4.17.2. Proxy behavior
4.17.3. Classes in the Rdp module
4.17.4. Class AbstractRdpProxy
4.17.5. Class Rdp4FallbackProxy
4.17.6. Class Rdp4Proxy
4.17.7. Class Rdp5Proxy
4.17.8. Class Rdp5ProxyStrict
4.17.9. Class RdpProxy
4.18. Module Rsh
4.18.1. The RSH protocol
4.18.2. Proxy behavior
4.18.3. Related standards
4.18.4. Classes in the Rsh module
4.18.5. Class AbstractRshProxy
4.18.6. Class RshProxy
4.19. Module Sip
4.19.1. The SIP protocol
4.19.2. Related standards
4.19.3. Classes in the Sip module
4.19.4. Class AbstractSipProxy
4.19.5. Class SipProxy
4.20. Module Smtp
4.20.1. The SMTP protocol
4.20.2. Proxy behavior
4.20.3. Related standards
4.20.4. Classes in the Smtp module
4.20.5. Class AbstractSmtpProxy
4.20.6. Class SmtpProxy
4.21. Module Socks
4.21.1. The SOCKS protocol
4.21.2. Proxy behaviour
4.21.3. Related standards
4.21.4. Classes in the Socks module
4.21.5. Class AbstractSocksProxy
4.21.6. Class SocksProxy
4.22. Module SQLNet
4.22.1. The SQL*Net protocol
4.22.2. Proxy behavior
4.22.3. Related standards
4.22.4. Classes in the SQLNet module
4.22.5. Class AbstractSQLNetProxy
4.22.6. Class SQLNetProxy
4.23. Module Ssh
4.23.1. The Secure Shell protocol
4.23.2. Proxy behavior
4.23.3. Related standards
4.23.4. Classes in the Ssh module
4.23.5. Class AbstractSshProxy
4.23.6. Class SshProxy
4.23.7. Class SshSFtpProxy
4.23.8. Class SshScpProxy
4.24. Module Telnet
4.24.1. The Telnet protocol
4.24.2. Proxy behavior
4.24.3. Related standards
4.24.4. Classes in the Telnet module
4.24.5. Class AbstractTelnetProxy
4.24.6. Class TelnetProxy
4.24.7. Class TelnetProxyStrict
4.25. Module TFtp
4.25.1. The TFtp protocol
4.25.2. Proxy behavior
4.25.3. Related standards
4.25.4. Classes in the TFtp module
4.25.5. Class AbstractTFtpProxy
4.25.6. Class TFtpProxy
4.26. Module Vnc
4.26.1. The VNC protocol
4.26.2. Proxy behavior
4.26.3. Classes in the Vnc module
4.26.4. Class AbstractVncProxy
4.26.5. Class VncProxy
4.27. Module Whois
4.27.1. The Whois protocol
4.27.2. Proxy behavior
4.27.3. Related standards
4.27.4. Classes in the Whois module
4.27.5. Class AbstractWhoisProxy
4.27.6. Class WhoisProxy
4.28. Module X11
4.28.1. The X11 protocol
4.28.2. Proxy behavior
4.28.3. Classes in the X11 module
4.28.4. Class AbstractX11Proxy
4.28.5. Class X11Proxy
4.29. Module Xmlsec
4.29.1. The SOAP protocol
4.29.2. Proxy behaviour
4.29.3. Classes in the Xmlsec module
4.29.4. Class AbstractXmlsecProxy
4.29.5. Class XmlsecProxy
5. Core
5.1. Module Auth
5.1.1. Authentication and authorization basics
5.1.2. Authentication and authorization in Zorp
5.1.3. Functions in module Auth
5.1.4. Classes in the Auth module
5.1.5. Functions
5.1.6. Class AbstractAuthentication
5.1.7. Class AbstractAuthorization
5.1.8. Class AuthCache
5.1.9. Class AuthenticationPolicy
5.1.10. Class AuthorizationPolicy
5.1.11. Class BasicAccessList
5.1.12. Class InbandAuthentication
5.1.13. Class NEyesAuthorization
5.1.14. Class PairAuthorization
5.1.15. Class PermitGroup
5.1.16. Class PermitTime
5.1.17. Class PermitUser
5.1.18. Class SatyrAuthentication
5.1.19. Class ServerAuthentication
5.1.20. Class ZAAuthentication
5.2. Module AuthDB
5.2.1. Classes in the AuthDB module
5.2.2. Class AbstractAuthenticationBackend
5.2.3. Class AuthenticationProvider
5.2.4. Class ZAS2AuthenticationBackend
5.3. Module Chainer
5.3.1. Selecting the network protocol
5.3.2. Classes in the Chainer module
5.3.3. Class AbstractChainer
5.3.4. Class ConnectChainer
5.3.5. Class FailoverChainer
5.3.6. Class MultiTargetChainer
5.3.7. Class RoundRobinChainer
5.3.8. Class SideStackChainer
5.3.9. Class StateBasedChainer
5.4. Module Config
5.5. Module Dispatch
5.5.1. Zone-based service selection
5.5.2. Parameters of the bindto option
5.5.3. Classes in the Dispatch module
5.5.4. Class CSZoneDispatcher
5.5.5. Class Dispatcher
5.6. Module Domain
5.6.1. Classes in the Domain module
5.6.2. Class AbstractDomain
5.6.3. Class Inet6Domain
5.6.4. Class InetDomain
5.7. Module Keybridge
5.7.1. Classes in the Keybridge module
5.7.2. Class X509KeyBridge
5.8. Module Matcher
5.8.1. Classes in the Matcher module
5.8.2. Class AbstractMatcher
5.8.3. Class CombineMatcher
5.8.4. Class DNSMatcher
5.8.5. Class MatcherPolicy
5.8.6. Class RegexpFileMatcher
5.8.7. Class RegexpMatcher
5.8.8. Class SmtpInvalidRecipientMatcher
5.8.9. Class WindowsUpdateMatcher
5.9. Module NAT
5.9.1. Classes in the NAT module
5.9.2. Class AbstractNAT
5.9.3. Class BalanceNAT
5.9.4. Class GeneralNAT
5.9.5. Class HashNAT
5.9.6. Class NATPolicy
5.9.7. Class OneToOneMultiNAT
5.9.8. Class OneToOneNAT
5.9.9. Class RandomNAT
5.9.10. Class StaticNAT
5.10. Module Notification
5.10.1. Classes in the Notification module
5.10.2. Class AbstractNotificationMethod
5.10.3. Class EmailNotificationMethod
5.10.4. Class NotificationPolicy
5.11. Module Proxy
5.11.1. Functions in module Proxy
5.11.2. Classes in the Proxy module
5.11.3. Functions
5.11.4. Class Proxy
5.12. Module Resolver
5.12.1. Classes in the Resolver module
5.12.2. Class AbstractResolver
5.12.3. Class DNSResolver
5.12.4. Class HashResolver
5.12.5. Class ResolverPolicy
5.13. Module Router
5.13.1. The source address used in the server-side connection
5.13.2. Classes in the Router module
5.13.3. Class AbstractRouter
5.13.4. Class DirectedRouter
5.13.5. Class InbandRouter
5.13.6. Class TransparentRouter
5.14. Module Service
5.14.1. Naming services
5.14.2. Determining the server and client zone
5.14.3. Classes in the Service module
5.14.4. Class AbstractService
5.14.5. Class PFService
5.14.6. Class Service
5.15. Module Session
5.15.1. Classes in the Session module
5.15.2. Class StackedSession
5.16. Module SockAddr
5.16.1. Functions in module SockAddr
5.16.2. Classes in the SockAddr module
5.16.3. Functions
5.16.4. Class SockAddrInet
5.16.5. Class SockAddrInetRange
5.16.6. Class SockAddrUnix
5.17. Module Stack
5.17.1. Classes in the Stack module
5.17.2. Class AbstractStackingBackend
5.17.3. Class RemoteStackingBackend
5.17.4. Class StackingProvider
5.18. Module Stream
5.18.1. Classes in the Stream module
5.18.2. Class Stream
5.19. Module Zone
5.19.1. Classes in the Zone module
5.19.2. Class InetZone
5.20. Module Zorp
5.20.1. Functions in module Zorp
5.20.2. Functions
1. Additional proxy information
1.1. NNTP appendix
1.2. RADIUS appendix
1.3. SQL*Net appendix
1.4. TELNET appendix
2. Manual pages
zorp — Zorp Firewall Suite
kzorp — Tool for the kzorp kernel module
instances.confzorp(8) instances database
policy.pyzorp(8) policy file.
zorpctl — Start and stop zorp instances.
zorpctl.confzorpctl(8) configuration file.
zms — Zorp Management Server engine
zms.conf — Configuration file format for the Zorp Management Server (zms(8).
zms-integrity — ZMS Database Integrity Checker
zms-transfer-agent — ZMS Transfer Agent
zmsagent.conf — Configuration file format for the Zorp Management Agents (zms-transfer-agent(8) and zms-monitor-agent(8)).
zms-monitor-agent — ZMS Monitor Agent
zas — Zorp Authentication Server
zas.cfgzas(8) configuration file.
zcv — Zorp Content Vectoring Server
zcv.cfgzcv(8) configuration file format
zqc — Zorp Quarantine Checker
zavupdate — Updates the various AntiVirus engine's databases and optionally the VirusBuster engine as well.
zavupdate.optionszavupdate(8) configuration files.
3. Monitoring jobs reference
connect
diskfree
hastatus
iface
load
mem
mysql
ping
postfix
proc
raid
smtp
urlcheck
vmstat
zorp
4. Global options of Zorp
4.1. Setting global options of Zorp
blob
audit
options
Index of Proxy attributes
Index of Core attributes
Index of all attributes

List of Examples

2.1. Customizing FTP commands
2.2. Using the POLICY action
2.3. Default and explicit actions
2.4. Customizing response codes
2.5. Example PlugProxy allowing secondary sessions
2.6. HTTP proxy stacked into an HTTPS connection
2.7. Program stacking in HTTP
3.1. Configuring FTPS support
4.1. Controlling the number of max hops
4.2. FTP protocol sample
4.3. Customizing FTP to allow only anonymous sessions
4.4. Configuring FTPS support
4.5. Example HTTP transaction
4.6. Proxy style HTTP query
4.7. Data tunneling with connect method
4.8. Implementing URL filtering in the HTTP proxy
4.9. 404 response filtering in HTTP
4.10. Header filtering in HTTP
4.11. URL redirection in HTTP proxy
4.12. Redirecting HTTP to HTTPS
4.13. Using parent proxies in HTTP
4.14. URL-filtering example
4.15. URL filtering HTTP proxy
4.16. IMAP protocol sample
4.17. Rewriting IMAP capability response
4.18. Changing the greeting string in IMAP
4.19. IMAP arguments in use
4.20. Example Ldap entry
4.21. Example of the commands usage
4.22. Example mail header containing MIME message
4.23. Example PNG format picture attachment
4.24. Example multipart message
4.25. Example usage of MimeProxy module, denying applications
4.26. Customising RPC to allow connection to service "11223344-5566-7788-99aa-bbccddeeff00"
4.27. Example NNTP connection
4.28. Example for filtering accessible newsgroups
4.29. Example for defining policies for responses in NNTP
4.30. POP3 protocol sample
4.31. Example for allowing only APOP authentication in POP3
4.32. Example for converting simple USER/PASS authentication to APOP in POP3
4.33. Rewriting the banner in POP3
4.34. Example RadiusProxy config
4.35. Disabling RDP5 protocol by force-reverting it to RDP4
4.36. Disabling channel RDPDR
4.37. Enabling custom channels
4.38. Dynamically change username and server address
4.39. Strict Rsh proxy denying root user access and logging the issued Rsh commands
4.40. Disabling video traffic in SIP
4.41. SMTP protocol sample
4.42. SOCKS and HTTP traffic
4.43. Enabling and disabling SSH channels
4.44. Enabling only SFTP connections
4.45. Restricting local forwarding
4.46. Modifying the keypair used in public-key authentication
4.47. Example for disabling the Telnet X Display Location option
4.48. Rewriting the DISPLAY environment variable
4.49. Example WhoisProxy logging all whois requests
4.50. Stacking Xmlsec into an HTTP proxy
4.51. Custom SOAP validation
5.1. A simple authentication policy
5.2. Caching authentication decisions
5.3. A simple authorization policy
5.4. BasicAccessList example
5.5. A simple PairAuthorization policy
5.6. A simple PermitGroup policy
5.7. PermitTime example
5.8. A simple PermitUser policy
5.9. Outband authentication example
5.10. A sample authentication provider
5.11. A sample ConnectChainer
5.12. A DirectedRouter using FailoverChainer
5.13. A DirectedRouter using RoundRobinChainer
5.14. Using DBIface
5.15. CSZoneDispatcher example
5.16. Dispatcher example
5.17. Whitelisting e-mail recipients
5.18. DNSMatcher example
5.19. RegexpFileMatcher example
5.20. RegexpMatcher example
5.21. SmtpInvalidMatcher example
5.22. WindowsUpdateMatcher example
5.23. GeneralNat example
5.24. Using Natpolicies
5.25. A simple DNSResolver policy
5.26. A simple HashResolver policy
5.27. DirectedRouter example
5.28. InbandRouter example
5.29. TransparentRouter example
5.30. PFService example
5.31. Service example
5.32. SockAddrInet example
5.33. SockAddrUnix example
5.34. A simple StackingProvider class
5.35. Using a StackingProvider in an FTP proxy
5.36. Finding IP networks
5.37. Zone examples
5.38. Determining the zone of an IP address
1.1. An example for the SQL*Net connection string

List of Procedures

1.1. Zorp startup and initialization
1.2.1. Handling packet-filtering services
1.2.2. Handling application-level services
1.3. Proxy startup and the server-side connection
3.1.1.1. The SSL handshake
3.2.7.1. Configuring keybridging
4.1. Setting global options of Zorp

Preface

Welcome to Zorp Reference Guide. This book contains reference documentation on the available Zorp proxies and their working environment, the Python framework.

This book contains information about the low-level proxy attributes available to customize proxy behavior and the low-level classes comprising Zorp's access control and service framework. Basic introduction to the various protocols is also provided for reference, but the detailed discussion of the protocols is beyond the scope of this book.

1. Summary of contents

Chapter 4, Proxies is a complete reference of the proxies available in Zorp. Information in this chapter is essential for fine-tuning proxy behavior and tailoring Zorp to accurately represent the security policy of your organization. Each section includes an overview of the protocol architecture, a short description of the protocol states and elements, and basic proxy behavior.

Chapter 2 is the reference of Zorp core modules which are directly used by gateway administrators, forming the access control and authentication framework.

2. Terminology

The following terms used throughout this documentation might require a brief explanation:

  • class: A class is a set of attribute and method definitions performing certain specific functionality. Classes can inherit methods and attributes from one or more parent classes. Classes do not contain actual values for attributes; they only describe them.

  • instance: An instance is a set of attribute values (as described by the class) and associated methods. Instances are also called objects. Instances are created from classes by "calling" the class, with arguments required by the constructor. For example, to create an instance of a class named "class" one would write class(arg1, arg2 [,.. argN]) where arg1 and arg2 are arguments of the constructor.

  • method: A function working in the context of an instance. It automatically receives a "self" argument which can be used to fetch or set attributes stored in the associated instance.

  • type: Variables in Python are not strongly typed, meaning that it is possible to assign any kind of values to a variable; typing is assigned to the value.

  • attribute: An attribute of an object is a variable holding some value, interpreted and manipulated by object methods. Although Python is not strongly typed, types were assigned to the variables in Zorp to indicate what kind of values they are supposed to hold.

  • actiontuple: A tuple is a simple Python type defined as a list of values. An actiontuple is a special tuple defined by Zorp where the first value must be a value specifying what action to take, and trailing items specify arguments to the action. For example (HTTP_REQ_REJECT, "We don't like this request") is a tuple for rejecting HTTP requests and returning the message specified in the second value.

Chapter 1. How Zorp works

This chapter describes how Zorp works, and provides information about the core Zorp modules, explaining how they interoperate. For a detailed reference of the core modules, see the description of the particular in Chapter 5, Core.

  • Zorp startup and initialization: The main Zorp thread is started, and the Dispatchers listening for incoming connections are initialized.

  • Handling incoming connections: The client-side connection is established and the service to proxy the connection is selected.

  • Proxy startup and server-side connections: The proxy instance inspecting the traffic is created and connection to the server is established.

1.1. Procedure – Zorp startup and initialization

  1. The zorpctl utility loads the instances.conf file and starts the main zorp program. The instances.conf file stores the parameters of the configured Zorp instances.

  2. zorp performs the following initialization steps:

    • Sets the stack limit.

    • Creates its PID file.

    • Changes the running user to the user and group specified for the instance.

    • Initializes the handling of dynamic capabilities and sets the chroot directory.

    • Loads the firewall policy from the policy.py file.

  3. The init() of Zorp initializes the Dispatchers (Listeners and Receivers) defined for the Zorp instance. The Dispatcher creates sockets according to the IP addresses, port numbers, and protocols (TCP or UDP) where incoming connections are permitted. Zorp polls these sockets to detect incoming connections.

    If a Dispatcher has the threaded parameter enabled , Zorp starts a separate thread to monitor the socket.

  4. The kzorp kernel module uploads packet-filtering services, dispatchers, and zones into the kernel.

1.2. Handling incoming connections

Incoming connections are first received by the kzorp kernel module, which is actually a netfilter table. The kzorp module determines the source and destination zones of the connection, and the tries to find a suitable dispatcher. If the dispatcher points to a packet-filtering service, the connection is processed according to Procedure 1.2.1, Handling packet-filtering services; if it points to an application-level service, the connection is processed according to Procedure 1.2.2, Handling application-level services. If no suitable dispatcher is found, the connection is rejected.

1.2.1. Procedure – Handling packet-filtering services

  1. The Dispatcher generates a session ID and creates a CONNTRACK entry for the connection. This ID is based on all relevant information about the connection, including the protocol (TCP/UDP) and the client's address.

    The session ID uniquely identifies the connection and is included in every log message related to this particular connection.

  2. The Dispatcher selects the service that will inspect the connection.

  3. The Router defined in the service determines the destination address of the server.

    The Router performs the following actions:

    • Determines the destination address of the server.

    • Sets the source address of the server-side connection, according to the forge_address settings of the router.

  4. If the client is permitted to access the selected service, the packet filter is instructed to let the connection pass Zorp.

  5. The kzorp module performs network address translation (NAT) on the connection, if needed.

1.2.2. Procedure – Handling application-level services

  1. For incoming connection requests that are processed on the application level, the main Zorp thread establishes the connection with the client. The connection is further processed in a separate thread; the main thread is listening for new connections.

  2. The Dispatcher creates the MasterSession object of the connection and generates the base session ID. This object stores all relevant information of the connection, including the protocol (TCP/UDP) and the client's address.

    The session ID uniquely identifies the connection and is included in every log message related to this particular connection. Other components of Zorp add further digits to the session ID.

  3. For TCP-based connections, Zorp copies the Type of Service (ToS) value of the client-Zorp connection in the Zorp-client connection.

  4. The Dispatcher selects the service that will inspect the connection.

  5. The Router defined in the service determines the destination address of the server. The result is stored in the Session object, where the Chainer can access it later.

    The Router performs the following actions:

    • Determines the destination address of the server.

    • Sets the source address of the server-side connection (according to the forge_port, forge_address settings of the router).

    • Sets the ToS value of the server-side connection.

  6. If the client is permitted to access the selected service, the startInstance() method of the service is started. The startInstance() method performs the following actions:

    • Verifies that the new instance does not exceed the number of instances permitted for the service (max_instances parameter).

    • Creates the final session ID.

    • Creates an instance of the proxy class associated with the service. This proxy instance is associated with a StackedSession object. The startup of the proxy is detailed in Procedure 1.3, Proxy startup and the server-side connection.

1.3. Procedure – Proxy startup and the server-side connection

  1. To create an instance of the application-level proxy, the __init__ constructor of the proxy class calls the Proxy.__init__ function of the Proxy module. The proxy instance is created into a new thread from the ZorpProxy ancestor class.

  2. From the new thread, the proxy loads its configuration.

  3. The proxy initiates connection to the server.

    [Note] Note

    Some proxies connect the server only after receiving the first client request.

  4. The Proxy.connectServer() method creates the server-side connection using the Chainer assigned to the service. The Chainer performs the following actions:

    • Reads the parameters related to the server-side connection from the Session object. These parameters were set by the Router and the Proxy.

    • Performs source and destination network address translation. This may modify the addresses set by the Router and the Proxy.

    • Verifies that access to the server is permitted.

    • Establishes the connection using the Attach subsystem, and passes to the proxy the stream that represents the connection.

    [Note] Note

    The Proxy.connectServer() method connects stacked proxies with their parent proxies.

Chapter 2. Configuring Zorp proxies

This chapter describes how Zorp proxies work in general, and how to configure them.

2.1. Policies for requests and responses

Zorp offers great flexibility in proxy customization. Requests and commands, responses, headers, etc. can be managed individually in Zorp. This means that it is not only possible to enable/disable them one-by-one, but custom actions can be assigned to them as well. The available options are listed in the description of each proxy, but the general guidelines are discussed here.

All important events of a protocol have an associated policy hash: usually there is one for the requests or commands and one for the responses. Where applicable for a protocol, there are other policy hashes defined as well (e.g., for controlling the capabilities available in the IMAP protocol, etc.). The entries of the hash are the possible events of the protocol (e.g., the request hash of the FTP protocol contains the possible commands - RMD, DELE, etc.) and an action associated with the event - what Zorp should do when this event occurs. The available actions may slightly vary depending on the exact protocol and the hash, but usually they are the following:

Action Description
ACCEPT Enable the event; the command/response/etc. can be used and is allowed through the firewall.
REJECT Reject the event and send an error message. The event is blocked and the client notified. The communication can continue, the connection is not closed.
DROP Reject the event without sending an error message. The event is blocked but the client is not notified. The communication can continue, the connection is not closed. In some cases (depending on the protocol) this action is able to remove only a part of the message (e.g., a particular header in HTTP traffic) without rejecting the entire message.
ABORT Reject the event and terminate the connection.
POLICY Call a Python function to make a decision about the event. The final decision must be one of the above actions (i.e. POLICY is not allowed). The parameters received by the function are listed in the module descriptions. See the examples below and in the module descriptions for details.

Table 2.1.  Action codes for protocol events


The use of the policy hashes and the action codes is illustrated in the following examples.

[Example] Example 2.1. Customizing FTP commands

In this example the 'RMD' command is rejected, and the connection is terminated if the user attempts to delete a file.

class MyFtp(FtpProxy):
	def config(self):
		self.request["RMD"] = (FTP_REQ_REJECT)
		self.request["DELE"] = (FTP_REQ_ABORT)
[Example] Example 2.2. Using the POLICY action

This example calls a function called pUser (defined in the example) whenever a USER command is received within an FTP session. All other commands are accepted. The parameter of the USER command (i.e. the username) is examined: if it is 'user1' or 'user2', the connection is accepted, otherwise it is rejected.

class MyFtp(FtpProxy):
	def config(self):
		self.request["USER"] = (FTP_REQ_POLICY, self.pUser)
		self.request["*"] = (FTP_REQ_ACCEPT)

	def pUser(self,command):
		if self.request_parameter == "user1" or self.request_parameter == "user2":
			return FTP_REQ_ACCEPT
		return FTP_REQ_REJECT

It must be noted that there is a difference between how Zorp processes the POLICY actions and all the other ones (e.g., ACCEPT, DROP, etc.). POLICY actions are evaluated on the policy (or Python) level of Zorp, while the other ones on the proxy (or C) level. Since the proxies of Zorp are written in C, and operate on the proxy level, the evaluation of POLICY actions is slightly slower, but this can be an issue only in very high-throughput environments with complex policy settings.

2.1.1. Default actions

Default actions for all events of a hash (e.g., all requests) can be set using the '*' wildcard as the event. (Most hashes have default actions configured by default, these can be found in the description of the proxy classes.) It is important to note that setting the action using the '*' wildcard does NOT override an action explicitly defined for an event, even if the explicit setting precedes the general one in the Python code. This feature is illustrated in the example below.

[Example] Example 2.3. Default and explicit actions

The following two proxy classes have the same effect, even though the order of the code lines is switched. The 'APPE' command is rejected, while all other commands are accepted.

class MyFtp1(FtpProxy):
	def config(self):
		self.request["APPE"] = (FTP_REQ_REJECT)
		self.request["*"] = (FTP_REQ_ACCEPT)
class MyFtp2(FtpProxy):
	def config(self):
		self.request["*"] = (FTP_REQ_ACCEPT)
		self.request["APPE"] = (FTP_REQ_REJECT)
[Warning] Warning

If the relevant hash does not contain a received request or response, the '*' entry is used which matches to every request/response. If there is no '*' entry in the given hash, the request/response is denied.

2.1.2. Response codes

Responses in certain protocols include numeric response codes, e.g., in the FTP protocol responses start with a three-digit code. In Zorp it is possible to filter these codes as well, furthermore, to filter them based on the command to which the response arrives to. In these cases the hash contains both the command and the answer, and an action as well. The '*' wildcard character can be used to match for every command or response code.

[Example] Example 2.4. Customizing response codes

The following example accepts the response '250' only to the 'DELE' command, but allows any response code to the 'LIST' command.

class MyFtp1(FtpProxy):
	def config(self):
		self.response["DELE", "250"] = (FTP_RSP_ACCEPT)
		self.response["*", "250"] = (FTP_RSP_REJECT)
		self.response["LIST", "*"] = (FTP_RSP_ACCEPT)

It is not necessary to specify the full response code, it is also possible to specify only the first, or the first two digits.

For example, all three response codes presented below are valid, but have different effects:

  • "PWD","200"

    Match exactly the answer 200 coming in a reply to a PWD command.

  • "PWD","2"

    Match every answer starting with '2' in a reply to a PWD command.

  • "*","20"

    Match every answer between 200 and 209 in a reply to any command.

This kind of response code lookup is available in the following proxies: FTP, HTTP, NNTP, and SMTP. The precedence how the hash table entries are processed is the following:

  1. Exact match. ("PWD","200")

  2. Exact command match, partial response matches ("PWD","20"; "PWD","2"; "PWD","*")

  3. Wildcard command, with answer codes repeated as above. ("*","200"; "*","20"; "*","2")

  4. Wildcard for both indexes. ("*","*")

2.2. Secondary sessions

Certain proxies support the use of secondary sessions, i.e. several sessions using the same proxy instance (the same thread), effectively reusing proxy instances. As new sessions enter the proxy via a fastpath, using secondary sessions can significantly decrease the load on the firewall.

When a new connection is accepted, Zorp looks for the appropriate proxy instance which is willing to accept secondary sessions. If there is none, a new proxy instance is started. An already running proxy instance is appropriate if it is willing to accept secondary channels and the criteria about secondary sessions are met. (The criteria can be specified in the configuration of the proxy class.)

The criteria are set via the secondary_mask attribute, while the number of secondary sessions allowed within the same instance is controlled by the secondary_sessions attribute. The secondary_mask attribute is an integer specifying which properties of an established session are considered to be important. If all important properties match, the connection can be handled as a secondary session by a proxy instance accepting secondary sessions, provided the new session does not exceed the limit set in secondary_sessions. The secondary_mask attribute is actually a bitfield interpreted as follows: bit 0 means source address; bit 1 means source port; bit 2 means destination address; bit 3 means destination port.

Currently the Plug, RADIUS, and Sip proxies support the use of secondary sessions.

[Example] Example 2.5. Example PlugProxy allowing secondary sessions

This example allows 100 parallel sessions in one proxy thread if the IP address and Port of the targets are the same.

class MyPlugProxy(PlugProxy):
	def config(self):
		PlugProxy.config(self)
		self.secondary_mask = 0xC
		self.secondary_sessions = 100

2.3. Embedded protocol analysis

Each protocol proxy available in Zorp inspects the traffic for conformance to the given protocol. Often further analysis of the data transferred via the protocol is required, this can be accomplished via stacking. Stacking is a method when the data transferred in the protocol is passed to another proxy or program. After performing the inspection, the stacked proxy or program returns the data to the original proxy, which resumes its transmission.

2.3.1. Proxy stacking

Proxy stacking is mainly used to inspect embedded protocols, or perform virus filtering: e.g., to inspect HTTPS traffic, the external SSL protocol is examined with a Pssl proxy, and then a HTTP proxy is stacked to inspect the internal protocol. It is possible to stack several layers of proxies into each other if needed, e.g., in the above example, a further virus filtering solution (like a ZCV module) could be stacked into the HTTP proxy.

[Note] Note

Starting with Zorp version 3.3FR1, every proxy is able to handle SSL/TLS-encypted connection on its own, making the Pssl proxy redundant. This feature greatly decreases the need of proxy stacking, making it needed only in special cases, for example, to inspect HTTP traffic tunneled in SSH.

Stacking a proxy to inspect the embedded protocol is possible via the self.request_stack attribute; if another attribute has to be used, it is noted in the description of the given proxy. The HTTP proxy is special in the sense that it is possible to stack different proxies into the requests and the responses.

The parameters of the stack attribute has to specify the following:

  • The protocol elements for which embedded inspection is required. This parameter can be used to specify if all received data should be passed to the stacked proxy ("*"), or only the data related (sent or received) to specific protocol elements (e.g., only the data received with a GET request in HTTP).

  • The mode how the data is passed to the stacked proxy. This parameter governs if only the data part should be passed to the stacked proxy (XXXX_STK_DATA, where XXXX depends on the protocol), or (if applicable) MIME header information should be included as well (XXXX_STK_MIME) to make it possible to process the data body as a MIME envelope. Please note that while it is possible to change the data part in the stacked proxy, it is not possible to change the MIME headers - they can be modified only by the upper level proxy. The available constants are listed in the respective protocol descriptions. The default value for this argument is XXXX_STK_NONE, meaning that no data is transferred to the stacked proxy. In some proxies it is also possible to call a function (using the XXXX_STK_POLICY action) to decide which part (if any) of the traffic should be passed to the stacked proxy.

  • The proxy class that will perform inspection of the embedded protocol.

The use of proxy stacking is illustrated in the following example:

[Example] Example 2.6. HTTP proxy stacked into an HTTPS connection

The following proxy class stacks an Http proxy into a Pssl Proxy to inspect HTTPS traffic.

class HttpsPsslProxy(PsslProxy):
	def config(self):
		PsslProxy.config(self)
		self.stack_proxy=(Z_STACK_PROXY, HttpProxy)

For additional information on proxy stacking, see Section 8.5.3., Stacking proxies of the Zorp Administrator's Guide, and the various tutorials available at the BalaBit Documentation Page http://www.balabit.com/support/documentation/.

2.3.2. Program stacking

When stacking a program, the data received by a proxy within a protocol is directed to the standard input. Arbitrary commands (including command line scripts, or applications) working from the standard input can be run on this data stream. The original proxy obtains the processed data back from the standard output. When stacking a command, the command to be called has to be included in the proper stack attribute of the proxy between double-quotes. This is illustrated in the following example.

[Example] Example 2.7. Program stacking in HTTP

In this example a simple 'sed' (stream editor) command is stacked into the HTTP proxy to replace all occurrences of 'http' to 'https', thus securing the HTTP connections on one side of the firewall.

class MyHttp(HttpProxy):
	def config(self):
		HttpProxy.config(self)
		self.response_stack["GET"] = /
		(HTTP_STK_DATA, (Z_STACK_PROGRAM, "/bin/sed '/http:/s//https:/g'"))

2.4. List of the proxies available in Zorp

Chapter 3. The Zorp SSL framework

This chapter describes the SSL protocol and the SSL framework available for every Zorp proxy.

3.1. The SSL protocol

Secure Socket Layer v3 (SSL) and Transport Layer Security v1 (TLS) are widely used crypto protocols guaranteeing data integrity and confidentiality in many PKI and e-commerce systems. They allow both the client and the server to authenticate each other. SSL/TLS use reliable TCP connection for data transmission and cooperate with any application level protocol. SSL/TLS guarantee that:

  • Communication in the channel is private, only the other communicating party can decrypt the messages.

  • The channel is authenticated, so the client can make sure that it communicates with the right server. Optionally, the server can also authenticate the client. Authentication is performed via certificates issued by a Certificate Authority (CA). Certificates identify the owner of an encryption keypair used in encrypted communication.

  • The channel is reliable, which is ensured by message integrity verification using MAC.

SSL/TLS is almost never used in itself: it is used as a secure channel to transfer other, less secure protocols. The protocols most commonly embedded into SSL/TLS are HTTP and POP3 (i.e. these are the HTTPS and POP3S protocols).

3.1.1. The SSL handshake

As an initial step, both the client and the server collect information to start the encrypted communication.

3.1.1.1. Procedure – The SSL handshake

  1. The client sends a CLIENT-HELLO message.

  2. The server answers with a SERVER-HELLO message containing the certificate of the server. At this point the parties determine if a new master key is needed.

    [Note] Note

    The server stores information (including the session ID and other parameters) about past SSL/TLS sessions in its session cache. Clients that have contacted a particular server previously can request to continue a session (by identifying its session ID); this can be used to accelerate the initialization of the connection. Zorp currently does not support this feature, but this does not cause any noticeable difference to the clients.

  3. The client verifies the server's certificate. If the certificate is invalid the client sends an ERROR message to the server.

    [Note] Note

    If a new master key is needed the client gets the server certificate from the SERVER-HELLO message and generates a master key, sending it to the server in a CLIENT-MASTER-KEY message.

  4. The server sends a SERVER-VERIFY message, which authenticates the server itself.

  5. Optionally, the server can also authenticate the client by requesting the client's certificate with a REQUEST-CERTIFICATE message.

  6. The server verifies the certificate received from the client and finishes the handshake with a SERVER-FINISH message.

[Note] Note

In SSL two separate session keys are used, one for outgoing communication (which is of course incoming at the other end), and another key for incoming communication. These are known as SERVER/CLIENT-READ-KEY and SERVER/CLIENT-WRITE-KEY.

3.2. Configuring TLS and SSL encrypted connections

Zorp version 3.3FR1 introduces a common framework that allows every Zorp proxy to use SSL/TLS encryption, and also to support STARTTLS.

[Note] Note

In Zorp 3.4 LTS, the following proxies support STARTTLS: Ftp proxy (to start FTPS sessions), Smtp proxy.

3.2.1. Behavior of the SSL framework

[Warning] Warning

For the details of the attributes related to the SSL framework, see Section 5.11.4, Class Proxy.

The SSL framework was built for inspecting SSL/TLS connections, and also any other connections embedded into the encrypted SSL/TLS channel. SSL/TLS connections initiated from the client are terminated on the Zorp firewall; and two separate SSL/TLS connections are built: one between the client and the firewall, and one between the firewall and the server. If both connections are accepted by the local security policy (the certificates are valid, and only the allowed encryption algorithms are used), Zorp inspects the protocol embedded into the secure channel as well.

Several configuration examples and considerations are discussed in the Technical White Paper and Tutorial Proxying secure channels - the Secure Socket Layer, available at the BalaBit Documentation Page http://www.balabit.com/support/documentation/.

3.2.1.1. General behavior

The SSL framework starts its operation by inspecting the values set in the ssl.handshake_seq attribute. When this attribute is set to SSL_HSO_CLIENT_SERVER the client side, otherwise (SSL_HSO_SERVER_CLIENT) the server side handshake is performed first.

As part of the handshake process the proxy checks if SSL is enabled on the given side (ssl.client_connection_security and ssl.server_connection_security attributes). It is not necessary for SSL to be enabled on both sides - Zorp can handle one-sided SSL connections as well (e.g., the firewall communicates in an unencrypted channel with the client, but in a secure channel with the server). If SSL is not enabled, the handshake is skipped for that side.

When SSL is needed, the proxy will cooperate with the policy layer to have all required parameters (keys, certificates, etc.) set up. This is achieved using decision points in the hash named ssl.handshake_hash which is explained later in detail.

The SSL handshake is slightly different for the client (in this case Zorp behaves as an SSL server) and the server (when Zorp behaves as an SSL client).

3.2.1.2. Client-side (SSL server) behavior

As an SSL server the first thing to present to an SSL client is a certificate/key pair, thus a call to the 'setup_key' callback is made. It is expected that by the time this callback returns the attributes ssl.client_local_privatekey and ssl.client_local_certificate are filled appropriately.

If peer authentication is enabled (by setting the attribute ssl.client_verify_type) a list of trusted CA certificates must be set up (stored in the hash ssl.client_local_ca_list). The list can be set up by the 'setup_ca_list' function call. Peer certificates are verified against the trusted CA list and their associated revocation lists. Revocations can be set up in the 'setup_crl_list' callback.

At the end of the verification another callback named 'verify_cert' is called which can either ACCEPT or DENY the certificate possibly overriding the verification against the local CA database.

3.2.1.3. Server-side (SSL client) behavior

The server-side handshake is similar to the client-side handshake previously described. The difference is the order of certificate verification. On the server side Zorp verifies the server's certificate first and then sends its own certificate for verification. This is unlike the client side where the local certificate is sent first, and then the peer's certificate is verified.

So the callbacks are called in this order: 'setup_ca_list' and 'setup_crl_list' to set up CA and CRL information, 'verify_cert' to finalize certificate validation, and 'setup_key' to optionally provide a local certificate/key pair.

3.2.2. Handshake callbacks

As described earlier, the SSL framework provides a way to customize the SSL handshake process. This is done using the ssl.client_handshake and ssl.server_handshake hashes. These hashes are indexed by the keywords listed below.

The tuple can be separated to two parts: 1) tuple type, 2) parameters for the given type. For now only SSL_HS_POLICY is valid as tuple type, and it requires a function reference as parameter.

The following keys are accepted as indexes:

setup_key

This function is called when the proxy needs the private key/certificate pair to be set up. All attributes filled in the earlier phases can be used to decide which key/certificate to use. The function expects two parameters: self, side.

setup_ca_list

This function is called when the proxy needs the trusted CA list to be set up. The function expects two parameters: self, side.

setup_crl_list

This function is called when the proxy needs the CRL list to be set up. This function gets a single string parameter which contains the name of the CA whose CRL is to be filled up. The function expects three parameters: self, side, ca_name.

verify_cert

This function is called to finalize the verification process. The function expects two parameters: self, side.

The function arguments as referenced above are defined as:

self

The proxy instance.

side

The side where handshake is being performed.

ca_name

Name of an X.509 certificate.

The functions returns one of the SSL_HS_* constants. Generally if the function returns SSL_HS_ACCEPT the handshake continues, otherwise the handshake is aborted. As an exception, verify_cert may return SSL_HS_VERIFIED in which case the certificate is accepted without further verification.

Name Value
SSL_HS_ACCEPT 0
SSL_HS_REJECT 1
SSL_HS_POLICY 6
SSL_HS_VERIFIED 10

Table 3.1.  Handshake policy decisions


3.2.3. X.509 Certificates

An X.509 certificate is a public key with a subject name specified as an X.500 DN (distinguished name) signed by a certificate issuing authority (CA). X.509 certificates are represented as Python policy objects having the following attributes:

subject

Subject of the certificate.

issuer

Issuer of the certificate (i.e. the CA that signed it).

serial

Serial number of the certificate.

blob

The certificate itself as a string in PEM format.

Zorp uses X.509 certificates to provide a convenient and efficient way to manage and distribute certificates and keys used by the various components and proxies of the managed Zorp hosts. It is mainly aimed at providing certificates required for the secure communication between the different parts of the firewall system, e.g. Zorp hosts and ZMS engine (the actual communication is realized by agents).

Certificates of trusted CAs (and their accompanying CRLs) are used in Zorp to validate the certificates of servers accessed by the clients. The hashes and structures below are used by the various certificate-related attributes of the Zorp Pssl proxy, particularly the ones of certificate type.

3.2.3.1. X.509 Certificate Names

A certificate name behaves as a string, and contains a DN in the following format (also known as one-line format):

/RDN=value/RDN=value/.../RDN=value/

The word RDN stands for relative distinguished name. For example the DN below:

cn=Root CA, ou=CA Group, o=Foo Ltd, l=Bar, st=Foobar State, c=US

becomes:

/C=US/ST=Foobar State/L=Bar/O=Foo Ltd/OU=CA Group/CN=Root CA/

[Warning] Warning

The format and representation of certificate names may change in future releases.

3.2.3.2. X.509 Certificate Revocation List

A certifying authority may revoke the issued certificates. A revocation means that the serial number and the revocation date is added to the list of revoked certificates. Revocations are published on a regular basis. This list is called the Certificate Revocation List, also known as CRL. A CRL always has an issuer, a date when the list was published, and the expected date of its next update.

3.2.3.3. X.509 Certificate hash

The proxy stores trusted CA certificates in a Certificate hash. This hash can be indexed by two different types. If an integer index is used, the slot specified by this value is looked up; if a string index is used, it is interpreted as a one-line DN value, and the appropriate certificate is looked up. Each slot in this hash contains an X.509 certificate.

3.2.3.4. X.509 CRL hash

Similarly to the certificate hash, a separate hash for storing Certificate Revocation Lists was defined. A CRL contains revocation lists associated to CAs.

3.2.3.5. Certificate verification options

Zorp is able to automatically verify the certificates received. The types of accepted certificates can be controlled separately on the client and the server side using the ssl.client_verify_type and the ssl.server_verify_type attributes. These attributes offer an easy way to restrict encrypted access only to sites having trustworthy certificates. The available options are summarized in the following table.

Name Value
SSL_VERIFY_NONE Automatic certificate verification is disabled.
SSL_VERIFY_OPTIONAL_UNTRUSTED Certificate is optional, if present, both trusted and untrusted certificates are accepted.
SSL_VERIFY_OPTIONAL_TRUSTED Certificate is optional, but if a certificate is present, only certificates signed by a trusted CA are accepted.
SSL_VERIFY_REQUIRED_UNTRUSTED Valid certificate is required, both trusted and untrusted certificates are accepted.
SSL_VERIFY_REQUIRED_TRUSTED Certificate is required, only valid certificates signed by a trusted CA are accepted.

Table 3.2.  Certificate verification settings


The ssl.server_check_subject can be used to compare the domain name provided in the Subject field of the server certificate to application level information about the server. Currently it can compare the Subject field to the domain name of the HTTP request in HTTPS communication. If the ssl.server_check_subject is set to TRUE and ssl.server_verify_type is SSL_VERIFY_REQUIRED_UNTRUSTED or SSL_VERIFY_REQUIRED_TRUSTED, the HTTP proxy using the SSL framework will deny access to the page and return an error if the Subject field does not match the domain name of the URL.

3.2.4. Setting the allowed SSL/TLS protocol

As there are different and sometimes incompatible releases of the SSL protocol, it is possible to specify which SSL/TLS version is allowed to pass the Zorp firewall. The attributes ssl.client_ssl_method and ssl.server_ssl_method can be used for this purpose. Specify the appropriate 'SSL_METHOD_*' constant to allow the selected protocol. Only one constant can be specified. Zorp currently supports the SSL versions 2 and 3 and the TLS v1 protocols.

Name Value
SSL_METHOD_SSLV2 Permit the use of SSLv2 exclusively.
SSL_METHOD_SSLV3 Permit the use of SSLv3 exclusively.
SSL_METHOD_TLSV1 Permit the use of TLSv1 exclusively.
SSL_METHOD_ALL Permit the use of all the supported (SSLv2, SSLv3, and TLSv1) protocols.

Table 3.3.  Constants for SSL/TLS protocol selection


[Warning] Warning

The OpenSSL implementation of the SSL protocol (used by Zorp) has an important feature regarding method selection: it allows automatical fallbacks if one side does not support the selected method. That means that even if SSL_METHOD_SSLv3 is specified, the communication might fall back to SSLv2 if one of the communicating parties does not support v3. To explicitly deny a protocol, set the appropriate ssl.client_disable_proto_* or ssl.server_disable_proto_* attribute to TRUE. In Zorp SSLv2 is disabled by default.

3.2.5. SSL cipher selection

The cipher algorithms used for key exchange and mass symmetric encryption are specified by the attributes ssl.client_ssl_ciphers and ssl.server_ssl_ciphers. These attributes contain a cipher specification as specified by the OpenSSL manuals, see the manual page ciphers(ssl) for further details.

The default set of ciphers can be set by using the following predefined variables.

Name Value
SSL_CIPHERS_ALL Permit the use of all supported ciphers, including the 40 and 56 bit exportable ciphers.
SSL_CIPHERS_HIGH Permit only the use of ciphers which use at least 128 bit long keys.
SSL_CIPHERS_MEDIUM Permit only the use of ciphers which use 128 bit long keys.
SSL_CIPHERS_LOW Permit only the use of ciphers which use keys shorter then 128 bits.

Table 3.4.  Constants for cipher selection


Cipher specifications as defined above are sorted by key length, the cipher providing the best key length will be the most preferred.

3.2.6. Enabling STARTTLS

Starting with version 3.3FR1, Zorp supports the STARTTLS method for encrypting connections. STARTTLS support can be configured separately for the client- and server side using the ssl.client_connection_security and ssl.server_connection_security parameters, respectively. The parameters have the following possible values:

[Note] Note

In Zorp 3.4 LTS, the following proxies support STARTTLS: Ftp proxy (to start FTPS sessions), Smtp proxy.

Name Value
SSL_NONE Disable encryption between Zorp and the peer.
SSL_FORCE_SSL Require encrypted communication between Zorp and the peer.
SSL_ACCEPT_STARTTLS Permit STARTTLS sessions. Currently supported only in the Ftp proxy.

Table 3.5.  Client connection security type.


Name Value
SSL_NONE Disable encryption between Zorp and the peer.
SSL_FORCE_SSL Require encrypted communication between Zorp and the peer.
SSL_FORWARD_STARTTLS Forward STARTTLS requests to the server. Currently supported only in the Ftp proxy.

Table 3.6.  Server connection security type.


[Example] Example 3.1. Configuring FTPS support

This example is a standard FtpProxy with FTPS support enabled.

class FtpsProxy(FtpProxy):
	def config(self):
		self.ssl.client_connection_security = SSL_ACCEPT_STARTTLS
		self.ssl.server_connection_security = SSL_FORWARD_STARTTLS

3.2.7. Keybrigding certificates

Keybridging is a method to let the client see a copy of the server's certificate (or vice versa), allowing it to inspect it and decide about its trustworthiness. Because of proxying the SSL/TLS connection, the client is not able to inspect the certificate of the server directly, therefore Zorp generates a certificate based on the server's certificate on-the-fly. This generated certificate is presented to the client.

3.2.7.1. Procedure – Configuring keybridging

Purpose: 

To configure keybridging in a proxy, complete the following steps.

Steps: 

  1. Create the required keys and CAs.

    1. Generate two local CA certificates. One of them will be used to sign bridging certificates for servers having trusted certificates, the other one for servers with untrusted or self-signed certificates. It is useful to reflect this difference somewhere in the CA's certificates, for example, in their common name (CA_for_Untrusted_certs; CA_for_Trusted_certs). These CA certificates can either be self-signed or signed by a local root CA. The certificate of the CA signing the trusted certificates should be imported to your clients to make the generated certificates 'trusted'. The other CA certificate should not be imported to the clients.

      [Warning] Warning

      IMPORTANT: Do NOT set a password for these CAs, as they have to be accessible automatically by Zorp.

    2. Generate a new certificate. The private key of this keypair will be used in the on-the-fly generated certificates, the public part (DN and similar information) will not be used.

    3. Copy the generated certificate, the CA certificates, and the keys to the firewall, for example, into /etc/zorp/sslbridge/. This directory will be used in the ssl.client_ca_directory option.

      [Note] Note

      If you want to send the root CA of the CA certificates to the clients, also copy the root CA (and any intermediate CA certificates) to this directory.

    4. Create a cache directory to store the keybridged certificates generated by Zorp, for example, /var/lib/zorp/sslbridge/, and make it writable for the zorp user.

      [Note] Note

      Zorp automatically creates a file called serial.txt in the cache directory. If you delete the certificates from the cache, do NOT delete this file. If you accidentally delete it, recreate it, and make sure that it is writable for the zorp user.

  2. Set up a proxy class (for example, a class derived from the HttpProxy class) and set the following attributes with the following values:

    • Instruct Zorp to perform the handshake with the server first: self.ssl.handshake_seq=SSL_HSO_SERVER_CLIENT

      class KeybrideHttpsProxy(HttpProxy):
          def config(self):
              self.ssl.handshake_seq=SSL_HSO_SERVER_CLIENT
    • Enable keybridging. Depending on the direction the keybridging is performed, add the self.ssl.client_keypair_generate or the self.ssl.server_keypair_generate parameter, and set it to TRUE. When the generated certificates are shown to the clients, the self.ssl.client_keypair_generate parameter has to be used. (Actually, if a keypair_generate parameter is set, the proxy will request a keypair from the key_generator class. This class — discussed a bit later — returns either a newly generated keypair, or if its key_file parameter is set, a pregenerated keypair. In this example this latter option will be used.)

      class KeybrideHttpsProxy(HttpProxy):
          def config(self):
              self.ssl.handshake_seq=SSL_HSO_SERVER_CLIENT
              self.ssl.client_keypair_generate = TRUE
    • Configure the key_generator class. Note that the parameters of this class must be added to the proxy as a single line, for example:

      class KeybrideHttpsProxy(HttpProxy):
          def config(self):
              self.ssl.handshake_seq=SSL_HSO_SERVER_CLIENT
              self.ssl.client_keypair_generate = TRUE
              self.ssl.key_generator=X509KeyBridge( \
              key_file="/etc/key.d/Keybridging_cert/key.pem", \
              key_passphrase="", cache_directory="/var/lib/zorp/sslbridge",\
              trusted_ca_files=("/etc/ca.d/certs/0000000070.pem",\
                  "/etc/ca.d/keys/0000000070.pem"),\
              untrusted_ca_files=("/etc/ca.d/certs/0000000069.pem",\
                  "/etc/ca.d/keys/0000000069.pem"))
  3. Create a service and a dispatcher using the modified proxy class. Use the previously defined proxy class in your Service definition, set up service and access control properties as usual.

  4. Restart Zorp.

    Expected result: 

    Every time the client connects to a previously unknown host, a new certificate will be generated, signed by one of the CAs specified above. This new certificate will be stored under /var/lib/zorp/sslbridge under a filename based on the original server certificate. It will also be shown to the client as the server certificate, and assuming the signer CA is trusted, the client (browser or other application) will not warn about untrusted certificates in any way. If the certificate is signed by the CA for untrusted certificates, the application will not recognize the issuer CA (since its certificate has not been imported to the client) and give a warning to the user. The user can then decide whether the certificate can be accepted or not.

    (Actually, two files are stored on the firewall for each certificate: the original certificate received from the server, and the generated certificate. When a client connects to the server, the certificate provided by the server is compared to the stored one: if the two does not match, a new certificate is generated. This happens for example if the server certificate has been expired and refreshed.)

3.3. Related standards

  • The SSL protocol is defined by Netscape Ltd. at http://wp.netscape.com/eng/ssl3/ssl-toc.html

  • The TLS protocol is defined in RFC 2246.

3.4. SSL options reference

The SSL options are described in detail in the documentation of the Proxy class. See Section 5.11.4, Class Proxy.

Chapter 4. Proxies

This chapter contains reference information on all the available Zorp proxies.

4.1. General information on the proxy modules

The sections discussing the available proxies are organized as follows. Overall introduction is followed by proxy class descriptions. Each module has an abstract class which is an interface between the policy and the proxy itself. Abstract classes are the point where the low-level attributes implemented by the proxy appear.

Each Python module contains an abstract proxy class (e.g., AbstractFtpProxy) and one or more preconfigured proxy classes derived from the abstract class (e.g., FtpProxy, FtpProxyRO, etc.). These abstract proxies are very low level classes which always require customization to operate at all, thus they are not directly usable. The preconfigured classes customize the base abstract proxy to perform actually useful functionality. These derived classes inherit all their attributes from the class they were derived from, but have some of their parameters set to default values. Consequently, they can be used for certain tasks without any (or only minimal) modification. Most default classes were derived directly from the abstract classes, but it is possible to derive a class from another derived class. In this case this new class inherits the attributes from its parent class and the abstract class as well. Abstract classes should not be used directly for configuring services in Zorp, always derive an own class and modify its attributes to suit the requirements.

4.2. Attribute values

The description of each abstract class includes a detailed list and definition of the attributes of the proxy class. The type and default value of the attribute is also provided. Most types of the attributes (e.g., integer, string, boolean, etc.) are self-explanatory; more complicated attributes (listed as complex type) are explained in their respective description or in the general proxy behavior section of the module.

Proxy attributes can be available and modified during configuration time, run time, or both. Configuration time attributes are set and modified when the proxy is configured, that is, when the session starts. Run time attributes are available when the connection is active, for example, information about the HTTP header being processed is available only when the header is processed. Access to the attributes is indicated in the header of the description of the attribute in the following format: availability during configuration time : availability during run time. The type of availability can be read (r) access, write (w) access, both, or not available (n/a). An attribute that is available for reading and writing during both configuration and run time is indicated as rw:rw, an attribute that is available only for reading during run time is indicated as n/a:r.

[Note] Note

Unless noted otherwise, default values related to lengths (e.g., line length, etc.) are in bytes.

Timeout values are always given in milliseconds. Setting a timeout to -1 disables the timeout (i.e. it becomes unlimited).

The description of every proxy class includes a list or textual description of the attributes modified relative to their parent class. The values of the other attributes are inherited from the parent class.

4.3. Examples

A number of Python code samples is provided for the proxies to illustrate both their general operation and their capabilities. Most of the proxy configurations shown in the examples can be easily reproduced using the ZMC graphical interface. However, some of them utilize the advanced flexibility of Zorp and therefore require the use of configuration scripts written in Python. From ZMC these can be implemented, maintained and edited using the Class editor. (The Class editor is available under the Proxies tab of the Zorp ZMC component. When creating a new class, click on the Class editor button under the list of available classes.)

4.4. List of the proxies available in Zorp

Module Description
Finger Proxy for the Finger User Information Protocol.
Ftp Proxy for the File Transfer Protocol.
Http Proxy for the HyperText Transfer Protocol.
Imap Proxy for the Internet Message Access Protocol.
Ldap Proxy for the Lightweight Directory Access Protocol.
Lp Proxy for the Line Printer Daemon Protocol.
Mime Proxy for inspecting Multipurpose Internet Mail Extensions objects.
MSRpc Proxy for the Microsoft version of the DCE Remote Procedure Call protocol.
Nntp Proxy for the Network News Transfer Protocol.
Plug Proxy for transferring data without protocol inspection.
Pop3 Proxy for the Post Office Protocol version 3.
Radius Proxy for the Remote Authentication Dial In User Service.
Rdp Proxy for the Microsoft Remote Desktop Protocol.
Rsh Proxy for the Remote shell protocol.
Sip Proxy for the Session Initiation Protocol.
Smtp Proxy for the Simple Mail Transport Protocol.
Socks Proxy for the SOCKS protocol
SQLNet Proxy for communicating with Oracle database servers.
Ssh Proxy for the Secure Shell (SSH) v2 protocol.
Telnet Proxy for the Telnet protocol.
TFtp Proxy for the Trivial File Transfer Protocol.
Vnc Proxy for the VNC protocol
Whois Proxy for the Whois information lookup protocol.
X11 Proxy for the X11 protocol.
Xmlsec Proxy for the SOAP protocol

Table 4.1. List of Zorp proxies


4.5. Module Finger

The Finger module defines the classes constituting the proxy for the Finger protocol.

4.5.1. The Finger protocol

Finger is a request/response based User Information Protocol using port TCP/79. The client opens a connection to the remote machine to initiate a request. The client sends a one line query based on the Finger query specification and waits for the answer. A remote user information program (RUIP) processes the query, returns the result and closes the connection. The response is a series of lines consisting of printable ASCII closed carriage return-line feed (CRLF, ASCII13, ASCII10). After receiving the answer the client closes the connection as well.

The following queries can be used:

  • <CRLF> This is a simple query listing all users logged in to the remote machine.

  • USERNAME<CRLF> A query to request all available information about the user USERNAME.

  • USERNAME@HOST1<CRLF> Request the RUIP to forward the query to HOST1. The response to this query is all information about the user USERNAME available at the remote computer HOST1.

  • USERNAME@HOST1@HOST2<CRLF> Request HOST1 to forward the query to HOST2. The response to this query is all information about the user USERNAME available at the remote computer HOST2.

4.5.2. Proxy behavior

Finger is a module built for parsing messages of the Finger protocol. It reads the QUERY at the client side, parses it and - if the local security policy permits - sends it to the server. When the RESPONSE arrives it processes the RESPONSE and sends it back to the client. It is possible to prepend and/or append a string to the response. Requests can also be manipulated in various ways using the fingerRequest function, which is called by the proxy if it is defined.

Length of the username, the line and the hostname can be limited by setting various attributes. Finger proxy also has the capability of limiting the number of hosts in a request, e.g.: finger user@domain@server normally results in fingering 'user@domain' performed by the host 'server'. By default, the proxy removes everything after and including the first '@' character. This behavior can be modified by setting the max_hop_count attribute to a non-zero value.

[Example] Example 4.1. Controlling the number of max hops
def MyFingerProxy(FingerProxy):
	def config(self):
		FingerProxy.config(self)
		self.max_hop_count = 2
		self.timeout = 30

4.5.3. Related standards

  • The Finger User Information Protocol is described in RFC 1288.

4.5.4. Classes in the Finger module

Class Description
AbstractFingerProxy Class encapsulating the abstract Finger proxy.
FingerProxy Class encapsulating the default Finger proxy.

Table 4.2. Classes of the Finger module


4.5.5. Class AbstractFingerProxy

This proxy implements the Finger protocol as specified in RFC 1288.

4.5.5.1. Attributes of AbstractFingerProxy

max_hop_count (integer, rw:r)
Default: 0
Maximum number of '@' characters in the request. Any text after the last allowed '@' character is stripped from the request.

max_hostname_length (integer, rw:r)
Default: 30
Maximum number of characters in a single name of the hostname chain.

max_line_length (integer, rw:r)
Default: 132
Maximum number of characters in a single line in requests and responses.

max_username_length (integer, rw:r)
Default: 8
Maximum length of the username in a request.

request_detailed (integer, n/a:rw)
Default: n/a
Indicates if multi-line formatting request (/W prefix) was sent by the client (-l parameter). Request for multi-line formatting can be added/removed by the proxy during the fingerRequest event.

request_hostnames (string, n/a:rw)
Default: n/a
The hostname chain. The hostname chain can be modified by the proxy during the fingerRequest event.

request_username (string, n/a:rw)
Default: n/a
The username to be queried. The username can be modified by the proxy during the fingerRequest event.

response_footer (string, rw:rw)
Default:
String to be appended by the proxy to each finger response.

response_header (string, n/a:rw)
Default: ""
String to be prepended by the proxy to each finger response.

strict_username_check (boolean, rw:r)
Default: TRUE
If enabled (TRUE), only requests for usernames containing alphanumeric characters and underscore [a-zA-Z0-9_] are allowed.

timeout (integer, rw:r)
Default: n/a
Timeout value for the request in milliseconds.

4.5.5.2. AbstractFingerProxy methods

Method Description
fingerRequest(self, username, hostname) Function processing finger requests.

Table 4.3. Method summary


Method fingerRequest(self, username, hostname)

Arguments of fingerRequest
hostname (unknown, n/a:n/a)
Default: n/a
Destination hosts of the finger request.

username (unknown, n/a:n/a)
Default: n/a
Username to be fingered.

This function is called by the Finger proxy to process requests. It can also modify request-specific attributes.

4.5.6. Class FingerProxy

Simple FingerProxy based on AbstractFingerProxy.

4.6. Module Ftp

The Ftp module defines the classes constituting the proxy for the File Transfer Protocol (FTP).

4.6.1. The FTP protocol

File Transfer Protocol (FTP) is a protocol to transport files via a reliable TCP connection between a client and a server. FTP uses two reliable TCP connections to transfer files: a simple TCP connection (usually referred to as the Control Channel) to transfer control information and a secondary TCP connection (usually referred to as the Data Channel) to perform the data transfer. It uses a command/response based approach, i.e. the client issues a command and the server responds with a 3-digit status code and associated status information in text format. The Data Channel can be initiated either from the client or the server; the Control Channel is always started from the client.

The client is required to authenticate itself before other commands can be issued. This is performed using the USER and PASS commands specifying username and password, respectively.

4.6.1.1. Protocol elements

The basic protocol is as follows: the client issues a request (also called command in FTP terminology) and the server responds with the result. Both commands and responses are line based: commands are sent as complete lines starting with a keyword identifying the operation to be performed. A response spans one or more lines, each specifying the same 3-digit status code and possible explanation.

4.6.1.2. Data transfer

Certain commands (for example RETR, STOR or LIST) also have a data attachment which is transferred to the peer. Data attachments are transferred in a separate TCP connection. This connection is established on-demand on a random, unprivileged port when a data transfer command is issued.

Endpoint information of this data channel is exchanged via the PASV and PORT commands, or their newer equivalents (EPSV and EPRT).

The data connection can either be initiated by the client (passive mode) or the server (active mode). In passive mode (PASV or EPSV command) the server opens a listening socket and sends back the endpoint information in the PASV response. In active mode (PORT or EPRT command) the client opens a listening socket and sends its endpoint information as the argument of the PORT command. The source port of the server is usually either 20, or the port number of the Command Channel minus one.

[Example] Example 4.2. FTP protocol sample
220 FTP server ready
USER account
331 Password required.
PASS password
230 User logged in.
SYST
215 UNIX Type: L8
PASV
227 Entering passive mode (192,168,1,1,4,0)
LIST
150 Opening ASCII mode data connection for file list
226-Transferring data in separate connection complete.
226 Quotas off
QUIT
221 Goodbye

4.6.2. Proxy behavior

FtpProxy is a module built for parsing commands of the Control Channel in the FTP protocol. It reads the REQUEST at the client side, parses it and - if the local security policy permits - sends it to the server. The proxy parses the arriving RESPONSES and sends them to the client if the policy permits that. FtpProxy uses a PlugProxy to transfer the data arriving in the Data Channel. The proxy is capable of manipulating commands and stacking further proxies (e.g.: MimeProxy) into the Data Channel. Both transparent and non-transparent modes are supported.

The default low-level proxy implementation (AbstractFtpProxy) denies all requests by default. Different commands and/or responses can be enabled by using one of the several predefined proxy classes which are suitable for most tasks. Alternatively, use of the commands can be permitted individually using different attributes. This is detailed in the following two sections.

4.6.2.1. Configuring policies for FTP commands and responses

Changing the default behavior of commands can be done by using the hash attribute request, indexed by the command name (e.g.: USER or PWD). There is a similar attribute for responses called response, indexed by the command name and the response code. The possible values of these hashes are shown in the tables below. See Section 2.1, Policies for requests and responses for details. When looking up entries of the response attribute hash, the lookup precedence described in Section 2.1.2, Response codes is used.

Action Description
FTP_REQ_ACCEPT Allow the request to pass.
FTP_REQ_REJECT Reject the request with the error message specified in the second optional parameter.
FTP_REQ_POLICY Call the function specified to make a decision about the event. The function receives two parameters: 'self', and 'command'. See Section 2.1, Policies for requests and responses for details.
FTP_REQ_ABORT Terminate the connection.

Table 4.4.  Action codes for commands in FTP


Action Description
FTP_RSP_ACCEPT Allow the response to pass.
FTP_RSP_REJECT Modify the response to a general failure with error message specified in the optional second parameter.
FTP_RSP_POLICY Call the function specified to make a decision about the event. The function receives three parameters: 'self', 'command', and 'answer'. See Section 2.1, Policies for requests and responses for details.
FTP_RSP_ABORT Terminate the connection.

Table 4.5.  Action codes for responses in FTP


[Example] Example 4.3. Customizing FTP to allow only anonymous sessions

This example calls a function called pUser (defined in the example) whenever a USER command is received. All other commands are accepted. The parameter of the USER command (i.e. the username) is examined: if it is 'anonymous' or 'Anonymous', the connection is accepted, otherwise it is rejected.

class AnonFtp(FtpProxy):
	def config(self):
		self.request["USER"] = (FTP_REQ_POLICY, self.pUser)
		self.request["*"] = (FTP_REQ_ACCEPT)

	def pUser(self,command):
		if self.request_parameter == "anonymous" or self.request_parameter == "Anonymous":
			return FTP_REQ_ACCEPT
		return FTP_REQ_REJECT

4.6.2.2. Configuring policies for FTP features and FTPS support

FTP servers send the list of supported features to the clients. For example, proftpd supports the following features: LANG en, MDTM, UTF8, AUTH TLS, PBSZ, PROT, REST STREAM, SIZE. Zorp can change the default behavior of Ftp features using the hash attribute features, indexed by the name of the feature (e.g.: UTF8 or AUTH TLS). The possible actions are shown in the table below. See Section 2.1, Policies for requests and responses for details.

The built-in Ftp proxies of Zorp permit the use of every feature by default.

Action Description
FTP_FEATURE_ACCEPT Forward the availability of the feature from the server to the client.
FTP_FEATURE_DROP Remove the feature from the feature list sent by the server.
FTP_FEATURE_INSERT Add the feature into the list of available features.

Table 4.6.  Policy about enabling FTP features.


Enabling FTPS connections

For FTPS connections to operate correctly, the FTP server and client applications must comply to the FTP Security Extensions (RFC 2228) and Securing FTP with TLS (RFC 4217) RFCs.

For FTPS connections, the AUTH TLS, PBSZ, PROT features must be accepted. Also, STARTTLS support must be properly configured. See Section 3.2, Configuring TLS and SSL encrypted connections for details.

If the proxy is configured to disable encryption between Zorp and the client, the proxy automatically removes the AUTH TLS, PBSZ, PROT features from the list sent by the server.

If STARTTLS connections are accepted on the client side (self.ssl.client_security=SSL_ACCEPT_STARTTLS), but TLS-forwarding is disabled on the server side, the proxy automatically inserts the AUTH TLS, PBSZ, PROT features into the list sent by the server. These features are inserted even if encryption is explicitly disabled on the server side or the server does not support the FEAT command, making one-sided STARTTLS support feasible.

[Warning] Warning

When using inband routing with the FTPS protocol, Zorp compares the server's certificate to its hostname. The subject_alt_name parameter (or the Common Name parameter if the subject_alt_name parameter is empty) of the server's certificate must contain the hostname or the IP address (as resolved from the Zorp host) of the server (e.g., ftp.example.com).

Alternatively, the Common Name or the subject_alt_name parameter can contain a generic hostname, e.g., *.example.com.

Note that if the Common Name of the certificate contains a generic hostname, do not specify a specific hostname or an IP address in the subject_alt_name parameter.

[Note] Note
  • The Zorp Ftp proxy does not support the following FTPS-related commands: REIN, CCC, CDC.

  • STARTTLS is supported in nontransparent scenarios as well.

[Example] Example 4.4. Configuring FTPS support

This example is a standard FtpProxy with FTPS support enabled.

class FtpsProxy(FtpProxy):
	def config(self):
		self.ssl.client_connection_security = SSL_ACCEPT_STARTTLS
		self.ssl.server_connection_security = SSL_FORWARD_STARTTLS

4.6.2.3. Stacking

The available stacking modes for this proxy module are listed in the following table. For additional information on stacking, see Section 2.3.1, Proxy stacking.

Action Description
FTP_STK_DATA Pass the data to the stacked proxy or program.
FTP_STK_NONE No proxy stacked.

Table 4.7.  Stacking policy.


4.6.2.4. Configuring inband authentication

Starting with Zorp 3.3FR1, the Ftp proxy supports inband authentication as well to use the built-in authentication method of the FTP and FTPS protocols to authenticate the client. The authentication itself is performed by the ZAS backend configured for the service.

If the client uses different usernames on ZAS and the remote server (e.g., he uses his own username to authenticate to ZAS, but anonymous on the target FTP server), the client must specify the usernames and passwords in the following format:

Username:

<ftp user>@<proxy user>@<remote site>[:<port>]

Password:

<ftp password>@<proxy password>

Alternatively, all the above information can be specified as the username:

<ftp user>@<proxy user>@<remote site>[:<port>]:<ftp password>@<proxy password>
[Warning] Warning

When using inband routing with the FTPS protocol, Zorp compares the server's certificate to its hostname. The subject_alt_name parameter (or the Common Name parameter if the subject_alt_name parameter is empty) of the server's certificate must contain the hostname or the IP address (as resolved from the Zorp host) of the server (e.g., ftp.example.com).

Alternatively, the Common Name or the subject_alt_name parameter can contain a generic hostname, e.g., *.example.com.

Note that if the Common Name of the certificate contains a generic hostname, do not specify a specific hostname or an IP address in the subject_alt_name parameter.

4.6.3. Related standards

  • The File Transfer Protocol is described in RFC 959.

  • FTP Security Extensions including the FTPS protocol and securing FTP with TLS are described in RFC 2228 and RFC 4217.

4.6.4. Classes in the Ftp module

Class Description
AbstractFtpProxy Class encapsulating the abstract FTP proxy.
FtpProxy Default Ftp proxy based on AbstractFtpProxy.
FtpProxyAnonRO FTP proxy based on AbstractFtpProxy, only allowing read-only access to anonymous users.
FtpProxyAnonRW FTP proxy based on AbstractFtpProxy, allowing full read-write access, but only to anonymous users.
FtpProxyRO FTP proxy based on AbstractFtpProxy, allowing read-only access to any user.
FtpProxyRW FTP proxy based on AbstractFtpProxy, allowing full read-write access to any user.

Table 4.8. Classes of the Ftp module


4.6.5. Class AbstractFtpProxy

This proxy implements the FTP protocol as specified in RFC 959. All traffic and commands are denied by default. Consequently, either customized Ftp proxy classes derived from the abstract class should be used, or one of the predefined classes (e.g.: FtpProxy, FtpProxyRO, etc.).

4.6.5.1. Attributes of AbstractFtpProxy

active_connection_mode (enum, rw:r)
Default: FTP_ACTIVE_MINUSONE
In active mode the server connects the client. By default this must be from Command Channel port minus one (FTP_ACTIVE_MINUSONE). Alternatively, connection can also be performed either from port number 20 (FTP_ACTIVE_TWENTY) or from a random port (FTP_ACTIVE_RANDOM).

buffer_size (integer, rw:r)
Default: 4096
Buffer size for data transfer in bytes.

data_mode (enum, rw:r)
Default: FTP_DATA_KEEP
The type of the FTP connection on the server side can be manipulated: leave it as the client requested (FTP_DATA_KEEP), or force passive (FTP_DATA_PASSIVE) or active (FTP_DATA_ACTIVE) connection.

data_port_max (integer, rw:r)
Default: 41000
On the proxy side, ports equal to or below the value of data_port_max can be allocated as the data channel.

data_port_min (integer, rw:r)
Default: 40000
On the proxy side, ports equal to or above the value of data_port_min can be allocated as the data channel.

features (complex, rw:rw)
Default:
Hash containing the filtering policy for FTP features.

hostname (string, n/a:rw)
Default:
The hostname of the FTP server to connect to, when inband routing is used.

hostport (integer, n/a:rw)
Default:
The port of the FTP server to connect to, when inband routing is used.

masq_address_client (string, rw:r)
Default: ""
IP address of the firewall appearing on the client side. If its value is set, Zorp sends this IP regardless of its true IP (where it is binded). This attribute may be used when network address translation is performed before Zorp.

masq_address_server (string, rw:r)
Default: ""
IP address of the firewall appearing on the server side. If its value is set, Zorp sends this IP regardless of its true IP (where it is binded). This attribute may be used when network address translation is performed before Zorp.

max_continuous_line (integer, rw:r)
Default: 100
Maximum number of answer lines for a command.

max_hostname_length (integer, rw:r)
Default: 128
Maximum length of hostname. Used only in non-transparent mode.

max_line_length (integer, rw:r)
Default: 255
Maximum length of a line that the proxy is allowed to transfer. Requests/responses exceeding this limit are dropped.

max_password_length (integer, rw:r)
Default: 64
Maximum length of the password.

max_username_length (integer, rw:r)
Default: 32
Maximum length of the username.

password (string, n/a:rw)
Default:
The password to be sent to the server.

permit_client_bounce_attack (boolean, rw:rw)
Default: FALSE
If enabled the IP addresses of data channels will not need to match with the IP address of the control channel, permitting the use of FXP while increasing the security risks.

permit_empty_command (boolean, rw:r)
Default: TRUE
Enable transmission of lines without commands.

permit_server_bounce_attack (boolean, rw:rw)
Default: FALSE
If enabled the IP addresses of data channels will not need to match with the IP address of the control channel, permitting the use of FXP while increasing the security risks.

permit_unknown_command (boolean, rw:r)
Default: FALSE
Enable the transmission of unknown commands.

proxy_password (string, n/a:rw)
Default:
The password to be used for proxy authentication given by the user, when inband authentication is used.

proxy_username (string, n/a:rw)
Default:
The username to be used for proxy authentication given by the user, when inband authentication is used.

request (complex, rw:rw)
Default:
Normative policy hash for FTP requests indexed by command name (e.g.: "USER", "PWD" etc.). See also Section 2.1, Policies for requests and responses.

request_command (string, n/a:rw)
Default: n/a
When a request is evaluated on the policy level, this variable contains the requested command.

request_parameter (string, n/a:rw)
Default: n/a
When a request is evaluated on the policy level, this variable contains the parameters of the requested command.

request_stack (complex, rw:rw)
Default:
Hash containing the stacking policy for the FTP commands. The hash is indexed by the FTP command (e.g. RETR, STOR). See also Section 2.3.1, Proxy stacking.

response (complex, rw:rw)
Default:
Normative policy hash for FTP responses indexed by command name and answer code (e.g.: "USER","331"; "PWD","200" etc.). See also Section 2.1, Policies for requests and responses.

response_parameter (string, n/a:rw)
Default:
When a response is evaluated on the policy level, this variable contains answer parameters.

response_status (string, n/a:rw)
Default:
When a response is evaluated on the policy level, this variable contains the answer code.

response_strip_msg (boolean, rw:r)
Default: FALSE
Strip the response message and only send the response code.

strict_port_checking (boolean, rw:rw)
Default: TRUE
If enabled Zorp will strictly check the foreign port: in active mode the server must be connected on port 20, while in any other situation the foreign port must be above 1023.

target_port_range (string, rw:r)
Default: 21
The port where the client can connect through a non-transparent FtpProxy.

timeout (integer, rw:r)
Default: 300000
General I/O timeout in milliseconds. When there is no specific timeout for a given operation, this value is used.

transparent_mode (boolean, rw:r)
Default: TRUE
Specifies if the proxy works in transparent (TRUE) or non-transparent (FALSE) mode.

username (string, n/a:rw)
Default:
The username authenticated to the server.

valid_chars_username (string, rw:r)
Default: a-zA-Z0-9._@
List of the characters accepted in usernames.

4.6.6. Class FtpProxy

A permitting Ftp proxy based on the AbstractFtpProxy, allowing all commands, responses, and features, including unknown ones. The connection is terminated if a response with the answer code 421 is received.

4.6.7. Class FtpProxyAnonRO

FTP proxy based on AbstractFtpProxy, enabling read-only access (i.e. only downloading) to anonymous users (uploads and usernames other than 'anonymous' or 'ftp' are disabled). Commands and return codes are strictly checked, unknown commands and responses are rejected. Every feature is accepted.

The ABOR; ACCT; AUTH; CDUP; CWD; EPRT; EPSV; FEAT; LIST; MODE; MDTM; NLST; NOOP; OPTS; PASV; PASS; PORT; PWD; QUIT; REST; RETR; SIZE; STAT; STRU; SYST; TYPE; and USER commands are permitted, the CLNT; XPWD; MACB commands are rejected.

4.6.8. Class FtpProxyAnonRW

FTP proxy based on AbstractFtpProxy, enabling full read-write access to anonymous users (the 'anonymous' and 'ftp' usernames are permitted). Commands and return codes are strictly checked, unknown commands and responses are rejected. Every feature is accepted.

The ABOR; ACCT; APPE; CDUP; CWD; DELE; EPRT; EPSV; LIST; MKD; MODE; MDTM; NLST; NOOP; OPTS; PASV; PASS; PORT; PWD; QUIT; RMD; RNFR; RNTO; REST; RETR; SIZE; STAT; STOR; STOU; STRU; SYST; TYPE; USER and FEAT commands are permitted, the AUTH; CLNT; XPWD; MACB commands are rejected.

4.6.9. Class FtpProxyRO

FTP proxy based on AbstractFtpProxy, enabling read-only access to any user. Commands and return codes are strictly checked, unknown commands and responses are rejected. Every feature is accepted.

The ABOR; ACCT; AUTH; CDUP; CWD; EPRT; EPSV; FEAT; LIST; MODE; MDTM; NLST; NOOP; OPTS; PASV; PASS; PORT; PWD; QUIT; REST; RETR; SIZE; STAT; STRU; SYST; TYPE; and USER commands are permitted, the CLNT; XPWD; MACB commands are rejected.

4.6.10. Class FtpProxyRW

FTP proxy based on AbstractFtpProxy, enabling full read-write access to any user. Commands and return codes are strictly checked, unknown commands and responses are rejected. Every feature is accepted.

The ABOR; ACCT; AUTH; CDUP; CWD; EPRT; EPSV; FEAT; LIST; MODE; MDTM; NLST; NOOP; OPTS; PASV; PASS; PORT; PWD; QUIT; REST; RETR; SIZE; STAT; STRU; SYST; TYPE; and USER commands are permitted, the CLNT; XPWD; MACB commands are rejected.

4.7. Module Http

The Http module defines the classes constituting the proxy for the HyperText Transfer Protocol (HTTP). HTTP is the protocol the Web is based on, therefore it is the most frequently used protocol on the Internet. It is used to access different kinds of content from the Web. The type of content retrieved via HTTP is not restricted, it can range from simple text files to hypertext files and multimedia formats like pictures, videos or audio files.

4.7.1. The HTTP protocol

HTTP is an open application layer protocol for hypermedia information systems. It basically allows an open-ended set of methods to be applied to resources identified by Uniform Resource Identifiers (URIs).

4.7.1.1. Protocol elements

HTTP is a text based protocol where a client sends a request comprising of a METHOD, an URI and associated meta information represented as MIME-like headers, and possibly a data attachment. The server responds with a status code, a set of headers, and possibly a data attachment. Earlier protocol versions perform a single transaction in a single TCP connection, HTTP/1.1 introduces persistency where a single TCP connection can be reused to perform multiple transactions.

An HTTP method is a single word - usually spelled in capitals - instructing the server to apply a function to the resource specified by the URI. Commonly used HTTP methods are "GET", "POST" and "HEAD". HTTP method names are not restricted in any way, other HTTP based protocols (such as WebDAV) add new methods to the protocol while keeping the general syntax intact.

Headers are part of both the requests and the responses. Each header consists of a name followed by a colon (':') and a field value. These headers are used to specify content-specific and protocol control information.

The response to an HTTP request starts with an HTTP status line informing the client about the result of the operation and an associated message. The result is represented by three decimal digits, the possible values are defined in the HTTP RFCs.

4.7.1.2. Protocol versions

The protocol has three variants, differentiated by their version number. Version 0.9 is a very simple protocol which allows a simple octet-stream to be transferred without any meta information (e.g.: no headers are associated with requests or responses).

Version 1.0 introduces MIME-like headers in both requests and responses; headers are used to control both the protocol (e.g.: the "Connection" header) and to give information about the content being transferred (e.g.: the "Content-Type" header). This version has also introduced the concept of name-based virtual hosts.

Building on the success of HTTP/1.0, version 1.1 of the protocol adds persistent connections (also referred to as "connection keep-alive") and improved proxy control.

4.7.1.3. Bulk transfer

Both requests and responses might have an associated data blob, also called an entity in HTTP terminology. The size of the entity is determined using one of three different methods:

  1. The complete size of the entity is sent as a header (the Content-Length header).

  2. The transport layer connection is terminated when transfer of the blob is completed (used by HTTP/0.9 and might be used in HTTP/1.1 in non-persistent mode).

  3. Instead of specifying the complete length, smaller chunks of the complete blob are transferred, and each chunk is prefixed with the size of that specific chunk. The end of the stream is denoted by a zero-length chunk. This mode is also called chunked encoding and is specified by the Transfer-Encoding header.

[Example] Example 4.5. Example HTTP transaction
GET /index.html HTTP/1.1
Host: www.example.com
Connection: keep-alive
User-Agent: My-Browser-Type 6.0

HTTP/1.1 200 OK
Connection: close
Content-Length: 14

<html>
</html>

4.7.2. Proxy behavior

The default low-level proxy implementation (AbstractHttpProxy) denies all requests by default. Different requests and/or responses can be enabled by using one of the several predefined proxy classes which are suitable for most tasks. Alternatively, a custom proxy class can be derived from AbstractHttpProxy and the requests and responses enabled individually using different attributes.

Several examples and considerations on how to enable virus filtering in the HTTP traffic are discussed in the Technical White Paper and Tutorial Virus filtering in HTTP, available at the BalaBit Documentation Page http://www.balabit.com/support/documentation/.

4.7.2.1. Transparent and non-transparent modes

HttpProxy is able to operate both in transparent and non-transparent mode. In transparent mode, the client does not notice (or even know) that it is communicating through a proxy. The client communicates using normal server-style requests.

In non-transparent mode, the address and the port of the proxy server must be set on the client. In this case the client sends proxy-style requests to the proxy.

[Example] Example 4.6. Proxy style HTTP query
GET http://www.example.com/index.html HTTP/1.1
Host: www.example.com
Connection: keep-alive
User-Agent: My-Browser-Type 6.0

HTTP/1.1 200 OK
Connection: close
Content-Length: 14

<html>
</html>

In non-transparent mode it is possible to request the use of the SSL protocol through the proxy, which means the client communicates with the proxy using the HTTP protocol, but the proxy uses HTTPS to communicate with the server. This technique is called data tunneling.

[Example] Example 4.7. Data tunneling with connect method
CONNECT www.example.com:443 HTTP/1.1
Host: www.example.com
User-agent: My-Browser-Type 6.0

HTTP/1.0 200 Connection established
Proxy-agent: My-Proxy/1.1

4.7.2.2. Configuring policies for HTTP requests and responses

Changing the default behavior of requests is possible using the request attribute. This hash is indexed by the HTTP method names (e.g.: GET or POST). The response attribute (indexed by the request method and the response code) enables the control of HTTP responses. The possible actions are described in the following tables. See also Section 2.1, Policies for requests and responses. When looking up entries of the response attribute hash, the lookup precedence described in Section 2.1.2, Response codes is used.

Action Description
HTTP_REQ_ACCEPT

Allow the request to pass.

HTTP_REQ_REJECT

Reject the request. The reason for the rejection can be specified in the optional second argument.

HTTP_REQ_ABORT

Terminate the connection.

HTTP_REQ_DENY

Same as HTTP_REQ_ABORT.

HTTP_REQ_POLICY

Call the function specified to make a decision about the event. The function receives four arguments: self, method, url, version. See Section 2.1, Policies for requests and responses for details.

Table 4.9.  Action codes for HTTP requests


Action Description
HTTP_RSP_ACCEPT Allow the response to pass.
HTTP_RSP_DENY Reject the response and return a policy violation page to the client.
HTTP_RSP_ABORT Same as HTTP_RSP_DENY.
HTTP_RSP_REJECT Reject the response and return a policy violation page to the client, with error information optionally specified as the second argument.
HTTP_RSP_POLICY Call the function specified to make a decision about the event. The function receives five parameters: self, method, url, version, response. See Section 2.1, Policies for requests and responses for details.

Table 4.10.  Action codes for HTTP responses


[Example] Example 4.8. Implementing URL filtering in the HTTP proxy

This example calls the filterURL function (defined in the example) whenever a HTTP GET request is received. If the requested URL is 'http://www.disallowedsite.com', the request is rejected and an error message is sent to the client.

class DmzHTTP(HttpProxy):
        def config(self):
                HttpProxy.config(self)
                self.request["GET"] = (HTTP_REQ_POLICY, self.filterURL)

        def filterURL(self, method, url, version):
                if (url == "http://www.disallowedsite.com"):
                        self.error_info = 'Access of this content is denied by the local policy.'
                        return HTTP_REQ_REJECT
                return HTTP_REQ_ACCECT
[Example] Example 4.9. 404 response filtering in HTTP

In this example the 404 response code to GET requests is rejected, and a custom error message is returned to the clients instead.

class DmzHTTP(HttpProxy):
        def config(self):
                HttpProxy.config(self)
                self.response["GET", "404"] = (HTTP_RSP_POLICY, self.filter404)

        def filter404(self, method, url, version, response):
                self.error_status = 404
                self.error_info = "Requested page was not accessible."
                return HTTP_RSP_REJECT

4.7.2.3. Configuring policies for HTTP headers

Both request and response headers can be modified by the proxy during the transfer. New header lines can be inserted, entries can be modified or deleted. To change headers in the requests and responses use the request_header hash or the response_header hash, respectively.

Similarly to the request hash, these hashes are indexed by the header name (like "User-Agent") and contain an actiontuple describing the action to take.

By default, the proxy modifies only the "Host", "Connection", "Proxy-Connection" and "Transfer-Encoding" headers. "Host" headers need to be changed when the proxy modifies the URL; "(Proxy-)Connection" is changed when the proxy turns connection keep-alive on/off; "Transfer-Enconding" is changed to enable chunked encoding.

Action Description
HTTP_HDR_ABORT Terminate the connection.
HTTP_HDR_ACCEPT Accept the header.
HTTP_HDR_DROP Remove the header.
HTTP_HDR_POLICY Call the function specified to make a decision about the event. The function receives three parameters: self, hdr_name, and hdr_value.
HTTP_HDR_CHANGE_NAME Rename the header to the name specified in the second argument.
HTTP_HDR_CHANGE_VALUE Change the value of the header to the value specified in the second argument.
HTTP_HDR_CHANGE_BOTH Change both the name and value of the header to the values specified in the second and third arguments, respectively.
HTTP_HDR_INSERT Insert a new header defined in the second argument.
HTTP_HDR_REPLACE Remove all existing occurrences of a header and replace them with the one specified in the second argument.

Table 4.11.  Action codes for HTTP headers


[Example] Example 4.10. Header filtering in HTTP

The following example hides the browser used by the client by replacing the value of the User-Agent header to Lynx in all requests. The use of cookies is disabled as well.

class MyHttp(HttpProxy):
        def config(self):
                HttpProxy.config(self)
                self.request_header["User-Agent"] = (HTTP_HDR_CHANGE_VALUE, "Lynx 2.4.1")
                self.request_header["Cookie"] = (HTTP_HDR_POLICY, self.processCookies)
                self.response_header["Set-Cookie"] = (HTTP_HDR_DROP,)

        def processCookies(self, name, value):
                # You could change the current header in self.current_header_name
                # or self.current_header_value, the current request url is
                # in self.request_url
                return HTTP_HDR_DROP

4.7.2.4. Redirecting URLs

URLs or sets of URLs can be easily rejected or redirected to a local mirror by modifying some attributes during request processing.

When an HTTP request is received, normative policy chains are processed (self.request, self.request_header). Policy callbacks for certain events can be configured with the HTTP_REQ_POLICY or HTTP_HDR_POLICY directives. Any of these callbacks may change the request_url attribute, instructing the proxy to fetch a page different from the one specified by the browser. Please note that this is transparent to the user and does not change the URL in the browser.

[Example] Example 4.11. URL redirection in HTTP proxy

This example redirects all HTTP GET requests to the 'http://www.balabit.com/' URL by modifying the value of the requested URL.

class MyHttp(HttpProxy):
        def config(self):
                HttpProxy.config(self)
                self.request["GET"] = (HTTP_REQ_POLICY, self.filterURL)

        def filterURL(self, method, url, version):
                self.request_url = "http://www.balabit.com/"
                return HTTP_REQ_ACCEPT
[Example] Example 4.12. Redirecting HTTP to HTTPS

This example redirects all incoming HTTP connections to an HTTPS URL.

class HttpProxyHttpsredirect(HttpProxy):
        def config(self):
                HttpProxy.config(self)
                self.error_silent = TRUE
                self.request["GET"] = (HTTP_REQ_POLICY, self.reqRedirect)

        def reqRedirect(self, method, url, version):
                self.error_status = 301
                #self.error_info = 'HTTP/1.0 301 Moved Permanently'
                self.error_headers="Location: https://%s/" % self.request_url_host
                return HTTP_REQ_REJECT

4.7.2.5. Request types

Zorp differentiates between two request types: server requests and proxy request. Server requests are sent by browsers directly communicating with HTTP servers. These requests include an URL relative to the server root (e.g.: /index.html), and a 'Host' header indicating which virtual server to use.

Proxy requests are used when the browser communicates with an HTTP proxy. These requests include a fully specified URL (e.g.: http://www.example.com/index.html).

As there is no clear distinction between the two request types, the type of the request cannot always be accurately detected automatically, though all common cases are covered.

Requests are handled differently in transparent and non-transparent modes.

A transparent HTTP proxy (transparent_mode attribute is TRUE) is meant to be installed in front of a network where clients do not know about the presence of the firewall. In this case the proxy expects to see server type requests only. If clients communicate with a real HTTP proxy through the firewall, proxy type requests must be explicitly enabled using the permit_proxy_requests attribute, or transparent mode has to be used.

The use of non-transparent HTTP proxies (transparent_mode attribute is FALSE) must be configured in web browsers behind the firewall. In this case Zorp expects proxy requests only, and emits server requests (assuming parent_proxy is not set).

4.7.2.6. Using parent proxies

Parent proxies are non-transparent HTTP proxies used behind Zorp. Two things have to be set in order to use parent proxies. First, select a router which makes the proxy connect to the parent proxy, this can be either InbandRouter() or DirectedRouter(). Second, set the parent_proxy and parent_proxy_port attributes in the HttpProxy class. Setting these attributes results in proxy requests to be emitted to the target server both in transparent and non-transparent mode.

The parent proxy attributes can be set both in the configuration phase (e.g.: config() event), or later on a per-request basis. This is possible because the proxy re-connects.

[Example] Example 4.13. Using parent proxies in HTTP

In this example the MyHttp proxy class uses a parent proxy. For this the domain name and address of the parent proxy is specified, and a service using an InbandRouter is created.

class MyHttp(HttpProxy):
        def config(self):
                HttpProxy.config(self)
                self.parent_proxy = "proxy.example.com"
                self.parent_proxy_port = 3128

def instance():
        Service("http", MyHttp, router=InbandRouter())
        Listener(SockAddrInet('10.0.0.1', 80), "http")

4.7.2.7. FTP over HTTP

In non-transparent mode it is possible to let Zorp process ftp:// URLs, effectively translating HTTP requests to FTP requests on the fly. This behaviour can be enabled by setting permit_ftp_over_http to TRUE and adding port 21 to target_port_range. Zorp currently supports passive mode transfers only.

4.7.2.8. Error messages

There are cases when the HTTP proxy must return an error page to the client to indicate certain error conditions. These error messages are stored as files in the directory specified by the error_files_directory attribute, and can be customized by changing the contents of the files in this directory.

Each file contains plain HTML text, but some special macros are provided to dynamically add information to the error page. The following macros can be used:

  • @INFO@ -- further error information as provided by the proxy

  • @VERSION@ -- Zorp version number

  • @DATE@ -- current date

  • @HOST@ -- hostname of Zorp

It is generally recommended not to display error messages to untrusted clients, as they may leak confidential information. To turn error messages off, set the error_silent attribute to TRUE, or strip error files down to a minimum.

[Note] Note

The language of the messages can be set using the config.options.language global option, or individually for every Http proxy using the language parameter. See Appendix 4, Global options of Zorp for details.

4.7.2.9. Stacking

HTTP supports stacking proxies for both request and response entities (e.g.: data bodies). This is controlled by the request_stack and response_stack attribute hashes. See also Section 2.3.1, Proxy stacking.

There are two stacking modes available: HTTP_STK_DATA sends only the data portion to the downstream proxy, while HTTP_STK_MIME also sends all header information to make it possible to process the data body as a MIME envelope. Please note that while it is possible to change the data part in the stacked proxy, it is not possible to change the MIME headers - they can be modified only by the HTTP proxy. The possible parameters are listed in the following tables.

Action Description
HTTP_STK_NONE No additional proxy is stacked into the HTTP proxy.
HTTP_STK_DATA The data part of the HTTP traffic is passed to the specified stacked proxy.
HTTP_STK_MIME The data part including header information of the HTTP traffic is passed to the specified stacked proxy.

Table 4.12.  Constants for proxy stacking


Please note that stacking is skipped altogether if there is no body in the message.

4.7.2.10. Webservers returning data in 205 responses

Certain webserver applications may return data entities in 205 responses. This is explicitly prohibited by the RFCs, but Zorp permits such responses for interoperability reasons.

4.7.2.11. URL filtering in HTTP

Starting with version 3.3FR1, Zorp supports category-based URL filtering using a regularly updated database.

Configuring URL-filtering in HTTP

The URLs and domains in the database are organized into thematic categories like adult, news, jobsearch, etc.

To enable url-filtering, set the enable_url_filter and enable_url_filter_dns options to TRUE. The enable_url_filter_dns option is needed only to ensure that a domain or URL is correctly categorized even when it is listed in the database using its domain name, but the client tries to access it with its IP address (or vice-versa).

[Note] Note

URL-filtering is handled by the Zorp Http proxy, without the need of using ZCV. The URL-filtering capability of Zorp is available only after purchasing the url-filter license option.

Updates to the URL database are automatically downloaded daily from the BalaBit website using the zavupdate utility.

Access to specific categories can be set using the url_category option, which is a hash indexed by the name of the category. The following actions are possible:

Action Description
HTTP_URL_ACCEPT

Permit access to the URL.

HTTP_URL_REJECT

Reject the request. The error code and reason for the rejection can be specified in the optional second and third arguments. See Section Configuring URL-filtering in HTTP for details.

HTTP_URL_REDIRECT

Redirect the connection to the URL specified in the second argument.

Table 4.13.  Action codes for URL filtering


[Example] Example 4.14. URL-filtering example

The following example blocks several categories and accepts the rest. For a complete list of categories, see Section List of URL-filtering categories.

class MyHTTPUrlFilter(HttpProxy):
    def config(self):
        HttpProxy.config(self)
        self.enable_url_filter=TRUE
        self.enable_url_filter_dns=TRUE
        self.url_category['adult']=(HTTP_URL_REJECT, (403, "Adult website",))
        self.url_category['porn']=(HTTP_URL_REJECT, (403, "Porn website",))
        self.url_category['malware']=(HTTP_URL_REJECT, (403, "Site contains malware",))
        self.url_category['phishing']=(HTTP_URL_REJECT, (403, "Phishing site",))
        self.url_category['warez']=(HTTP_URL_REJECT, (403, "Warez site",))
        self.url_category['*']=(HTTP_URL_ACCEPT,)

The following example redirects access to online gaming sites to a dummy website.

class MyHTTPUrlFilter(HttpProxy):
    def config(self):
        HttpProxy.config(self)
        self.enable_url_filter=TRUE
        self.enable_url_filter_dns=TRUE
        self.url_category['onlinegames']=(HTTP_URL_REDIRECT, "http://example.com")
        self.url_category['*']=(HTTP_URL_ACCEPT,)
List of URL-filtering categories

The Zorp URL database contains the following thematic categories by default.

  • abortion: Abortion information excluding when related to religion

  • ads: Advert servers and banned URLs

  • adult: Sites containing adult material such as swearing but not porn

  • aggressive: Similar to violence but more promoting than depicting

  • antispyware: Sites that remove spyware

  • artnudes: Art sites containing artistic nudity

  • astrology: Astrology websites

  • audio-video: Sites with audio or video downloads

  • banking: Banking websites

  • beerliquorinfo: Sites with information only on beer or liquors

  • beerliquorsale: Sites with beer or liquors for sale

  • blog: Journal/Diary websites

  • cellphones: stuff for mobile/cell phones

  • chat: Sites with chat rooms etc

  • childcare: Sites to do with childcare

  • cleaning: Sites to do with cleaning

  • clothing: Sites about and selling clothing

  • contraception: Information about contraception

  • culinary: Sites about cooking et al

  • dating: Sites about dating

  • desktopsillies: Sites containing screen savers, backgrounds, cursers, pointers, desktop themes and similar timewasting and potentially dangerous content

  • dialers: Sites with dialers such as those for pornography or trojans

  • drugs: Drug related sites

  • ecommerce: Sites that provide online shopping

  • entertainment: Sites that promote movies, books, magazine, humor

  • filehosting: Sites to do with filehosting

  • frencheducation: Sites to do with french education

  • gambling: Gambling sites including stocks and shares

  • games: Game related sites

  • gardening: Gardening sites

  • government: Military and schools etc

  • guns: Sites with guns

  • hacking: Hacking/cracking information

  • homerepair: Sites about home repair

  • hygiene: Sites about hygiene and other personal grooming related stuff

  • instantmessaging: Sites that contain messenger client download and web-based messaging sites

  • jewelry: Sites about and selling jewelry

  • jobsearch: Sites for finding jobs

  • kidstimewasting: Sites kids often waste time on

  • mail: Webmail and email sites

  • marketingware: Sites about marketing products

  • medical: Medical websites

  • mixed_adult: Mixed adult content sites

  • mobile-phone: Sites to do with mobile phones

  • naturism: Sites that contain nude pictures and/or promote a nude lifestyle

  • news: News sites

  • onlineauctions: Online auctions

  • onlinegames: Online gaming sites

  • onlinepayment: Online payment sites

  • personalfinance: Personal finance sites

  • pets: Pet sites

  • phishing: Sites attempting to trick people into giving out private information

  • porn: Pornography

  • proxy: Sites with proxies to bypass filters

  • radio: non-news related radio and television

  • religion: Sites promoting religion

  • ringtones: Sites containing ring tones, games, pictures and other

  • searchengines: Search engines such as google

  • sect: Sites about religious groups

  • sexuality: Sites dedicated to sexuality, possibly including adult material

  • shopping: Shopping sites

  • socialnetworking: Social networking websites

  • sportnews: Sport news sites

  • sports: All sport sites

  • spyware: Sites who run or have spyware software to download

  • updatesites: Sites where software updates are downloaded from including virus sigs

  • vacation: Sites about going on holiday

  • violence: Sites containing violence

  • virusinfected: Sites who host virus infected files

  • warez: Sites with illegal pirate software

  • weather: Weather news sites and weather related

  • weapons: Sites detailing or selling weapons

  • webmail: Just webmail sites

  • whitelist: Contains site suitable for kids

Customizing the URL database

To customize the database, you have to manually edit the relevant files of the database. The URL database is located on the Zorp hosts under the /etc/zorp/urlfilter/ directory. Every thematic category is subdirectory containing two files called domains and urls. These files contain the list of domains (e.g., example.com) and URLs (e.g., example.com/news/) that fall into the specific category. Optionally, the subdirectory may contain a third file called expressions, where more complex rules can be defined using regular expressions.

  • To to allow access (whitelist) to a domain or URL, add it to the domains or urls file of the whitelist category. Do not forget to configure your Http proxies to permit access to the domains of the whitelist category.

    [Warning] Warning

    Deleting a domain from a category is not equivalent to whitelisting. Deleted domains will be re-added to their original category after the next database update.

  • To add a new URL or domain to an existing category, create a new subdirectory under /etc/zorp/urlfilter/, create the domains and urls files for this new category, and add the domain or URL (without the http://www. prefix) to the domains or urlsfile. Zorp will automatically add these sites to the specific category after the next daily database update, or when the zufupdate command is executed.

  • To create a new category, create a new subdirectory under /etc/zorp/urlfilter/, create the domains and urls files for this new category, and add domains and URLs to these files. Do not forget to configure your Http proxies to actually use the new category.

[Warning] Warning

Manual changes to the URL database are not applied automatically, they become effective only after the next daily database update, or when the zufupdate command is executed.

[Note] Note

Manual changes are automatically merged with the original database during database updates.

If you are using the URL-filter database on several Zorp hosts and modify the database manually, make sure to copy your changes to the other hosts as well.

4.7.3. Related standards

  • The Hypertext Transfer Protocol -- HTTP/1.1 protocol is described in RFC 2616.

  • The Hypertext Transfer Protocol -- HTTP/1.0 protocol is described in RFC 1945.

4.7.4. Classes in the Http module

Class Description
AbstractHttpProxy Class encapsulating the abstract HTTP proxy.
HttpProxy Default HTTP proxy based on AbstractHttpProxy.
HttpProxyNonTransparent HTTP proxy based on HttpProxy, operating in non-transparent mode.
HttpProxyURIFilter HTTP proxy based on HttpProxy, with URI filtering capability.
HttpProxyURIFilterNonTransparent HTTP proxy based on HttpProxyURIFilter, with URI filtering capability and permitting non-transparent requests.
HttpWebdavProxy HTTP proxy based on HttpProxy, allowing WebDAV extensions.
NontransHttpWebdavProxy HTTP proxy based on HttpProxyNonTransparent, allowing WebDAV extension in non-transparent requests.

Table 4.14. Classes of the Http module


4.7.5. Class AbstractHttpProxy

This class implements an abstract HTTP proxy - it serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractHttpProxy, or one of the predefined proxy classes, such as HttpProxy or HttpProxyNonTransparent. AbstractHttpProxy denies all requests by default.

4.7.5.1. Attributes of AbstractHttpProxy

auth_by_cookie (boolean, rw:r)
Default: FALSE
Authentication informations for one-time-password mode is organized by a cookie not the address of the client.

auth_cache_time (integer, rw:r)
Default: 0
Caching authentication information this amount of seconds.

auth_cache_update (boolean, rw:r)
Default: FALSE
Update authentication cache by every connection.

auth_forward (boolean, rw:rw)
Default: FALSE
Controls whether inband authentication information (username and password) should be forwarded to the upstream server. When a parent proxy is present, the incoming authentication request is put into a 'Proxy-Authorization' header. In other cases the 'WWW-Authorization' header is used.

auth_realm (string, w:r)
Default: "Zorp HTTP auth"
The name of the authentication realm to be presented to the user in the dialog window during inband authentication.

buffer_size (integer, rw:r)
Default: 1500
Size of the I/O buffer used to transfer entity bodies.

connect_proxy (class, rw:rw)
Default: PlugProxy
For CONNECT requests the HTTP proxy starts an independent proxy to control the internal protocol. The connect_proxy attribute specifies which proxy class is used for this purpose.

connection_mode (enum, n/a:rw)
Default: n/a
This value reflects the state of the session. If the value equals to 'HTTP_CONNECTION_CLOSE', the session will be closed after serving the current request. Otherwise, if the value is 'HTTP_CONNECTION_KEEPALIVE' another request will be fetched from the client. This attribute can be used to forcibly close a keep-alive connection.

current_header_name (string, n/a:rw)
Default: n/a
Name of the header. It is defined when the header is processed, and can be modified by the proxy to actually change a header in the request or response.

current_header_value (string, n/a:rw)
Default: n/a
Value of the header. It is defined when the header is processed, and can be modified by the proxy to actually change the value of the header in the request or response.

default_port (integer, rw:rw)
Default: 80
This value is used in non-transparent mode when the requested URL does not contain a port number. The default should be 80, otherwise the proxy may not function properly.

enable_url_filter (boolean, rw:r)
Default: FALSE
Enables URL filtering in HTTP requests. See Section 4.7.2.11, URL filtering in HTTP for details. Note that URL filtering requires the url-filter license option.

enable_url_filter_dns (boolean, rw:r)
Default: FALSE
Enables DNS- and reverse-DNS resolution to ensure that a domain or URL is correctly categorized even when it is listed in the database using its domain name, but the client tries to access it with its IP address (or vice-versa). See Section 4.7.2.11, URL filtering in HTTP for details. Note that URL filtering requires the url-filter license option.

error_files_directory (string, rw:rw)
Default: "/usr/share/zorp/http"
Location of HTTP error messages.

error_headers (string, n/a:rw)
Default: n/a
A string included as a header in the error response. The string must be a valid header and must end with a " " sequence.

error_info (string, n/a:rw)
Default: n/a
A string to be included in error messages.

error_msg (string, n/a:rw)
Default: n/a
A string used as an error message in the HTTP status line.

error_silent (boolean, rw:rw)
Default: FALSE
Turns off verbose error reporting to the HTTP client (makes firewall fingerprinting more difficult).

error_status (integer, rw:rw)
Default: 500
If an error occurs, Zorp uses this value as the status code of the HTTP response it generates.

keep_persistent (boolean, rw:r)
Default: FALSE
Try to keep the connection to the client persistent even if the server does not support it.

language (string, rw:r)
Default: en
Specifies the language of the HTTP error pages displayed to the client. English (en) is the default. Other supported languages: de (German); hu (Hungarian).

max_auth_time (integer, rw:rw)
Default: 0
Request password authentication from the client, invalidating cached one-time-passwords. If the time specified (in seconds) in this attribute expires, Zorp requests a new authentication from the client browser even if it still has a password cached.

max_body_length (integer, rw:rw)
Default: 0
Maximum allowed length of an HTTP request or response body. The default "0" value means that the length of the body is not limited.

max_chunk_length (integer, rw:rw)
Default: 0
Maximum allowed length of a single chunk when using chunked transfer-encoding. The default "0" value means that the length of the chunk is not limited.

max_header_lines (integer, rw:rw)
Default: 50
Maximum number of header lines allowed in a request or response.

max_hostname_length (integer, rw:rw)
Default: 256
Maximum allowed length of the hostname field in URLs.

max_keepalive_requests (integer, rw:rw)
Default: 0
Maximum number of requests allowed in a single session. If the number of requests in the session the reaches this limit, the connection is terminated. The default "0" value allows unlimited number of requests.

max_line_length (integer, rw:r)
Default: 4096
Maximum allowed length of lines in requests and responses. This value does not affect data transfer, as data is transmitted in binary mode.

max_url_length (integer, rw:rw)
Default: 4096
Maximum allowed length of an URL in a request. Note that this directly affects forms using the 'GET' method to pass data to CGI scripts.

parent_proxy (string, rw:rw)
Default: ""
The address or hostname of the parent proxy to be connected. Either DirectedRouter or InbandRouter has to be used when using parent proxy.

parent_proxy_port (integer, rw:rw)
Default: 3128
The port of the parent proxy to be connected.

permit_both_connection_headers (boolean, rw:r)
Default: FALSE
Some clients send both a Connection and a Proxy-Connection header, which are used by Zorp to automatically detect what kind of connection Zorp receives. This situation is forbidden in Zorp by default but can be enabled by setting this attribute to TRUE.

permit_ftp_over_http (boolean, rw:r)
Default: FALSE
Allow processing FTP URLs in non-transparent mode.

permit_http09_responses (boolean, rw:r)
Default: TRUE
Allow server responses to use the limited HTTP/0.9 protocol. As these responses carry no control information, verifying the validity of the protocol stream is impossible. This does not pose a threat to web clients, but exploits might pass undetected if this option is enabled for servers. It is recommended to turn this option off for protecting servers and only enable it when Zorp is used in front of users.

permit_invalid_hex_escape (boolean, rw:r)
Default: FALSE
Allow invalid hexadecimal escaping in URLs (% must be followed by two hexadecimal digits).

permit_null_response (boolean, rw:r)
Default: TRUE
Permit RFC incompliant responses with headers not terminated by CRLF and not containing entity body.

permit_proxy_requests (boolean, rw:r)
Default: FALSE
Allow proxy-type requests in transparent mode.

permit_server_requests (boolean, rw:r)
Default: TRUE
Allow server-type requests in non-transparent mode.

permit_unicode_url (boolean, rw:r)
Default: FALSE
Allow unicode characters in URLs encoded as %u. This is an IIS extension to HTTP, UNICODE (UTF-7, UTF-8 etc.) URLs are forbidden by the RFC as default.

request (complex, rw:rw)
Default: empty
Normative policy hash for HTTP requests indexed by the HTTP method (e.g.: "GET", "PUT" etc.). See also Section 4.7.2.2, Configuring policies for HTTP requests and responses.

request_count (integer, n/a:r)
Default: 0
The number of keepalive requests within the session.

request_header (complex, rw:rw)
Default: empty
Normative policy hash for HTTP header requests indexed by the header names (e.g.: "Set-cookie"). See also Section 4.7.2.3, Configuring policies for HTTP headers.

request_method (string, n/a:r)
Default: n/a
Request method (GET, POST, etc.) sent by the client.

request_mime_type (string, n/a:r)
Default: n/a
The MIME type of the request entity. Its value is only defined when the request is processed.

request_stack (complex, rw:rw)
Default: n/a
Attribute containing the request stacking policy: the hash is indexed based on method names (e.g.: GET). See Section 4.7.2.9, Stacking.

request_url (string, n/a:rw)
Default: n/a
The URL requested by the client. It can be modified to redirect the current request.

request_url_file (string, n/a:r)
Default: n/a
Filename specified in the URL.

request_url_host (string, n/a:r)
Default: n/a
Remote hostname in the URL.

request_url_passwd (string, n/a:r)
Default: n/a
Password in the URL (if specified).

request_url_port (integer, n/a:r)
Default: n/a
Port number as specified in the URL.

request_url_proto (string, n/a:r)
Default: n/a
Protocol specifier of the URL. This attribute is an alias for request_url_scheme.

request_url_scheme (string, n/a:r)
Default: n/a
Protocol specifier of the URL (http://, ftp://, etc.).

request_url_username (string, n/a:r)
Default: n/a
Username in the URL (if specified).

require_host_header (boolean, rw:r)
Default: TRUE
Require the presence of the Host header. If set to FALSE, the real URL cannot be recovered from certain requests, which might cause problems with URL filtering.

rerequest_attempts (integer, rw:rw)
Default: 0
Controls the number of attempts the proxy takes to send the request to the server. In case of server failure, a reconnection is made and the complete request is repeated along with POST data.

reset_on_close (boolean, rw:rw)
Default: FALSE
Whenever the connection is terminated without a proxy generated error message, send an RST instead of a normal close. Causes some clients to automatically reconnect.

response (complex, rw:rw)
Default: empty
Normative policy hash for HTTP responses indexed by the HTTP method and the response code (e.g.: "PWD", "209" etc.). See also Section 4.7.2.2, Configuring policies for HTTP requests and responses.

response_header (complex, rw:rw)
Default: empty
Normative policy hash for HTTP header responses indexed by the header names (e.g.: "Set-cookie"). See also Section 4.7.2.3, Configuring policies for HTTP headers.

response_mime_type (string, n/a:r)
Default: n/a
The MIME type of the response entity. Its value is only defined when the response is processed.

response_stack (complex, rw:rw)
Default: n/a
Attribute containing the response stacking policy: the hash is indexed based on method names (e.g.: GET). See Section 4.7.2.9, Stacking.

rewrite_host_header (boolean, rw:rw)
Default: TRUE
Rewrite the Host header in requests when URL redirection is performed.

strict_header_checking (boolean, rw:r)
Default: FALSE
Require RFC conformant HTTP headers.

strict_header_checking_action (enum, rw:r)
Default: HTTP_HDR_DROP
This attribute control what will the Zorp do if a non-rfc conform or unknown header found in the communication. Only the HTTP_HDR_ACCEPT, HTTP_HDR_DROP and HTTP_HDR_ABORT can be used.

target_port_range (string, rw:rw)
Default: "80,443"
List of ports that non-transparent requests are allowed to use. The default is to allow port 80 and 443 to permit HTTP and HTTPS traffic. (The latter also requires the CONNECT method to be enabled).

timeout (integer, rw:rw)
Default: 300000
General I/O timeout in milliseconds. If there is no timeout specified for a given operation, this value is used.

timeout_request (integer, rw:rw)
Default: 10000
Time to wait for a request to arrive from the client.

timeout_response (integer, rw:rw)
Default: 300000
Time to wait for the HTTP status line to arrive from the server.

transparent_mode (boolean, rw:r)
Default: TRUE
Set the operation mode of the proxy to transparent (TRUE) or non-transparent (FALSE).

url_category (complex, rw:rw)
Default: empty
Normative policy hash for category-based URL-filtering. The hash is indexed by the name of the category. See also Section List of URL-filtering categories.

use_canonicalized_urls (boolean, rw:rw)
Default: TRUE
This attribute enables URL canonicalization, which means to automatically convert URLs to their canonical form. This enhances security but might cause interoperability problems with some applications. It is recommended to disable this setting on a per-destination basis. URL filtering still sees the canonicalized URL, but at the end the proxy sends the original URL to the server.

use_default_port_in_transparent_mode (boolean, rw:rw)
Default: TRUE
Set the target port to the value of default_port in transparent mode. This ensures that only the ports specified in target_port_range can be used by the clients, even if InbandRouter is used.

4.7.5.2. AbstractHttpProxy methods

Method Description
getRequestHeader(self, header) Function returning the value of a request header.
getResponseHeader(self, header) Function returning the value of a response header.
setRequestHeader(self, header, new_value) Function changing the value of a request header.
setResponseHeader(self, header, new_value) Function changing the value of a response header.

Table 4.15. Method summary


Method getRequestHeader(self, header)

This function looks up and returns the value of a header associated with the current request.
Method getResponseHeader(self, header)

This function looks up and returns the value of a header associated with the current response.
Method setRequestHeader(self, header, new_value)

This function looks up and changes the value of a header associated with the current request.
Method setResponseHeader(self, header, new_value)

This function looks up and changes the value of a header associated with the current response.

4.7.6. Class HttpProxy

HttpProxy is a default HTTP proxy based on AbstractHttpProxy. It is transparent, and enables the most commonly used HTTP methods: "GET", "POST" and "HEAD".

4.7.7. Class HttpProxyNonTransparent

HTTP proxy based on HttpProxy. This class is identical to HttpProxy with the only difference being that it is non-transparent (transparent_mode = FALSE). Consequently, clients must be explicitly configured to connect to this proxy instead of the target server and issue proxy requests. On the server side this proxy connects transparently to the target server.

For the correct operation the proxy must be able to set the server address on its own. This can be accomplished by using InbandRouter.

4.7.8. Class HttpProxyURIFilter

HTTP proxy based on HttpProxy, having URL filtering capability. The matcher attribute should be initialized to refer to a Matcher object. The initialization should be done in the class body as shown in the next example.

[Example] Example 4.15. URL filtering HTTP proxy
class MyHttp(HttpProxyURIFilter):
        matcher = RegexpFileMatcher('/etc/zorp/blacklist.txt', \ 
                                        '/etc/zorp/whitelist.txt')

4.7.8.1. Attributes of HttpProxyURIFilter

matcher (class, rw:rw)
Default: None
Matcher determining whether access to an URL is permitted or not.

4.7.9. Class HttpProxyURIFilterNonTransparent

HTTP proxy based on HttpProxyURIFilter, but operating in non-transparent mode (transparent_mode = FALSE).

4.7.10. Class HttpWebdavProxy

HTTP proxy based on HttpProxy, also capable of inspecting WebDAV extensions of the HTTP protocol.

The following requests are permitted: PROPFIND; PROPPATCH; MKCOL; COPY; MOVE; LOCK; UNLOCK.

4.7.11. Class NontransHttpWebdavProxy

HTTP proxy based on HttpProxyNonTransparent, operating in non-transparent mode (transparent_mode = FALSE) and capable of inspecting WebDAV extensions of the HTTP protocol.

The following requests are permitted: PROPFIND; PROPPATCH; MKCOL; COPY; MOVE; LOCK; UNLOCK.

4.8. Module Imap

Internet Message Access Protocol (IMAP) is a protocol to access electronic mailboxes via a reliable TCP connection between the client and the server.

4.8.1. The IMAP protocol

IMAP is a standard IETF protocol to access mail folders stored on a remote mail server. Unlike POP3 which gives only limited access to a single INBOX, IMAP permits manipulation of a remote mail store in a way that is functionally equivalent to local mailboxes.

Unlike many common IETF protocols, IMAP is not a one-request/one-response protocol. The client might issue one or more actions to be performed in parallel, thus responses to those commands can arrive in an order independent from the order they were issued. Requests and the appropriate responses are paired by a unique request identifier called 'tag'. There is one exception to this rule: the server might return untagged responses, when more than a single response is associated with a single command. In this case the server responds with one or more untagged responses and at the end a tagged response to indicate the end of the processing.

4.8.1.1. Protocol elements

The syntax of the IMAP protocol is strictly defined, both the client and the server is either reading a complete line or a sequence of octets prefixed with the length of the sequence.

Request lines start with the tag, followed by a command verb identifying the operation. Each command might have one or more arguments separated by spaces. Each argument has an associated type, one of: ATOM, LITERAL, STRING, LIST. The type further specifies the syntax how these arguments are represented.

A response from the server might be sent directly in response to a request, or unilaterally whenever the server implementation feels it appropriate. The response includes a response verb with zero or more arguments. Note that there might be more response verbs returned for a single command and the response verbs have no direct relationship with the request verb.

Content (e.g.: mail bodies) are transferred as literals embedded in commands and responses. There is no separate bulk transfer mode in the protocol like in POP3 or SMTP. This results in extremely large request/response sizes.

Each message might have one or more associated message flags like '\Deleted' or '\Seen'.

4.8.1.2. Protocol states

IMAP defines four protocol states. Most commands are valid only in certain states. IMAP has the following states:

  • Non-Authenticated State: This state is at the beginning of the protocol flow before the client authenticates him/herself.

  • Authenticated State: In this state the client is authenticated and MUST select a mailbox to access before commands that affect messages are be permitted.

  • Selected State: In this state, a mailbox is selected for access. The protocol enters this state when a mailbox has been successfully selected.

  • Logout State: In this state the connection is being terminated and the server will close the connection.

IMAP is similar to other protocols in the sense that a connection is authenticated once, at the beginning of the communication. Before authentication is performed only a limited set of commands can be issued, for example AUTHENTICATE and LOGIN.

Each IMAP operation requires a current mailbox which is similar to the current working directory on UNIX systems. Without a selected mailbox, only a limited set of commands can be issued, for example SELECT, CREATE or REMOVE.

Once a mailbox is selected using the SELECT command, further operations become available, like FETCH or STORE.

[Example] Example 4.16. IMAP protocol sample
* OK newmail IMAP server ready
A001 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 ACL QUOTA LITERAL+\
	MAILBOX-REFERRALS NAMESPACE UIDPLUS ID\
	NO_ATOMIC_RENAME UNSELECT CHILDREN\
	MULTIAPPEND SORT THREAD=ORDEREDSUBJECT\
	THREAD=REFERENCES IDLE STARTTLS LISTEXT\
	LIST-SUBSCRIBED ANNOTATEMORE
A001 OK Completed
A002 LOGIN user password
A002 OK User logged in
A003 SELECT INBOX 
* FLAGS (\Answered \Flagged \Draft \Deleted \Seen)
* OK [PERMANENTFLAGS (\Answered \Flagged \Draft\
	\Deleted \Seen \*)]
* 1094 EXISTS
* 3 RECENT
* OK [UNSEEN 1092]
* OK [UIDVALIDITY 1047554575]
* OK [UIDNEXT 36885]
A003 OK [READ-WRITE] Completed
A004 FETCH 1 RFC822
* 1 FETCH (RFC822 {12}
123456789012
)
A004 OK Completed
A005 LOGOUT
* BYE LOGOUT received
A005 OK Completed

Responses to IMAP requests come in two types: tagged and untagged. When a client issues a request, the server responds with a single tagged response, which may be preceeded by a number of untagged response lines. In the example above, the client issues a tagged A001 CAPABILITY command to ask the server for the supported capabilities. The server replies with the untagged * CAPABILITY IMAP4 ... line, listing the capabilities, and the tagged A001 OK Completed line, indicating that the request was successfully completed.

4.8.2. Proxy behavior

ImapProxy is a module built for parsing requests and responses of the IMAP protocol. It reads all the REQUESTs at the client side, parses them and - if the local security policy permits - sends them to the server one-by-one. When the RESPONSEs arrive they are parsed by the proxy and sent to the client one by one if the local security policy permits it. Simple greeting rewriting is supported to hide the version of the server. ImapProxy also implements the NAMESPACE, RLIST and RLSUB commands and the LOGIN authentication method. Other authentication methods are not supported and are denied (the proxy does not send them to the policy level).

4.8.2.1. Configuring policies for IMAP requests and responses

Changing the default behaviour of requests is possible using the request attribute. This hash is indexed by the IMAP command name.

The response attribute is indexed as follows: The response attribute hash is a three-dimensional hash, indexed by the command name for which the response is sent; the type of the response (TAGGED or UNTAGGED); and the response name. Untagged responses are accepted when there is a command in the pending queue (i.e. no tagged response arrived to it yet). The following constants are defined for the response types:

Name Value
IMAP_TAG_UNTAGGED Untagged responses.
IMAP_TAG_ALL Both types of responses.
IMAP_TAG_TAGGED Tagged responses.

Table 4.16.  Constants for IMAP response types


The proxy looks up the hash value corresponding to the IMAP command name as the key. If the hash contains no entry for a command, the "*" entry is used. If there is no "*" entry in the hash, the command is denied.

The possible actions are described in the following tables.

Action Description
IMAP_REQ_ACCEPT Allow the command to pass.
IMAP_REQ_REJECT Reject the command and send an error message to the client.
IMAP_REQ_DROP Silently drop the command - reject the command without sending an error message.
IMAP_REQ_ABORT Terminate the connection.
IMAP_REQ_POLICY Call the function specified in the argument to make a decision about the event. See Section 4.8.2.1, Configuring policies for IMAP requests and responses for details.
IMAP_REQ_REWRITE Replace the request with a predefined one. See the example below.
IMAP_REQ_RESPOND Respond to the request instead of the server. The request is not sent to the server. This action requires two arguments: a string containing a tagged response for the request, and a string list containing the optional untagged responses.

Table 4.17.  Action codes for IMAP requests


Action Description
IMAP_RSP_ACCEPT Allow the response to pass.
IMAP_RSP_REJECT Reject the response and send an error message to the client.
IMAP_RSP_DROP Silently drop the response.
IMAP_RSP_ABORT Terminate the connection.
IMAP_RSP_POLICY Call the function specified to make a decision about the event. See Section 4.8.2.1, Configuring policies for IMAP requests and responses for details.
IMAP_RSP_REWRITE Replace the response containing the greeting string with a predefined one. See the example below.

Table 4.18.  Action codes for IMAP responses


4.8.2.2. Calling methods

For calling a method, the hash must contain a tuple containing two values. The first value is IMAP_REQ_POLICY and the second is the function to call. The function must return with one of the IMAP_REQ_* values (excluding IMAP_*_POLICY), displayed in the table above.

The function is called with three arguments (apart from 'self'): the command tag, the command name, and its arguments. The representation of arguments used by IMAP is described in Section 4.8.2.4, The IMAP command structure in policies.

If the proxy is to answer instead of the server, the action tuples must contain the following three items: The value IMAP_REQ_RESPOND; the STRING to be sent back followed by a command tag, and a LIST containing untagged lines to be sent back to the client.

For example, to reply to every CAPABILITY request on behalf of the server:

[Example] Example 4.17. Rewriting IMAP capability response
self.request["CAPABILITY"] = (IMAP_REQ_RESPOND, "OK CAPABILITY completed", ("[IMAP4rev1]", ))

There are other methods to control which CAPABILITYs are known by the client. There is a separate capability hash for this, indexed by the name of the capabilities. The valid values are listed below.

Action Description
IMAP_CAP_ACCEPT Allow use of the capability.
IMAP_CAP_DROP Reject the capability.

Table 4.19.  Action codes for IMAP capabilities


This hash has nothing to do with capabilities known by the proxy; it defines which answers can arrive to the client for a CAPABILITY command.

Modifying the IMAP greeting string

The IMAP greeting string can be modified (rewritten) by the proxy to hide sensitive information about the server. This can be realized as a rule defined as a tuple containing the following three items:

  • The value IMAP_REQ_REWRITE;

  • a default return value (e.g.: IMAP_REQ_ACCEPT);

  • and a string.

[Example] Example 4.18. Changing the greeting string in IMAP
def config(self):
	...
	self.response["GREETING", "UNTAGGED", "OK"] = / 
	(IMAP_REQ_REWRITE, IMAP_REQ_ACCEPT, "Welcome to Zorp IMAP proxy")
	...
IMAP states

In IMAP there are some defined states, and some commands are allowed only in certain states. On the policy level these states may be examined and modified if necessary. This can be accomplished by setting two attributes, imap_state_old and imap_state_new. The possible values for these variables are listed in the following table.

Name Value
IMAP_IS_INITIAL Before any command arrived.
IMAP_IS_NONAUTH Before authentication.
IMAP_IS_AUTHENTICATING Authentication is in progress.
IMAP_IS_AUTH Authentication performed.
IMAP_IS_SELECTED A mailbox is selected.
IMAP_IS_QUIT Logged out.

Table 4.20.  IMAP states


4.8.2.3. Configuring acceptable flags

In the IMAP protocol the user can assign flags to mails (or other objects). For example, a flag is assigned to a message to indicate that it has been read (\Seen), it can be marked as important mail or it can be indicated that it has already been answered (\Answered). The usable flags are not predefined in the protocol, IMAP clients can assign any flags they desire.

Flags can be controlled similarly to requests and responses using the flag hash. It is a normative hash indexed by the name of the flag (case sensitive). The common practice is to accept any flags by default and explicitly drop unneeded flags. The possible actions related to flags are shown in the table below.

Action Description
IMAP_FLAG_ACCEPT Accept the flag.
IMAP_FLAG_REJECT Reject the flag, including the entire command or response.
IMAP_FLAG_DROP Drop the flag silently, but accept the rest of the command. If the command contains only the flag that is dropped, the entire command is dropped.

Table 4.21.  Action codes for IMAP flags


4.8.2.4. The IMAP command structure in policies

When using functions in policies to evaluate IMAP commands, the commands are represented as a recursive tuple of tuples having the following structure. Every command is a tuple of length 3, containing the tag of the command, the name of the command and a tuple containing the arguments.

The following values are possible as arguments (IMAP command structure in the policy layer):

  • (int, string) -- Integer

  • (int, int) -- Range

  • <LITERAL> -- Literal Literals (the actual messages) in the requests/responses are represented by a string having the 'Literal' value. The reason for this is that literals can be very large, therefore they are not sent to (thus not available) the policy level in Zorp.

  • string -- A string or an atom

  • (",", a1, a2...) -- Comma-separated list

  • ("[", a1, a2...) -- Bracketed list

  • ("(", a1, a2...) -- Parenthesized list

Of course, lists can contain other lists recursively.

When processing IMAP responses where a number argument precedes the response name (e.g.: 1094 EXISTS), the number counts as the first argument.

Below are some examples how the different argument types are used in the IMAP protocol.

[Example] Example 4.19.  IMAP arguments in use
Issued command: a0001 FETCH 1,2 RFC822
The command as processed by the Zorp IMAP proxy:
tag: "a0001"
command: "FETCH"
arguments: ((',', (1, '1'), (2, '2')), 'RFC822');
where (',', (1, '1'), (2, '2') is a comma separated list,
(1, '1') is an integer, and RFC822 is a string.
Issued command: a0002 FETCH 1:2 RFC822
The command as processed by the Zorp IMAP proxy:
tag: a0002
command: FETCH
arguments: ((1, 2), 'RFC822');
where (1, 2) is a range.
Received response: * 1 FETCH (RFC822 <literal>) 
The command as processed by the Zorp IMAP proxy:
command: FETCH
arguments: ((1, '1'), ('(', 'RFC822', '<LITERAL>'));
where <LITERAL> is a literal represented by a string.

4.8.2.5. Stacking

IMAP supports stacking proxies into different levels of the IMAP communication. Stacking is controlled by the stack attribute hash. See also Section 2.3.1, Proxy stacking. There are three stacking modes available, described in the table below.

Name Value
IMAP_BODY_FULL Pass the complete IMAP messages to the stacked proxy or program.
IMAP_BODY_PART Pass only the body part of IMAP messages to the stacked proxy or program.
IMAP_BODY_TEXT Pass only the text part of IMAP messages to the stacked proxy or program.

Table 4.22.  Body part selection for stacking


4.8.3. Related standards

  • Internet Message Access Protocol (v4rev1) is described in RFC 3501.

  • IMAP4 Binary Content Extension is described in RFC 3516.

  • The IMAP UNSELECT command is described in RFC 3691.

  • The IMAP MULTIAPPEND Extension is described in RFC 3502.

  • The IMAP4 ID Extension is described in RFC 2971.

  • IMAP4 Namespace is described in RFC 2342.

  • IMAP4 Login Referrals are described in RFC 2221.

  • IMAP4 Mailbox Referrals are described in RFC 2193.

  • The IMAP4 QUOTA Extension is described in RFC 2087.

  • The IMAP4 ACL Extension is described in RFC 2086.

  • IMAP/POP AUTHorize Extension for Simple Challenge/Response is described in RFC 2195.

4.8.4. Classes in the Imap module

Class Description
AbstractImapProxy Class encapsulating the abstract IMAP proxy.
ImapProxy Default IMAP proxy based on AbstractImapProxy.
ImapProxyStrict IMAP proxy based on AbstractImapProxy, allowing only the minimal command set.

Table 4.23. Classes of the Imap module


4.8.5. Class AbstractImapProxy

This class implements an abstract IMAP proxy - it serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractImapProxy, or one of the predefined proxy classes, such as ImapProxy or ImapProxyStrict. AbstractImapProxy denies every command, response, etc. by default.

4.8.5.1. Attributes of AbstractImapProxy

capability (complex, rw:rw)
Default:
Normative hash defining the capabilities accepted by the proxy. See Section 4.8.2.2, Calling methods.

flag (complex, rw:rw)
Default:
Normative hash controlling flag values accepted by the proxy. See Section 4.8.2.3, Configuring acceptable flags.

imap_state_new (enum, n/a:rw)
Default: n/a
Protocol state after processing the line, one of the IMAP_IS_* constants. See Section 4.8.2.2, Calling methods.

imap_state_old (enum, n/a:rw)
Default: n/a
Protocol state before the command arrived, one of the IMAP_IS_* constants. See Section 4.8.2.2, Calling methods.

max_line_length (integer, rw:rw)
Default: 2048
Maximum allowed line length.

max_literal_count (integer, rw:rw)
Default: 32
Maximum number of literals allowed in one command or answer.

max_literal_length (integer, rw:rw)
Default: 65536
Maximum allowed literal length (e.g.: e-mail bodies are sent as literals).

max_password_length (integer, rw:rw)
Default: 32
Maximum allowed length of passwords.

max_pending_count (integer, rw:rw)
Default: 4
Maximum number of pending IMAP commands.

max_respond_lines (integer, rw:rw)
Default: 2
Maximum number of untagged lines that may be sent back to the client from policy.

max_username_length (integer, rw:rw)
Default: 32
Maximum allowed length of usernames.

password (string, n/a:r)
Default: n/a
Password sent to the remote server.

request (complex, rw:rw)
Default:
Normative policy hash for IMAP requests indexed by command name. See also Section 2.1, Policies for requests and responses.

response (complex, rw:rw)
Default:
Normative policy hash for IMAP responses, indexed by command name, response type and response name. See Section 4.8.2.1, Configuring policies for IMAP requests and responses.

stack (complex, rw:rw)
Default:
Attribute containing the stacking policy for IMAP messages. See Section 4.8.2.5, Stacking for details.

timeout (integer, rw:rw)
Default: 600000
Timeout value in milliseconds.

username (string, n/a:r)
Default: n/a
Username sent to the remote server.

4.8.6. Class ImapProxy

ImapProxy is the default proxy for the IMAP protocol, based on AbstractImapProxy.

All requests, responses and flags are permitted, as well as the following capabilities: IMAP4; IMAP4rev1; ACL; QUOTA; NAMESPACE; X-NON-HIERARCHICAL-RENAME; NO_ATOMIC_RENAME; UNSELECT; MAILBOX-REFERRALS; LOGIN-REFERRALS; AUTH=LOGIN; ID; CHILDREN; MULTIAPPEND; SORT; THREAD=ORDEREDSUBJECT; THREAD=REFERENCES; LISTEXT; LIST-SUBSCRIBED; ANNOTATEMORE.

4.8.7. Class ImapProxyStrict

IMAP proxy based on AbstractImapProxy, allowing only the minimal command set.

All flags are accepted. The following commands are permitted: AUTHENTICATE; CAPABILITY; CHECK; CLOSE; EXAMINE; FETCH; FIND; GETACL; LIST; LOGIN; LOGOUT; LSUB; NAMESPACE; NOOP; RLIST; RLSUB; SELECT; STATUS; UID; EXPUNGE; STORE.

The permitted capabilities are the following IMAP4; IMAP4rev1; ACL; QUOTA; NAMESPACE; X-NON-HIERARCHICAL-RENAME; NO_ATOMIC_RENAME; UNSELECT; MAILBOX-REFERRALS; LOGIN-REFERRALS; AUTH=LOGIN.

4.9. Module Ldap

The Ldap module defines the classes constituting the proxy for the LDAP protocol.

4.9.1. The LDAP protocol

Lightweight Directory Access Protocol (LDAP) is designed to provide access to X.500 directory services (i.e. to maintain directory databases). It is frequently used to distribute public key certificates, address book information, and user authentication information. Clients can be controlled by individuals (via an application, called LDAP browser) or an agent (e.g.: authentication module or any other application).

X.500 represents information in a hierarchical directory structure. Every entry in the tree is identified with a unique distinguished name (DN) and contains several attributes. A DN looks like the following:

uid=username,ou=administrators,ou=some-department,ou=some-part-of-the-company,dc=company,dc=net

A schema defines sets of attribute entries in an ObjectClass. Every container can have different ObjectClasses, with each ObjectClass having mandatory and optional entries. The following example defines a user with several attributes from five ObjectClasses.

[Example] Example 4.20. Example Ldap entry
dn: uid=username,ou=departnent,dc=company,dc=hu
uid: username
cn: username
sn: username
uidNumber: 1234
gidNumber: 1234
mail: username@company.hu
displayName: Dr. UserName
homeDirectory: /home/username
objectClass: top
objectClass: posixAccount
objectClass: inetOrgPerson
objectClass: inetLocalMailRecipient
objectClass: sambaSamAccount
sambaSID: 1234
loginShell: /bin/bash
userPassword: {SMD5}fdsfhiz234dsadsad
telephoneNumber: 1234
street: Foo
postOfficeBox: 1234
roomNumber: 107

4.9.1.1. Protocol elements

LDAP is a request/response based binary protocol. The client can connect to the server on a channel at TCP/389 port and send REQUESTs. The client can request several operations in parallel. The following operations can be performed:

  • Bind: Identify the client and optionally perform authentication.

  • Unbind: Terminate a protocol session.

  • Search: Search for entries using filters.

  • Modify: Modify tree entries and attributes.

  • Add: Request the addition of an entry into the directory.

  • Delete: Request the deletion of an entry from the directory.

  • Modify DN: Change the leftmost component of the name of an entry in the directory, or to move a subtree of entries to a new location in the directory.

  • Compare: Compare an assertion provided with an entry in the directory.

  • Abandon: Request the server to cancel an outstanding operation.

  • Extended: This operation is for additional operations to be defined for services not available elsewhere in the protocol.

The protocol operates according to the following general scheme:

  1. The client opens a connection at TCP/389 and binds to an object in the directory tree. The server authenticates the client to this object. If authentication is not required, the client can use the given tree anonymously.

  2. If the authentication process is successful the client can perform requests (i.e. the above mentioned operations: modify, add, delete etc.).

  3. Finally the client unbinds and closes the connection.

The LDAP protocol is described using ASN.1 (Abstract Syntax Notation), and is typically transferred using the Basic Encoding Rules, a subset of ASN.1.

4.9.2. Proxy behavior

LdapProxy is a module built for parsing the LDAP protocol version v2 and v3. It reads and parses the REQUESTs at the client side and - if the local security policy permits - sends them to the server. It parses the arriving RESPONSE and - if the local security policy permits - forwards it to the client. LdapProxy can parse the following requests and responses, consequently, these requests can be accepted or denied:

Request/Response Description
BindRequest Request for binding as an object.
BindResponse Response to BindRequests.
UnbindRequest Request for unbinding.
SearchRequest Request for submitting an LDAP query.
SearchResultEntry Response to SearchRequests.
SearchResultDone Response indicating the SearchRequest was performed.
ModifyRequest Request to modify an entry.
ModifyResponse Response to ModifyRequests.
AddRequest Request to add a new entry.
AddResponse Response to AddRequests.
DelRequest Request to delete an LDAP entry.
DelResponse Response to DelRequests.
ModifyDNRequest Request to modify a DN object.
ModifyDNResponse Response to ModifyDNRequests.
CompareRequest Request to compare the provided assertion with an entry in the directory.
CompareResponse Response to CompareRequests.
AbandonRequest Request to cancel a request.
SearchResultReference Response referring to another LDAP server.
ExtendedRequest Request reserved for further queries.
ExtendedResponse Response to ExtendedRequests.

Table 4.24. Parsed LDAP operations


4.9.3. Configuring policies for LDAP requests

Changing the default behavior of requests can be done using the hash attribute request. The hash is indexed by the request name. The possible values of these hashes are shown in the tables below. See Section 2.1, Policies for requests and responses for details.

Action Description
LDAP_REQ_ACCEPT Allow the request to pass.
LDAP_REQ_REJECT Reject the request.
LDAP_REQ_ABORT Terminate the connection.

Table 4.25.  Action codes for LP requests


[Example] Example 4.21. Example of the commands usage

In the following example the Ldap proxy allows only BindRequest, UnbindRequest, SearchRequest and CompareRequest requests.

def config(self):
	AbstractLdapProxy.config(self)
	self.request["BindRequest"]	= LDAP_REQ_ACCEPT
	self.request["UnbindRequest"]	= LDAP_REQ_ACCEPT
	self.request["SearchRequest"]	= LDAP_REQ_ACCEPT
	self.request["CompareRequest"]	= LDAP_REQ_ACCEPT
	self.request["*"]		= LDAP_REQ_REJECT

4.9.4. Simple Authentication and Security Layer (SASL) on LDAP messages

Simple Authentication and Security Layer (SASL) is a framework for authentication and data security in Internet protocols. It is also used by Microsoft Active directory. Please note that support for the SASL security layer in Zorp is a work in progress - currently LDAP protocol analysis is effectively disabled for SASL wrapped requests.

4.9.5. Related standards

  • Lightweight Directory Access Protocol (v3) is described in RFC 2251.

  • The LDAP URL Format is described in RFC 2255.

  • Using Domains in LDAP/X.500 Distinguished Names is described in RFC 2247.

  • Lightweight Directory Access Protocol (v3): Technical Specification is in RFC 3377.

4.9.6. Classes in the Ldap module

Class Description
AbstractLdapProxy Class encapsulating the abstract Ldap proxy.
LdapProxy Default Ldap proxy based on AbstractLdapProxy.
LdapProxyRO Ldap proxy enabling only read-only access.

Table 4.26. Classes of the Ldap module


4.9.7. Class AbstractLdapProxy

This class implements an abstract LDAP proxy - it serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractLdapProxy, or one of the predefined proxy classes. AbstractLdapProxy denies all requests by default.

4.9.7.1. Attributes of AbstractLdapProxy

max_message_size (integer, rw:r)
Default: 65535
Maximum allowed size of requests and responses.

max_pending_request (integer, rw:r)
Default: 32
Maximum number of pending requests.

max_search_response_number (integer, w:r)
Default: 2147483648
Determines the maximal number of LDAP search results. The action to perform on results over this limit can be set in the response_overrun_action attribute.

permit_sasl_transport (boolean, rw:r)
Default: FALSE
Permit the use of the Simple Authentication and Security Layer (SASL) on LDAP messages. See Section 4.9.4, Simple Authentication and Security Layer (SASL) on LDAP messages for details.

request (complex, rw:r)
Default: n/a
Normative policy hash for LDAP requests indexed by the request. See also Section 4.9.3, Configuring policies for LDAP requests.

response_overrun_action (enum, w:r)
Default: LDAP_RSP_DROP
The action to perform on search results over the limit set in the max_search_response_number attribute.

timeout (integer, rw:r)
Default: 600000
I/O timeout in milliseconds.

4.9.8. Class LdapProxy

LdapProxy is a default proxy for the LDAP protocol based on AbstractLdapProxy. All syntactically correct operation is permitted.

4.9.9. Class LdapProxyRO

LDAP proxy based on AbstractLdapProxy, with read-only access. This proxy does not allow clients to write or delete on the Ldap server, i.e. the Add, Modify, Delete operations are disabled.

4.10. Module Lp

This module defines the classes constituting the proxy for the LPD protocol.

4.10.1. The LPD protocol

The Berkeley Unix operating system provides line printer spooling functionalities via a collection of commands: 'lpr' assigns a queue, 'lpq' lists the printer queue, 'lprm' deletes a job from the queue and 'lpc' controls the queue. The protocol between the printer server and the client is the Line Printer Daemon Protocol (LPD).

A printing environment contains a printer server and several clients. The server provides printing service at port TCP/515 and manages the printer spool to which clients connect and send printing jobs. Every job is assigned a job ID which is a number between 0 and 999; both the client and server use this ID to refer to a given job. The protocol allows the client to send a file to print, maintain the printing queue, remove jobs from the spool and get the status of jobs.

LPD protocol is a request/acknowledgment based protocol. Every REQUEST begins with a single octet code, which represents the binary number of the requested function. The code is followed by the ASCII name of the printer queue. Other operands can follow the queue name separated by whitespace. The request must be closed with an ASCII line feed character. After certain operations (e.g.: receiving a datafile) the server may send an acknowledgment.

4.10.1.1. Protocol elements

The protocol has six main and several sub-commands.

  • PRINT (queue): Start the printing process if it is not already running.

  • RECEIVE (queue): Receive a job. This command switches the daemon into receiving mode. Receive mode has three different subcommands:

    • ABORT JOB: Remove any file which has been created during this "Receive job" command.

    • RECEIVE CONTROL FILE: After issuing this subcommand the client can send a file containing the commands to perform on the printer queue.

    • RECEIVE DATA FILE: After issuing this subcommand the client can send the file to be printed.

  • REMOVE (queue, agent, list): Remove a job from the queue. The jobs to be removed are sent in a whitespace-separated list.

  • SHORTSTATE (queue, list): Short status report command. List is a whitespace-separated list of jobs to report about.

  • LONGSTATE (queue, list): Long status report command. List is a whitespace-separated list of jobs to report about.

  • DATAFILE (length: int, name): Receive a data file.

The request attribute hash is also consulted for every control file line sent by the RECEIVE CONTROL FILE command. If a function is called, it gets one argument, the whole control line but the first character.

The control file commands are the following:

  • C CLASS -- Set the class name to be printed on the banner page.

  • H HOST -- Specifies the name of the host sending the print job.

  • I INDENT -- This command specifies that, for files which are printed with the 'f', of columns given.

  • J JOBNAME -- Set the name of the job to be printed on the banner page.

  • L BANNER -- Print a banner page at the end of the job.

  • M MAIL -- Send a mail to the user when the job is finished. The user is specified in the operand, the host name is set via the 'H' command.

  • N SOURCE -- The name of the file from which the job was formed.

  • P USER -- The entity who generated the job.

  • S SYMLINK -- Record symbolic link data on a Unix system so that a file will not be re-printed if its directory entry is changed after it has been printed.

  • T TITLE -- The title of the document to be printed.

  • U UNLINK -- Indicates that the specified file is no longer needed.

  • W WIDTH -- Limit the output to the specified number of columns for the 'f', 'l', and 'p' commands.

  • 1 TROFF1 -- Specify the file name for the troff R font.

  • 2 TROFF2 -- Specify the file name for the troff I font.

  • 3 TROFF3 -- Specify the file name for the troff B font.

  • 4 TROFF4 -- Specify the file name for the troff S font.

  • c CIF -- Plot a CalTech Intermediate Form (CIF) data file.

  • d DVI -- Print a Device Independent Interface (DVI - TeX output) data file.

  • f FORMAT -- Print a plaintext (including page breaks) data file.

  • g PLOT -- Plot a data file of the output of the Berkeley Unix plot library.

  • k KERB -- Reserved for use by Kerberized LPR clients and servers.

  • l NOFILTER -- Print file omitting control characters.

  • n DITROFF -- Print a DITROFF data file.

  • o PS -- Print a standard PostScript data file.

  • p PR -- Print the data file with heading, page numbers, and pagination.

  • r FORTRAN -- Print the data file with FORTRAN carriage control.

  • t TROFF -- Print the data file as Graphic Systems C/A/T phototypesetter input.

  • v RASTER -- Prints a Sun raster format file.

4.10.2. Proxy behavior

LpProxy is a module built for parsing the LPD protocol. It reads and parses the REQUESTs on the client side and sends them to the server if the local security policy permits it.

By default, every LP command conforming to the RFC is accepted; everything else is rejected. Use of the different LP commands can be restricted if needed. This procedure is described in the next section.

4.10.2.1. Configuring policies for LP commands

Changing the default behavior of commands can be done by using the hash attribute request. The hash is indexed by the command names. The possible actions are described in the following table. See Section 2.1, Policies for requests and responses for details.

Action Description
LP_REQ_ACCEPT Allow the command to pass.
LP_REQ_REJECT Block the command and report it to the client.
LP_REQ_ABORT Terminate the connection.
LP_REQ_DROP Block the command without further action.
LP_REQ_POLICY Call the function specified to make a decision about the event. The function receives three parameters: self, command, and the parameters of the command. See Section 2.1, Policies for requests and responses for details.

Table 4.27.  Action codes for LP requests


To call a policy function, the hash value must be a tuple containing LP_REQ_POLICY as its first value and the function to be called as the second. The arguments which the function is called with depend on the command.

4.10.3. Related standards

The LP protocol is specified in RFC 1179.

4.10.4. Classes in the Lp module

Class Description
AbstractLpProxy Class encapsulating the abstract LP proxy.
LpProxy Default LP proxy based on AbstractLpProxy.

Table 4.28. Classes of the Lp module


4.10.5. Class AbstractLpProxy

This class implements an abstract LP proxy - it serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractLpProxy, or the predefined LpProxy proxy class. AbstractLpProxy denies all commands by default.

4.10.5.1. Attributes of AbstractLpProxy

max_line_length (integer, rw:r)
Default: 1024
Maximum allowed length of a line.

request (complex, rw:rw)
Default: empty
Normative policy hash for LP requests indexed by the command name (including protocol commands and their subcommands, as well as control file commands). See also Section 4.10.2.1, Configuring policies for LP commands.

timeout (integer, rw:r)
Default: 30000
General I/O timeout in milliseconds.

4.10.6. Class LpProxy

LpProxy is a default LP proxy based on AbstractLpProxy, accepting all commands, including unknown ones.

4.11. Module Mime

This module defines the classes representing the MIME proxy.

4.11.1. The MIME protocol

Multipurpose Internet Mail Extensions (MIME) is a complex representation of multiple type of message bodies, and refers to an official Internet standard that defines how messages must be formatted. It makes possible for different types of e-mail systems to exchange messages successfully. MIME is a flexible format which allows to include different type of messages in a single e-mail message. It redefines message format to allow:

  • text messages in different character sets;

  • extensible set of non-text format messages;

  • multiple message types in one message body;

  • text header information.

The content of the message is shown by the MIME header, which indicates the type and number of parts the message contains. The header also contains encoding system and version information. MIME supports the following body-types:

Body-type Description
text The primary type of MIME content. The main subtype is plain.
multipart The message contains different types of data.
message Indicates an encapsulated text message.
image Indicates that the message contains image file.
audio Indicates that the message contains audio data.
video Indicates that the message contains video data.

Table 4.29. MIME body-types


To make sure message contents arrive without corruption, non-text messages must be encoded to printable ASCII characters. Older UNIX systems use uuencode/uudecode transformation. MIME encoding provides base64 to encode any attachment as text.

MIME indicates the parameters of the message in the header field, which can be the following:

MIME header Description
MIME-Version Indicates the exact version of the MIME message.
Content-Type Indicates the type of the data contained in the body. The default content type is 'text/plain; charset=us-ascii'.
Content-Transfer-Encoding Indicates the encoding used in the message part. It is also possible to create private transfer encoding, which can be indicated by X-My-Private-Transfer-Encoding.
Content-ID Unique identifier of the MIME object.
Content-Description Extra comments added to the message by the user.
Additional MIME Header Fields Extra fields to be used by the developers in the future.

Table 4.30. MIME headers


[Note] Note

MIME headers do not guarantee that the message really contains the type of content indicated in the header.

[Example] Example 4.22. Example mail header containing MIME message

A simple e-mail message containing text message.

From: Sender User <sender@balabit.hu>
To: Receiver User <receiver@balabit.com>
Message-Id: <asdfghjkl@balabit.internal.server>
Content-Type: text/plain
Mime-Version: 1.0
Date: Thu, 01 Jul 2004 11:34:30 +0200
Content-Transfer-Encoding: 7bit
[Example] Example 4.23. Example PNG format picture attachment

A message containing an image attachment in base64 encoding.

Mime-Version: 1.0
Content-Type: image/jpeg; name="image.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="image.png"
[Example] Example 4.24. Example multipart message

A multipart type message containing a simple text message with a postscript attachment.

This is a multi-part message in MIME format.
--------------080709090505030904090905
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

us-ascii message comes here...

--------------080709090505030904090905
Content-Type: application/postscript; name="zorp-pro-reference-guide-3.0.ps"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="zorp-pro-reference-guide-3.0.ps"

base64 message comes here...

4.11.2. Proxy behavior

MimeProxy is a module built for parsing MIME messages. Since MIME is not a communication protocol in itself, the MIME proxy cannot be used on its own. It can only inspect data received from a protocol proxy (e.g.: a HTTP proxy, POP3 proxy, etc. that stacks the MimeProxy). MimeProxy reads the data received from the other proxy and handles message headers and bodies if there are any. If the message conforms to the RFC standard it is accepted, otherwise the content is rejected. It is also possible to stack a further proxy into the Mime module (e.g.: a virus filtering module).

4.11.2.1. Configuring policies for MIME headers and content types

Configuring the default behavior for MIME objects is possible using the header and body_type attributes.

MimeProxy parses MIME headers first. See Table 4.30, MIME headers and Table 4.29, MIME body-types for the available headers and body-types. The following table shows the possible actions on MIME headers. Headers may be accepted or dropped, or the entire object can be rejected. Subobjects (i.e. MIME objects embedded into other MIME objects) cannot be dropped or rejected individually, the entire object must be rejected/dropped.

Action Description
MIME_HDR_ACCEPT Accept header.
MIME_HDR_DROP Drop the header, but do not reject the entire MIME object.
MIME_HDR_ABORT Reject the entire connection.
MIME_HDR_POLICY Call the function specified to make a decision about the header. See Section 4.11.2.1, Configuring policies for MIME headers and content types for details. Put header line into policy level.

Table 4.31.  Action codes for MIME headers


Second, MimeProxy parses MIME content (or body) types. The following table shows the possible actions on MIME types (body_type). Stacking another module is possible using the MIME_TPE_STACK action.

Action Description
MIME_TPE_ACCEPT Accept the MIME type.
MIME_TPE_DROP Drop the entire MIME object.
MIME_TPE_DROP_ONE Drop the MIME object. This does not affect other objects in the object.
MIME_TPE_CHANGE Modify the type of the object to the one specified in the second argument.
MIME_TPE_ABORT Abort the connection and reject the entire MIME object.
MIME_TPE_STACK Pass the content to be inspected by another proxy.
MIME_TPE_POLICY Call the function specified to make a decision about the event. See Section 4.11.2.1, Configuring policies for MIME headers and content types for details.

Table 4.32.  Action codes for MIME content types


If all contents and headers are acceptable by the local security policy, MimeProxy rebuilds the MIME message and passes it back to the parent proxy.

[Example] Example 4.25. Example usage of MimeProxy module, denying applications

Removes all applications from the messages. An error message is sent to the client (silent_drop = FALSE; the directory where the error messages are stored is specified in the mime_message_path attribute).

class MyMimeProxy(MimeProxy):
	def config(self):
		MimeProxy.config(self)
		self.body_type["application" "*"] = (MIME_TPE_DROP)
		self.silent_drop = FALSE
		self.mime_message_path="/usr/share/zorp/mime"

4.11.3. Related standards

  • RFC 2045: MIME Part One: Format of Internet Message Bodies

  • RFC 2046: MIME Part Two: Media Types

  • RFC 2047: MIME Part Three: Message Header Extensions for Non-ASCII Text

  • RFC 2048: MIME Part Four: Registration Procedures

  • RFC 2049: MIME Part Five: Conformance Criteria and Example

4.11.4. Classes in the Mime module

Class Description
AbstractMimeProxy Class encapsulating the abstract MIME proxy.
MimeProxy Default MIME proxy based on AbstractMimeProxy.

Table 4.33. Classes of the Mime module


4.11.5. Class AbstractMimeProxy

This class implements an abstract MIME proxy - it serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractMimeProxy, or the predefined MimeProxy proxy class. AbstractMimeProxy rejects all headers and body-types by default.

4.11.5.1. Attributes of AbstractMimeProxy

append_object (string, rw:r)
Default: ""
Appends the specified file (e.g.: /tmp/attachment) as a new attachment. Requires the permit_empty_headers parameter to be set to TRUE.

body_type (complex, rw:r)
Default:
Multi-dimensional policy hash for body-types, indexed by body-type name (major and minor parts of the body type). See Section 4.11.2.1, Configuring policies for MIME headers and content types.

drop_bad_header (boolean, rw:r)
Default: FALSE
Reject the (sub)object or silently drop the header if it is syntactically or semantically incorrect. If the header is essential for MIME parsing, this option is ignored and the message will be dropped.

error (complex, rw:rw)
Default: n/a
An alias of the error_action parameter. Obsolete, use error_action instead.

error_action (complex, rw:rw)
Default: n/a
With this normative hash you can control the action taken when some error occurs. For compatibility reasons, the error parameter refers to the same hash.

header (complex, rw:r)
Default:
Normative policy hash for MIME header types, indexed by the header type. See Section 4.11.2.1, Configuring policies for MIME headers and content types.

keep_header_comments (boolean, rw:r)
Default: TRUE

Keep or remove header comments. The syntax of MIME headers is very complex and it is possible to confuse a parser with a specially crafted comment. To prevent this, it is possible to remove all comments. (NOTE: This option will be header-specific in future releases of Zorp.)

max_header_length (integer, rw:r)
Default: 4096
The maximum length of a single header.

max_header_line_length (integer, rw:r)
Default: 1000
The maximum length of a single header line. A header may be split into multiple lines, this value limits the length of a single line.

max_header_lines (integer, rw:r)
Default: 1024
Maximum number of headers in a (sub)object. Different objects are counted separately even when these objects are subobjects of the same object. If drop_bad_header turned on all headers above this number will dropped. If not, the conversation will aborted.

max_multipart_level (integer, rw:r)
Default: 10
The maximum recursion level the proxy should check. If the number of levels in an object exceeds the allowed limit, the object is rejected.

max_multipart_number (integer, rw:r)
Default: 100
Maximum number of subobjects that an object is allowed to contain. The default is 100. The counter is not restarted when checking a new subobject. (i.e.: this limits the global number of objects)

mime_message_path (string, rw:r)
Default: "/usr/share/zorp/mime"
Path to the directory where the custom error messages are stored.

permit_bad_continuous_line (boolean, rw:r)
Default: FALSE
Parse bad headers as continuous lines.

permit_empty_headers (boolean, rw:r)
Default: FALSE
If enabled (TRUE) and the first line of a MIME object (or subobject) is not parseable as a MIME header, it is handled as a MIME body without a header.

silent_drop (boolean, rw:r)
Default: FALSE
If disabled (FALSE), dropped objects are replaced with an object containing an error message. If enabled (TRUE), objects and headers are dropped without notification.

timeout (integer, rw:r)
Default: -1
I/O timeout in milliseconds. The default value (-1) means unlimited.

4.11.6. Class MimeProxy

MimeProxy is a default MIME proxy based on the AbstractMimeProxy. All headers and body-types are accepted.

4.12. Module MSRpc

Remote Procedure Call (RPC) is a protocol for calling procedures on remote machines.

4.12.1. The RPC protocol

The RPC protocol consists of two phases: negotiating an access point to a service and communicating with the service itself. On the server side the negotiation is performed by a special service called 'Endpoint Mapper' (EPM), which listens on the TCP/UDP port 135. The protocol of the communication is specified in the DCE RPC Specification. If the client is allowed to use the requested service, the EPM passes its address and IP in its response, and the client may connect to it and make any data transfer it wishes. The protocol format varies from service to service, so Zorp only filters the communication between the client and the EPM, also maintaining transparent forwarding facilities between the client and the service.

The filtering of the traffic between the client and the EPM means that requests can be approved or rejected for services specified by their UUID. The denial of a service is implemented as if the EPM had refused it, the approval is transparent in a way that the resulting service access point has the same IP as in the original EPM request: only the port is altered to point to the dedicated forwarder facility.

The timing parameters of the communication may also be limited by specifying the maximal allowed duration of the requests/responses; the idle timeout between requests/responses and the maximal delay between the service approval and the connection to the approved service.

4.12.2. Proxy behavior

The Zorp MSRpc proxy is a module supporting version 2 of the MSRPC protocol.

4.12.2.1. Setting policies for services

Changing the default behavior for services can be accomplished via the self.interface hash attribute. This hash is indexed by the service UUID, and each item in this hash is an action code defining proxy behavior for the given command. The available action codes are shown in the following table:

Name Value
MSRPC_UUID_ACCEPT Allow access to the requested service.
MSRPC_UUID_REJECT Reject access to the requested service.
MSRPC_UUID_DROP Drop the request without further notice.

Table 4.34.  Action codes for MSRpc requests.


[Example] Example 4.26. Customising RPC to allow connection to service "11223344-5566-7788-99aa-bbccddeeff00"
class MyRpcProxy(MSRpcProxy):
        def config(self):
                self.interface["11223344-5566-7788-99aa-bbccddeeff00"] = MSRPC_UUID_ACCEPT

4.12.2.2. Restrictions

Currently the proxy handles only TCP connections and tracks/filters only the traffic toward the EPM service. Since this does not cover the protocols used by either the standardized or the proprietary DCOM services, some applications may not work properly through this proxy. Some remote management applications that use the ISystemActivator service and the notification feature of Exchange are known to have issues with the Zorp MSRpc proxy.

4.12.2.3. Global options

The following global options apply to all classes of the the MSRpc proxy:

config.msrpc.forwarder_data_timeout

Timeout value (in milliseconds) for forwarded traffic. Default value: 60000 (60 sec)

4.12.3. Classes in the MSRpc module

Class Description
AbstractMSRpcProxy Class encapsulating the abstract MSRpc proxy.
MSRpcProxy Default MSRpc proxy based on AbstractMSRpcProxy.

Table 4.35. Classes of the MSRpc module


4.12.4. Class AbstractMSRpcProxy

This class implements an abstract MSRpc proxy, denying access to all services by default.

4.12.4.1. Attributes of AbstractMSRpcProxy

command_timeout (integer, rw:r)
Default: 600000
Command timeout in milliseconds. If a packet cannot be transmitted during this interval, the connection is dropped.

forwarder_timeout (integer, rw:r)
Default: 20000
Forwarder timeout in milliseconds. If no connection is established to a forwarder facility during this period (measured from service approval), the forwarder will be cancelled.

interface (complex, rw:rw)
Default: empty
Normative policy hash indexed by the UUID of the services, specifying the security policy about the service. See Section 4.12.2.1, Setting policies for services for details.

secondary_port_max (integer, rw:r)
Default: 0
The upper limit of the port range allocated for forwarders. (Zero means no restriction.)

secondary_port_min (integer, rw:r)
Default: 0
The lower limit of the port range allocated for forwarders. (Zero means no restriction.)

timeout (integer, rw:r)
Default: 600000
Idle timeout in milliseconds. If no packet arrives during this period, the connection is dropped.

4.12.5. Class MSRpcProxy

This proxy allows access only to the most necessary EPM services for RPC to function. These services are 99fcfec4-5260-101b-bbcb-00aa0021347a and 8a885d04-1ceb-11c9-9fe8-08002b104860.

4.13. Module Nntp

The Nntp module defines the classes constituting the proxy for the Network News Transfer Protocol.

4.13.1. The NNTP Protocol

Network News Transfer Protocol (NNTP) is a protocol for distributing, reading or posting USENET articles via a reliable TCP connection between client-server or server-server.

4.13.1.1. The USENET system

Traditional mailing lists have several drawbacks. Members must subscribe to each list and a mailing list application (e.g.: the legendary majordomo) resends all posts to every member and keeps one more message in the list archive. This process lavishes bandwidth, time and storage space.

The solution is NNTP and USENET. Articles are stored in a central news server in Standard for Interchange of USENET Messages format. The central article repository (technically a spool) on a receiving host allows the readers to select the desired article and read it, or post a message to a USENET group. The client selects the article to read and the server presents it without duplicating it.

News clients usually connect to intermediate ("slave") servers or directly to the main repository. When a client sends a message to a newsgroup, a slave server receives the message and forwards it to the other servers.

4.13.1.2. Protocol elements

NNTP protocol is a request-response based protocol. The client sends REQUEST commands - text commands with arguments and closed by CRLF (carriage return followed by a line feed). The server answers with a STATUS RESPONSE, which is a 3 digit numeric status indicator code and a text message. After the STATUS RESPONSE comes the answer itself if there is any.

Status responses are reports from the server indicating the result of the last command received from the client. Status response lines begin with a 3 digit numeric code.

The first number indicates the success, failure or the progress of the last command. 1 means informative message is coming, 2 means the command is OK, 3 means the command is OK so far, 4 means the command is OK, but it is temporary unavailable and 5 means the command is incorrect.

The second number indicates the function response category, where 0 means the message is related to connection setup, 1 means the message is about newsgroup selection and 4 means the message is about posting.

The most common STATUS RESPONSEs are "200 server ready, posting allowed", "500 command not recognized" and "201 server ready, posting not allowed".

NNTP defines default commands for reading and posting articles or listing and changing between newsgroups. Several extensions are also available which allow the protocol to implement user identification and authentication.

[Example] Example 4.27. Example NNTP connection
200 newsfeed.example.com InterNetNews NNTP server INN 2.3.2 ready (posting ok).
LIST
215 Newsgroups in form "group high low flags".
hun.business.egyeb 0000000091 0000000088 y
hun.comp.lang.java 0000054077 0000050155 m
hun.comp.lang.madach 0000000000 0000000001 y
hun.comp.net 0000000009 0000000009 y
hun.comp.os.os2 0000000002 0000000002 y
hun.comp.os.solaris 0000000007 0000000007 y
hun.comp.text.tex 0000000007 0000000007 y
hun.flame 0000000065 0000000065 y
GROUP hun.comp.lang.java
211 3923 50155 54077 hun.comp.lang.java
ARTICLE 54077
220 54077 <XXXXXXXX.XXXXXXXX@foo.hu> article
Path: newsfeed.example.com
Distribution: hun
Subject:
.
Article comes here...
.
.
QUIT
205 .

4.13.2. Proxy behavior

NntpProxy is a module built for parsing the NNTP protocol. It reads and parses REQUESTs (commands) at the client side, and sends them to the server if the local security policy permits. When a RESPONSE arrives it parses the STATUS response and sends it to the client if the local security policy permits. It is possible to manipulate both the requests and the responses.

4.13.2.1. Default processing of commands and responses

The NNTP proxy denies all commands and responses by default. A customized proxy class can be used to enable commands and responses individually, or a predefined proxy class can be used.

4.13.2.2. Configuring policies for NNTP requests and responses

Changing the default behavior of requests is possible using the request attribute. This hash is indexed by the NNTP command name (e.g.: POST or ARTICLE). The response attribute (indexed by the command name and the response code) enables the control of NNTP responses. The possible actions are described in the following tables. See also Section 2.1, Policies for requests and responses. When looking up entries of the response attribute hash, the lookup precedence described in Section 2.1.2, Response codes is used.

Action Description
NNTP_REQ_ACCEPT

Allow the command.

NNTP_REQ_ACCEPT_CLIENTTEXT

Allow the command and notify the low level proxy layer that the client will send extra text (for example an article) immediately after this request.

This action is required only by certain non-standard NNTP extensions. It should be handled with great care, because its use can result in deadlocks or erroneous behavior.

NNTP_REQ_REJECT

Reject the command.

NNTP_REQ_REJECT_CLIENTTEXT

Reject the command and the extra text from the client.

NNTP_REQ_ABORT

Reject the command and terminate the NNTP session.

NNTP_REQ_POLICY

Call the function specified to make a decision about the event. The function receives three parameters: self, command, and the parameters of the command. See Section 2.1, Policies for requests and responses for details.

Table 4.36.  Action codes for NNTP requests


Action Description
NNTP_RSP_ACCEPT

Accept the response.

NNTP_RSP_ACCEPT_CLIENTTEXT

Accept the response and notify the low level layer that the client will send extra text (for example an article) immediately after this response.

NNTP_RSP_ACCEPT_SERVERTEXT

Accept the response and notify the low level layer of the proxy that the NNTP server will send extra text (e.g.: the list of newsgroups, or the body of an article) immediately after this response.

NNTP_RSP_REJECT

Reject the response. A response indicating a general error is sent to the client.

NNTP_RSP_REJECT_SERVERTEXT

Reject the response and notify the low level layer that although the server will send extra text following this response, it must not be forwarded to the client.

NNTP_RSP_ABORT

Reject the response and immediately terminate the current NNTP session.

NNTP_RSP_POLICY

Call the function specified to make a decision about the event. The function receives three parameters: self, response code, and the parameters of the response. See Section 2.1, Policies for requests and responses for details.

Table 4.37.  Action codes for NNTP responses


[Example] Example 4.28. Example for filtering accessible newsgroups

In this example access to certain newsgroups is disallowed: the GROUP responses are inspected by the function filterGroup (defined in the example), and responses containing the group 'disallowed.news.group' are rejected.

class MyFilteredNntpProxy(NntpProxyStrict):
	def config(self):
		NntpProxyStrict.config(self)
		self.response["GROUP", "*"] = (NNTP_REQ_POLICY, self.filterGroup)
   
	def filterGroup(self, command, param):
		if param == "disallowed.news.group":
			return NNTP_REQ_REJECT
		return NNTP_REQ_ACCEPT
[Example] Example 4.29. Example for defining policies for responses in NNTP

This example rejects all responses, except for GREETING, which is modified by the proxy. If a DATE response is received, the connection is terminated.

class MyNntpProxy(NntpProxyStrict):
	def config(self):
		NntpProxyStrict.config(self)
		self.response["*", "*"] = (NNTP_RSP_REJECT)
		self.response["GREETING", "*"] = (NNTP_RSP_POLICY, self.changeGreeting)
		self.response["DATE", "*"] = (NNTP_RSP_ABORT)
                    
	def changeGreeting(self, response, param):
		self.response_param = "NNTP server of Example Corporation"
		return NNTP_RSP_ACCEPT

Predefined constants are available for NNTP response codes for easier use. These are listed in Table 1.1, Constants for NNTP responses .

4.13.2.3. Stacking

The available stacking modes for this proxy module are listed in the following table. For additional information on stacking, see Section 2.3.1, Proxy stacking.

Action Description
NNTP_STK_NONE No additional proxy is stacked into the NNTP proxy.
NNTP_STK_MIME The data part including header information is passed to the specified stacked proxy.
NNTP_STK_POLICY Call the function specified to make a decision about the proxy stacking. See Section 4.13.2.3, Stacking for details.

Table 4.38.  Constants for proxy stacking


Stacking in NNTP is possible for all multiline commands. These are: ARTICLE, HEAD, BODY, HELP, IHAVE, LIST, NEWGROUPS, NEWNEWS, POST, LIST ACTIVE, LIST ACTIVE.TIMES, LIST DISTRIBUTIONS, LIST DISTRIB.PATS, LIST NEWSGROUPS, LIST OVERVIEW.FMT, LIST SUBSCRIPTIONS, LIST MOTD, LIST EXTENSIONS, LISTGROUP, XGTITLE, XHDR, XINDEX, XOVER, XPAT, XROVER.

4.13.3. Related standards

The NNTP protocol is described by the following standards:

  • The NNTP protocol is described in RFC 977.

  • The most common extensions are defined in RFC 2980.

  • Standard for Interchange of USENET Messages format is described in the RFC 1036.

  • The USENET news system is described in RFC 850.

4.13.4. Classes in the Nntp module

Class Description
AbstractNntpProxy Class encapsulating the abstract Nntp proxy.
NntpProxy Default NNTP proxy class based on AbstractNntpProxy.
NntpProxyGroupFilter NNTP proxy class based on NntpProxy with group filtering capacility.
NntpProxyRO NNTP proxy based on AbstractNntpProxy, denying the posting of articles.
NntpProxyStrict NNTP proxy based on AbstractNntpProxy, allowing only the minimal command set.

Table 4.39. Classes of the Nntp module


4.13.5. Class AbstractNntpProxy

This class implements an abstract NNTP proxy - it serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractNntpProxy, or a predefined NntpProxy proxy class. All responses defined in RFC 977 and RFC 2980 are accepted, all commands are rejected by default.

4.13.5.1. Attributes of AbstractNntpProxy

group_name (string, n/a:r)
Default: n/a
The name of the active (and acknowledged) group.

max_line_length (integer, rw:r)
Default: 513
Maximum allowed length of a command or an answer.

max_password_length (integer, rw:r)
Default: 32
Maximum allowed length of passwords at authentication, longer passwords are rejected.

max_username_length (integer, rw:r)
Default: 16
Maximum allowed length of username at authentication; longer names are rejected.

request (complex, rw:rw)
Default:
Normative policy hash for NNTP requests indexed by the command name. See also Section 4.13.2.2, Configuring policies for NNTP requests and responses.

request_command (string, n/a:rw)
Default: n/a
Command string sent by the client.

request_param (string, n/a:rw)
Default: n/a
Parameters of the command.

request_stack (complex, rw:rw)
Default:
Normative policy hash, instructing the proxy to stack another proxy into multiline answers. See also Section 4.13.2.3, Stacking.

response (complex, rw:rw)
Default:
Normative policy hash for NNTP responses indexed by the command name and the response code. See also Section 4.13.2.2, Configuring policies for NNTP requests and responses.

response_param (string, n/a:rw)
Default: n/a
Parameters of the response.

response_value (enum, n/a:rw)
Default: n/a
Response code sent by the server.

timeout (integer, rw:r)
Default: 120000
I/O timeout in milliseconds.

4.13.6. Class NntpProxy

A permitting NNTP proxy based on AbstractNntpProxy, allowing all commands and all possible responses.

4.13.7. Class NntpProxyGroupFilter

NNTP proxy based on NntpProxy, with the possibility to deny access to selected groups. NntpProxyGroupFilter uses a matcher policy (e.g., a RegexpMatcher) to determine if a particular group can be accessed or not.

4.13.7.1. Attributes of NntpProxyGroupFilter

matcher (class, rw:rw)
Default: None
Matcher determining whether access to a newsgroup is permitted or not.

4.13.8. Class NntpProxyRO

NNTP proxy based on AbstractNntpProxy, allowing read-only access to servers (i.e. posting of articles is disabled).

All known possible responses are enabled. The following commands are permitted: ARTICLE; AUTHINFO USER; AUTHINFO PASS; AUTHINFO SIMPLE; BODY; DATE; GROUP; HEAD; LAST; LIST; LIST ACTIVE; LIST ACTIVE.TIMES; LIST DISTRIBUTIONS; LIST DISTRIB.PATS; LIST MOTD; LIST NEWSGROUPS; LIST OVERVIEW.FMT; LIST SUBSCRIPTIONS; LISTGROUP; MODE READER; NEWGROUPS; NEWNEWS; NEXT; STAT; QUIT; XGTITLE; XHDR; XOVER; LIST EXTENSIONS. All other commands are rejected.

4.13.9. Class NntpProxyStrict

NNTP proxy based on AbstractNntpProxy, permitting only a minimal set of commands to be used. All known possible responses are enabled. The following commands are permitted: ARTICLE; BODY; HEAD; DATE; STAT; GROUP; LAST; LIST; NEWGROUPS; NEWNEWS; NEXT; QUIT; LIST ACTIVE; LIST ACTIVE.TIMES; LIST DISTRIBUTIONS; LIST DISTRIB.PATS; LIST NEWSGROUPS; LIST OVERVIEW.FMT; LIST NEWSGROUPS; LIST SUBSCRIPTIONS; LIST MOTD; LISTGROUP; XGTITLE; XHDR; XOVER; DATE; AUTHINFO USER; AUTHINFO PASS; MODE READER; HELP; IHAVE; POST; SLAVE; XINDEX; XPAT; XROVER; AUTHINFO SIMPLE; LIST EXTENSIONS. All other commands are rejected.

4.14. Module Plug

This module defines an interface to the Plug proxy. Plug is a simple TCP or UDP circuit, which means that transmission takes place without protocol verification.

4.14.1. Proxy behavior

This class implements a general plug proxy, and is capable of optionally disabling data transfer in either direction. Plug proxy reads connection on the client side, then creates another connection at the server side. Arriving responses are sent back to the client. However, it is not a protocol proxy, therefore PlugProxy does not implement any protocol analysis. It offers protection to clients and servers from lower level (e.g.: IP) attacks. It is mainly used to allow traffic pass the firewall for which there is no protocol proxy available.

By default plug copies all data in both directions. To change this behavior, set the copy_to_client or copy_to_server attribute to FALSE.

Plug supports the use of secondary sessions as described in Section 2.2, Secondary sessions.

[Note] Note

Copying of out-of-band data is not supported.

4.14.2. Related standards

Plug proxy is not a protocol specific proxy module, therefore it is not specified in standards.

4.14.3. Classes in the Plug module

Class Description
AbstractPlugProxy Class encapsulating the abstract Plug proxy.
PlugProxy Class encapsulating the default Plug proxy.

Table 4.40. Classes of the Plug module


4.14.4. Class AbstractPlugProxy

An abstract proxy class for transferring data.

4.14.4.1. Attributes of AbstractPlugProxy

bandwidth_to_client (integer, n/a:r)
Default: n/a
Read-only variable containing the bandwidth currently used in server->client direction.

bandwidth_to_server (integer, n/a:r)
Default: n/a
Read-only variable containing the bandwidth currently used in client->server direction.

buffer_size (integer, w:r)
Default: 1500
Size of the buffer used for copying data.

copy_to_client (boolean, w:r)
Default: TRUE
Allow data transfer in the server->client direction.

copy_to_server (boolean, w:r)
Default: TRUE
Allow data transfer in the client->server direction.

packet_stats_interval_packet (integer, w:r)
Default: 0
The number of passing packages between two successive packetStats() events. It can be useful when the Quality of Service for the connection is influenced dynamically. Set to 0 to turn packetStats() off.

packet_stats_interval_time (integer, w:r)
Default: 0
The time in milliseconds between two successive packetStats() events. It can be useful when the Quality of Service for the connection is influenced dynamically. Set to 0 to turn packetStats() off.

secondary_mask (secondary_mask, rw:r)
Default: 0xf
Specifies which connections can be handled by the same proxy instance. See Section 2.2, Secondary sessions for details.

secondary_sessions (integer, rw:r)
Default: 10
Maximum number of allowed secondary sessions within a single proxy instance. See Section 2.2, Secondary sessions for details.

shutdown_soft (boolean, w:r)
Default: FALSE
If enabled, the two sides of a connection are closed separately. (E.g.: if the server closes the connection the client side connection is held until it is verified that no further data arrives, for example from a stacked proxy.) It is automatically enabled when proxies are stacked into the connection.

stack_proxy (enum, w:r)
Default: n/a
Proxy class to stack into the connection. All data is passed to the specified proxy.

timeout (integer, w:r)
Default: 60000
I/O timeout in milliseconds.

4.14.4.2. AbstractPlugProxy methods

Method Description
packetStats(self, client_bytes, client_pkts, server_bytes, server_pkts) Function called when the packet_stats_interval is elapsed.

Table 4.41. Method summary


Method packetStats(self, client_bytes, client_pkts, server_bytes, server_pkts)

Arguments of packetStats
client_bytes (unknown, n/a:n/a)
Default: n/a
Number of bytes transmitted to the client.

client_pkts (unknown, n/a:n/a)
Default: n/a
Number of packets transmitted to the client.

server_bytes (unknown, n/a:n/a)
Default: n/a
Number of bytes transmitted to the server.

server_pkts (unknown, n/a:n/a)
Default: n/a
Number of packets transmitted to the server.

This function is called whenever the time interval set in packet_stats_interval elapses, or a given number of packets were transmitted. This event receives packet statistics as parameters.

This function can be used in managing the Quality of Service of the connections; e.g.: to terminate connections with excessive bandwidth requirements (for instance to limit the impact of a covert channel opened when using plug instead of a protocol specific proxy).

4.14.5. Class PlugProxy

A default PlugProxy based on AbstractPlugProxy.

4.15. Module Pop3

The Pop3 module defines the classes constituting the proxy for the POP3 protocol.

4.15.1. The POP3 protocol

Post Office Protocol version 3 (POP3) is usually used by mail user agents (MUAs) to download messages from a remote mailbox. POP3 supports a single mailbox only, it does not support advanced multi-mailbox operations offered by alternatives such as IMAP.

The POP3 protocol uses a single TCP connection to give access to a single mailbox. It uses a simple command/response based approach, the client issues a command and a server can respond either positively or negatively.

4.15.1.1. Protocol elements

The basic protocol is the following: the client issues a request (also called command in POP3 terminology) and the server responds with the result. Both commands and responses are line based, each command is sent as a complete line, a response is either a single line or - in case of mail transfer commands - multiple lines.

Commands begin with a case-insensitive keyword possibly followed by one or more arguments (such as RETR or DELE).

Responses begin with a status indicator ("+OK" or "-ERR") and a possible explanation of the status code (e.g.: "-ERR Permission denied.").

Responses to certain commands (usually mail transfer commands) also contain a data attachment, such as the mail body. See the Section 4.15.1.3, Bulk transfers for further details.

4.15.1.2. POP3 states

The protocol begins with the server displaying a greeting message, usually containing information about the server.

After the greeting message the client takes control and the protocol enters the AUTHORIZATION state where the user has to pass credentials proving his/her identity.

After successful authentication the protocol enters TRANSACTION state where mail access commands can be issued.

When the client has finished processing, it issues a QUIT command and the connection is closed.

4.15.1.3. Bulk transfers

Responses to certain commands (such as LIST or RETR) contain a long data stream. This is transferred as a series of lines, terminated by a "CRLF '.' CRLF" sequence, just like in SMTP.

[Example] Example 4.30. POP3 protocol sample
+OK POP3 server ready
USER account
+OK User name is ok
PASS password
+OK Authentication successful
LIST
+OK Listing follows
1 5758
2 232323
3 3434
.
RETR 1
+OK Mail body follows
From: sender@sender.com
To: account@receiver.com
Subject: sample mail

This is a sample mail message. Lines beginning with
..are escaped, another '.' character is perpended which
is removed when the mail is stored by the client.
.
DELE 1
+OK Mail deleted
QUIT
+OK Good bye

4.15.2. Proxy behavior

Pop3Proxy is a module built for parsing messages of the POP3 protocol. It reads and parses COMMANDs on the client side, and sends them to the server if the local security policy permits. Arriving RESPONSEs are parsed as well, and sent to the client if the local security policy permits. It is possible to manipulate both the requests and the responses.

4.15.2.1. Default policy for commands

By default, the proxy accepts all commands recommended in RFC 1939. Additionally, the following optional commands are also accepted: USER, PASS, AUTH. The proxy understands all the commands specified in RFC 1939 and the AUTH command. These additional commands can be enabled manually.

4.15.2.2. Configuring policies for POP3 commands

Changing the default behavior of commands can be done using the hash named request. The hash is indexed by the command name (e.g.: USER or AUTH). See Section 2.1, Policies for requests and responses for details.

Action Description
POP3_REQ_ACCEPT

Accept the request without any modification.

POP3_REQ_ACCEPT_MLINE

Accept multiline requests without modification. Use it only if unknown commands has to be enabled (i.e. commands not specified in RFC 1939 or RFC 1734).

POP3_REQ_REJECT

Reject the request. The second parameter contains a string that is sent back to the client.

POP3_REQ_POLICY

Call the function specified to make a decision about the event. See Section 2.1, Policies for requests and responses for details. This action uses two additional tuple items, which must be callable Python functions. The first function receives two parameters: self and command.

The second one is called with an answer, (if the answer is multiline, it is called with every line) and receives two parameters: self and response_param.

POP3_REQ_ABORT

Reject the request and terminate the connection.

Table 4.42.  Action codes for POP3 requests


[Example] Example 4.31. Example for allowing only APOP authentication in POP3

This sample proxy class rejects the USER authentication requests, but allows APOP requests.

class APop3(Pop3Proxy):
	def config(self):
		Pop3Proxy.config(self)
		self.request["USER"] = (POP3_REQ_REJECT)
		self.request["APOP"] = (POP3_REQ_ACCEPT)
[Example] Example 4.32. Example for converting simple USER/PASS authentication to APOP in POP3

The above example simply rejected USER/PASS authentication, this one converts USER/PASS authentication to APOP authentication messages.

class UToAPop3(Pop3Proxy):
	def config(self):
		Pop3Proxy.config(self)
		self.request["USER"] = (POP3_REQ_POLICY,self.DropUSER)
		self.request["PASS"] = (POP3_REQ_POLICY,self.UToA)

	def DropUSER(self,command):
		self.response_value = "+OK"
		self.response_param = "User ok Send Password"
		return POP3_REQ_REJECT

	def UToA(self,command):
		# Username is stored in self->username,
		# password in self->request_param,
		# and the server timestamp in self->timestamp,
		# consequently the digest can be calculated.
		# NOTE: This is only an example, calcdigest must be
		# implemented separately
		digest = calcdigest(self->timestamp+self->request_param)
		self->request_command = "APOP"
		self->request_param = name + " " + digest
		return POP3_REQ_ACCEPT

4.15.2.3. Rewriting the banner

As in many other protocols, POP3 also starts with a server banner. This banner contains the protocol version the server uses, the possible protocol extensions that it supports and, in many situations, the vendor and exact version number of the POP3 server.

This information is useful only if the clients connecting to the POP3 server can be trusted, as it might make bug hunting somewhat easier. On the other hand, this information is also useful for attackers when targeting this service.

To prevent this, the banner can be replaced with a neutral one. Use the request hash with the 'GREETING' keyword as shown in the following example.

[Example] Example 4.33. Rewriting the banner in POP3
class NeutralPop3(Pop3Proxy):
	def config(self):
	Pop3Proxy.config(self)
	self.request["GREETING"] = (POP3_REQ_POLICY, None, self.rewriteBanner)

	def rewriteBanner(self, response)
		self.response_param = "Pop3 server ready"
		return POP3_RSP_ACCEPT
[Note] Note

Some protocol extensions (most notably APOP) use random characters in the greeting message as salt in the authentication process, so changing the banner when APOP is used effectively prevents APOP from working properly.

4.15.2.4. Stacking

The available stacking modes for this proxy module are listed in the following table. For additional information on stacking, see Section 2.3.1, Proxy stacking.

Action Description
POP3_STK_POLICY

Call the function specified to decide which part (if any) of the traffic should be passed to the stacked proxy.

POP3_STK_NONE

No additional proxy is stacked into the POP3 proxy.

POP3_STK_MIME

The data part of the traffic including the MIME headers is passed to the specified stacked proxy.

POP3_STK_DATA

Only the data part of the traffic is passed to the specified stacked proxy.

Table 4.43.  Action codes for proxy stacking


4.15.2.5. Rejecting viruses and spam

When filtering messages for viruses or spam, the content vectoring modules reject infected and spam e-mails. In such cases the POP3 proxy notifies the client about the rejected message in a special e-mail.

To reject e-mail messages using the ERR protocol element, set the reject_by_mail attribute to FALSE. However, this is not recommended, because several client applications handle ERR responses incorrectly.

[Note] Note

Infected e-mails are put into the quarantine and deleted from the server.

4.15.3. Related standards

  • Post Office Protocol Version 3 is described in RFC 1939.

  • The POP3 AUTHentication command is described in RFC 1734.

4.15.4. Classes in the Pop3 module

Class Description
AbstractPop3Proxy Class encapsulating the abstract POP3 proxy.
Pop3Proxy Default POP3 proxy based on AbstractPop3Proxy.

Table 4.44. Classes of the Pop3 module


4.15.5. Class AbstractPop3Proxy

This class implements an abstract POP3 proxy - it serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractPop3Proxy, or a predefined Pop3Proxy proxy class. AbstractPop3Proxy denies all requests by default.

4.15.5.1. Attributes of AbstractPop3Proxy

max_authline_count (integer, rw:r)
Default: 4
Maximum number of lines that can be sent during the authentication conversation. The default value is enough for password authentication, but might have to be increased for other types of authentication.

max_password_length (integer, rw:r)
Default: 16
Maximum allowed length of passwords.

max_request_line_length (integer, rw:r)
Default: 90
Maximum allowed line length for client requests.

max_response_line_length (integer, rw:r)
Default: 512
Maximum allowed line length for server responses.

max_username_length (integer, rw:r)
Default: 8
Maximum allowed length of usernames.

password (string, n/a:r)
Default:
Password sent to the server (if any).

permit_longline (boolean, rw:r)
Default: FALSE
In multiline answer (especially in downloaded messages) sometimes very long lines can appear. Enabling this option allows the unlimited long lines in multiline answers.

permit_unknown_command (boolean, rw:r)
Default: FALSE
Enable unknown commands.

reject_by_mail (boolean, rw:r)
Default: TRUE
If the stacked proxy or content vectoring module rejects an e-mail message, reply with a special e-mail message instead of an ERR response. See Section 4.15.2.5, Rejecting viruses and spam for details.

request (complex, rw:rw)
Default:
Normative policy hash for POP3 requests indexed by the command name (e.g.: "USER", "UIDL", etc.). See also Section 4.15.2.2, Configuring policies for POP3 commands.

request_command (string, n/a:rw)
Default: n/a
When a command is passed to the policy level, its value can be changed to this value.

request_param (string, n/a:rw)
Default: n/a
When a command is passed to the policy level, the value of its parameters can be changed to this value.

response_multiline (boolean, n/a:rw)
Default: n/a
Enable multiline responses.

response_param (string, n/a:rw)
Default: n/a
When a command or response is passed to the policy level, the value its parameters can be changed to this value. (It has effect only if the return value is not POP3_*_ACCEPT).

response_stack (complex, rw:rw)
Default:
Hash containing the stacking policy for multiline POP3 responses. The hash is indexed by the POP3 response. See also Section 4.15.2.4, Stacking.

response_value (string, n/a:rw)
Default: n/a
When a command or response is passed to the policy level, its value can be changed to this value. (It has effect only if the return value is not POP3_*_ACCEPT).

session_timestamp (string, n/a:r)
Default: n/a
If the POP3 server implements the APOP command, with the greeting message it sends a timestamp, which is stored in this parameter.

timeout (integer, rw:r)
Default: 600000
Timeout in milliseconds. If no packet arrives within this interval, connection is dropped.

username (string, n/a:r)
Default: n/a
Username as specified by the client.

4.15.6. Class Pop3Proxy

Pop3Proxy is the default POP3 proxy based on AbstractPop3Proxy, allowing the most commonly used requests.

The following requests are permitted: APOP; DELE; LIST; LAST; NOOP; PASS; QUIT; RETR; RSET; STAT; TOP; UIDL; USER; GREETING. All other requests (including CAPA) are rejected.

4.16. Module Radius

The Radius module defines the classes constituting the proxy for the RADIUS protocol.

4.16.1. The RADIUS protocol

Remote Authentication Dial In User Service (RADIUS) is a client-server protocol for user authentication between the Network Access Server (NAS) and the authenticator server. The protocol has three participants:

  • The user requesting network access the service (e.g.: PPP, PLIP etc.).

  • The access point (modem pools or NAS servers), which delivers the service. The access point acts as the client in the protocol.

  • The server which authenticates the user.

The RadiusProxy is installed between the server and client (i.e. the access point).

4.16.1.1. Protocol elements

During the authentication process the participants use the following protocol elements:

  • REQUEST: When a new connection attempt arrives to the NAS, it sends a message towards the RADIUS server requesting the authentication of the user; or it sends an accounting related message.

  • RESPONSE: The RADIUS server attempts to authenticate the user when an authentication REQUEST is received. The server returns the result of the process to the NAS in a RESPONSE message.

  • ATTRIBUTE: Both the REQUEST and RESPONSE packets contain a set of structured attribute-value pairs containing information like username, password or the type of service requested by the user. Attributes are identified by a number ranging from 0 to 255. Each attribute has an associated type specified in the RADIUS RFCs which define the range of valid values.

    [Note] Note

    There are also some vendor-specific RADIUS dictionaries, where certain attributes are used for internal purposes. Obviously, these are not discussed in the RFCs.

4.16.1.2. RADIUS states

The user initiates the authentication process when attempting to use a NAS service. When the user request arrives, the NAS sends an Access-Request message containing the attributes username, md5 hashed password, the user IP and the port ID. The message is sent to port UDP/1812; if no response is received within a period of time, the request is re-sent a number of times.

If RADIUS is configured to use username/password based authentication, the server consults the database and if all the terms match, the server replies with an Access-Accept message. When the challenge/response method is used the server generates a challenge and sends it to the client in an Access-Challenge message. The client displays it to the user who calculates the response which is resubmitted by the NAS client in another Access-Request message with a new request ID, encrypted User-Password attribute and the State Attribute. If the response is correct the server allows the connection request in an Access-Accept message and the NAS starts to deliver the service. If the authentication process fails the server sends an Access-Reject message and the NAS denies the delivery of the service.

The user and the NAS server (technically the radius client) are authenticated separately. The user is authenticated only after the NAS has been verified via the Radius secret (i.e. password). Users can be authenticated by username/password or challenge/response methods.

Username/password authentication is a traditional authentication method where the user id identifies the user and the password authenticates him/her. During the challenge/response the user ID identifies the user itself and the client is authenticated by a one time password. The server sends an unpredictable number to the client. The user calculates it with a hardware or software tool and sends the result back. If the answer is correct, it validates the client's identity and this is the response which authenticates the user.

The Access-Accept message might deliver additional parameters to the service, such as IP address. These additional parameters are delivered as values of various attributes.

RADIUS can also be used to send Service-Start and Service-End messages for accounting purposes. While the protocol is the same as the one described above, it uses a separate port and a separate set of attributes. When the client is configured to use RADIUS Accounting, it sends an Accounting-Start message describing the type of the service and the user using it. RADIUS accounting uses the port UDP/1813. The RADIUS server returns an acknowledgment. The client repeats sending the request until it receives the acknowledgment. At the end of delivering the service, the client sends an Accounting-Stop message to the server describing the type and optionally the statistics about the connection. The server acknowledges the stop messages as well.

[Note] Note

Earlier UDP/1645 was also used by RADIUS servers, and accounting messages were sent using port UDP/1646.

4.16.2. Proxy behavior

RadiusProxy is a module built for parsing the messages of the RADIUS protocol. It reads the REQUESTs at the client side and decrypts the user password with the given shared secret (known by both the client and the server). If the REQUEST and all the ATTRIBUTEs are permitted by the local security policy, it sends the message to the RADIUS server. It parses the arriving RESPONSE and validates the authenticator signature. The authenticator signature is an MD5 hash included in the RADIUS message, generated from various message parameters, including the shared secret. It is used to ensure that the response is genuine and was indeed sent by the server. If the RESPONSE is permitted by the local security policy and is authentic, the message encrypted with the secret is returned to the NAS. It is possible to keep different secrets on the two sides of the proxy (i.e. password translation is possible). RadiusProxy is able to parse both authentication and accounting messages, and it can also manipulate RESPONSEs if the secret is available. If the secret is not available, Zorp cannot validate the authenticator signatures, thus it is not possible to verify that the received response was sent to a proper request. Both the client and server side secrets are required for modifying the messages; for validating the authenticator signature, the server side secret is sufficient.

4.16.2.1. Configuring policies for RADIUS commands and responses

Changing the default behavior of commands can be done by using the hash attribute request. There is a similar attribute for responses called response. These hashes are indexed by the type of the request/response. The possible values of these hashes are shown in the tables below. See Section 2.1, Policies for requests and responses for details.

Action Description
RADIUS_REQ_ACCEPT Allow the request to pass.
RADIUS_REQ_REJECT Block the request and report it to the client.
RADIUS_REQ_ABORT Terminate the connection.
RADIUS_REQ_DROP Block the request without further action.
RADIUS_REQ_POLICY Call the function specified to make a decision about the event. See Section 2.1, Policies for requests and responses for details.

Table 4.45.  Action codes for RADIUS requests


Action Description
RADIUS_RSP_ACCEPT Allow the response to pass.
RADIUS_RSP_REJECT Block the response and report it to the client.
RADIUS_RSP_ABORT Terminate the connection.
RADIUS_RSP_DROP Block the response without further action.
RADIUS_RSP_POLICY Call the function specified to make a decision about the event. See Section 2.1, Policies for requests and responses for details.

Table 4.46.  Action codes for RADIUS responses


Similar policies can be defined for RADIUS attributes. For easier use, predefined constants are available for the different attributes. The possible actions on the attributes are listed in the following table. The attribute constants are listed in Table 1.2, RADIUS Protocol Attribute types described in RFC 2865. .

Action Description
RADIUS_ATR_ACCEPT Allow the attribute to pass.
RADIUS_ATR_REJECT Block the attribute and report it to the client.
RADIUS_ATR_ABORT Terminate the connection.
RADIUS_ATR_DROP Reject the entire message if it contains the specified attribute.
RADIUS_ATR_POLICY Call the function specified to make a decision about the event. See Section 2.1, Policies for requests and responses for details.
RADIUS_ATR_ZERO An alias of RADIUS_ATR_DROP the action code.
RADIUS_ATR_ACCEPT_MAXONE The message can contain zero or one of the specified attribute.
RADIUS_ATR_ACCEPT_ONE Accept exactly one attribute in the message. The message is rejected if it does not contain the specified attribute. This action can be used to check the existance of mandatory attributes.
RADIUS_ATR_DROP_ONE Drop the attribute from the message; the message itself is not rejected.

Table 4.47.  Action codes for RADIUS attributes


4.16.2.2. Binding secondary sessions

The RADIUS protocol does not guarantee the delivery of the messages (since it uses UDP), consequently packages are dropped if the system is overburden. Clients and servers attempt to send messages several times; allowing secondary sessions increases reliability and decreases server load. See Section 2.2, Secondary sessions for further information.

[Example] Example 4.34. Example RadiusProxy config

The following example defines a RADIUS proxy which serves 1000 parallel requests in one thread. Packet rebuilding is turned on as well, therefore the server and client side secrets are also specified.

class MyRadiusProxy(RadiusProxy):
	def config(self):
		RadiusProxy.config(self)
		self.client_secret="secret"
		self.server_secret="secret"
		self.rebuild_packets='TRUE'
		self.secondary_mask = 0xC
		self.secondary_sessions = 1000

4.16.3. Related standards

  • The RADIUS protocol is defined in RFC 2865.

  • The RADIUS Accounting protocol is defined in RFC 2866.

4.16.4. Classes in the Radius module

Class Description
AbstractRadiusProxy Class encapsulating the abstract RADIUS proxy.
RadiusProxy Default RADIUS proxy based on AbstractRadiusProxy.
RadiusProxyStrict RADIUS proxy based on AbstractRadiusProxy, allowing only a minimal command set.

Table 4.48. Classes of the Radius module


4.16.5. Class AbstractRadiusProxy

This class implements the RADIUS protocol as described by RFC 2865.

4.16.5.1. Attributes of AbstractRadiusProxy

attribute_desc (complex, rw:rw)
Default: n/a
Attribute descriptors, this hash is indexed by the attribute type and the value contains a tuple of (type, min, max). The min and max values are interpreted depending on the RADIUS type. For integers it means the minimum and maximum integer values, for strings it is applied to the string length.

attribute_usage (complex, rw:rw)
Default:
Describes attribute usage, the hash is indexed by the tuple of (packet type, attribute id). The value is a singleton tuple containing one of the RADIUS_ATR values.

client_secret (string, rw:r)
Default:
Secret string (password) shared between the client (probably NAS) and Zorp. Setting this value is not mandatory, but some of the proxy functions will not be available (see Section 4.16.2, Proxy behavior for details).

max_packet_length (integer, rw:r)
Default: 4096
Maximum allowed length of packets.

permit_trailing_zeroes (boolean, rw:rw)
Default: FALSE
Workaround for a Cisco bug (the router sometimes pads the packets with NUL bytes).

rebuild_packets (boolean, rw:rw)
Default: FALSE
Specifies whether to rebuild packets (requires both shared secrets to be available, see Section 4.16.2, Proxy behavior for details).

request (complex, rw:rw)
Default:
Normative policy hash for RADIUS request types indexed by the type of the request. See also Section 4.16.2.1, Configuring policies for RADIUS commands and responses.

response (complex, rw:rw)
Default:
Normative policy hash for RADIUS response types indexed by the type of the response. See also Section 4.16.2.1, Configuring policies for RADIUS commands and responses.

secondary_mask (secondary_mask, rw:r)
Default: 0xf
Specifies which connections can be handled by the same proxy instance (the same connection is enabled as secondary session by default). See Section 2.2, Secondary sessions for details.

secondary_sessions (integer, rw:r)
Default: 10
Maximum number of allowed secondary sessions within a single proxy instance. See Section 2.2, Secondary sessions for details.

server_secret (string, rw:r)
Default:
Secret string (password) shared between the server and Zorp. Setting this value is not mandatory, but some of the proxy functions will not be available (see Section 4.16.2, Proxy behavior for details).

timeout (integer, rw:r)
Default: 60000
Timeout in milliseconds.

4.16.6. Class RadiusProxy

Default RADIUS proxy based on AbstractRadiusProxy allowing all well-formed RADIUS packets (all requests, responses, and attributes) through the firewall. Secondary sessions are enabled for the same target (secondary_mask=0xC) (maximum 10). For a stricter default configuration use the RadiusProxyStrict class.

4.16.7. Class RadiusProxyStrict

Radius proxy strictly checking RFC compliance of the passing packets. Packets containing attributes that are not defined in the RFC are dropped.

The following requests and responses are permitted: radius_access_request; radius_access_challenge; radius_access_reject; radius_access_accept; radius_accounting_request; radius_accounting_response. All other requests and responses are rejected. The policy used for the attributes is listed in the Radius Appendix.

4.17. Module Rdp

The Remote Desktop Protocol is used to access the desktop of remote computers that run Microsoft Windows Operating systems. Its most commonly used to remotely manage Windows-based servers.

4.17.1. The Remote Desktop Protocol protocol

The Microsoft Remote Desktop Protocol (RDP) provides remote display and input capabilities over network connections for Windows-based applications running on a server. Using RDP, clients can access the desktop and other facilities (e.g., file shares) of remote computers. The proxy currently supports two versions of the RDP protocol: RDP4 and RDP5. RDP4 uses 512bit RSA keys to encrypt the communication, and does not support the forwarding of additional facilities. RDP5 uses either 512bit RSA keys (RDP4-style) or X.509 certificates (RDP5-style) for encryption, and can forward additional facilities like disk shares or sound.

Both versions support specifying a default username and optionally a password for it.

4.17.2. Proxy behavior

The Zorp RDP proxy can control the RDP traffic at three main points, controlling the version of RDP enabled in the connection, the channels and facilities enabled in the connection, and modifying the username and the address of the destination server.

[Note] Note

Starting with Zorp 3.4, in case a password-based authentication is unsuccessful, the Zorp proxy terminates the connection instead of re-requesting the password from the user.

4.17.2.1. Controlling the protocol version

You can set restrictions on the protocol version used in the connection.

[Example] Example 4.35. Disabling RDP5 protocol by force-reverting it to RDP4

The following proxy class enables RDP4 sessions only, and reverts the session to RDP4 if a client tries to initiate an RDP5 session.

class MyRdpProxy(RdpProxy):
        def config(self):
                RdpProxy.config(self)
                self.enable_rdp5 = FALSE
                self.force_rdp4 = TRUE
                self.enable_rdp4 = TRUE

4.17.2.2. Channel filtering

You can control which channels (i.e., remote facilities) can be used in the connection. The available facility channels are shown in the following table:

Name Value
RDP_CHANNEL_RDPDR Sharing of disks, printers, serial and parallel ports, and secure devices.
RDP_CHANNEL_RDPSND Sharing sound devices.
RDP_CHANNEL_SEAMRDP Displaying remote windows as local ones instead of displaying the whole remote desktop in a local window (called seamless RDP).

Table 4.49.  Channel names of remotely accessible facilities.


[Example] Example 4.36. Disabling channel RDPDR

The following proxy class disables access to file-shares, printers, and other similar facilites.

class MyRdpProxy(RdpProxy):
        def config(self):
                RdpProxy.config(self)
                self.channel_policy[RDP_CHANNEL_RDPDR] = ZV_REJECT

Applications can open custom channels to the clients connecting remotely to the server. To permit access to these channels, derive a proxy class and explicitly enable the channels required by the application. Consult the documentation of the application for the exact names of these custom channels. Alternatively, configure an RDP proxy and try to use the application: Zorp logs the names of the rejected channels.

[Example] Example 4.37. Enabling custom channels

The following proxy class enables access to custom channels examplechannelname1 and examplechannelname2 used by an application.

class CustomRdpProxy(RdpProxy):
        def config(self):
                RdpProxy.config(self)
                self.channel_policy[examplechannelname1] = ZV_ACCEPT
                self.channel_policy[examplechannelname2] = ZV_ACCEPT

4.17.2.3. Actions by username

If the client supplies a default username, the parse_connection_name function can be used to modify the username, and the address and port of the destination server.

[Example] Example 4.38. Dynamically change username and server address

The following proxy class examines the username sent by the client and modifies the username and the address of the destination server. If the client sends and unknown username, the connection is rejected.

class MyRdpProxy(RdpProxy):
        def parse_connection_name(self, conn_name):
                if (conn_name == "j@svr1"):
                        return ("joe", "1.1.1.1", 3389)
                elif (conn_name == "a@svr1"):
                        return ("Administrator", "1.1.1.1", 3389)
                elif (conn_name == "j@svr2"):
                        return ("joe", "2.2.2.2", 3389)
                elif (conn_name == "a@svr2"):
                        return ("Administrator", "2.2.2.2", 3389)
                return (None)
                        
        def config(self):
                RdpProxy.config(self)

4.17.2.4. Verifying the server certificate

Use the server_certs_verify attribute to control if a server certificate is accepted. The following options are available.

Name Value
RDP_SCV_ACCEPT_ANY Accept any server certificate.
RDP_SCV_ACCEPT_ONCE Accept unknown server certificates only on the first occassion. The IP address-port pair of unknown server certificates is registered, later on that certificate is used to verify connections from that address.
RDP_SCV_ACCEPT_KNOWN Accept only known server certificates. X509 certificates can be configured for each IP address or port pair (like in case of the known_hosts file). For any unknown IP address-port pair the connection is terminated.

Table 4.50.  RDP server certificate verification mode.


4.17.2.5. Related standards

RDP is based on the ITU T.120 family of protocols. For details, see http://www.itu.int/rec/T-REC-T.120/en.

4.17.3. Classes in the Rdp module

Class Description
AbstractRdpProxy Class encapsulating the abstract Rdp proxy.
Rdp4FallbackProxy Rdp proxy for RDP4 and RDP5 sessions.
Rdp4Proxy Rdp proxy for RDP4 sessions.
Rdp5Proxy Rdp proxy for RDP5 sessions.
Rdp5ProxyStrict Rdp proxy for strictly RDP5 sessions.
RdpProxy Default Rdp proxy based on AbstractRdpProxy.

Table 4.51. Classes of the Rdp module


4.17.4. Class AbstractRdpProxy

This class implements an abstract proxy for the Remote Desktop Protocol. AbstractRdpProxy serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractRdpProxy, or one of the predefined RdpProxy proxy classes.

4.17.4.1. Attributes of AbstractRdpProxy

audit_channels (complex)
Default: n/a
Normative policy hash for information about RDP channels are to be audited or not, indexed by the channel name. This hash may be overridden by policy functions.

auth_server (boolean)
Default: FALSE
When set to TRUE, authentication is performed on the target server, only the authorization is handled on Zorp.

channel_policy (complex)
Default: n/a
Normative policy hash for RDP channels indexed by the channel name and (optionally) the names of sub-facilities and/or facility functions.

disable_font_smoothing (boolean)
Default: TRUE
When set to TRUE, font smoothing (antialiasing) is disabled in RDP version 5. This can affect the user experience when accessing the graphical desktop of remote hosts.

enable_compression (boolean)
Default: TRUE
When set to TRUE, RDP traffic is compressed to reduce bandwidth usage.

enable_console_session (boolean)
Default: TRUE
Enable console sessions. NOTE: Not yet implemented

enable_crypt (rdp_crypt_mask)
Default: 0x6000001b
Enable encryption.

enable_rdp4 (boolean)
Default: TRUE
Enable RDP4 sessions.

enable_rdp4_auth (boolean)
Default: TRUE
Enable RDP4-style client authentication in RDP5 sessions.

enable_rdp5 (boolean)
Default: TRUE
Enable RDP5 sessions.

force_rdp4 (boolean)
Default: FALSE
Revert RDP5 sessions to RDP4.

host_key_cert_file (string)
Default:
Read the X509 certificate from the file specified.

host_key_rsa512_file (certificate)
Default:
Read the 512-bit RSA hostkey from the file specified.

host_key_rsa_file (certificate)
Default:
Read the RSA hostkey from the file specified.

host_keypair_rsa_file (certificate)
Default:
A tuple of two file names containing the certificate and key files.

max_bpp (integer)
Default:
Maximal allowed colour depth of remote desktops, no limit if unset. Must be one of 8, 15, 16, 24 and 32, otherwise will be coerced to an applicable value.

max_height (integer)
Default:
Maximal allowed height of remote desktops, no limit if unset.

max_width (integer)
Default:
Maximal allowed width of remote desktops, no limit if unset. Must be divisible by 4, otherwise it will be rounded down to the nearest applicable value.

timeout (integer)
Default: 600000
I/O timeout in milliseconds. NOTE: not yet implemented

4.17.4.2. AbstractRdpProxy methods

Method Description
parse_connection_name(self, conn_name) Method to make decisions based on the username.

Table 4.52. Method summary


Method parse_connection_name(self, conn_name)

This function is invoked right at the start of the session, just before connecting to the server. At this time all attributes are configured and the argument conn_name is set to the default username provided by the client. This method shall return one of the following:

  • None: Leave everything unchanged.

  • A string: Change the username to the one specified in the string.

  • A tuple: Change the username, the server name and the server port. The parameters of the tuple are optional from the right. Any parameter may be set to None or 0 to leave the original value unchanged.

4.17.5. Class Rdp4FallbackProxy

Rdp4Proxy enables RDP4 sessions only, however, if a client tries to initiate an RDP5 session, it will be reverted to RDP4.

4.17.6. Class Rdp4Proxy

Rdp4Proxy enables RDP4 sessions only.

4.17.7. Class Rdp5Proxy

Rdp5Proxy enables RDP5 sessions only, but RDP4-style client authentication is permitted.

4.17.8. Class Rdp5ProxyStrict

Rdp5Proxy enables RDP5 sessions only.

4.17.9. Class RdpProxy

RdpProxy is a proxy class based on AbstractRdpProxy, allowing the use of all Rdp options.

4.17.9.1. Attributes of RdpProxy

cert_cache_directory (string)
Default: "/var/lib/zorp/rdp-cert-cache"
The directory used for caching generated certificates.

generator_ca_files (certificate)
Default:
A tuple of two file names containing the certificate and key files used as a signing CA for run-time generated certificates.

server_certs_dir (trustedkeydir)
Default:
The directory containing known RDP server certificates.

server_certs_verify (enum)
Default: RDP_SCV_ACCEPT_KNOWN
The verification mode for RDP server certificates. See Section 4.17.2.4, Verifying the server certificate.

4.18. Module Rsh

Remote shell (RSH) is an old protocol used to execute commands on a remote server.

4.18.1. The RSH protocol

RSH has a dual channel architecture. The client establishes a connection to the RSH daemon (rshd) and sends a user name and a command to execute. This channel becomes the standard input and output of the executed command. An optional second channel is initiated by the daemon to transfer standard error messages.

[Warning] Warning

Both channels are plain text and completely insecure.

The protocol uses the following steps:

The client initiates a connection towards the server. At this stage the client sends an optional port number where it listens for a connection used for transferring the standard error stream. These ports must be between TCP/513-1023, this is verified by both the client and the server. The server initiates a connection to this port if one is specified. Both connections must originate from TCP ports 513-1023. As this is the only security measure in the protocol, both the server and client check it strictly.

Most server implementations verify the name and the address of the client using 'host' and 'gethostbyname' commands. If the verification is not successful, the server aborts the connection with a "Host address mismatch" message. This feature can be important if the original client address is not forged.

The client sends his/her username on the client machine. Username can be up to 16 characters long.

The client sends his/her username on the server machine. Username can be up to 16 characters long.

Rshd validates the user using the file /etc/hosts.equiv and the .rhosts files found in the user's home directory. Users list the allowed client hosts and user IDs in their homes (in $HOME/.rhosts).

Rshd executes the command, returns its standard output in the command channel and sends the standard error in the error channel.

Finally, the client closes the connection.

4.18.2. Proxy behavior

RshProxy is a module built for parsing messages of the RSH protocol. It reads and parses the COMMANDs on the client side, and sends them to the server if the local security policy permits. The COMMANDs can be manipulated by calling the rshRequest function.

Since the RSH protocol uses ports from the privileged port range (TCP 513-1023), the forge_port parameter of the router used must be enabled when configuring the service for the proxy.

[Example] Example 4.39. Strict Rsh proxy denying root user access and logging the issued Rsh commands

RshProxy calls the rshRequest function if defined.

class StrictRshProxy(RshProxy):
	def config(self):
		RshProxy.config(self)
		self.timeout = 300000
  
	def rshRequest(self, client_user, server_user, cmd):
		if (self.server_user == 'root'):
			return RSH_REQ_DENY
		log(None, CORE_DEBUG, 3, "Rsh command; '%s'" % (cmd))
		return RSH_REQ_ACCEPT

The following actions are available for rsh requests:

Action Description
RSH_REQ_ACCEPT Allow the request to pass.
RSH_REQ_DENY
RSH_REQ_REJECT Block the request and report it to the client.
RSH_REQ_ABORT Terminate the connection.
RSH_REQ_DROP Block the request without further action.

Table 4.53.  Action codes for RSH requests


4.18.3. Related standards

The RSH protocol is described in the man pages of rshd.

4.18.4. Classes in the Rsh module

Class Description
AbstractRshProxy Class encapsulating the abstract Rsh proxy.
RshProxy Default Rsh proxy based on AbstractRshProxy. All settings are inherited from AbstractRshProxy.

Table 4.54. Classes of the Rsh module


4.18.5. Class AbstractRshProxy

This class implements an application gateway for the RSH protocol as described in the rshd manual pages.

4.18.5.1. Attributes of AbstractRshProxy

buffer_size (integer, rw:r)
Default: 4096
Size of the I/O buffer.

client_username (string, rw:rw)
Default: n/a
Username on the client specified by the client.

command (string, rw:rw)
Default: n/a
The command itself with its arguments.

max_command_length (integer, rw:r)
Default: 256
Maximum allowed length of the command (including arguments) issued by the client.

max_username_length (integer, rw:r)
Default: 16
Maximal number of characters in the username on the server side.

require_privileged_port (boolean, rw:r)
Default: TRUE
Set to TRUE if the clients need to use privileged source port (TCP/513-1023).

server_username (string, rw:rw)
Default: n/a
Username on the server specified by the client.

timeout (integer, rw:r)
Default: 600000
Timeout in milliseconds. If no packet arrives in the command channel within this interval, connection is dropped.

timeout_stderr_connect (integer, rw:r)
Default: 30000
Connection timeout value in milliseconds. If no packet arrives in the standard error channel within this interval, connection is dropped.

4.18.5.2. AbstractRshProxy methods

Method Description
rshRequest(self, client_user, server_user, cmd) Function for influencing client/server usernames and the requested command.

Table 4.55. Method summary


Method rshRequest(self, client_user, server_user, cmd)

Function for influencing client/server usernames and the requested command.

4.18.6. Class RshProxy

The default RshProxy based on AbstractRshProxy.

4.19. Module Sip

The Sip module defines the classes constituting the proxy for the Session Initiation Protocol (SIP).

4.19.1. The SIP protocol

SIP is a peer-to-peer protocol providing call processing functions and features similar to public switched telephone networks. The SIP protocol (or protocol family rather) is not a conventional Internet protocol, because it is not based on the traditional client-server model. Although there are prioritized servers for performing certain tasks, in most cases SIP phones function as both clients and servers on the network. Consequently, the protocol does not use the usual request/response based communication, and that has important consequences in perimeter defense.

4.19.1.1. Protocol elements

The devices involved in SIP communication can have several different roles, but a single device can play the part of different roles at the same time. The most important roles are briefly summarized below:

  • User-agent: The phone itself. In the traditional model, this would be called client.

  • Registrar: The registration service. The address where a particular user-agent is accessible is registered here. It acts as a sort of a name service for the protocol.

  • Proxy: This device transmits the requests of the user-agents. It has nothing to do, and is not to be confused with a proxy firewall or with a web cache proxy.

  • Presence server: Similar to the registrar; this device stores information about the availability of the user-agents. Users can monitor if the VoIP devices of their contacts (friends, business partners, etc.) are active (i.e. on-line) via the presence server.

  • Back2back user-agent: This is a special proxy implementing the functions of two user-agents. On one side of a connection it acts as the caller, on the other side as the called party.

SIP is only involved in the signaling part of a communication session, and relies on other protocols to perform the actual data transfer. SIP communication takes place in multiple channels: one is the signaling channel, the other one the actual data channel used to transmit the voice and/or video data. This latter channel is opened dynamically according to parameters negotiated in the signaling channel. The negotiation uses a separate - embedded - protocol called Session Description Protocol (SDP) used to describe the channel and the type of media used in a session (i.e. the IP ports, codecs, etc.). It is essential for the firewall to understand and inspect the SDP protocol, since it contains all the information required to allow the VoIP traffic pass the firewall. The SDP traffic also has to be modified in case network address translation is performed. To transfer the actual voice, video, or other data, SIP uses the Real-time Transport Protocol (RTP). RTP defines a standardized packet format for delivering audio and video over the Internet, and is frequently used in audio/video streaming and conferencing solutions.

From the signaling point of view, it is important to note that there is no client/server hierarchy between the user-agents, only caller/called party. The signaling traffic is usually not transmitted directly between the user-agents, generally proxies and back2back user-agents are also involved. Consequently, signaling messages (for example a request and a corresponding answer) can take very different routes between two user-agents, greatly complicating the secure transmission of the protocol. On the other hand, the RTP session is built directly between the user-agents without the interaction of proxies, though back2back user-agents may still be involved in the transmission of the audio/video data. Therefore a special care must be taken when creating the access control rules of the SIP signaling and data traffic.

4.19.1.2. Proxy behavior

The Zorp SIP proxy allows SIP signaling (accepting SIP messages on the TCP port 5060) and the dynamic RTP traffic through the firewall without compromising the security of the firewall and the defended network. Ports are dynamically opened through the firewall based on information received in the signaling traffic. The signaling part of the protocol is inspected on the application level for protocol conformance: Zorp's SIP proxy enforces the standards, protecting the network from attacks violating the protocol. This is especially important since SIP clients and even servers are rarely designed with security in mind and many of them have issues from a security point of view. As an application level gateway, Zorp parses, checks, and rebuilds every passing signaling request and response. The actual (audio, video, etc.) communication is not inspected, it is forwarded through Zorp on the kernel level using stateful package filtering. These connections are handled as related UDP connections. Furthermore, it is possible to perform NATing and connection marking (see the description of the SIP proxy classes for details).

When packets arrive to the port the Sip proxy is listening on, basic access control is performed based on the source IP address of the packets. Each and every request and response is inspected on the application level (Layer 7 in the OSI model). The requests and responses - including protocol elements like headers - are parsed and strictly checked for conformance with the SIP standards. The Zorp SIP proxy understands and enforces the SIP protocol as described in RFC 3261. The syntax and length of the various protocol elements (e.g.: length of lines, headers, requests, etc.) is checked in order to repel various attack forms based on malformed messages, such as buffer overflow attacks. The relation of the arriving packets relative to other packets and previous communication information is also inspected. Packets not conforming to the logic and workflow of the protocol (e.g.: responses without requests, etc.) are rejected. This step is important because SIP uses random ports for transferring the actual communication data (the RTP stream, e.g.: voice, video), and otherwise it would be possible to open covert channels through the firewall between machines, not only the intended VoIP communication between the two SIP endpoints (i.e. the caller and the receiver).

The payload (SDP) part of the communication is parsed as well and modified if network address translation (NAT) is used. In this case, the addresses and dynamic ports used by the RTP traffic stream have to be modified accordingly. After all these sanity checks the policy settings of the firewall are consulted. Address, and media type filtering is performed (e.g.: to allow only voice traffic to/from specific addresses). Network address translation is also performed at this step if required.

Access control on the RTP stream part of the protocol is performed separately. This is important because RTP and signaling streams can have different access control settings. If SIP servers or a SIP proxy is used on some part of the network, the signaling and the RTP streams originate from different sources. (In such situation, the signaling is originating from the proxy, but the RTP stream arrives directly from the actual client. However, such a situation could also be used to initiate covert channels.)

The proxy supports the use of secondary sessions as described in Section 2.2, Secondary sessions.

4.19.1.3. Keepalive messages in SIP

Keepalive messages in SIP are not originally part of the RFC. However, many SIP implementations actually use them, sending UDP packets (containing only whitespaces) to maintain the connection. Zorp accepts these packets if they are not longer than a preset value (see the max_keepalive_size attribute of the AbstractSipProxy proxy class) and interprets them as keepalive messages. Such packets are uniformly replaced by Zorp with UDP packets containing only a single line-feed.

4.19.1.4. Configuring SIP policies

The Zorp SIP proxy is capable of filtering the different media types in the SIP traffic based on their SDP headers using the media hash attribute. The possible actions for the different media types are shown in the table below. See Section 2.1, Policies for requests and responses for details.

Action Description
SIP_MEDIA_ACCEPT Accept the media type.
SIP_MEDIA_DROP Drop the media from the list of proposed media channels but forward the message to the peer.
SIP_MEDIA_ABORT Drop the SIP message containing the corresponding media type.
SIP_MEDIA_POLICY Call the function specified to make a decision about the media type. The function receives two parameters: self, and the media type string. See Section 2.1, Policies for requests and responses for details.

Table 4.56.  Action codes for SIP media types.


Media types are the strings in SDP headers that identify the type of media sent in the channel (e.g.: audio, video, * for all types, etc.). There are no predefined constants for the media types, as they are not defined in any RFCs or other standards. Typically, audio and video are used for voice and video streams, respectively.

[Example] Example 4.40. Disabling video traffic in SIP

This example class accepts only voice traffic, denying video streams and aborting on all other types of media streams.

class AudioSip(SipProxy)
      def config(self):
        self.media["audio"]=[SIP_MEDIA_ACCEPT]
        self.media["video"]=[SIP_MEDIA_DROP]
        self.media["*"]=[SIP_MEDIA_ABORT]

4.19.2. Related standards

  • The Session Initiation Protocol is described in RFC 3261.

  • The Session Description Protocol is described in RFC 2327.

  • RTP: A Transport Protocol for Real-Time Applications is described in RFC 3550.

4.19.3. Classes in the Sip module

Class Description
AbstractSipProxy Class encapsulating the abstract SIP proxy.
SipProxy Default SIP proxy class based on AbstractSipProxy.

Table 4.57. Classes of the Sip module


4.19.4. Class AbstractSipProxy

This proxy implements the SIP protocol as specified in RFC 3261. Service definitions should refer to a customized class derived from AbstractSipProxy, or a predefined proxy class.

4.19.4.1. Attributes of AbstractSipProxy

max_keepalive_size (integer, w:r)
Default: 128
Maximum size for SIP signaling keepalive messages in bytes. See Section 4.19.1.3, Keepalive messages in SIP for details.

max_message_size (integer, w:r)
Default: 65536
Maximum allowed size of a SIP signaling message in bytes.

media_connection_mark (integer, w:rw)
Default: 0
Connection mark value that is set on all on media connections. That way media connections can be easily identified and handled by specific packet filtering rules.

secondary_mask (secondary_mask, rw:r)
Default: 0xf
Specifies which connections can be handled by the same proxy instance. See Section 2.2, Secondary sessions for details.

secondary_sessions (integer, rw:r)
Default: 10
Maximum number of allowed secondary sessions within a single proxy instance. See Section 2.2, Secondary sessions for details.

timeout (integer, w:r)
Default: 600000
I/O timeout in milliseconds.

4.19.5. Class SipProxy

This class encapsulates the default SIP proxy.

4.19.5.1. Attributes of SipProxy

media (complex, rw:r)
Default:
Policy hash implementing media type filtering, indexed by the media type (as a string, e.g.: audio). See Section 4.19.1.4, Configuring SIP policies for details.

permit_rtp_zones (complex, rw:r)
Default:
A comma-separated list of Zorp zone pairs that are permitted to exchange voice or video streams (e.g.: (("internet", "intranet"),)). This option replaces the Zorp DAC decision (which is unavailable here, since RTP streams are forwarded on the kernel level). NOTE: this is a two-way connection between the zones.

rtp_endpoint_rewrite_nat_policy (string, rw:r)
Default:
Reference to an existing Zorp NAT policy that rewrites RTP endpoints from internal to external addresses. The policy is called for all messages containing an SDP part, since those may also contain addresses of the endpoints.

4.20. Module Smtp

Simple Mail Transport Protocol (SMTP) is a protocol for transferring electronic mail messages from Mail User Agents (MUAs) to Mail Transfer Agents (MTAs). It is also used for exchanging mails between MTAs.

4.20.1. The SMTP protocol

The main goal of SMTP is to reliably transfer mail objects from the client to the server. A mail transaction involves exchanging the sender and recipient information and the mail body itself.

4.20.1.1. Protocol elements

SMTP is a traditional command based Internet protocol; the client issues command verbs with one or more arguments, and the server responds with a 3 digit status code and additional information. The response can span one or multiple lines, the continuation is indicated by an '-' character between the status code and text.

The communication itself is stateful, the client first specifies the sender via the "MAIL" command, then the recipients using multiple "RCPT" commands. Finally it sends the mail body using the "DATA" command. After a transaction finishes the client either closes the connection using the "QUIT" command, or starts a new transaction with another "MAIL" command.

[Example] Example 4.41. SMTP protocol sample
220 mail.example.com ESMTP Postfix (Debian/GNU)
EHLO client.host.name
250-mail.example.com
250-PIPELINING
250-SIZE 50000000
250-VRFY
250-ETRN
250-XVERP
250 8BITMIME
MAIL From: <sender@sender.com>
250 Sender ok
RCPT To: <account@recipient.com>
250 Recipient ok
RCPT To: <account2@recipient.com>
250 Recipient ok
DATA
354 Send mail body
From: sender@sender.com
To: account@receiver.com
Subject: sample mail

This is a sample mail message. Lines beginning with
..are escaped, another '.' character is perpended which
is removed when the mail is stored by the client.
.
250 Ok: queued as BF47618170
QUIT
221 Farewell

4.20.1.2. Extensions

Originally SMTP had a very limited set of commands (HELO, MAIL, RCPT, DATA, RSET, QUIT, NOOP) but as of RFC 1869, an extension mechanism was introduced. The initial HELO command was replaced by an EHLO command and the response to an EHLO command contains all the extensions the server supports. These extensions are identified by an IANA assigned name.

Extensions are used for example to implement inband authentication (AUTH), explicit message size limitation (SIZE) and explicit queue run initiation (ETRN). Each extension might add new command verbs, but might also add new arguments to various SMTP commands. The SMTP proxy has built in support for the most important SMTP extensions, further extensions can be added through customization.

4.20.1.3. Bulk transfer

The mail object is transferred as a series of lines, terminated by the character sequence "CRLF '.' CRLF". When the '.' character occurs as the first character of a line, an escaping '.' character is prepended to the line which is automatically removed by the peer.

4.20.2. Proxy behavior

The Smtp module implements the SMTP protocol as specified in RFC 2821. The proxy supports the basic SMTP protocol plus five extensions, namely: PIPELINING, SIZE, ETRN, 8BITMIME, and STARTTLS. All other ESMTP extensions are filtered by dropping the associated token from the EHLO response. If no connection can be established to the server, the request is rejected with an error message. In this case the proxy tries to connect the next mail exchange server.

4.20.2.1. Default policy for commands

The abstract SMTP proxy rejects all commands and responses by default. Less restrictive proxies are available as derived classes (e.g.: SmtpProxy), or can be customized as required.

4.20.2.2. Configuring policies for SMTP commands and responses

Changing the default behavior of commands can be done by using the hash attribute request. These hashes are indexed by the command name (e.g.: MAIL or DATA). Policies for responses can be configured using the response attribute, which is indexed by the command name and the response code. The possible actions are shown in the tables below. See Section 2.1, Policies for requests and responses for details. When looking up entries of the response attribute hash, the lookup precedence described in Section 2.1.2, Response codes is used.

Action Description
SMTP_REQ_ACCEPT Accept the request without any modification.
SMTP_REQ_REJECT Reject the request. The second parameter contains an SMTP status code, the third one an associated parameter which will be sent back to the client.
SMTP_REQ_POLICY Call the function specified to make a decision about the event. The function receives three parameters: self, command, and the parameters of the command. See Section 2.1, Policies for requests and responses for details.
SMTP_REQ_ABORT Reject the request and terminate the connection.

Table 4.58.  Action codes for SMTP requests


Action Description
SMTP_RSP_ACCEPT Accept the response without any modification.
SMTP_RSP_REJECT Reject the response. The second parameter contains an SMTP status code, the third one an associated parameter which will be sent back to the client.
SMTP_RSP_POLICY Call the function specified to make a decision about the event. The function receives three parameters: self, command, and the parameters of the command. See Section 2.1, Policies for requests and responses for details.
SMTP_RSP_ABORT Reject the response and terminate the connection.

Table 4.59.  Action codes for SMTP responses


SMTP extensions can be controlled using the extension hash, which is indexed by the extension name. The supported extensions (SMTP_EXT_PIPELINING; SMTP_EXT_SIZE; SMTP_EXT_ETRN; SMTP_EXT_8BITMIME) can be accepted or dropped (SMTP_EXT_ACCEPT or SMTP_EXT_DROP) individually or all at once using the SMTP_EXT_ALL index value.

4.20.2.3. Stacking

The available stacking modes for this proxy module are listed in the following table. For additional information on stacking, see Section 2.3.1, Proxy stacking.

Action Description
SMTP_STK_NONE No additional proxy is stacked into the SMTP proxy.
SMTP_STK_MIME The data part including header information of the traffic is passed to the specified stacked proxy.

Table 4.60.  Stacking options for SMTP


4.20.3. Related standards

  • Simple Mail Transfer Protocol is described in RFC 2821.

  • SMTP Service Extensions are described in the obsoleted RFC 1869.

  • The STARTTLS extension is described in RFC 3207.

4.20.4. Classes in the Smtp module

Class Description
AbstractSmtpProxy Class encapsulating the abstract SMTP proxy.
SmtpProxy Default SMTP proxy based on AbstractSmtpProxy.

Table 4.61. Classes of the Smtp module


4.20.5. Class AbstractSmtpProxy

This class implements an abstract SMTP proxy - it serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractSmtpProxy, or one of the predefined proxy classes.

The following requests are permitted: HELO; MAIL; RCPT; DATA; RSET; QUIT; NOOP; EHLO; AUTH; ETRN. The following extensions are permitted: PIPELINING; SIZE; ETRN; 8BITMIME; STARTTLS.

4.20.5.1. Attributes of AbstractSmtpProxy

active_extensions (integer, n/a:r)
Default: n/a
Active extension bitmask, contains bits defined by the constants 'SMTP_EXT_*'

add_received_header (boolean, rw:rw)
Default: FALSE
Add a Received: header into the email messages transferred by the proxy.

append_domain (string, rw:rw)
Default:
Domain to append to email addresses which do not specify domain name. An address is rejected if it does not contain a domain and append_domain is empty.

autodetect_domain_from (enum, rw:rw)
Default:
If you want Zorp to autodetect the domain name of the firewall and write it to the Received line, then set this. This attribute either set the method how the Zorp detect the mailname. Only takes effect if prepend_receive_line is TRUE.

domain_name (string, rw:rw)
Default:
If you want to set a fix domain name into the added Receive line, set this. Only takes effect if prepend_receive_line is TRUE.

extensions (complex, rw:rw)
Default:
Normative policy hash for ESMTP extension policy, indexed by the extension verb (e.g. ETRN). It contains an action tuple with the SMTP_EXT_* values as possible actions.

interval_transfer_noop (integer, rw:rw)
Default: 600000
The interval between two NOOP commands sent to the server while waiting for the results of stacked proxies.

max_auth_request_length (integer, rw:r)
Default: 256
Maximum allowed length of a request during SASL style authentication.

max_request_length (integer, rw:r)
Default: 256
Maximum allowed line length of client requests.

max_response_length (integer, rw:r)
Default: 512
Maximum allowed line length of a server response.

permit_long_responses (boolean, rw:r)
Default: FALSE
Permit overly long responses, as some MTAs include variable parts in responses which might get very long. If enabled, responses longer than max_response_length are segmented into separate messages. If disabled, such responses are rejected.

permit_omission_of_angle_brackets (boolean, rw:r)
Default: FALSE
Permit MAIL From and RCPT To parameters without the normally required angle brackets around them. They will be added when the message leaves the proxy anyway.

permit_unknown_command (boolean, rw:r)
Default: FALSE
Enable unknown commands.

request (complex, rw:rw)
Default:
Normative policy hash for SMTP requests indexed by the command name (e.g.: "USER", "UIDL", etc.). See also Section 4.20.2.2, Configuring policies for SMTP commands and responses.

request_command (string, n/a:rw)
Default: n/a
When a command is passed to the policy level, its value can be changed to this value.

request_param (string, n/a:rw)
Default: n/a
When a command is passed to the policy level, the value of its parameter can be changed to this value.

request_stack (complex, rw:rw)
Default:
Attribute containing the stacking policy for SMTP commands. See Section 4.20.2.3, Stacking.

require_crlf (boolean, rw:r)
Default: TRUE
Specifies whether the proxy should enforce valid CRLF line terminations.

resolve_host (boolean, rw:rw)
Default: FALSE
Resolve the client host from the IP address and add it to the Received line. Only takes effect if prepend_receive_line is TRUE.

response (complex, rw:rw)
Default:
Normative policy hash for SMTP responses indexed by the command name and the response code. See also Section 4.20.2.2, Configuring policies for SMTP commands and responses.

response_param (string, n/a:rw)
Default: n/a
When a response is passed to the policy level, the value of its parameter can be changed to this value. (It has effect only when the return value is not SMTP_*_ACCEPT.)

response_value (string, n/a:rw)
Default: n/a
When a response is passed to the policy level, its value can be changed to this value. (It has effect only when the return value is not SMTP_*_ACCEPT.)

timeout (integer, rw:r)
Default: 600000
Timeout in milliseconds. If no packet arrives within this in interval, the connection is dropped.

tls_passthrough (boolean, rw:r)
Default: FALSE
Change to passthrough mode after a successful STARTTLS request. Zorp does not process or change the encrypted traffic in any way, it is transported intact between the client and server.

unconnected_response_code (integer, rw:rw)
Default: 451
Error code sent to the client if connecting to the server fails.

4.20.6. Class SmtpProxy

SmtpProxy implements a basic SMTP Proxy based on AbstractSmtpProxy, with relay checking and sender/recipient check restrictions. (Exclamation marks and percent signs are not allowed in the e-mail addresses.)

4.20.6.1. Attributes of SmtpProxy

error_soft (boolean, rw:rw)
Default: FALSE
Return a soft error condition when recipient filter does not match. If enabled, the proxy will try to re-valdate the recipient and send the mail again. This option is useful when the server used for the recipient matching is down.

permit_exclamation_mark (boolean, rw:rw)
Default: FALSE
Allow the '!' sign in the local part of e-mail addresses.

permit_percent_hack (boolean, rw:rw)
Default: FALSE
Allow the '%' sign in the local part of e-mail addresses.

recipient_matcher (class, rw:rw)
Default:
Matcher class (e.g.: SmtpInvalidRecipientMatcher) used to check and filter recipient e-mail addresses.

relay_check (boolean, rw:rw)
Default: TRUE
Enable/disable relay checking.

relay_domains (complex, rw:r)
Default:
Domains mails are accepted for. Use Postfix style lists. (E.g.: '.example.com' allows every subdomain of example.com, but not example.com. To match example.com use 'example.com'.)

relay_domains_matcher (class, rw:r)
Default:
Domains mails are accepted for based on a matcher (e.g.: RegexpFileMatcher).

relay_zones (complex, rw:r)
Default:
Zorp zones that are relayed. The administrative hierarchy of the zone is also used.

sender_matcher (class, rw:rw)
Default:
Matcher class (e.g.: SmtpInvalidRecipientMatcher) used to check and filter sender e-mail addresses.

4.21. Module Socks

The Socks module defines the classes for the proxy to inspect Socks communication.

4.21.1. The SOCKS protocol

4.21.2. Proxy behaviour

SOCKS is a network protocol for routing packets using a proxy server between the clients and the servers. SOCKS performs at Layer 5 of the OSI model. SOCKS is typically used to proxy other, Layer 7 protocols, most often HTTP.

[Example] Example 4.42. SOCKS and HTTP traffic

The following configuration example embeds an HTTP proxy into a Socks proxy and can be used to inspect HTTP traffic that uses a SOCKS proxy to access the servers. Client authentication is disabled.

class MySocksProxy(SocksProxy):
    def config(self):
        SocksProxy.config(self)
        self.enable_socks_v4 = TRUE;
        self.require_auth_v5 = FALSE

    def requestStack(self, ip, port):
        return MyHttpProxy

4.21.2.1. Authenticating clients

The Zorp proxy can authenticate the clients using passwords. GSS-API and other authentication methods supported by the SOCKSv5 protocol are not supported. The process of negotiating the authentication between the client and the Zorp Socks proxy is the following:

  1. The client sends the list of authentication methods is supports to the SOCKS server.

  2. The Zorp Socks proxy replies to the client on behalf of the SOCKS server, depending on the configuration of the Socks proxy:

    • If the client selected password-based authentication and the disable_auth_v5 option is set to FALSE and the require_auth_v5 is set to TRUE (which are the defaults), Zorp replies that password authentication is supported.

    • If the require_auth_v5 is set to FALSE, and the client supports the none authentication method, the connection is accepted without authentication.

    • In other cases, the client receives an authentication error.

The Zorp Socks proxy supports inband authentication as well. For details on inband authentication, see Section 5.1.12, Class InbandAuthentication.

4.21.3. Related standards

  • The SOCKS 5 protocol is defined in RFC 1928.

4.21.4. Classes in the Socks module

Class Description
AbstractSocksProxy Class encapsulating the Socks Proxy.
SocksProxy Default Socks proxy class based on AbstractSocksProxy.

Table 4.62. Classes of the Socks module


4.21.5. Class AbstractSocksProxy

This proxy validates SOCKS traffic. It serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractSocksProxy, or the predefined SocksProxy proxy class.

4.21.5.1. Attributes of AbstractSocksProxy

auth (class)
Default:
The authentication provider object used in the authentication process, set in the authentication_policy() parameter of the Zorp service. See Section 5.1.1, Authentication and authorization basics for details.

auth_server (boolean)
Default:
The address of the ZAS server used to authenticate the connection. Note that this option cannot be modified by the proxy, it is set in the AuthenticationPolicy used by the Service definition.

connect_server (boolean)
Default: TRUE
Set to TRUE, if the Socks proxy is connecting directly to the SOCKS server. Set to FALSE, if the Socks proxy is an embedded proxy and another Zorp proxy is performing the actual connection.

disable_auth_v5 (boolean)
Default: FALSE
Disable authentication in the SOCKSv5 protocol. If this option is enabled, the Zorp proxy sends only the none authentication method to the client.

enable_socks_v4 (boolean)
Default: FALSE
Accept SOCKSv4 connections as well. If the client is using an unsupported protocol version, or the client is using SOCKSv4 but the enable_socks_v4() option is set to FALSE, the Unsupported protocol version='4' log message is sent to the system logs.

require_auth_v5 (boolean)
Default: TRUE
Require authentication in the SOCKSv5 protocol. If this option is enabled, the Zorp proxy sends only the password authentication method to the client. Note that using this option requires a properly configured ZAS AuthenticationPolicy and an authentication backend in the definition of the service that uses the Socks proxy.

timeout (integer)
Default: 600000
Timeout in milliseconds. The -1 value disables the timeout.

4.21.5.2. AbstractSocksProxy methods

Method Description
requestForward(self, ip, port) Called when the SOCKS protocol reaches forward state.

Table 4.63. Method summary


Method requestForward(self, ip, port)

Arguments of requestForward
IP (string)
Default: n/a
The IP address of the target host.

port (integer)
Default: n/a
The port number to connect to.

return (complex)
Default: n/a
Tuple of SOCKS_STK_* and a class. SOCKS_STK_NONE will result in simple forwarding, while SOCKS_STK_DATA will start a stacked proxy instance of the returned class.

This method must determine whether to stack another proxy class into the traffic, or simply forward the traffic without analyzing. The method can raise an exception which will result in denying any traffic. The default behavior is to forward traffic without analyzing.

4.21.6. Class SocksProxy

A default proxy for the SOCKS protocol based on AbstractSocksProxy. It serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractSocksProxy, or the predefined SocksProxy proxy class. By default, the proxy rejects SOCKSv4 connections, and requires authentication from the clients.

4.22. Module SQLNet

4.22.1. The SQL*Net protocol

This class implements parts of Oracle TNS (Transparent Network Substrate) to enable clients to communicate with Oracle servers behind firewalls using port TCP/1521. This module is especially needed when tnslsnr (the TNS listener) is in Multi-threaded Server (MTS) mode.

The SQL*Net proxy does not analyze the whole protocol stream, as the data protocol of Oracle operates on top of TNS.

An example for the SQL*Net connection string is provided in Example 1.1, An example for the SQL*Net connection string .

4.22.2. Proxy behavior

SQLNetProxy is a module built for parsing messages of the SQL*Net protocol. It reads and parses QUERYs on the client side, and sends them to the server if the local security policy permits.

In MTS mode Oracle returns a redirect packet specifying where the client should connect to. The proxy processes this packet and initiates a new connection to the address specified; all packets sent by the client will be automatically redirected to this new address. This functionality is completely transparent to the clients. To accomplish this, either InbandRouter has to be used, or the overridable option has to be set for DirectedRouter and TransparentRouter.

SQLNet proxy is able to parse connect_string and connection_data containing the address and port of the target server and information on the database.

When the connection is established the SQLNetProxy inspects TNS headers, but does not inspect the layers above TNS.

4.22.3. Related standards

SQL*Net is a not specified in any public standards.

4.22.4. Classes in the SQLNet module

Class Description
AbstractSQLNetProxy Class encapsulating the abstract SQLNet proxy.
SQLNetProxy Default SQLNet proxy class based on AbstractSQLNetProxy.

Table 4.64. Classes of the SQLNet module


4.22.5. Class AbstractSQLNetProxy

AbstractSQLNetProxy is a default proxy for the SQL*Net protocol - it serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractSQLNetProxy, or the predefined proxy class.

4.22.5.1. Attributes of AbstractSQLNetProxy

connect_data (string, n/a:rw)
Default: n/a
The TNS connect string as sent by the client, or as modified by the policy.

server_address (string, rw:rw)
Default: n/a
Name of the Oracle server to connect to. This value is only used together with InbandRouter, or if the overridable option is set for DirectedRouter or TransparentRouter.

server_port (integer, rw:rw)
Default: n/a
Port of the Oracle listener to connect to.

split_connect_threshold (integer, rw:rw)
Default: 231
CONNECT data that is larger than this value will be split into smaller DATA packets.

strict_redirect_parsing (boolean, rw:rw)
Default: TRUE
Disabling this option allows improperly formed packets to pass the firewall.

timeout (integer, rw:r)
Default: 600000
Timeout in milliseconds.

4.22.5.2. AbstractSQLNetProxy methods

Method Description
connectRequest(self, connect_data) Function called when the client issues a CONNECT request.

Table 4.65. Method summary


Method connectRequest(self, connect_data)

Arguments of connectRequest
connect_data (unknown, n/a:n/a)
Default: n/a
The connect string as sent by the client.

This function is called when the client issues a CONNECT request, to have a chance to validate and change the CONNECT string sent by the client. The connect string can be found in the parameter connect_data. The function has to return a logical TRUE or FALSE value, i.e. SQLNET_ACCEPT or SQLNET_ABORT.

4.22.6. Class SQLNetProxy

A transparent SQL*Net proxy based on AbstractSQLNetProxy.

In transparent mode the client addresses directly the server, so the target address is readily available; while in nontransparent mode the client connects directly to Zorp, and Zorp receives the address of the server within the protocol.

4.22.6.1. Attributes of SQLNetProxy

transparent_mode (boolean, rw:rw)
Default: TRUE
Enable/disable transparent mode operation.

4.23. Module Ssh

4.23.1. The Secure Shell protocol

Secure Shell (SSH) is a protocol designed to remotely access (login and execute commands) on a computer connected to the network. SSH was aimed to replace the earlier unencrypted protocols (e.g.: rlogin, TELNET and rsh), and provides secure encrypted communication between two hosts over an insecure network. Users of SSH can also use it for tunneling, forwarding arbitrary TCP ports and X11 connections over the resultant secure channel; and can transfer files using the embedded SFTP or SCP protocols.

4.23.1.1. Protocol elements

One of the main features of the SSH protocol is that almost the entire communication between the client and the server is encrypted - including the authentication of the user. (Naturally, the negotiation of the encryption method to be used is in plain text). During the initialization of the session server authentication is performed and parameters for encryption, data compression and integrity verification of the data transferred are negotiated. The protocol enforces user authentication and is capable of authenticating the user via various methods: password, RSA key, Challenge/Response schemes like S/Key and OPIE, etc.

The typical uses of SSH include the following:

Remote shell

Remotely administer a computer via an interactive terminal console. This is one of the most widespread uses of SSH.

Remote command execution

Execute commands on the remote machine. Remote command execution can also result in significant data transfer, for example when performing scheduled or manual tasks such as file copying (scp), data or file synchronization (rsync), creating archive backups (tar), etc.

TCP IP forwarding (also known as port forwarding)

It is possible to tunnel any TCP/IP connection from the client or from the server into the encrypted SSH channel. It can also be used to forward communication otherwise not allowed, such as the access of ports banned by the security policy. This allows to secure any - normally unencrypted - data transfer and is frequently used as an easy way to secure connections between the hosts without the need to set up full VPN connections.

File transfer

Securely transfer files using SFTP.

X11 forwarding

Applications running on the server and requiring graphical interface (X Window) appear on the client's monitor, but run on the server in all other respect, thus it is possible to work with them remotely.

Agent forwarding:

Transfer authentication requests to the client machine.

4.23.1.2. Protocol versions

The original version of the protocol (SSH-1, dated 1995) has been revised in 1996, and SSH-2 was created offering improved security and new features. The two versions of the protocol are incompatible with each other. Since SSH-1 has inherent design flaws and is vulnerable to attacks, it is now generally considered obsolete and its use should not be permitted. Practically all server and client applications today support SSH-2, however, software not supporting SSH-2 may still be in use by some organizations, posing a considerable security vulnerability to them.

The Zorp SSH proxy supports only the SSHv2 protocol (SECSH).

4.23.2. Proxy behavior

Zorp's SSH proxy uses man-in-the-middle technique to decrypt and terminate the SSH connections on the firewall. It separates the connections into two parts and inspects all traffic, so that no data can be directly transferred between the server and the client. Zorp supports exclusively the SSH-2 protocol, but owing to the widespread use and availability of SSH-2 implementations, this does not mean any hindrance. The general capabilities of Zorp's SSH proxy are summarized below.

  • Protocol inspection : All traffic is inspected and only permitted across the firewall if it fully complies to the SSH-2 protocol. This feature of Zorp provides effective protection against a great number of attacks exploiting vulnerabilities of server and client applications, including buffer overflow vulnerabilities.

  • Verify encryption method : Zorp can also control the internal parameters of the connections, allowing it to enforce the use of selected encryption methods (cipher type, key length, etc.), thus provide protection against downgrade attacks.

  • Control user authentication : The different authentication methods can be separately enabled or disabled, e.g.: it is possible to enforce the use of strong authentication methods by completely disabling password based authentication. User-level filtering and access control can also be performed. Although this can obviously be done on the servers themselves, Zorp as an external device provides these features reliably even if the server or the client machines get compromised.

  • Control of SSH channels : Zorp has full control over the SSH channels, i.e. it can be specified which channels are allowed to and from a given server or in a given connection. For instance, file transfer, port forwarding, or X forwarding can be separately enabled/disabled based on various criteria.

  • Disable agent forwarding : Zorp can disable agent forwarding, thus prevent that the keys used in the internal network become accessible on external machines.

  • Control remote command execution : Zorp is able to fully inspect the SSH protocol, thus it can be specified which commands are allowed, which ones are disabled. More sophisticated decisions can also be made based on the parameters of the session, e.g.: to allow the execution of a command only to certain users, etc.

4.23.2.1. Configuring policies for SSH channels

The opening of SSH channels from the server and the client side is possible using the server_channel and client_channel hashes. These hashes are indexed by the channel type (e.g.: session). The available channel types are listed in the following table.

Name Value
session Channels for terminal shells, remote execution requests (e.g.: scp), and SFTP.
direct-tcpip Channels for client-to-server forwarded connections.
forwarded-tcpip Channels for server-to-client forwarded connections.
auth-agent Channels for forwarding authentication agents.
auth-agent@openssh.com Channels for forwarding authentication agents, as implemented in OpenSSH.
x11 Channels for forwarding graphical interfaces.

Table 4.66.  The list of available channel types.


The possible actions are described in the following table. See also Section 2.1, Policies for requests and responses.

Action Description
SSH_CHAN_ACCEPT Accept the request without any modification.
SSH_CHAN_REJECT Reject the channel opening request.
SSH_CHAN_POLICY Call the function specified to make a decision about the channel opening request.
SSH_CHAN_ABORT Reject the channel opening request and terminate the connection.

Table 4.67.  Action codes for SSH channel open requests.


[Example] Example 4.43. Enabling and disabling SSH channels

The following proxy class accepts only terminal session (shell) connections, and rejects all other channel types.

class ShellonlySshProxy(SshProxy):
        def config(self):
                SshProxy.config(self)
                self.client_channel["session"] = (SSH_CHAN_ACCEPT)
                self.client_channel["session-shell"] = (SSH_CHAN_ACCEPT)
                self.client_channel["*"] = (SSH_CHAN_REJECT)

4.23.2.2. Configuring policies for SSH requests

Changing the default behavior of requests arriving from the server and the client side is possible using the server_request and client_request attributes. All requests specified in the RFCs are supported. The index of these hashes is composed of the channel type (e.g.: session, see Section 4.23.2.1, Configuring policies for SSH channels for a detailed list), a single hyphen, and the request name as defined by the SSH protocol specification. E.g.: session-x11-req. The possible actions are described in the following table. See also Section 2.1, Policies for requests and responses.

Action Description
SSH_REQ_ACCEPT Accept the request without any modification.
SSH_REQ_REJECT Reject the request.
SSH_REQ_POLICY Call the function specified to make a decision about the request.
SSH_REQ_ABORT Reject the request and terminate the connection.

Table 4.68.  Action codes for SSH channel and global requests.


For complex decisions that are based on the parameters of the requests, you have to use the SSH_REQ_POLICY parameter and create a function within the proxy class that examines and optionally modifies the parameters.

This custom function can receive the following four attributes:

self

side

The side of the connection relative to Zorp: 0 for the client side, 1 for the server side.

index

The name of the request, e.g., x11, subsystem, etc.

request

A structure that has fields containing the parameters of the request. See Section 4.23.2.3, Parameters of the SSH requests for details on the different request parameters.

See the following example.

[Example] Example 4.44. Enabling only SFTP connections

The following proxy class accepts SFTP connections. SFTP is a subsystem of SSH, therefore the parameters of the session-subsystem request must be examined.

class SFtponlySshProxy(SshProxy):
        def config(self):
                SshProxy.config(self)
                self.client_channel["session"] = (SSH_CHAN_ACCEPT)
                self.client_request["session-subsystem"] = (SSH_REQ_POLICY, self.permitSFTPOnly)
                self.client_channel["*"] = (SSH_CHAN_REJECT)
        def permitSFTPOnly(self, side, index, request):
                if request.subsystem == "sftp":
                    return SSH_REQ_ACCEPT
                return SSH_REQ_REJECT

4.23.2.3. Parameters of the SSH requests

SSH requests can be controlled using the server_request and client_request hashes. These hashes are indexed by the channel type (e.g.: session). Some requests have additional parameters that are also listed. Some channels (e.g., the X11 channel) require two request messages to open, the first message requests the channel, while the second message actually opens the requested channel. The following requests are available from the client side. For examples on local and remote forwarding, see Section 4.23.2.4, Configuring local and remote forwarding.

window-change
When the window (terminal) size changes on the client side a message may be sent to inform the server of the new window dimensions. Parameters of the request:
width_cols Width of the terminal window in characters.
height_rows Height of the terminal window in characters.
width_px Width of the terminal window in pixels.
height_px Height of the terminal window in pixels.
pty-req
Request a pseudo-terminal for the session. Parameters of the request:
term Requests a pseudo-terminal.
width_cols Width of the terminal window in characters.
height_rows Height of the terminal window in characters.
width_px Width of the terminal window in pixels.
height_px Height of the terminal window in pixels.
x11-req
Request X11 forwarding for the session. Parameters of the request:
x11_auth_proto The name of the X11 authentication method used, e.g., MIT-MAGIC-COOKIE-1.
x11_auth_cookie  
screen_number  
single_connection If set to TRUE, the server forwards only a single connection.
x11
Open an X11 channel. Parameters of the request:
originator_host IP address of the host.
originator_port Port number of the host.
auth-agent-req
Request the forwarding of the authentication requests. This request has no additional parameters.
auth-agent-req@openssh.com
Request the forwarding of the authentication requests, as implemented in OpenSSH. This request has no additional parameters.
env
Pass an environment variable and its value in the message. Parameters of the request:
name The name of environment variable.
value The value of environment variable.
shell
Request a shell be started on the server side. This request has no additional parameters.
exec
Request the server to start the execution of the command sent in the message. Parameters of the request:
command The command to be executed. The command may include a path.
subsystem
Request the server to execute a predefined subsystem. (Subsystems usually include a general file transfer mechanism, and possibly other features as well.) Parameters of the request:
subsystem Name of the subsystem to be executed.
signal
A signal delivered to the remote process or service. Parameters of the request:
signal Name of the signal to be sent.

The following requests are available from the server side. Some requests have additional parameters that are also listed.

exit-status
When the command running on the server terminates, an exit-status message can be sent to return the exit status of the command.
exit_status  
exit-signal
A message indicating that the remote command was terminated violently due to a signal. A zero usually means that the command terminated successfully.
signal_name Name of the signal. One of: ABRT, ALRM, FPE, HUP, ILL, INT, KILL, PIPE, QUIT, SEGV, TERM, USR1, USR2, or a custom signal consisting of two strings and the @ character (e.g., signal@ example).
core_dumped  
error The text of the error message. The message may consist of multiple lines separated by CRLF (Carriage Return - Line Feed) pairs.
lang Language tag confirming to RFC3066.
xon-xoff
A message informing the client when it can or cannot perform flow control.
client_can_do TRUE if the client can perform flow control.

4.23.2.4. Configuring local and remote forwarding

Remote port-forwarding transfers connections arriving to a port of the server to the client. The client sends a global-tcpip-forward request to the server. The parameters of this request tell the server which address and port it should listen on for incoming connections ( bind_address, bind_port). When the server receives a connection to this address/port pair, it opens a forwarded-tcpip towards the client. The parameters of these requests are summarized in the following tables.

Remote TCP forwarding

Figure 4.1. Remote TCP forwarding


global-tcpip-forward
Connections arriving to the specified IP address and port of the server are forwarded to the client.
bind_address

The server forwards connections received on this address to the client. The following special addresses may be used:

  • The "" parameter means that connections are to be accepted on all protocol families supported by the SSH implementation.

  • The 0.0.0.0 parameter means to listen on all IPv4 addresses.

  • The :: parameter means to listen on all IPv6 addresses.

  • The localhost parameter means to listen on all protocol families supported by the SSH implementation on loopback addresses only ([RFC3330] and [RFC3513]).

  • The 127.0.0.1 and ::1 parameters indicate listening on the loopback interfaces for IPv4 and IPv6, respectively.

bind_port The server forwards connections received on this port to the client.
forwarded-tcpip
Opens a channel used to forward remote connections to the client.
connected_addr The IP address of the server that received the connection.
connected_port The port of the server that received the connection.
originator_addr The IP address of the remote host whose connection is forwarded to the client.
originator_port The port of the remote host whose connection is forwarded to the client

Local port-forwarding transfers connections arriving to the client from a host to a remote host via the SSH server. For local port-forwarding, the client sends a direct-tcpip channel opening request to the server. The parameters of this request tell the server which host it should forward the connection, as well as the address of the host that connects to the client (usually localhost). This request has the following parameters.

Local TCP forwarding

Figure 4.2. Local TCP forwarding


direct-tcpip
Opens a channel used to forward remote connections to the client.
originator_addr The IP address of the host whose connection is forwarded to the remote host.
originator_port The port of the host whose connection is forwarded to the remote host.
host_addr The IP address of the remote host that is the destination of the forwarded connection.
host_port The port of the remote host that is the destination of the forwarded connection.
[Example] Example 4.45. Restricting local forwarding

The following proxy class permits local forwading only to port 80 of the 192.168.1.1 remote host. Only shell and local forwarding channels are permitted.

class RestrictedlocalforwardSshProxy(SshProxy):
        def config(self):
                SshProxy.config(self)
                self.client_channel["session"] = (SSH_CHAN_ACCEPT)
                self.client_channel["direct-tcpip"] = (SSH_CHAN_ACCEPT)
                self.client_request["direct-tcpip"] = (SSH_REQ_POLICY, self.controllocalforward)
                self.client_channel["*"] = (SSH_CHAN_REJECT)
        def controllocalforward(self, side, index, request):
                if request.host_address == "192.168.1.1" and request.host_port == "80":
                    return SSH_REQ_ACCEPT
                return SSH_REQ_REJECT

4.23.2.5. Configuring encryption parameters

The Zorp SSH proxy is able to enforce policies on the various elements of the encrypted SSH communication, such as the MAC, key-exchange, etc. algorithms that are permitted to be used. The parameters can be set separately for the client and for the server side. The attributes are represented as comma-separated strings listing the enabled methods/algorithms, in the order of preference.

Key exchange algorithms

The permitted key exchange algorithms can be specified via the client_kex_algos and server_kex_algos attributes. The Zorp SSH proxy supports the diffie-hellman-group14-sha1 and diffie-hellman-group1-sha1 algorithms.

Host key algorithms

The permitted host key algorithms can be specified via the client_hostkey_algos and server_hostkey_algos attributes. The supported algorithms are ssh-rsa and ssh-dss.

[Note] Note

For a hostkey algorithm to work for the clients the corresponding private key has to be set in the host_key_rsa or the host_key_dss attribute. The supported algorithms are ssh-rsa and ssh-dss.

Symmetric cipher algorithms

The permitted symmetric cipher algorithms can be specified via the client_cipher_algos and server_cipher_algos attributes. The following algorithms are supported: aes128-cbc, 3des-cbc, blowfish-cbc, cast128-cbc, arcfour, aes192-cbc, aes256-cbc, aes128-ctr, aes192-ctr, aes256-ctr.

MAC algorithms

The permitted MAC algorithms can be specified via the client_mac_algos and server_mac_algos attributes. The supported algorithms are: hmac-sha1 and hmac-md5.

4.23.2.6. Host key verification

To successfully build the required SSH connections both towards the client and the server, Zorp has to show the appropriate keys to the client (otherwise the client will reject the connection as the key does not match the server it intends to connect). This problem can be easily overcome if Zorp is used to protect the servers: the server key has to be deployed on Zorp as well. However, this is not possible when protecting clients, because the private keys of all servers that will be contacted is rarely available. In this case, Zorp's SSH proxy can be configured to automatically verify the identity of the server using the server_hostkeys_verify attribute. This is similar to certificate verification in SSL connections, but in SSH there is no certificate or other identity information attached to the host keys.

The methods supported for host key verification are shown in the following table.

Name Value
SSH_HKV_ACCEPT_ANY Accept any host key.
SSH_HKV_ACCEPT_ONCE Accept unknown host keys only on the first occassion. The IP address-port pair of unknown host keys is registered, later on that key is used to verify connections from that address.
SSH_HKV_ACCEPT_KNOWN Accept only known host keys. Public keys can be configured for each IP address or port pair (like in case of the known_hosts file). For any unknown IP address-port pair the connection is terminated.

Table 4.69.  SSH host key verification mode.


4.23.2.7. Auditing SSH channels

The SSH proxy supports the general auditing framework of Zorp. The SSH proxy can even be configured to audit only certain types of channels, it is not necessary to fully audit all sessions (e.g.: the auditing of large file transfers such as backups is rarely needed). The channels to be audited can be set via the audit_trails attribute. The available channel types are described in Section 4.23.2.1, Configuring policies for SSH channels.

4.23.2.8. Manipulating the keys of public-key authentication

The Zorp SSH proxy can use different keys in the server-side connection and the client-side connection. To use this feature, you have to derive a custom proxy class from the SshProxy class, and override the mapUserKey function. In the mapUserKey function, you can check the public key of the client, and return the private key that will be used in the server-side connection. Using this function you can set every connection to use a single key on the server side, change the type of the key from RSA to DSA, or restrict access of certain channels only to the selected users.

The mapUserKey function receives the blob_type and blob parameters that contain the type of the key (ssh-dss for DSA keys, ssh-rss for RSA keys) and the public key of the client. The function can return None to reject the connection, or a key type and a private key that will be used to authenticate on the target server.

[Example] Example 4.46. Modifying the keypair used in public-key authentication

The following proxy class accepts only connections that use a specific DSA public key, and uses a different RSA key-pair on the server side.

class KeymappingSshProxy(SshProxy):
        def config(self):
                SshProxy.config(self)
        def mapUserKey(self, blob_type, blob):
                if blob_type != 'ssh-dss' or blob != """ssh-dss
                AAAAB3NzaC1kc3MAAACBANhSxBWzv4kLvnBEV9sJX4rQkNtTxARJUP4l0u71Nu..."""
                        return None
                return ('ssh-rss', """-----BEGIN RSA PRIVATE KEY-----
                MIIEogIBAAKCAQEAz/U9WbGjeQfEj4nUoqSImQpKIPoNPIPQG2IPGTRC/ROc+VeQ
                D/ax8n7wB3PF/1DB0WpHK5j075yJ6TPCPqFDYLOWOM41sBhyHsGCiGyDuNCOaRal
                ....
                -----END RSA PRIVATE KEY-----""")

4.23.3. Related standards

The Secure Shell (SSH) Protocol is described in the following RFCs:Architecture is described in RFC 4251.

  • The Secure Shell (SSH) Protocol Architecture is described in RFC 4251.

  • The Secure Shell (SSH) Authentication Protocol is described in RFC 4252.

  • The Secure Shell (SSH) Transport Layer Protocol is described in RFC 4253.

  • The Secure Shell (SSH) Connection Protocol is described in RFC 4254.

4.23.4. Classes in the Ssh module

Class Description
AbstractSshProxy Class encapsulating the abstract SSH proxy.
SshProxy Class encapsulating the abstract SSH proxy.
SshSFtpProxy Class encapsulating an SFTP proxy.
SshScpProxy Class encapsulating an SCP proxy.

Table 4.70. Classes of the Ssh module


4.23.5. Class AbstractSshProxy

This class implements an abstract SSH proxy for the SSH2 protocol - it serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractSshProxy, or one of the predefined proxy classes.

4.23.5.1. Attributes of AbstractSshProxy

audit_channels (string, rw:r)
Default: ""
A comma separated list of channel types to be audited. See also Section 4.23.2.7, Auditing SSH channels.

auth_agent_forward (boolean, w:r)
Default: FALSE
Authenticate using the data received from the agent during agent-forwarding.

auth_methods (string, rw:rw)
Default: "password,keyboard-interactive,none"
A comma separated list of permitted authentication methods as defined in the SSH protocol specification. The proxy currently supports the following authentication methods: publickey, keyboard-interactive, password and none. The none method is only used to determine which authentication methods does the server support.

check_insane_settings (boolean, w:r)
Default: TRUE
Reject unrealistic terminal and screen settings. The number of columns and rows of the terminal must be lower than 512; the size of the screen cannot be greater than 8192 pixels in either directions.

client_channel (complex, r:r)
Default:
A normative policy hash defining the action to take when a specific channel type is opened on the client side. See Section 4.23.2.1, Configuring policies for SSH channels for details.

client_cipher_algos (string, rw:r)
Default: "aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,3des-cbc,arcfour"
A comma separated list of symmetric cipher algorithms permitted on the client side, in the order of preference. See Section 4.23.2.5, Configuring encryption parameters for details.

client_comp_algos (string, rw:r)
Default:
A comma separated list of compression algorithms, in the order of preference. Currently no compression algorithm is supported.

client_hostkey_algos (string, rw:r)
Default: "ssh-rsa,ssh-dss"
A comma separated list of hostkey algorithms permitted on the client side, in the order of preference. See Section 4.23.2.5, Configuring encryption parameters for details.

client_kex_algos (string, rw:r)
Default: "diffie-hellman-group14-sha1,diffie-hellman-group1-sha1"
A comma separated list of allowed key exchange algorithms permitted on the client side, in the order of preference. See Section 4.23.2.5, Configuring encryption parameters for details.

client_mac_algos (string, rw:r)
Default: "hmac-sha1,hmac-md5"
A comma separated list of MAC algorithms, in the order of preference. See Section 4.23.2.5, Configuring encryption parameters for details.

client_request (complex, r:r)
Default:
A normative policy hash defining the action to take when a specific channel request is received from the client side. See Section 4.23.2.2, Configuring policies for SSH requests for details.

connection_start (enum, rw:r)
Default: SSH_CONN_START_IMMEDIATELY
Specifies when is the server-side connection started. When using agent authentication, set it to SSH_CONN_START_AFTER_PROXY_AUTH.

greeting (string, rw:r)
Default:
The content of this attribute is sent to the SSH client before sending the protocol header, e.g.: before performing key exchange or authentication. It is usually displayed to the user or sent to the system log.

host_key_x509_dss (string, rw:r)
Default:
The DSS host key in openssl PEM format used when communicating with SSH clients. Either host_key_rsa or host_key_dss is required.

host_key_x509_dss_certificate (string, rw:r)
Default:
The DSS host key in openssl PEM format used when communicating with SSH clients. Either host_key_rsa or host_key_dss is required.

host_key_x509_dss_files (certificate, rw:r)
Default:
A tuple of two file names containing the certificate and key files for the DSS host key in PEM format.

host_key_x509_rsa (string, rw:r)
Default:
The RSA host key in openssl PEM format used when communicating with SSH clients. Either host_key_rsa or host_key_dss is required.

host_key_x509_rsa_certificate (string, rw:r)
Default:
The RSA host key in openssl PEM format used when communicating with SSH clients. Either host_key_rsa or host_key_dss is required.

host_key_x509_rsa_files (certificate, rw:r)
Default:
A tuple of two file names containing the certificate and key files for the RSA host key in PEM format.

id_comment (string, rw:r)
Default:
Specifies the comment field in the SSH protocol header.

max_kbdint_prompt_len (integer, rw:r)
Default: 128
Specifies the maximum length of a prompt in the keyboard-interactive authentication method.

max_kbdint_prompts (integer, rw:r)
Default: 10
Specifies the maximum number of prompts in the keyboard-interactive authentication method.

max_kbdint_response_len (integer, rw:r)
Default: 128
Specifies the maximum length of a response in the keyboard-interactive authentication method.

server_channel (complex, r:r)
Default:
A normative policy hash defining the action to take when a specific channel type is opened on the server side. See Section 4.23.2.1, Configuring policies for SSH channels for details.

server_cipher_algos (string, rw:r)
Default: "aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,3des-cbc,arcfour"
A comma separated list of symmetric cipher algorithms permitted on the server side, in the order of preference.

server_comp_algos (string, rw:r)
Default:
A comma separated list of compression algorithms permitted on the server side, in the order of preference. Currently no compression algorithm is supported.

server_hostkey_algos (string, rw:r)
Default: "ssh-rsa,ssh-dss"
A comma separated list of hostkey algorithms permitted on the server side, in the order of preference. See Section 4.23.2.5, Configuring encryption parameters for details.

server_kex_algos (string, rw:r)
Default: "diffie-hellman-group14-sha1,diffie-hellman-group1-sha1"
A comma separated list of key exchange algorithms permitted on the server side, in the order of preference. See Section 4.23.2.5, Configuring encryption parameters for details.

server_mac_algos (string, rw:r)
Default: "hmac-sha1,hmac-md5"
A comma separated list of MAC algorithms permitted on the server side, in the order of preference. See Section 4.23.2.5, Configuring encryption parameters for details.

server_request (complex, r:r)
Default:
A normative policy hash defining the action to take when a specific channel request is received from the server side. See Section 4.23.2.2, Configuring policies for SSH requests for details.

software_version (string, rw:r)
Default: "SSH"
The string sent to the SSH peers as the version of the software. Before changing the default, please note that peers enable or disable various protocol workarounds based on the value of this attribute.

timeout (integer, rw:r)
Default: 600000
I/O timeout in milliseconds. If no activity is detected within this period interval, the connection is terminated.

transparent_mode (boolean, rw:r)
Default: TRUE
Specifies whether the proxy is in transparent or non-transparent mode. In non-transparent mode the name of destination server is extracted from the username, which should be in the format (user@host:port). The set of characters accepted as username/hostname separators is '@' and '%'. The set of characters that separates hostname from port number is ':', '+' and '/'.

userauth_banner (string, rw:r)
Default:
The content of this attribute is sent to the SSH client at the start of the SSH userauth protocol. It is usually displayed by clients as a text message.

4.23.6. Class SshProxy

This proxy implements a default SSH proxy based on AbstractSshProxy. A number of higher-level attributes have been defined that allow easy configuration of the various services offered by SSH (e.g.: port-forwarding, etc.). Port-forwarding, X11-forwarding, and agent-forwarding are disabled by default, the clients may open only session channels. The following client requests are accepted in the channel: window-change, pty-req, shell, exec, subsystem, signal, exit-status, exit-signal, and xon-xoff. The env request is not permitted. Only known host keys are accepted on the server side.

4.23.6.1. Attributes of SshProxy

enable_agent_forward (boolean, rw:r)
Default: FALSE
Enable SSH agent forwarding specific requests and channels. NOTE: this is a high level interface for changing the low level attributes, thus using this setting while changing the low level policy hashes manually might lead to conflicts.

enable_port_forward (boolean, rw:r)
Default: FALSE
Enable port forwarding (both client and server initiated) specific requests and channels. NOTE: this is a high level interface for changing the low level attributes, thus using this setting while changing the low level policy hashes manually might lead to conflicts.

enable_x11_forward (boolean, rw:r)
Default: FALSE
Enable X11 display forwarding specific requests and channels. NOTE: this is a high level interface for changing the low level attributes, thus using this setting while changing the low level policy hashes manually might lead to conflicts.

host_key_dss_file (certificate, rw:r)
Default: ""
Read the DSS hostkey from the file specified. This must be DSA, not RSA.

host_key_rsa_file (certificate, rw:r)
Default: ""
Read the RSA hostkey from the file specified. This must be RSA, not DSA.

server_hostkeys_dir (trustedkeydir, rw:r)
Default:
The directory containing known SSH host keys.

server_hostkeys_verify (enum, rw:r)
Default: SSH_HKV_ACCEPT_KNOWN
The verification mode for SSH host keys. See Section 4.23.2.6, Host key verification.

4.23.6.2. SshProxy methods

Table 4.71. Method summary


Method checkUserKey(self, blob_type, blob)

This method is called by the proxy to chek the publickey. It returns FALSE if it cannot be accepted, TRUE otherwise.
Method mapUserKey(self, blob_type, blob)

This method is called by the proxy to map the publickey of a user to a keypair.

4.23.7. Class SshSFtpProxy

This class implements an SFTP helper to be stacked into an SSH proxy parent.

4.23.7.1. Attributes of SshSFtpProxy

timeout (integer, rw:r)
Default: 600000
I/O timeout in milliseconds. If no activity is detected within this period interval, the connection is terminated.

4.23.8. Class SshScpProxy

This class implements an SCP helper to be stacked into an SSH proxy parent.

4.24. Module Telnet

The Telnet module defines the classes constituting the proxy for the TELNET protocol.

4.24.1. The Telnet protocol

The Telnet protocol was designed to remotely login to computers via the network. Although its main purpose is to access a remote standard terminal, it can be used for many other functions as well.

The protocol follows a simple scenario. The client opens a TCP connection to the server at the port 23. The server authenticates the client and opens a terminal. At the end of the session the server closes the connection. All data is sent in plain text format whithout any encryption.

4.24.1.1. The network virtual terminal

The communication is based on the network virtual terminal (NVT). Its goal is to map a character terminal so neither the "server" nor "user" hosts need to keep information about the characteristics of each other's terminals and terminal handling conventions. NVT uses 7 bit code ASCII characters as the display device. An end of line is transmitted as a CRLF (carriage return followed by a line feed). NVT ASCII is used by many other protocols as well.

NVT defines three mandatory control codes which must be understood by the participants: NULL, CR (Carriage Return), which moves the printer to the left margin of the current line and LF (Line Feed), which moves the printer to the next line keeping the current horizontal position.

NVT also contains some optional commands which are useful. These are the following:

  • BELL is an audible or visual sign.

  • BS (Back Space) moves the printer back one position and deletes a character.

  • HT (Horizontal Tab) moves the printer to the next horizontal tabular stop.

  • VT Vertical Tab moves the printer to the next vertical tabular stop.

  • FF (Form Feed) moves the printer to the top of the next page.

4.24.1.2. Protocol elements

The protocol uses several commands that control the method and various details of the interaction between the client and the server. These commands can be either mandatory commands or extensions. During the session initialization the client and the server negotiates the connection parameters with these commands. Sub-negotiation is a process during the protocol which is for exchanging extra parameters of a command (e.g.: sending the window size). The commands of the protocol are:

Request/Response Description
SE End of sub-negotiation parameters.
NOP No operation.
DM Data mark - Indicates the position of Sync event within the data stream.
BRK Break - Indicates that a break or attention key was hit.
IP Suspend, interrupt or abort the process.
AO Abort output - Run a command without sending the output back to the client.
AYT Are you there - Request a visible evidence that the AYT command has been received.
EC Erase character - Delete the character last received from the stream.
EL Erase line - Erase a line without a CRLF.
GA Go Ahead - Instruct the other machine to start the transmission.
SB Sub-negotiation starts here.
WILL Will (option code) - Indicates the desire to begin performing the indicated option, or confirms that it is being performed.
WONT Will not (option code) - Indicates the refusal to perform, or continue performing, the indicated option.
DO Do (option code) - Indicates the request that the other party perform, or confirmation that the other party is expected to perform, the indicated option.
DONT Do not (option code) - Indicates the request that the other party stop performing the indicated option, or confirmation that its performing is no longer expected.
IAC Interpret as command.

Table 4.72. Telnet protocol commands


4.24.2. Proxy behavior

TelnetProxy is a module built for parsing TELNET protocol commands and the negotiation process. It reads and parses COMMANDs on the client side, and sends them to the server if the local security policy permits. Arriving RESPONSEs are parsed as well and sent to the client if the local security policy permits. It is possible to manipulate options by using TELNET_OPT_POLICY. It is also possible to accept or deny certain options and suboptions.

The Telnet shell itself cannot be controlled, thus the commands issued by the users cannot be monitored or modified.

4.24.2.1. Default policy

The low level abstract Telnet proxy denies every option and suboption negotiation sequences by default. The different options can be enabled either manually in a derived proxy class, or the predefined TelnetProxy class can be used.

4.24.2.2. Configuring policies for the TELNET protocol

The Telnet proxy can enable/disable the use of the options and their suboptions within the session. Changing the default policy can be done using the option multi-dimensional hash, indexed by the option and the suboption (optional). If the suboption is specified, the lookup precedence described in Section 2.1.2, Response codes is used. The possible action codes are listed in the table below.

Action Description
TELNET_OPT_ACCEPT

Allow the option.

TELNET_OPT_DROP

Reject the option.

TELNET_OPT_ABORT

Reject the option and terminate the Telnet session.

TELNET_OPT_POLICY

Call the function specified to make a decision about the event. The function receives two parameters: self, and option (an integer). See Section 2.1, Policies for requests and responses for details.

Table 4.73.  Action codes for Telnet options


[Example] Example 4.47. Example for disabling the Telnet X Display Location option
class MyTelnetProxy(TelnetProxy):
	def config(self):
		TelnetProxy.config(self)
		self.option[TELNET_X_DISPLAY_LOCATION] = (TELNET_OPT_REJECT)

Constants have been defined for the easier use of TELNET options and suboptions. These are listed in Table 1.4, TELNET options and suboptions.

Policy callback functions

Policy callback functions can be used to make decisions based on the content of the suboption negotiation sequence. For example, the suboption negotiation sequences of the Telnet Environment option transfer environment variables. The low level proxy implementation parses these variables, and passes their name and value to the callback function one-by-one. These values can also be manipulated during transfer, by changing the current_var_name and current_var_value attributes of the proxy class.

[Example] Example 4.48. Rewriting the DISPLAY environment variable
class MyRewritingTelnetProxy(TelnetProxy):
	def config(self):
		TelnetProxy.config()
		self.option[TELNET_ENVIRONMENT, TELNET_SB_IS] = (TELNET_OPTION_POLICY, self.rewriteVar)

	def rewriteVar(self, option, name, value):
		if name == "DISPLAY":
			self.current_var_value = "rewritten_value:0"
		return TELNET_OPTION_ACCEPT
Option negotiation

In the Telnet protocol, options and the actual commands are represented on one byte. In order to be able to use a command in a session, the option (and its suboptions if there are any) corresponding to the command has to be negotiated between the client and the server. Usually the command and the option is represented by the same value, e.g.: the TELNET_STATUS command and option are both represented by the value "5". However, this is not always the case. The negotiation hash is indexed by the code of the command, and contains the code of the option to be negotiated for the given command (or the TELNET_NEG_NONE when no negotation is needed).

Currently the only command where the code of the command differs from the related option is self.negotiation["239"] = int(TELNET_EOR).

4.24.3. Related standards

The Telnet protocol is described in RFC 854. The different options of the protocol are described in various other RFCs, listed in Table 1.4, TELNET options and suboptions.

4.24.4. Classes in the Telnet module

Class Description
AbstractTelnetProxy Class encapsulating the abstract Telnet proxy.
TelnetProxy Default Telnet proxy based on AbstractTelnetProxy.
TelnetProxyStrict Telnet proxy based on AbstractTelnetProxy, allowing only the minimal command set.

Table 4.74. Classes of the Telnet module


4.24.5. Class AbstractTelnetProxy

This class implements the Telnet protocol (as described in RFC 854) and its most common extensions. Although not all possible options are checked by the low level proxy, it is possible to filter any option and suboption negotiation sequences using policy callbacks. AbstractTelnetProxy serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractTelnetProxy, or one of the predefined TelnetProxy proxy classes. AbstractTelnetProxy denies all options by default.

4.24.5.1. Attributes of AbstractTelnetProxy

current_var_name (string, n/a:rw)
Default: n/a
Name of the variable being negotiated.

current_var_value (string, n/a:rw)
Default: n/a
Value of the variable being negotiated (e.g.: value of an environment variable, an X display location value, etc.).

enable_audit (boolean, w:r)
Default: FALSE
Enable session auditing.

negotiation (complex, rw:rw)
Default:
Normative hash listing which options must be negotiated for a given command. See Section Option negotiation for details.

option (complex, rw:rw)
Default: n/a
Normative policy hash for Telnet options indexed by the option and (optionally) the suboption. See also Section 4.24.2.2, Configuring policies for the TELNET protocol.

timeout (integer, rw:r)
Default: 600000
I/O timeout in milliseconds.

4.24.6. Class TelnetProxy

TelnetProxy is a proxy class based on AbstractTelnetProxy, allowing the use of all Telnet options.

4.24.7. Class TelnetProxyStrict

TelnetProxyStrict is a proxy class based on AbstractTelnetProxy, allowing the use of the options minimally required for a useful Telnet session.

The following options are permitted: ECHO; SUPPRESS_GO_AHEAD; TERMINAL_TYPE; NAWS; EOR; TERMINAL_SPEED; X_DISPLAY_LOCATION; ENVIRONMENT. All other options are rejected.

4.25. Module TFtp

The TFtp module defines the classes constituting the proxy for the TFTP protocol.

4.25.1. The TFtp protocol

Trivial File Transfer Protocol (TFTP) is a very simple protocol used to transfer files over the UDP transport protocol. It is commonly used for bootstrapping diskless systems (normally workstations or routers).

The protocol follows a very simple procedure. The client sends a request to read (RRQ) or write (WRQ) a file to the server's UDP/69 port. If the server grants the request a connection is opened and the file server starts sending the file in fixed length blocks of 512 bytes. TFTP transports data in netascii encoding format (ASCII text with each line terminated by the 2-character sequence of a carriage return followed by a linefeed called CR/LF) or octet (data as 8-bit bytes with no interpretation) which is set by the mode indicator at the end of the RRQ/WRQ message. The DATA packet also contains a block number which is used later for acknowledgment. Every packet sent must be acknowledged by the receiver, which guarantees that the previous packet has been received. If a packet is lost the receiver sends a request after a timeout. The server keeps just one packet in store for retransmission until the acknowledgment arrives. A packet shorter than 512 bytes indicates the end of the transmission.

Most errors cause termination of the transfer process and are signaled by the sending of an error packet. This is neither acknowledged nor retransmitted. If an error occurred, then an ERROR packet is sent. If a network error occurred then even the ERROR packet might get lost, therefore timeout is also used to detect errors.

Normal transmission termination is started by a packet smaller than 512 bytes. The packet is acknowledged by a normal ACK packet like all the previous packet. Then the host sends the final ACK and waits for a while before it terminates the transmission. If the final ACK is not acknowledged or the the connection timed out the final ACK packet is retransmitted.

4.25.1.1. Protocol elements

TFTP supports five types of packets, all of which have been mentioned above:

  • 1 - Read request (RRQ)

  • 2 - Write request (WRQ)

  • 3 - Data (DATA)

  • 4 - Acknowledgment (ACK)

  • 5 - Error (ERROR), which can contain the following error messages:

    • 0 - Not defined, see error message (if any).

    • 1 - File not found.

    • 2 - Access violation.

    • 3 - Disk full or allocation exceeded.

    • 4 - Illegal TFTP operation.

    • 5 - Unknown transfer ID.

    • 6 - File already exists.

    • 7 - No such user.

4.25.2. Proxy behavior

TFtpProxy is a module built for parsing messages of the TFTP protocol. It reads and parses REQUESTs on the client side, and sends them to the server if the local security policy permits. The answers are similarly parsed and returned to the client if the local security policy permits. Rewriting the requested filename and encoding is supported (although transcoding is not).

One proxy instance is able to handle more than one session, if the Router and Chainer classes support fast path operation (currently this is supported in DirectedRouter). This functionality is similar to, but different from the secondary session handling used in PlugProxy and RadiusProxy. In TftpProxy the parameters of secondary sessions cannot be set, they are managed automatically based on the logic of the protocol.

4.25.2.1. Configuring policies for TFTP commands

Changing the default behaviour of requests is possible using the request attribute. This hash is indexed by the request method ("read" or "write"), and the requested filename. If the hash contains no entry for a given combination, the "*" entry is used. If there is no matching entry in the hash, the command is rejected. The possible actions are described in the following table. See also Section 2.1, Policies for requests and responses.

Action Description
TFTP_REQ_ACCEPT Allow the request to pass.
TFTP_REQ_REJECT Reject the request and send an error message. Message code and text can be specified as second and third elements of the tuple.
TFTP_REQ_DROP Drop the packet.
TFTP_REQ_POLICY Call the function specified to make a decision about the event. The function receives four parameters: self, the method ("read"/"write"), the file name and the encoding used in the request. See Section 2.1, Policies for requests and responses for details.
TFTP_REQ_REWRITE Rewrite filename and/or encoding and accept the packet. See Section Rewriting the request for details.

Table 4.75.  Action codes on TFTP requests


Rewriting the request

To rewrite and accept a request, the hash value must be a tuple containing TFTP_REQ_REWRITE as the first value, and the filename and encoding to be sent to the server as the second and third values.

Responding with a custom error

To respond with a user-defined error code and message, the hash value must be a tuple containing TFTP_REQ_ERROR as the first value, the error code (an integer as defined by the TFTP RFC) as the second one, and the error message as the third. The session is (obviously) terminated; the TFTP server is not notified.

4.25.3. Related standards

Trivial File Transfer Protocol is described in RFC 1350.

4.25.4. Classes in the TFtp module

Class Description
AbstractTFtpProxy Class encapsulating the abstract TFtp proxy.
TFtpProxy Default TFtp proxy class based on AbstractTFtpProxy.

Table 4.76. Classes of the TFtp module


4.25.5. Class AbstractTFtpProxy

This class implements the TFTP protocol as described in RFC 1350. It serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractTFtpProxy, or the predefined TFtpProxy proxy class.

4.25.5.1. Attributes of AbstractTFtpProxy

encoding (string, n/a:r)
Default: n/a
Encoding used in the current transfer.

filename (string, n/a:r)
Default: n/a
Name of the file being transferred.

request (complex, rw:rw)
Default:
Normative policy hash for TFTP requests indexed by the request method and the filename. See also Section 4.25.2.1, Configuring policies for TFTP commands.

timeout (integer, rw:r)
Default: -1
Timeout in milliseconds. The -1 value disables the timeout.

4.25.6. Class TFtpProxy

A default proxy for the TFTP protocol based on AbstractTFtpProxy, allowing only read-only access.

4.26. Module Vnc

VNC protocol is for accessing the desktop of remote computers.

4.26.1. The VNC protocol

4.26.2. Proxy behavior

4.26.3. Classes in the Vnc module

Class Description
AbstractVncProxy Class encapsulating the abstract Vnc proxy.
VncProxy Default Vnc proxy based on AbstractVncProxy.

Table 4.77. Classes of the Vnc module


4.26.4. Class AbstractVncProxy

This class implements the VNC protocol. AbstractVncProxy serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractVncProxy, or one of the predefined VncProxy proxy classes.

4.26.4.1. Attributes of AbstractVncProxy

enable_audit (boolean)
Default: FALSE
Decides whether to audit the traffic or not.

readonly (boolean)
Default: FALSE
Decides whether to block client activities or not.

4.26.5. Class VncProxy

VncProxy is a proxy class based on AbstractVncProxy, allowing the use of all Vnc options.

4.27. Module Whois

WHOIS is a protocol providing information about domain and IP owners.

4.27.1. The Whois protocol

Whois is a netwide service to the Internet users maintained by DDN Network Information Center (NIC).

The protocol follows a very simple method. First the client opens a TCP connection to the server at the port 43 and sends a one line REQUEST closed with <CRLF>. This request can contain only ASCII characters. The server sends the result back and closes the connection.

4.27.2. Proxy behavior

WhoisProxy is a module build for parsing messages of the WHOIS protocol. It reads and parses the REQUESTs on the client side and sends them to the server if the local security policy permits. Arriving RESPONSEs are not parsed as they do not have any fixed structure or syntax.

[Example] Example 4.49. Example WhoisProxy logging all whois requests
class MyWhoisProxy(AbstractWhoisProxy):
	def whoisRequest(self, request):
		log(None, CORE_DEBUG, 3, "Whois request: '%s'" % (request))
		return ZV_ACCEPT

4.27.3. Related standards

  • The NICNAME/WHOIS protocol is described in RFC 954.

4.27.4. Classes in the Whois module

Class Description
AbstractWhoisProxy Class encapsulating the abstract Whois proxy.
WhoisProxy Default proxy class based on AbstractWhoisProxy.

Table 4.78. Classes of the Whois module


4.27.5. Class AbstractWhoisProxy

This class implements the WHOIS protocol as specified in RFC 954.

4.27.5.1. Attributes of AbstractWhoisProxy

max_line_length (integer, rw:r)
Default: 132
Maximum number of characters allowed in a single line.

max_request_length (integer, rw:r)
Default: 128
Maximum allowed length of a Whois request.

request (string, n/a:rw)
Default:
The Whois request.

response_footer (string, rw:rw)
Default:
Append this string to each Whois response.

response_header (string, rw:rw)
Default:
Prepend this string to each Whois response.

timeout (integer, rw:r)
Default: 30000
I/O timeout in milliseconds.

4.27.5.2. AbstractWhoisProxy methods

Method Description
whoisRequest(self, request) Function to process whois requests.

Table 4.79. Method summary


Method whoisRequest(self, request)

This function is called by the Whois proxy to process the requests. It can also be used to change specific attributes of the request.

4.27.6. Class WhoisProxy

A default proxy class based on AbstractWhoisProxy.

4.28. Module X11

The X11 protocol is the traditional way for running remote graphic applications on Linux/UNIX systems.

4.28.1. The X11 protocol

The X11 protocol establishes a connection between the Application and the Display (which may be on a separate host) and transfers all desktop-related data. The protocol self is designed to be extendable, meaning that different implementations may integrate any specific functionality as an extension. Such extensions include support for hardware graphics accelerators, various input devices, power-saving subsystems and even application-specific graphic libraries.

4.28.2. Proxy behavior

The X11 proxy currently controls the X11 traffic only during the extension negotiation phase, enabling or disabling the extensions by their name. Since currently only the X11 core functionality is supported, extensions must be disabled.

4.28.3. Classes in the X11 module

Class Description
AbstractX11Proxy Class encapsulating the abstract X11 proxy.
X11Proxy Default X11 proxy based on AbstractX11Proxy.

Table 4.80. Classes of the X11 module


4.28.4. Class AbstractX11Proxy

This class implements an abstract proxy for the X11 Protocol. AbstractX11Proxy serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractX11Proxy, or to the predefined X11Proxy proxy class.

4.28.4.1. Attributes of AbstractX11Proxy

extension (complex)
Default: n/a
Normative policy hash for X11 extensions, indexed by the name of the extension.

4.28.5. Class X11Proxy

X11Proxy is a default X11 proxy based on AbstractX11Proxy. All extensions are rejected by default.

4.29. Module Xmlsec

The Xmlsec module defines the classes for the proxy to inspect XML-based SOAP communication.

4.29.1. The SOAP protocol

SOAP (originally called Simple Object Access Protocol) is an XML-based protocol for exchanging structured information in the implementation of Web Services in computer networks. The protocol consists of three parts:

  • The envelope defining the message and related processing instructions

  • Headers and encoding rules

  • Message body

The SOAP protocol is almost never used on its own, it is typically embedded into other application-layer protocols, for example, HTTP, HTTPS, Remote Procedure Call (RPC), or SMTP. The following is a sample SOAP message sent via an HTTP POST request:

POST /order HTTP/1.1
Host: www.onlinetrade.com
Content-Type: text/xml; charset="UTF-8"
Content-Length: 2000
SOAPAction: "http://www.onlinetrade.com/order#buy"

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header>
      <SOAP-SEC:Signature xmlns:SOAP-SEC="http://schemas.xmlsoap.org/soap/security/2000-12" SOAP-ENV:mustUnderstand="1">
        <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
          <ds:SignedInfo>
            <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2000/CR-xml-c14n-20001026"/>
            <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1"/>
            <ds:Reference URI="#Body">
              <ds:Transforms>
                <ds:Transform Algorithm="http://www.w3.org/TR/2000/CR-xml-c14n-20001026"/>
              </ds:Transforms>
              <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
              <ds:DigestValue>j6lwx3rvEPO0vKtMup4NbeVu8nk=</ds:DigestValue>
            </ds:Reference>
          </ds:SignedInfo>
          <ds:SignatureValue>MC0CFFrVLtRlk=...</ds:SignatureValue>
        </ds:Signature>
      </SOAP-SEC:Signature>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body xmlns:SOAP-SEC="http://schemas.xmlsoap.org/soap/security/2000-12" SOAP-SEC:id="Body">
      <order:buy xmlns:order="http://www.onlinetrade.com/order">
        <order:ticker-symbol>IBM</order:ticker-symbol>
        <order:quantity>100</order:quantity>
        <order:market>New York</order:market>
        <order:nonce>20010711-0001287634</order:nonce>
        <order:recipient>http://www.onlinetrade.com/</order:recipient>
      </order:buy>
    </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>

4.29.2. Proxy behaviour

The SOAP protocol is almost never used on its own, it is typically embedded into HTTP or HTTPS.

[Example] Example 4.50. Stacking Xmlsec into an HTTP proxy

The following configuration example embeds an Xmlsec proxy into HTTP POST requests.

class MyProxy(HttpProxy):
        class EmbeddedProxy(XmlsecProxy):
                def config(self):
                        XmlsecProxy.config(self)
                        self.check_mode = XMLSEC_CHECK_PURE

        def config(self):
                HttpProxy.config(self)
                self.request_stack["POST"] = (HTTP_STK_DATA, self.EmbeddedProxy)

4.29.2.1. Validating the XML

The Xmlsec proxy has the following methods to validate the XML:

Name Value
XMLSEC_CHECK_PURE Verify only that the XML is a well-formed XML
XMLSEC_CHECK_SOAP Verify that the XML is a well-formed SOAP request with proper envelope, header, and body parts.
XMLSEC_CHECK_SOAPSEC Verify the signature of the SOAP request. Note that the trusted_ca_directory() option must be properly set for signature validation.

Table 4.81. 


Action Description
XMLSEC_ACTION_ACCEPT

Allow the request to pass.

XMLSEC_ACTION_DROP

Drop the request.

XMLSEC_ACTION_WARNING

Issue a warning about the request.

Table 4.82.  Action codes for XML requests


4.29.2.2. Configuring custom SOAP checks

After completing the initial validation of the SOAP XML, the Xmlsec proxy automatically calls the xmlValidate method. This method is empty by default, but can be overridden and customized to perform any XML-related validation or verification. The method receives the complete XML structure of the SOAP message.

[Example] Example 4.51. Custom SOAP validation

The following example defines an Xmlsec proxy that checks that the incoming message is a well-formed SOAP message, then logs and accepts buy requests, rejecting any other type of transaction.

        def config(self):
                XmlsecProxy.config(self)
                self.check_mode = XMLSEC_CHECK_SOAP

        def xmlValidate(self, etree):
                buy_order = etree.xpath('//order:buy', namespaces = {'order': 'http://www.onlinetrade.com/order'})
                if len(buy_order) == 1:
                        details = [(e.tag, e.text) for e in buy_order[0].findall('*')]
                        for d in details:
                                proxyLog(self, "xmlsec.audit", 4, "Buy details; property='%s', value='%s'" % (d[0], d[1]))
                        return ZV_ACCEPT

                proxyLog(self, XMLSEC_POLICY, 3, "Not a buy request, rejecting")
                return ZV_REJECT

4.29.3. Classes in the Xmlsec module

Class Description
AbstractXmlsecProxy Class encapsulating the Xmlsec Proxy.
XmlsecProxy Default Xmlsec proxy class based on AbstractXmlsecProxy.

Table 4.83. Classes of the Xmlsec module


4.29.4. Class AbstractXmlsecProxy

This proxy validates incoming XML requests. It serves as a starting point for customized proxy classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractXmlsecProxy, or the predefined XmlsecProxy proxy class.

4.29.4.1. Attributes of AbstractXmlsecProxy

check_mode (enum)
Default: XMLSEC_CHECK_PURE
Specifies how to validate the XML. For details, see Section 4.29.2.1, Validating the XML.

failure_action (enum)
Default: XMLSEC_ACTION_DROP
The action to take if the XML validation fails. For details, see Section 4.29.2.1, Validating the XML.

max_content_length (integer)
Default: 16384
The maximum number of characters in the submitted XML file. Requests containing longer XML files are automatically rejected.

soap_namespace_uri (string)
Default: http://www.w3.org/2003/05/soap-envelope
The URL where the definition of the SOAP namespace is available, for example, http://schemas.xmlsoap.org/soap/envelope/.

timeout (integer)
Default: 30000
Timeout in milliseconds. The -1 value disables the timeout.

trusted_ca_directory (certificate)
Default: n/a
The directory storing Trusted CA certificates needed to verify the XML signatures. Needed only when the check_mode option is set to XMLSEC_CHECK_SOAPSEC.

4.29.4.2. AbstractXmlsecProxy methods

Method Description
xmlValidate(self, doc)  

Table 4.84. Method summary


Method xmlValidate(self, doc)

This method is automatically called after the proxy has successfully validated the XML, and can be used to implement additional validations and checks. For details, see Section 4.29.2.2, Configuring custom SOAP checks.

4.29.5. Class XmlsecProxy

A default proxy for the SOAP protocol based on AbstractXmlsecProxy, checking only the well-formedness of the XML.

Chapter 5. Core

This chapter provides detailed description for the core modules of Zorp.

Module Description
Auth Module defining interface to the Authentication module.
AuthDB Module defining interface to the authentication databases.
Chainer The Chainer module defines the classes required to connect to the target servers.
Config The Config module defines global options of Zorp.
Dispatch The Dispatch module defines the classes that accept incoming connections.
Domain Module defining interface to address domains.
Keybridge The Keybridge module implements generic X.509 key bridging.
Matcher Module defining interface to the Matchers.
NAT Module defining interface to Network Address Translation.
Notification Module defining interface to e-mail and other notifications.
Proxy The Proxy module defines the abstract proxy class.
Resolver Module defining the resolver used to resolve domain names to IP addresses.
Router The Router module defines the classes that select the destination address of the server-side connection.
Service The Service module defines the classes used to create service definitions.
Session Module defining interface to the session related classes.
SockAddr Module defining interface to the SockAddr.
Stack The Stack module defines the classes used to connect to a stacking provider.
Stream Module defining interface to the streaming component.
Zone Module defining interface to the Zones.
Zorp Module defining interface to the Zorp core entry points.

Table 5.1. List of Zorp proxies


5.1. Module Auth

This module contains classes related to authentication and authorization. Together with the AuthDB module it implements the Authentication and Authorization framework of Zorp.

User authentication verifies the identity of the user trying to access a particular network service. When performed on the connection level, that enables the full auditing of the network traffic. Authentication is often used in conjunction with authorization, allowing access to a service only to clients who have the right to do so.

5.1.1. Authentication and authorization basics

Authentication is a method to ensure that certain services (access to a server, etc.) can be used only by the clients allowed to access the service. The process generally called as authentication actually consists of three distinct steps:

  • Identification: Determining the clients identity (e.g.: requesting a username).

  • Authentication: Verifying the clients identity (e.g.: requesting a password that only the real client knows).

  • Authorization: Granting access to the service (e.g.: verifying that the authenticated client is allowed to access the service).

    [Note] Note

    It is important to note that although authentication and authorization are usually used together, they can also be used independently. Authentication verifies the identity of the client. There are situations where authentication is sufficient, because all users are allowed to access the services, only the event and the user's identity has to be logged. On the other hand, authorization is also possible without authentication, for example if access to a service is time-limited (e.g.: it can only be accessed outside the normal work-hours, etc.). In such situations authentication is not needed.

5.1.2. Authentication and authorization in Zorp

Zorp can authenticate and authorize access to the Zorp services. The aim of authentication is to identify the user and the associated group memberships. When the client initiates a connection, it actually tries to use a Zorp service. Zorp checks if an authentication policy is associated to the service. If an authentication policy is present, Zorp contacts the authentication provider specified in the authentication policy. The type of authentication (the authentication class used, e.g., InbandAuthentication) is also specified in the authentication policy. The authentication provider connects to an authentication backend (e.g., a user database) to perform the authentication of the client - Zorp itself does not directly communicate with the database.

If the authentication is successful, Zorp verifies that the client is allowed to access the service (by evaluating the authorization policy and the identity and group memberships of the client). If the client is authorized to access the service, the server-side connection is built. The client is automatically authorized if no authorization policy is assigned to the service.

Currently only one authentication provider, the Zorp Authentication Server (ZAS) is available via the ZAS2AuthenticationBackend class. Authentication providers are actually configured instances of the authentication backends, and it is independent from the database that the backend connects to. The authentication backend is that ties the authentication provider to the server storing the user data. For details on using ZAS, see the Connection authentication and authorization chapter of the Zorp Administrator's Guide.

The aim of authentication is to identify the user and resolve group memberships. The results are stored in the in the auth_user and auth_groups attributes of the session object. Note that apart from the information required for authentication, Zorp also sends session information (e.g., the IP address of the client) to the authentication provider.

Zorp provides the following authentication classes:

  • InbandAuthentication: Use the built-in authentication of the protocol to authenticate the client on the Zorp.

  • ServerAuthentication: Enable the client to connect to the target server, and extract its authentication information from the protocol.

  • ZAAuthentication: Outband authentication using the Zorp Authentication Agent.

If the authentication is successful, Zorp verifies that the client is allowed to access the service (by evaluating the authorization policy). If the client is authorized to access the service, the server-side connection is built. The client is automatically authorized if no authorization policy is assigned to the service.

Each Zorp service can use an authorization policy to determine whether a client is allowed to access the service. If the authorization is based on the identity of the client, it takes place only after a successful authentication - identity-based authorization can be performed only if the client's identity is known and has been verified. The actual authorization is performed by Zorp, based on the authentication information received from ZAS or extracted from the protocol.

Zorp provides the following authorization classes:

5.1.3. Functions in module Auth

Function Description
getAuthPolicyObsolete n/a

Table 5.2. Function summary


5.1.4. Classes in the Auth module

Class Description
AbstractAuthentication Class encapsulating the abstract authentication interface.
AbstractAuthorization Class encapsulating the authorization interface.
AuthCache Class encapsulating the authentication cache.
AuthenticationPolicy A policy determining how the user is authenticated to access the service.
AuthorizationPolicy A policy determining how the user is authorized to access the service.
BasicAccessList Class encapsulating the authorization by access list.
InbandAuthentication Class encapsulating the inband authentication interface.
NEyesAuthorization Class encapsulating N eyes authorization.
PairAuthorization Class encapsulating pair-based 4 eyes authorization.
PermitGroup Class encapsulating the group membership based authorization.
PermitTime Class encapsulating time based authorization.
PermitUser Class encapsulating the user-name based authorization.
SatyrAuthentication Class encapsulating the outband authentication interface using the Satyr application.
ServerAuthentication Class encapsulating the server authentication interface.
ZAAuthentication Class encapsulating the outband authentication interface using the Zorp Authentication Agent.

Table 5.3. Classes of the Auth module


5.1.5. Functions

5.1.5.1. Function getAuthPolicyObsolete(name)

n/a

5.1.6. Class AbstractAuthentication

This class encapsulates interfaces for inband and outband authentication procedures. Service definitions should refer to a customized class derived from AbstractAuthentication, or one of the predefined authentication classes, such as InbandAuthentication or ZAAuthentication.

5.1.6.1. AbstractAuthentication methods

Method Description
__init__(self, authentication_provider, auth_cache) Constructor to initialize an AbstractAuthentication instance.

Table 5.4. Method summary


Method __init__(self, authentication_provider, auth_cache)

This constructor initializes an instance of the AbstractAuthentication class.

5.1.7. Class AbstractAuthorization

This class encapsulates an authorization interface. Authorization determines whether the authenticated entity is in fact allowed to access a specific service. Service definitions should refer to a customized class derived from AbstractAuthorization, or one of the predefined authorization classes, such as PermitUser or PermitGroup.

5.1.8. Class AuthCache

This class encapsulates an authentication cache which associates usernames with client IP addresses. The association between a username and an IP address is valid only until the specified timeout. Caching the authentication results means that the users do not need to authenticate themselves for every request: it is assumed that the same user is using the computer within the timeout. E.g.: once authenticated for an HTTP service, the client can browse the web for Timeout period, but has to authenticate again to use FTP.

To use a single authorization cache for every service request of a client, set the service_equiv attribute to TRUE. That way Zorp does not make difference between the different services (protocols) used by the client: after a successful authentication the user can use all available services without having to perform another authentication. E.g.: if this option is enabled in the example above, the client does not have to re-authenticate for starting an FTP connection.

5.1.8.1. AuthCache methods

Method Description
__init__(self, name, timeout, update_stamp, service_equiv, cleanup_threshold) Constructor to initialize an instance of the AuthCache class.

Table 5.5. Method summary


Method __init__(self, name, timeout, update_stamp, service_equiv, cleanup_threshold)

Arguments of __init__
cleanup_threshold (integer)
Default: 100
When the number of entries in the cache reaches the value of cleanup_threshold, old entries are automatically deleted.

service_equiv (boolean)
Default: FALSE
If enabled, then a single authentication of a user applies to every service from that client.

timeout (integer)
Default: 600
Timeout while an authentication is assumed to be valid.

update_stamp (boolean)
Default: TRUE
If set to TRUE, then cached authentications increase the validity period of the authentication cache. Otherwise, the authentication cache expires according to the timeout value set in attribute timeout.

This constructor initializes and registers an AuthCache instance that can be referenced in authentication policies.

5.1.9. Class AuthenticationPolicy

Authentication policies determine how the user is authenticated to access the service. The authentication_policy attribute of a service can reference an instance of the AuthenticationPolicy class.
[Example] Example 5.1. A simple authentication policy

The following example defines an authentication policy that can be referenced in service definitions. This policy uses inband authentication and references an authentication provider.

AuthenticationPolicy(name="demo_authentication_policy", cache=None, authentication=InbandAuthentication(), provider="demo_authentication_provider")
            

To use the authentication policy, include it in the definition of the service:

Service(name="office_http_inter", proxy_class=HttpProxy, authentication_policy="demo_authentication_policy", authorization_policy="demo_authorization_policy")
            
[Example] Example 5.2. Caching authentication decisions

The following example defines an authentication policy that caches the authentication decisions for ten minutes (600 seconds). For details on authentication caching, see see Section 5.1.8, Class AuthCache).

AuthenticationPolicy(name="demo_authentication_policy", cache=AuthCache(timeout=600, update_stamp=TRUE, service_equiv=TRUE, cleanup_threshold=100), authentication=InbandAuthentication(), provider="demo_authentication_provider")
            

5.1.9.1. AuthenticationPolicy methods

Method Description
__init__(self, name, provider, authentication, cache) Constructor to initialize an instance of the AuthenticationPolicy class.

Table 5.6. Method summary


Method __init__(self, name, provider, authentication, cache)

Arguments of __init__
authentication (class)
Default: None
The authentication method used in the authentication process. See Section 5.1.1, Authentication and authorization basics for details.

cache (class)
Default: None
Caching method used to store authentication results.

name (string)
Default: n/a
Name identifying the AuthenticationPolicy instance.

provider (class)
Default: n/a
The authentication provider object used in the authentication process. See Section 5.1.1, Authentication and authorization basics for details.

5.1.10. Class AuthorizationPolicy

Authorization policies determine how the user is authorized to access the service. The authorization_policy attribute of a service can reference an instance of the AuthorizationPolicy class.
[Example] Example 5.3. A simple authorization policy

The following example defines an authotization policy that can be referenced in a service definition and permits only the members of the admin or system groups to access the service.

AuthorizationPolicy(name="demo_authorization_policy", authorization=PermitGroup(grouplist=("admin", "system")))
            

To use the authorization policy, include it in the definition of the service:

Service(name="office_http_inter", proxy_class=HttpProxy, authentication_policy="demo_authentication_policy", authorization_policy="demo_authorization_policy")
            

5.1.10.1. AuthorizationPolicy methods

Table 5.7. Method summary


Method __init__(self, name, authorization)

Arguments of __init__
authorization (class)
Default: n/a
The authorization method (e.g., PermitGroup) used in the instance. See Section 5.1.10, Class AuthorizationPolicy for examples.

name (string)
Default: n/a
Name of the AuthorizationPolicy instance. This name can be referenced in service definitions.

5.1.11. Class BasicAccessList

This class encapsulates an access list that uses any class derived from the AbstractAuthorization class. BasicAccessList allows to combine multiple access control requirements into a single decision.

BasicAccessList uses a list of rules. The rules are evaluated sequentially. Each rule can specify whether matching the current rule is Sufficient or Required. A connection is authorized if a Sufficient rule matches the connection, or all Required rules are fulfilled. If a Required rule is not met, the connection is refused.

Rules are represented as a list of Python tuples as the following example shows:

[Example] Example 5.4. BasicAccessList example

When referenced in a service definition, the following users can access the service:

  • members of the development group;

  • anyone with the user1 username;

  • anyone with the user2 username.

AuthPolicy('intra',
          authentication=ZAAAuthentication
                        ('zas2db', key_file='fwzaa.key', cert_file='fwzaa.crt'),
          authorization=BasicAccessList(
                ((Z_BACL_SUFFICIENT, PermitUser('user1')),
                 (Z_BACL_SUFFICIENT, PermitUser('user2')),
                 (Z_BACL_REQUIRED, PermitGroup('development')))))

5.1.11.1. BasicAccessList methods

Method Description
__init__(self, acl) Constructor to initialize a BasicAccessList instance.

Table 5.8. Method summary


Method __init__(self, acl)

Arguments of __init__
acl (complex)
Default: n/a
Access control rules represented as a list of tuple.

This constructor creates a new BasicAccessList instance which can be referenced in an authentication policy.

5.1.12. Class InbandAuthentication

This class encapsulates inband authentication. Inband authentication is performed by the proxy using the rules of the application-level protocol. Only the authentication methods supported by the particular protocol can be used during inband authentication. Authentication policies can refer to instances of the InbandAuthentication class using the auth parameter.

[Warning] Warning

Inband authentication is currently supported only for the Http, Ftp, and Socks proxy classes.

5.1.12.1. InbandAuthentication methods

Method Description
__init__(self, authentication_provider, auth_cache) Constructor to initialize an InbandAuthentication instance.

Table 5.9. Method summary


Method __init__(self, authentication_provider, auth_cache)

This constructor initializes an instance of the InbandAuthentication class.

5.1.13. Class NEyesAuthorization

This class encapsulates an N-eyes based authorization method, which means that connections are authorized if other administrators authenticate themselves within the defined timelimits.

When NEyesAuthorization is used, the client trying to access the service has to be authorized by another (already authorized) client (this authorization chain can be expanded to multiple levels). NEyesAuthorization can only be used in conjunction with another NEyesAuthorization policy. One of them is the authorizer set to authorize the authorized policy.

In a simple 4-eyes scenario the authorizer policy points to the authorized policy in its Authorization policy parameter, and has its wait_authorization parameter disabled. The authorized policy has an empty Authorization policy parameter (meaning that it is at lower the end of an N-eyes chain), and has its wait_authorization parameter enabled, meaning that it has to be authorized by another policy.

For examples on using the NEyesAuthorization class, see the Proxying secure channels - SSH tutorial available from the BalaBit Documentation Page at http://www.balabit.com/support/documentation/.

5.1.13.1. NEyesAuthorization methods

Method Description
__init__(self, authorize_policy, wait_authorization, wait_timeout) Constructor to initialize a NEyesAuthorization instance.

Table 5.10. Method summary


Method __init__(self, authorize_policy, wait_authorization, wait_timeout)

Arguments of __init__
authorize_policy (class)
Default: None
The authorization policy authorized by the current NEyesAuthorization policy.

wait_authorization (boolean)
Default: FALSE
Specifies whether the current authorization policy must wait for other authorization policies to finish. If this parameter is set, the client has to be authorized by another client. If set to FALSE, the current client is at the top of an authorizing chain.

wait_timeout (integer)
Default: 60000
The time (in milliseconds) Zorp will wait for the authorizing user to authorize the one accessing the service. If the other authorizations are not completed in time, the current authorization will fail.

This constructor initializes an NEyesAuthorization instance.

5.1.14. Class PairAuthorization

This class encapsulates pair-based authorization method. Only two users simultaneously accessing the service are authorized, single users are not permitted to access the service. Set the time (in milliseconds) Zorp will wait for the second user to access the service using the wait_timeout parameter.

[Example] Example 5.5. A simple PairAuthorization policy

The following example permits access to the service only if two users having different usernames authenticate successfully within one minute.

AuthorizationPolicy(name="demo_pairauthorization_policy", authorization=PairAuthorization(wait_timeout=60000))
            

For more detailed examples, see the Proxying secure channels - SSH tutorial available from the BalaBit Documentation Page at http://www.balabit.com/support/documentation/.

5.1.14.1. PairAuthorization methods

Method Description
__init__(self, wait_timeout) Constructor to initialize a PairAuthorization instance.

Table 5.11. Method summary


Method __init__(self, wait_timeout)

Arguments of __init__
wait_timeout (integer)
Default: 60000
The time (in milliseconds) Zorp will wait for the pair to complete the authorization. If the authorizations are not completed in time, the current authorization will fail.

This constructor initializes a PairAuthorization instance.

5.1.15. Class PermitGroup

This class encapsulates an authorization decision based on group membership. Users who authenticate as a member of a usergroup specified in the policy receive access to the service. Otherwise access is denied.

[Example] Example 5.6. A simple PermitGroup policy

The following example permits only the members of the admin or system groups to access the service.

AuthorizationPolicy(name="demo_authorization_policy", authorization=PermitGroup(grouplist=("admin", "system")))
            

5.1.15.1. PermitGroup methods

Method Description
__init__(self, grouplist) Constructor to initialize a PermitGroup instance.

Table 5.12. Method summary


Method __init__(self, grouplist)

Arguments of __init__
grouplist (complex)
Default: n/a
The list of authorized groups, represented as group names.

This constructor initilizes a PermitGroup instance.

5.1.16. Class PermitTime

This class encapsulates an authorization decision based on the time when the connection is started. The connection is permitted if it is started in one of the permitted time periods (according to the system time of the host running Zorp).

Specify the permitted time intervals as a comma-separated list, where each element contains the beginning and ending time of the permitted interval in HH:MM format.

[Example] Example 5.7. PermitTime example

When used in the intervals attribute of a PermitTime instance, the following example permits access only from 07:00 to 09:00 and from 17:00 to 19:00.

(("7:00", "9:00"), ("17:00", "19:00"))
          

The following is a complete authorization policy using the above intervals:

AuthorizationPolicy(name="demo_permittime_policy", authorization=PermitTime(intervals=(("7:00", "9:00"), ("17:00", "19:00"))))
          

5.1.16.1. PermitTime methods

Method Description
__init__(self, intervals) Constructor to initialize a PermitTime instance.

Table 5.13. Method summary


Method __init__(self, intervals)

Arguments of __init__
intervals (complex)
Default: n/a
List of time intervals when connections are permitted (in HH:MM, HH:MM format).

This constructor initilizes a PermitTime instance.

5.1.17. Class PermitUser

This class encapsulates an authorization decision based on usernames. Users who authenticate using one of the usernames specified in the policy receive access to the service. Otherwise access is denied.

[Example] Example 5.8. A simple PermitUser policy

The following example permits only the admin and root users to access the service.

AuthorizationPolicy(name="demo_permituser", authorization=PermitUser(userlist=("admin", "root")))
            

5.1.17.1. PermitUser methods

Method Description
__init__(self, userlist) Constructor to initialize a PermitUser instance.

Table 5.14. Method summary


Method __init__(self, userlist)

Arguments of __init__
userlist (complex)
Default: n/a
Comma-separated list of authorized usernames.

This constructor initilizes a PermitUser instance.

5.1.18. Class SatyrAuthentication

This class encapsulates outband authentication using the Satyr application. Satyr has been renamed to Zorp Authentication Agent, therefore this class is obsolete. Use ZAAuthentication instead. See Section 5.1.20, Class ZAAuthentication for details.

5.1.19. Class ServerAuthentication

This class encapsulates server authentication: Zorp authenticates the user based on the response of the server to the user's authentication request. Server authentication is a kind of inband authentication, it is performed within the application protocol, but the target server checks the credentials of the user instead of Zorp. This authentication method is useful when the server can be trusted for authentication purposes, but you need to include an authorization decision in the service definition.

5.1.19.1. ServerAuthentication methods

Method Description
__init__(self) Constructor to initialize a ServerAuthentication instance.

Table 5.15. Method summary


Method __init__(self)

This constructor initializes an instance of the ServerAuthentication class.

5.1.20. Class ZAAuthentication

This class encapsulates outband authentication using the Zorp Authentication Agent (ZAA). The Zorp Authentication Agent is an application that runs on the client computers and provides an interface for the users to authenticate themselves when Zorp requests authentication for accessing a service. This way any protocol, even those not supporting authentication can be securely authenticated. All communication between Zorp and ZAA is SSL-encrypted.

[Example] Example 5.9. Outband authentication example

The following authentication policy defines a class that uses outband authentication.

AuthenticationPolicy(name="demo_outbandauthentication_policy", cache=None, authentication=ZAAuthentication(port=1316, timeout=60000, connect_timeout=60000, pki=("/etc/key.d/Zorp_certificate/cert.pem", "/etc/key.d/Zorp_certificate/key.pem")), provider="demo_authentication_provider")

5.1.20.1. ZAAuthentication methods

Method Description
__init__(self, authentication_provider, pki, cert_file, key_file, port, timeout, connect_timeout, auth_cache) Constructor to initialize an instance of the ZAAuthentication class.

Table 5.16. Method summary


Method __init__(self, authentication_provider, pki, cert_file, key_file, port, timeout, connect_timeout, auth_cache)

Arguments of __init__
connect_timeout (integer)
Default: 60000
Connection timeout (in milliseconds) to the Zorp Authentication Agent.

pki (certificate)
Default: None
A tuple containing the name of a certificate and a key file. Zorp uses this certificate to encrypt the communication with the Authentication Agents.

port (integer)
Default: 1316
The port number where the Zorp Authentication Agent is listening. Default value: 1316.

timeout (integer)
Default: 60000
Authentication timeout in milliseconds.

This constructor initializes an instance of the ZAAuthentication authentication class that can be referenced in authentication policies to perform outband authentication.

5.2. Module AuthDB

This module contains classes related to authentication databases. Together with the Auth module it implements the Authentication and Authorization framework of Zorp. See Section 5.1.1, Authentication and authorization basics and Section 5.1.2, Authentication and authorization in Zorp for details.

5.2.1. Classes in the AuthDB module

Class Description
AbstractAuthenticationBackend Class encapsulating the abstract authentication backend like ZAS.
AuthenticationProvider A database-independent class used by Zorp to connect to an authentication backend.
ZAS2AuthenticationBackend Class encapsulating the ZAS authentication backend.

Table 5.17. Classes of the AuthDB module


5.2.2. Class AbstractAuthenticationBackend

This is an abstract class to encapsulate an authentication backend, which is responsible for checking authentication credentials against a backend database. In actual configurations, use one of the derived classes like ZAS2AuthenticationBackend.

The interface defined here is used by various authentication methods like ZAAuthentication and InbandAuthentication.

5.2.3. Class AuthenticationProvider

The authentication provider is an intermediate layer that mediates between Zorp and the authentication backend (e.g., a user database) during connection authentication - Zorp itself does not directly communicate with the database.

[Example] Example 5.10. A sample authentication provider

The following example defines an authentication provider that uses the ZAS2AuthenticationBackend backend.

AuthenticationProvider(name="demo_authentication_provider", backend=ZAS2AuthenticationBackend(serveraddr=SockAddrInet('192.168.10.10', 1317), use_ssl=TRUE, ssl_verify_depth=3, pki_cert=("/etc/key.d/ZAS_certificate/cert.pem", "/etc/key.d/ZAS_certificate/key.pem"), pki_ca=("/etc/ca.d/groups/demo_trusted_group/certs/", "/etc/ca.d/groups/demo_trusted_group/crls/")))
            

5.2.3.1. AuthenticationProvider methods

Method Description
__init__(self, name, backend) Constructor to initialize an AbstractAuthorizationBackend instance.

Table 5.18. Method summary


Method __init__(self, name, backend)

Arguments of __init__
backend (class)
Default: n/a
Type of the database backend used by the ZAS instance.

name (string)
Default: n/a
Name of the ZAS instance.

This constructor initializes an AbstractAuthorizationBackend instance.

5.2.4. Class ZAS2AuthenticationBackend

This class encapsulates a Zorp Authentication Server database and provides interface to other authentication classes to verify against users managed through ZAS. See Section 5.2.3, Class AuthenticationProvider for examples on using the ZAS2AuthenticationBackend class.

5.2.4.1. ZAS2AuthenticationBackend methods

Method Description
__init__(self, serveraddr, use_ssl, pki_cert, cert_file, key_file, pki_ca, ca_dir, crl_dir, ssl_verify_depth) Constructor to initialize a ZAS2AuthenticationProvider instance.

Table 5.19. Method summary


Method __init__(self, serveraddr, use_ssl, pki_cert, cert_file, key_file, pki_ca, ca_dir, crl_dir, ssl_verify_depth)

Arguments of __init__
pki_ca (cagroup)
Default: None
The name of a trusted CA group. When using SSL, ZAS must show a certificate signed by a CA that belongs to this group.

pki_cert (certificate)
Default: None
A tuple containing the name of a certificate and a key file. Zorp shows this certificate to ZAS when using SSL.

serveraddr (sockaddr)
Default: n/a
The IP address of this ZAS instance. ZAS accepts connections on this address.

ssl_verify_depth (integer)
Default: 3
Specifies the maximum number of CAs in the trust chain when verifying the certificate of Zorp.

use_ssl (boolean)
Default: FALSE
Enable this option if Zorp communicates with ZAS using SSL.

This constructor creates a new ZAS2AuthenticationProvider instance that can be used in authentication policies.

5.3. Module Chainer

Chainers establish a TCP or UDP connection between a proxy and a selected destination. The destination is usually a server, but the SideStackChainer connects an additional proxy before connecting the server.

5.3.1. Selecting the network protocol

The client-side and the server-side connections can use different networking protocols if needed. The protocol attribute of the chainer classes determines the network protocol used in the server-side connection. By default, Zorp uses the same protocol in both connections. The following options are available:

Name Description
ZD_PROTO_AUTO Use the protocol that is used on the client side.
ZD_PROTO_TCP Use the TCP protocol on the server side.
ZD_PROTO_UDP Use the UDP protocol on the server side.

Table 5.20.  The network protocol used in the server-side connection


5.3.2. Classes in the Chainer module

Class Description
AbstractChainer Class encapsulating the abstract chainer.
ConnectChainer Class to establish the server-side TCP/IP connection.
FailoverChainer Class encapsulating the connection establishment with multiple target addresses and keeping down state between connects. FailoverChainer prefers connecting to target hosts in the order they were specified.
MultiTargetChainer Class encapsulating connection establishment with multiple target addresses.
RoundRobinChainer Class encapsulating the connection establishment with multiple target addresses and keeping down state between connects.
SideStackChainer Class to pass the traffic to another proxy.
StateBasedChainer Class encapsulating connection establishment with multiple target addresses and keeping down state between connects.

Table 5.21. Classes of the Chainer module


5.3.3. Class AbstractChainer

AbstractChainer implements an abstract chainer that establishes a connection between the parent proxy and the selected destination. This class serves as a starting point for customized chainer classes, but is itself not directly usable. Service definitions should refer to a customized class derived from AbstractChainer, or one of the predefined chainer classes, such as ConnectChainer or FailoverChainer.

5.3.4. Class ConnectChainer

ConnectChainer is the default chainer class based on AbstractChainer. This class establishes a TCP or UDP connection between the proxy and the selected destination address.

ConnectChainer is used by default if no other chainer class is specified in the service definition.

ConnectChainer attempts to connect only a single destination address: if the connection establishment procedure selects multiple target servers (e.g., a DNSResolver with the multi=TRUE parameter or a DirectedRouter with multiple addresses), ConnectChainer will use the first address and ignore all other addresses. Use FailoverChainer to select from the destination from multiple addresses in a failover fashion, and RoundRobinChainer to distribute connections in a roundrobin fashion.

[Example] Example 5.11. A sample ConnectChainer

The following service uses a ConnectChainer that uses the UDP protocol on the server side.

Service(name="demo_service", proxy_class=HttpProxy, chainer=ConnectChainer(protocol=ZD_PROTO_UDP), router=TransparentRouter(overrideable=FALSE, forge_addr=FALSE))
		

5.3.4.1. ConnectChainer methods

Method Description
__init__(self, protocol, timeout_connect) Constructor to initialize an instance of the ConnectChainer class.

Table 5.22. Method summary


Method __init__(self, protocol, timeout_connect)

Arguments of __init__
protocol (enum)
Default: ZD_PROTO_AUTO
Optional parameter that specifies the network protocol used in the connection protocol. By default, the server-side communication uses the same protocol that is used on the client side. See Section 5.3.1, Selecting the network protocol for details.

timeout_connect (integer)
Default: 30000
Specifies connection timeout to be used when connecting to the target server.

This constructor creates a new ConnectChainer instance which can be associated with a Service.

5.3.5. Class FailoverChainer

This class is based on the StateBasedChainer class and encapsulates a real TCP/IP connection establishment, and is used when a top-level proxy wants to perform chaining. In addition to ConnectChainer this class adds the capability to perform stateful, failover HA functionality across a set of IP addresses.

[Note] Note

Use FailoverChainer if you want to connect to the servers in a predefined order: i.e., connect to the first server, and only connect to the second if the first server is unavailable.

If you want to distribute connections between the servers (i.e., direct every new connection to a different server to balance the load) use RoundRobinChainer .

[Example] Example 5.12. A DirectedRouter using FailoverChainer

The following service definition uses a DirectedRouter class with two possible destination addresses. Zorp uses these destinations in a failover fashion, targeting the second address only if the first one is unaccessible.

Service(name="intra_HTTP_inter", router=DirectedRouter(dest_addr=(SockAddrInet('192.168.55.55', 8080), SockAddrInet('192.168.55.56', 8080)), forge_addr=FALSE, forge_port=Z_PORT_ANY, overrideable=FALSE), chainer=FailoverChainer(protocol=ZD_PROTO_AUTO, timeout_state=60000, timeout_connect=30000), max_instances=0, proxy_class=HttpProxy,)

5.3.5.1. FailoverChainer methods

Method Description
__init__(self, protocol, timeout, timeout_state, timeout_connect, round_robin) Constructor to initialize a FailoverChainer instance.

Table 5.23. Method summary


Method __init__(self, protocol, timeout, timeout_state, timeout_connect, round_robin)

Arguments of __init__
protocol (enum)
Default: ZD_PROTO_AUTO
Optional, specifies connection protocol ( ZD_PROTO_TCP or ZD_PROTO_UDP ), when not specified it defaults to the protocol used on the client side.

timeout_connect (integer)
Default: 30000
Specifies connection timeout to be used when connecting to the target server.

timeout_state (integer)
Default: 60000
The down state of remote hosts is kept for this interval in milliseconds.

This constructor initializes a FailoverChainer class by filling arguments with appropriate values and calling the inherited constructor.

5.3.6. Class MultiTargetChainer

This class encapsulates a real TCP/IP connection establishment, and is used when a top-level proxy wants to perform chaining. In addition to ConnectChainer, this class adds the capability to perform stateless, simple load balance server connections among a set of IP addresses.

The same mechanism is used to set multiple server addresses as with a single destination address: the Router class sets a list of IP addresses in the session.target_address attribute.

5.3.6.1. MultiTargetChainer methods

Method Description
__init__(self, protocol, timeout_connect) Constructor to initialize a MultiTargetChainer instance.

Table 5.24. Method summary


Method __init__(self, protocol, timeout_connect)

Arguments of __init__
protocol (enum)
Default: ZD_PROTO_AUTO
Optional, specifies connection protocol (either ZD_PROTO_TCP or ZD_PROTO_UDP), when not specified defaults to the same protocol as was used on the client side.

self (class)
Default: n/a
this instance

timeout_connect (integer)
Default: 30000
Specifies connection timeout to be used when connecting to the target server.

This constructor initializes a MultiTargetChainer class by filling arguments with appropriate values and calling the inherited constructor.

5.3.7. Class RoundRobinChainer

This class is based on the StateBasedChainer class and encapsulates a real TCP/IP connection establishment, and is used when a top-level proxy wants to perform chaining. In addition to ConnectChainer this class adds the capability to perform stateful, load balance server connections among a set of IP addresses.

[Example] Example 5.13. A DirectedRouter using RoundRobinChainer

The following service definition uses a RoundRobinChainer class with two possible destination addresses. Zorp uses these destinations in a roundrobin fashion, alternating between the two destinations.

Service(name="intra_HTTP_inter", router=DirectedRouter(dest_addr=(SockAddrInet('192.168.55.55', 8080), SockAddrInet('192.168.55.56', 8080)), forge_addr=FALSE, forge_port=Z_PORT_ANY, overrideable=FALSE), chainer=RoundRobinChainer(protocol=ZD_PROTO_AUTO, timeout_state=60000, timeout_connect=30000), max_instances=0, proxy_class=HttpProxy)

5.3.8. Class SideStackChainer

This class encapsulates a special chainer. Instead of establishing a connection to a server, it creates a new proxy instance and connects the server side of the current (parent) proxy to the client side of the new (child) proxy. The right_class parameter specifies the child proxy.

It is possible to stack multiple proxies side-by-side. The final step of sidestacking is always to specify a regular chainer via the right_chainer parameter that connects the last proxy to the destination server.

[Tip] Tip

Proxy sidestacking is useful for example to create one-sided SSL connections. See the tutorials of the BalaBit Documentation Page available at http://www.balabit.com/support/documentation/ for details.

5.3.8.1. Attributes of SideStackChainer

right_chainer (unknown)
Default: n/a
The chainer used to connect to the destination of the side-stacked proxy class set in the right_class attribute.

right_class (unknown)
Default: n/a
The proxy class to connect to the parent proxy. Both built-in and customized classes can be used.

5.3.8.2. SideStackChainer methods

Method Description
__init__(self, right_class, right_chainer) Constructor to initialize an instance of the SideStackChainer class.

Table 5.25. Method summary


Method __init__(self, right_class, right_chainer)

Arguments of __init__
right_chainer (class)
Default: None
The chainer used to connect to the destionation of the side-stacked proxy class set in the right_class attribute.

right_class (class)
Default: n/a
The proxy class to connect to the parent proxy. Both built-in or customized classes can be used.

This constructor creates a new FailoverChainer instance which can be associated with a Service.

5.3.9. Class StateBasedChainer

This class encapsulates a real TCP/IP connection establishment, and is used when a top-level proxy wants to perform chaining. In addition to ConnectChainer, this class adds the capability to perform stateful, load balance server connections among a set of IP addresses.

[Note] Note

Both the FailoverChainer and RoundRobinChainer classes are derived from StateBasedChainer.

5.3.9.1. StateBasedChainer methods

Method Description
__init__(self, protocol, timeout_connect, timeout_state) Constructor to initialize a StateBasedChainer instance.

Table 5.26. Method summary


Method __init__(self, protocol, timeout_connect, timeout_state)

Arguments of __init__
protocol (enum)
Default: ZD_PROTO_AUTO
Optional, specifies connection protocol ( ZD_PROTO_TCP or ZD_PROTO_UDP ), when not specified it defaults to the same protocol used on the client side.

timeout_connect (integer)
Default: 30000
Specifies connection timeout to be used when connecting to the target server.

timeout_state (integer)
Default: 60000
The down state of remote hosts is kept for this interval in miliseconds.

This constructor initializes a StateBasedChainer class by filling arguments with appropriate values and calling the inherited constructor.

5.4. Module Config

This module defines global options of Zorp. For a detailed description of the options, see Appendix 4, Global options of Zorp.

5.5. Module Dispatch

Dispatchers bind to a specific IP address and port of the Zorp firewall and wait for incoming connection requests. For each accepted connection, the Dispatcher creates a new service instance to handle the traffic arriving in the connection.

[Note] Note

Earlier Zorp versions used different classes to handle TCP and UDP connections (Listeners and Receivers, respectively). These classes have been merged into the Dispatcher module.

For each accepted connection, the Dispatcher creates a new service instance to handle the traffic arriving in the connection. The service started by the dispatcher depends on the type of the dispatcher:

  • Dispatchers start the same service for every connection.

  • CSZoneDispatchers start different services based on the zones the client and the destination server belong to.

[Note] Note

Only one dispatcher can bind to an IP address/port pair.

5.5.1. Zone-based service selection

Dispatchers can start only a predefined service. Use CSZonedDispatchers to start different services for different connections. CSZoneDispatchers assign different services to different client-server zone pairs. Define the zones and the related services in the services parameter. The * wildcard matches all client or server zones.

[Note] Note

The server zone may be modified by the proxy, the router, the chainer, or the NAT policy used in the service. To select the service, CSZoneDispatcher determines the server zone from the original destination IP address of the incoming client request. Similarly, the client zone is determined from the source IP address of the original client request.

To accept connections from the child zones of the selected client zones, set the follow_parent attribute to TRUE. Otherwise, the dispatcher accepts traffic only from the client zones explicitly listed in the services attribute of the dispatcher.

5.5.2. Parameters of the bindto option

The Dispatcher binds to the address set in its bindto parameter. For nontransparent connections, this is the address where the service will accept the connections of the clients. The possible arguments of the bindto parameter are the following.

5.5.2.1. Class DBIface

The DBIface class refers to an interface and can be used in Dispatcher definitions.

[Example] Example 5.14. Using DBIface

A sample DBIface definition:

DBIface(protocol=ZD_PROTO_TCP, port=55555, iface="eth0", ip="192.168.0.15")

The same DBIface used in a Dispatcher definition:

Dispatcher(transparent=TRUE, bindto=DBIface(protocol=ZD_PROTO_TCP, port=55555, iface="eth0", ip="192.168.0.15"), rule_port="55555", service="intranet_PF5555_internet")
family (integer)
Default: 2

Specifies the IP address family used, that is, 2 for IPv4.

iface (string)
Default: n/a

The name of an existing interface, for example, eth0.

ip (string)
Default: n/a

The IP address of the interface to bind to. If the interface has multiple IP addresses and the ip attribute is set, the Dispatcher will bind only to the specified IP address.

port (integer)
Default: n/a

The port number to bind to. This attribute is used together with the ip attribute. Note that 0 is not a valid port value.

protocol (integer)
Default: n/a

The network protocol used, for example, ZD_PROTO_TCP. For the list of accepted values, see Table 5.20, The network protocol used in the server-side connection .

5.5.2.2. Class DBIfaceGroup

The DBIfaceGroup class refers to an interface group.

family (integer)
Default: 2

Specifies the IP address family used, that is, 2 for IPv4.

iface_group (integer)
Default: n/a

The ID of an existing interface group.

port (integer)
Default: n/a

The port number to bind to. This attribute is used together with the ip attribute. Note that 0 is not a valid port value.

protocol (integer)
Default: n/a

The network protocol used, for example, ZD_PROTO_TCP. For the list of accepted values, see Table 5.20, The network protocol used in the server-side connection .

5.5.2.3. Class DBSockAddr

The DBSockAddr class refers to a socket address.

Dispatcher(bindto=DBSockAddr('192.168.2.1', 50080), service="demo_http_service", transparent=TRUE, backlog=255, threaded=FALSE)
family (integer)
Default: 2

Specifies the IP address family used, that is, 2 for IPv4.

ip (string)
Default: n/a

The IP address of the interface to bind to. If the interface has multiple IP addresses and the ip attribute is set, the Dispatcher will bind only to the specified IP address.

port (integer)
Default: n/a

The port number to bind to. This attribute is used together with the ip attribute. Note that 0 is not a valid port value.

protocol (integer)
Default: n/a

The network protocol used, for example, ZD_PROTO_TCP. For the list of accepted values, see Table 5.20, The network protocol used in the server-side connection .

5.5.3. Classes in the Dispatch module

Class Description
CSZoneDispatcher Class encapsulating the Dispatcher which starts a service by the client and server zone.
Dispatcher Class encapsulating the Dispatcher which starts a service by the client and server zone.

Table 5.27. Classes of the Dispatch module


5.5.4. Class CSZoneDispatcher

This class is similar to a simple Dispatcher, but instead of starting a fixed service, it chooses one based on the client and the destined server zone.

It takes a mapping of services indexed by a client and the server zone name, with an exception of the '*' zone, which matches anything.

NOTE: the server zone might change during proxy and NAT processing, therefore the server zone used here only matches the real destination if those phases leave the server address intact.

[Example] Example 5.15. CSZoneDispatcher example

The following example defines a CSZoneDispatcher that starts the service called internet_HTTP_DMZ for connections received on the 192.168.2.1 IP address, but only if the connection comes from the internet zone and the destination is in the DMZ zone.

CSZoneDispatcher(bindto=DBSockAddr('192.168.2.1', 50080), services={("internet", "DMZ"):"internet_HTTP_DMZ"}, transparent=TRUE, backlog=255, threaded=FALSE, follow_parent=FALSE)

5.5.4.1. Attributes of CSZoneDispatcher

services (unknown)
Default: n/a
services mapping indexed by zone names

5.5.4.2. CSZoneDispatcher methods

Method Description
__init__(self, bindto, services, **kw) Constructor to initialize a CSZoneDispatcher instance.

Table 5.28. Method summary


Method __init__(self, bindto, services, **kw)

Arguments of __init__
bindto (sockaddr)
Default: n/a
An existing socket address or interface containing the IP address and port number where the Dispatcher accepts connections. For details, see Section 5.5.2, Parameters of the bindto option.

follow_parent (boolean)
Default: n/a
Set this parameter to TRUE if the dispatcher handles also the connections coming from the child zones of the selected client zones. Otherwise, the dispatcher accepts traffic only from the explicitly listed client zones.

services (complex)
Default: n/a
Client zone - server zone - service name pairs using the (("client_zone","server_zone"):"service") format; specifying the service to start when the dispatcher accepts a connection from the given client zone that targets the server zone.

This constructor initializes a CSZoneDispatcher instance and sets its initial attributes based on arguments.

5.5.5. Class Dispatcher

This class is the starting point of Zorp services. It listens on the given port, and when a connection is accepted it starts a session and the given service.

[Example] Example 5.16. Dispatcher example

The following example defines a transparent dispatcher that starts the service called demo_http_service for connections received on the 192.168.2.1 IP address.

Dispatcher(bindto=DBSockAddr('192.168.2.1', 50080), service="demo_http_service", transparent=TRUE, backlog=255, threaded=FALSE)
                

5.5.5.1. Attributes of Dispatcher

bindto (sockaddr)
Default: n/a
An existing socket address or interface containing the IP address and port number where the Dispatcher accepts connections. For details, see Section 5.5.2, Parameters of the bindto option.

protocol (unknown)
Default: n/a
the protocol we were bound to

service (service)
Default: n/a
Name of the service to start.

5.5.5.2. Dispatcher methods

Method Description
__init__(self, bindto, service, **kw) Constructor to initialize a Dispatcher instance.

Table 5.29. Method summary


Method __init__(self, bindto, service, **kw)

Arguments of __init__
bindto (sockaddr)
Default: n/a
An existing socket address or interface containing the IP address and port number where the Dispatcher accepts connections. For details, see Section 5.5.2, Parameters of the bindto option.

service (service)
Default: n/a
Name of the service to start.

transparent (boolean)
Default: n/a
Set this parameter to TRUE if the dispatcher starts a transparent service.

This constructor creates a new Dispatcher instance which can be associated with a Service.

5.6. Module Domain

This module implements the AbstractDomain class and its derived classes, which encapsulate a set of physical addresses.

5.6.1. Classes in the Domain module

Class Description
AbstractDomain Abstract base class for address domains.
Inet6Domain Class representing IPv6 address ranges, derived from Domain.
InetDomain Class representing IP address ranges, derived from Domain.

Table 5.30. Classes of the Domain module


5.6.2. Class AbstractDomain

An address domain encapsulates an address type (AF_INET, AF_INET6, etc.) and provides functions to parse and compare these addresses. This functionality is primarily used by Zone classes (see the Service module).

5.6.2.1. Attributes of AbstractDomain

family (unknown)
Default: n/a
The address family used by the domain.

5.6.2.2. AbstractDomain methods

Method Description
__init__(self) Constructor initializing an instance of the AbstractDomain class.

Table 5.31. Method summary


Method __init__(self)

This constructor is empty and does nothing.

5.6.3. Class Inet6Domain

A class representing Internet (IPv6) addresses, and IP segments. The address is represented in the XXX:XXX:XXX:XXX:XXX:XXX:XXX:XXX/M format, where XXX:XXX:XXX:XXX:XXX:XXX:XXX:XXX is the network address, and M specifies the number of ones (1) in the netmask.

Two Inet6Domain objects can be compared to each other, and can have the followin relations:

  • Class_A can contain Class_B;

  • Class_A can be equal to Class_B;

  • Class_B can contain Class_A.

This comparison is used to organize Zones hierarchically. The comparison can raise ValueError for incomparable IP addresses.

5.6.3.1. Attributes of Inet6Domain

ip (unknown)
Default: n/a
Network address represented by a tuple of eight 16-bit numbers.

mask (unknown)
Default: n/a
Netmask represented by a tuple of eight 16-bit numbers.

mask_bits (unknown)
Default: n/a
Number of bits in the netmask.

5.6.3.2. Inet6Domain methods

Method Description
__init__(self, addr) Constructor to initialize an Inet6Domain instance.

Table 5.32. Method summary


Method __init__(self, addr)

Arguments of __init__
addr (string)
Default: n/a
String representation of an address or address range.

This constructor parses the argument addr and fills instance attributes accordingly.

5.6.4. Class InetDomain

A class representing Internet (IPv4) addresses, and IP segments. The address is represented in the XXX.XXX.XXX.XXX/M format, where XXX.XXX.XXX.XXX is the network address, and M specifies the number of ones (1) in the netmask.

Two InetDomain objects can be compared to each other, and can have the followin relations:

  • Class_A can contain Class_B;

  • Class_A can be equal to Class_B;

  • Class_B can contain Class_A.

This comparison is used to organize Zones hierarchically. The comparison can raise ValueError for incomparable IP addresses.

5.6.4.1. Attributes of InetDomain

ip (unknown)
Default: n/a
Network address in network byte order.

mask (unknown)
Default: n/a
Netmask in network byte order.

mask_bits (unknown)
Default: n/a
Number of bits in the netmask.

5.6.4.2. InetDomain methods

Method Description
__init__(self, addr) Constructor to initialize an InetDomain instance

Table 5.33. Method summary


Method __init__(self, addr)

Arguments of __init__
addr (string)
Default: n/a
The string representation of an address, or network address in network byte order.

This constructor parses the argument addr and fills instance attributes accordingly.

5.7. Module Keybridge

Keybridging is a method to let the client see a copy of the server's certificate (or vice versa), allowing it to inspect it and decide about its trustworthiness. Because of proxying the SSL/TLS connection, the client is not able to inspect the certificate of the server directly, therefore Zorp generates a certificate based on the server's certificate on-the-fly. This generated certificate is presented to the client.

For details on configuring keybridging, see Section 3.2.7, Keybrigding certificates.

5.7.1. Classes in the Keybridge module

Class Description
X509KeyBridge Class to perform SSL keybridging.

Table 5.34. Classes of the Keybridge module


5.7.2. Class X509KeyBridge

This class is able to generate certificates mimicking another certificate, primarily used to transfer the information of a server's certificate to the client in keybridging. For details on configuring keybridging, see Section 3.2.7, Keybrigding certificates.

5.7.2.1. Attributes of X509KeyBridge

cache_directory (string)
Default: ""
The directory where all automatically generated certificates are cached.

key_file (string)
Default: ""
Name of the private key to be used for the newly generated certificates.

key_passphrase (string)
Default: ""
Passphrase required to access the private key stored in key_file.

trusted_ca_files (certificate)
Default: None
A tuple of cert_file, key_file, passphrase) for the CA used for keybridging trusted certificates.

untrusted_ca_files (certificate)
Default: None
A tuple of cert_file, key_file, passphrase) for the CA used for keybridging untrusted certificates.

5.7.2.2. X509KeyBridge methods


Method __init__(self, key_file, cache_directory, trusted_ca_files, untrusted_ca_files, key_passphrase, extension_whitelist)

Arguments of __init__
cache_directory (string)
Default: "/var/lib/zorp/keybridge-cache"
The directory where all automatically generated certificates are cached.

extension_whitelist (complex)
Default: None

Zorp transfers the following certificate extensions to the client side: Key Usage, Subject Alternative Name, Extended Key Usage. Other extensions will be automatically deleted during keybridging. This is needed because some certificate extensions contain references to the Issuer CA, which references become invalid for keybridged certificates. To transfer other extensions, list them in the extension_whitelist parameter. Note that modifying this parameter replaces the default values, so to extend the list of transferred extensions, include the 'keyUsage', 'subjectAltName', 'extendedKeyUsage' list as well. For example:

self.extension_whitelist = ('keyUsage', 'subjectAltName', 'extendedKeyUsage', 'customExtension')

key_file (certificate)
Default: n/a
Name of the private key to be used for the newly generated certificates.

key_passphrase (string)
Default: ""
Passphrase required to access the private key stored in key_file.

trusted_ca_files (certificate)
Default: n/a
A tuple of cert_file, key_file, passphrase) for the CA used for keybridging trusted certificates.

untrusted_ca_files (certificate)
Default: None
A tuple of cert_file, key_file, passphrase) for the CA used for keybridging untrusted certificates.

n/a

5.8. Module Matcher

In general, matcher policies can be used to find out if a parameter is included in a list (or which elements of a list correspond to a certain parameter), and influence the behavior of the proxy class based on the results. Matchers can be used for a wide range of tasks, for example, to determine if the particular IP address or URL that a client is trying to access is on a black or whitelist, or to verify that a particular e-mail address is valid.

5.8.1. Classes in the Matcher module

Class Description
AbstractMatcher Class encapsulating the abstract string matcher.
CombineMatcher Matcher for implementing logical expressions based on other matchers.
DNSMatcher DNS matcher
MatcherPolicy Class encapsulating a Matcher which can be used by a name.
RegexpFileMatcher Class encapsulating Matcher which uses regular expressions stored in files for string matching.
RegexpMatcher Class encapsulating a Matcher which uses regular expressions for string matching.
SmtpInvalidRecipientMatcher Class verifying the validity of the recipient addresses in E-mails.
WindowsUpdateMatcher Windows Update matcher

Table 5.36. Classes of the Matcher module


5.8.2. Class AbstractMatcher

This abstract class encapsulates a string matcher that determines whether a given string is found in a backend database.

Specialized subclasses of AbstractMatcher exist such as 'RegexpFileMatcher' which use regular expressions stored in flat files to find matches.

5.8.3. Class CombineMatcher

This matcher makes it possible to combine the results of several matchers using logical operations. CombineMatcher uses prefix-notation in its expressions and uses the following format: the operand, a comma, first argument, a comma, second argument. For example, an AND expression should be formatted the following way: (Z_AND, matcher1, matcher2). Expressions using more than one operands should be bracketed, e.g., (Z_OR (Z_AND, matcher1, matcher2), matcher3). The following oprations are available:

  • Z_AND : Logical AND operation.

  • Z_OR : Logical OR operation.

  • Z_XOR : Logical XOR operation.

  • Z_NOT : Logical negation.

  • Z_EQ : Logical equation.

[Example] Example 5.17. Whitelisting e-mail recipients

A simple use for CombineMatcher is to filter the recipients of e-mail addresses using the following process:

  1. An SmtpInvalidMatcher (called SmtpCheckrecipient) verifies that the recipient exists.

  2. A RegexpMatcher (called SmtpWhitelist) or RegexpFileMatcher is used to check if the address is on a predefined list (list of permitted addresses).

  3. A CombineMatcher (called SmtpCombineMatcher) sums up the results of the matchers with a logical AND operation.

  4. An SmtpProxy (called SmtpRecipientMatcherProxy) references SmtpCombineMatcher in its recipient_matcher attribute.

Python:
class SmtpRecipientMatcherProxy(SmtpProxy):
  recipient_matcher="SmtpCombineMatcher"
  def config(self):
    super(SmtpRecipientMatcherProxy, self).config()

MatcherPolicy(name="SmtpCombineMatcher", matcher=CombineMatcher (expr=(Z_AND, "SmtpCheckrecipient", "SmtpWhitelist")))
MatcherPolicy(name="SmtpWhitelist", matcher=RegexpMatcher (match_list=("info@example.com",), ignore_list=None))
MatcherPolicy(name="SmtpCheckrecipient", matcher=SmtpInvalidRecipientMatcher (server_port=25, cache_timeout=60, attempt_delivery=FALSE, force_delivery_attempt=FALSE, server_name="recipientcheck.example.com"))
            

5.8.4. Class DNSMatcher

DNSMatcher retrieves the IP addresses of domain names. This can be used in domain name based policy decisions, for example to allow encrypted connections only to trusted e-banking sites.

DNSMatcher operates as follows: it resolves the IP addresses stored in the list of domain names using the specified Domain Name Server, and compares the results to the IP address of the connection (i.e., the IP address of the server or the client). The matcher returns a true value if the IP addresses resolved from the list of domain names include the IP address of the connection.

[Example] Example 5.18. DNSMatcher example

The following DNSMatcher class uses the dns.example.com name server to resolve the example2.com and example3.com domain names.

MatcherPolicy(name="ExampleDomainMatcher", matcher=DNSMatcher(server="dns.example.com", hosts=("example2.com", "example3.com")))
            

5.8.4.1. DNSMatcher methods

Method Description
__init__(self, hosts, server) Constructor to initialize an instance of the DNSMatcher class.

Table 5.37. Method summary


Method __init__(self, hosts, server)

Arguments of __init__
hosts (complex)
Default: n/a
Hostnames to resolve.

server (string)
Default: None
IP address of the DNS server to query. Defaults to the servers set in the resolv.conf file.

This constructor initializes an instance of the DNSMatcher class.

5.8.5. Class MatcherPolicy

Matcher policies can be used to find out if a parameter is included in a list, or which elements of a list correspond to a certain parameter), and influence the behavior of the proxy class based on the results. Matchers can be used for a wide range of tasks, for example, to determine if the particular IP address or URL that a client is trying to access is on a black or whitelist, or to verify that a particular e-mail address is valid.

MatcherPolicy instances are reusable matchers that contain configured instances of the matcher classes (e.g., DNSMatcher, RegexpMatcher) available in Zorp. For examples, see the specific matcher classes.

5.8.6. Class RegexpFileMatcher

This class is similar to RegexpMatcher, but stores the regular expressions to match and ignore in files. For example, this class can be used for URL filtering. The matcher itself stores only the paths and the filenames to the lists. Zorp automatically monitors the file and reloads it when it is modified. Searches are case-insensitive.

[Example] Example 5.19. RegexpFileMatcher example
MatcherPolicy(name="demo_regexpfilematcher", matcher=RegexpFileMatcher(match_fname="/tmp/match_list.txt", ignore_fname="/tmp/ignore_list.txt"))
            

5.8.6.1. Attributes of RegexpFileMatcher

ignore_date (unknown)
Default: n/a
Date (in unix timestamp format) when the ignore_file was loaded.

ignore_file (unknown)
Default: n/a
Name of the file storing the patterns to ignore.

match_date (unknown)
Default: n/a
Date (in unix timestamp format) when the match_file was loaded.

match_file (unknown)
Default: n/a
Name of the file storing the patterns for positive matches.

5.8.6.2. RegexpFileMatcher methods

Method Description
__init__(self, match_fname, ignore_fname) Constructor to initialize a RegexpFileMatcher instance.

Table 5.38. Method summary


Method __init__(self, match_fname, ignore_fname)

Arguments of __init__
ignore_fname (filename)
Default: None
Name of the file storing the patterns to ignore.

match_fname (filename)
Default: None
Name of the file storing the patterns for positive matches.

This constructor initializes an instance of the RegexpFileMatcher class.

5.8.7. Class RegexpMatcher

A simple regular expression based matcher with a match and an ignore list. Searches are case-insensitive.

[Example] Example 5.20. RegexpMatcher example

The following RegexpMatcher matches only the smtp.example.com string.

MatcherPolicy(name="Smtpdomains", matcher=RegexpMatcher (match_list=("smtp.example.com",), ignore_list=None))
            

5.8.7.1. Attributes of RegexpMatcher

ignore (unknown)
Default: n/a
A list of compiled regular expressions defining the strings to be ignored even if match resulted in a positive match.

match (unknown)
Default: n/a
A list of compiled regular expressions which result in a positive match.

5.8.7.2. RegexpMatcher methods

Method Description
__init__(self, match_list, ignore_list, ignore_case) Constructor to initialize a RegexpMatcher instance.

Table 5.39. Method summary


Method __init__(self, match_list, ignore_list, ignore_case)

Arguments of __init__
ignore_list (filename)
Default: None
The list of regular expressions to ignore.

match_list (filename)
Default: None
The list of regular expressions to match.

This constructor initializes a RegexpMatcher instance by setting the match and ignore attributes to an empty list.

5.8.8. Class SmtpInvalidRecipientMatcher

This class encapsulates a VRFY/RCPT based validity checker to transparently verify the existance of E-mail addresses. Instead of immediately sending the e-mail to the recipient SMTP server, Zorp queuries an independent SMTP server about the existance of the recipient e-mail address.

Instances of this class can be referred to in the recipient_matcher attribute of the SmtpProxy class. The SmtpProxy will automatically reject unknown recipients even if the recipient SMTP server would accept them.

[Example] Example 5.21. SmtpInvalidMatcher example
Python:
class SmtpRecipientMatcherProxy(SmtpProxy):
  recipient_matcher="SmtpCheckrecipient"
  def config(self):
    super(SmtpRecipientMatcherProxy, self).config()

MatcherPolicy(name="SmtpCheckrecipient", matcher=SmtpInvalidRecipientMatcher (server_port=25, cache_timeout=60, attempt_delivery=FALSE, force_delivery_attempt=FALSE, server_name="recipientcheck.example.com"))
            

5.8.8.1. SmtpInvalidRecipientMatcher methods


Method __init__(self, server_name, server_port, cache_timeout, attempt_delivery, force_delivery_attempt, sender_address, bind_name)

Arguments of __init__
bind_name (string)
Default: ""
Specifies the hostname to bind to before initiating the connection to the SMTP server.

cache_timeout (integer)
Default: 60
How long will the result of an address verification be retained (in seconds).

force_delivery_attempt (boolean)
Default: FALSE
Force a delivery attempt even if the autodetection code otherwise would use VRFY. Useful if the server always returns success for VRFY.

sender_address (string)
Default: "<>"
This value will be used as the mail sender for the attempted mail delivery. Mail delivery is attempted if the force_delivery_attempt is TRUE, or the recipient server does not support the VRFY command.

server_name (string)
Default: n/a
Domain name of the SMTP server that will verify the addresses.

server_port (integer)
Default: 25
Port of the target server.

5.8.9. Class WindowsUpdateMatcher

WindowsUpdateMatcher is actually a DNSMatcher used to retrieve the IP addresses currently associated with the v5.windowsupdate.microsoft.nsatc.net, v4.windowsupdate.microsoft.nsatc.net, and update.microsoft.nsatc.net domain names from the specified name server. Windows Update is running on a distributed server farm, using the DNS round robin method and a short TTL to constantly change the set of servers currently visible, consequently the IP addresses of the servers are constantly changing.

[Example] Example 5.22. WindowsUpdateMatcher example
MatcherPolicy(name="demo_windowsupdatematcher", matcher=WindowsUpdateMatcher())
            

5.8.9.1. WindowsUpdateMatcher methods

Method Description
__init__(self, server) Constructor to initialize an instance of the WindowsUpdateMatcher class.

Table 5.41. Method summary


Method __init__(self, server)

Arguments of __init__
server (string)
Default: None
The IP address of the name server to query.

This constructor initializes an instance of the WindowsUpdateMatcher class.

5.9. Module NAT

Network Address Translation (NAT) is a technology that can be used to change source or destination addresses in a connection from one IP address to another one. This module defines the classes performing the translation for IP addresses.

Zorp supports several different NAT methods using different NAT classes, like GeneralNAT or StaticNAT. To actually perform network address translation in a service, you have to use a NATPolicy instance that contains a configured NAT class. NAT policies provide a way to re-use NAT instances whithout having to define NAT mappings for each service individually.

5.9.1. Classes in the NAT module

Class Description
AbstractNAT Class encapsulating the abstract NAT interface.
BalanceNAT Class encapsulating a Line Balancing NAT
GeneralNAT Class encapsulating a general subnet-to-subnet NAT.
HashNAT Class which sets the address from a hash table.
NATPolicy Class encapsulating named NAT instances.
OneToOneMultiNAT Class translating addresses between two IP ranges.
OneToOneNAT Class translating addresses between two IP ranges.
RandomNAT Class generating a random IP address.
StaticNAT Class that replaces the source or destination address with a predefined address.

Table 5.42. Classes of the NAT module


5.9.2. Class AbstractNAT

This class encapsulates an interface for application level network address translation (NAT). This NAT is different from the NAT used by packet filters: it modifies the outgoing source/destination addresses just before Zorp connects to the server.

Source and destination NATs can be specified when a Service is created.

The NAT settings are used by the ConnectChainer class just before connecting to the server.

5.9.2.1. AbstractNAT methods

Method Description
__init__(self) Constructor to initialize an AbstractNAT instance.
performTranslation(self, session, addrs, nat_type) Function that performs the address translation.

Table 5.43. Method summary


Method __init__(self)

This constructor initializes an AbstractNAT instance. Currently it does nothing, but serves as a placeholder for future extensions.

Method performTranslation(self, session, addrs, nat_type)

Arguments of performTranslation
addrs (unknown)
Default: n/a
tuple of (source, destination) address, any of them can be none in case of the other translation

nat_type (unknown)
Default: n/a
translation type, either NAT_SNAT or NAT_DNAT

session (unknown)
Default: n/a
Session which is about to connect the server.

This function is called before connecting a session to the destination server. The function returns the address (a SockAddr instance) to bind to before establishing the connection.

5.9.3. Class BalanceNAT

[Note] Note

BalanceNAT can be used only as Source NAT.

BalanceNAT performs simple line-balancing between multiple lines. It can be used for example to divide traffic between interfaces (e.g., multiple uplinks to the Internet).

5.9.3.1. BalanceNAT methods

Method Description
__init__(self, balance_policy, keep_sessions) Constructor to initialize a BalanceNAT instance.

Table 5.44. Method summary


Method __init__(self, balance_policy, keep_sessions)

Arguments of __init__
balance_policy (string)
Default: n/a
Name of the policy that specifies how to share the traffic between the lines.

keep_sessions (boolean)
Default: n/a
If enabled and there are multiple connections between a client and a destination, then these connections will use the same line.

This constructor initializes a BalanceNAT instance.

5.9.4. Class GeneralNAT

This class encapsulates a general subnet-to-subnet NAT. It requires a list of from, to, translated to parameters:

  • from: the source address of the connection.

  • to: the destination address of the connection.

  • translated to: the translated address.

If the NAT policy is used as SNAT, the translated address is used to translate the source address of the connection; if the NAT policy is used as DNAT, the translated address is used to translate the destination address of the connection. The translation occurs according to the first matching rule.

[Example] Example 5.23. GeneralNat example

The following example defines a simple GeneralNAT policy that maps connections coming from the 192.168.1.0/24 subnet and targeting the 192.168.10.0/24 subnet into the 10.70.0.0/24 subnet.

NATPolicy(name="Demo_GeneralNAT", nat=GeneralNAT(mapping=((InetDomain(addr="192.168.1.0/24"), InetDomain(addr="192.168.10.0/24"), InetDomain(addr="10.70.0.0/24")),)))

If the policy is used as SNAT, the 192.168.1.0/24 subnet is translated into the 10.70.0.0/24 subnet and used as the source address of the connection. If the policy is used as DNAT, the 192.168.10.0/24 subnet is translated into the 10.70.0.0/24 subnet and used as the target address of the connection.

5.9.4.1. GeneralNAT methods

Method Description
__init__(self, mapping) Constructor to initialize a GeneralNAT instance.

Table 5.45. Method summary


Method __init__(self, mapping)

Arguments of __init__
mapping (complex)
Default: n/a
List of tuples of InetDomains in (source domain, destination domain, mapped domain) format.

This constructor initializes a GeneralNAT instance.

5.9.5. Class HashNAT

HashNAT statically maps an IP address to another using a hash table. The table is indexed by the source IP address, and the value is the translated IP address. Both IP addresses are stored in string format.

5.9.5.1. HashNAT methods

Method Description
__init__(self, ip_hash, default_reject) Constructor to initialize a HashNAT instance.

Table 5.46. Method summary


Method __init__(self, ip_hash, default_reject)

Arguments of __init__
default_reject (boolean)
Default: TRUE
Enable this parameter to reject all connections outside the specific source range.

ip_hash (complex)
Default: n/a
The hash storing the IP address.

This constructor initializes a HashNAT instance.

5.9.6. Class NATPolicy

This class encapsulates a name and an associated NAT instance. NAT policies provide a way to re-use NAT instances whithout having to define NAT mappings for each service individually.

[Example] Example 5.24. Using Natpolicies

The following example defines a simple NAT policy, and uses this policy for SNAT in a service.

NATPolicy(name="demo_natpolicy", nat=GeneralNAT(mapping=((InetDomain(addr="10.0.1.0/24"), InetDomain(addr="192.168.1.0/24")),)))

Service(name="office_http_inter", proxy_class=HttpProxy, snat_policy="demo_natpolicy")
            

5.9.6.1. NATPolicy methods

Method Description
__init__(self, name, nat, cacheable) Constructor to initialize a NAT policy.

Table 5.47. Method summary


Method __init__(self, name, nat, cacheable)

Arguments of __init__
cacheable (boolean)
Default: TRUE
Enable this parameter to cache the NAT decisions.

name (string)
Default: n/a
Name identifying the NAT policy.

nat (class)
Default: n/a
NAT object which performs address translation.

This contructor initializes a NAT policy.

5.9.7. Class OneToOneMultiNAT

[Note] Note

This class is obsolete, use GeneralNAT instead.

This class is similar to OneToOneNAT as it 1:1 address translation between the source and destination subnets. The difference is that the OneToOneMultiNAT class supports multiple mappings by using a list of mapping pairs.

If the source address is outside the given source address range, a DACException is raised. The source and destination subnets must have the same size.

5.9.7.1. OneToOneMultiNAT methods

Method Description
__init__(self, mapping, default_reject) Constructor to initialize a OneToOneMultiNAT instance.

Table 5.48. Method summary


Method __init__(self, mapping, default_reject)

Arguments of __init__
default_reject (boolean)
Default: TRUE
Enable this parameter to reject all connections outside the specific source range.

mapping (complex)
Default: n/a
List of InetDomain pairs in the from, to format.

This constructor initializes an instance of the OneToOneMultiNAT class. Arguments must be InetDomain instances specifying two non-overlapping IP subnets with the same size.

5.9.8. Class OneToOneNAT

[Note] Note

This class is obsolete, use GeneralNAT instead.

This class performs 1:1 address translation between the source and destination subnets. If the source address is outside the given source address range, a DACException is raised. The source and destination subnets must have the same size.

[Tip] Tip

Use OneToOneNAT to redirect a a block of IP addresses to another block, for example, when the webservers located in the DMZ have dedicated IP aliases on the firewall.

5.9.8.1. OneToOneNAT methods

Method Description
__init__(self, from_domain, to_domain, default_reject) Constructor to initialize a OneToOneNAT instance.

Table 5.49. Method summary


Method __init__(self, from_domain, to_domain, default_reject)

Arguments of __init__
default_reject (boolean)
Default: TRUE
Enable this parameter to reject all connections outside the specific source range.

from_domain (class)
Default: n/a
The source subnet (InetDomain instance).

to_domain (class)
Default: n/a
The destination subnet (InetDomain instance).

This constructor initializes a OneToOneNAT instance. Arguments must be InetDomain instances specifying two non-overlapping IP subnets with the same size.

5.9.9. Class RandomNAT

This class randomly selects an address from a list of IP addresses. This can be used for load-balancing several lines by binding each session to a different interface.

5.9.9.1. RandomNAT methods

Method Description
__init__(self, addresses) Constructor to initialize a RandomNAT instance.

Table 5.50. Method summary


Method __init__(self, addresses)

Arguments of __init__
addresses (complex)
Default: n/a
List of the available interfaces. Each item of the list must be am instance of the SockAddr (or a derived) class.

This constructor initializes a RandomNAT instance.

5.9.10. Class StaticNAT

This class assigns a predefined value to the address of the connection.

5.9.10.1. StaticNAT methods

Method Description
__init__(self, addr) Constructor to initialize a StaticNAT instance.

Table 5.51. Method summary


Method __init__(self, addr)

Arguments of __init__
addr (sockaddr)
Default: n/a
The address that replaces all addresses.

This constructor initializes a StaticNAT instance.

5.10. Module Notification

5.10.1. Classes in the Notification module

Class Description
AbstractNotificationMethod Class encapsulating the abstract notification method.
EmailNotificationMethod Class sending out notifications in e-mail.
NotificationPolicy Class encapsulating a NotificationPolicy which describes how to send out notifications.

Table 5.52. Classes of the Notification module


5.10.2. Class AbstractNotificationMethod

This abstract class encapsulates a notification that is performed when a certain event occurs.

Specialized classes can be derived from AbstractNotification, such as the EmailNotification class.

5.10.3. Class EmailNotificationMethod

This class encapsulates a notification handler that sends an e-mail with the given mail properties.

5.10.3.1. Attributes of EmailNotificationMethod

recipient (unknown)
Default: n/a
The e-mail address of the recipient.

5.10.3.2. EmailNotificationMethod methods

Method Description
__init__(self, recipient) Constructor to initialize an EmailNotification instance.

Table 5.53. Method summary


Method __init__(self, recipient)

This constructor initializes an EmailNotification instance and sets the attributes of the outgoing e-mail.

5.10.4. Class NotificationPolicy

5.11. Module Proxy

This module encapsulates the ZorpProxy component implemented by the Zorp core. The Proxy module provides a common framework for protocol-specific proxies, implementing the functions that are used by all proxies. Protocol-specific proxy modules are derived from the Proxy module, and are described in Chapter 4, Proxies.

Starting with Zorp 3.3FR1, the Proxy module provides a common SSL/TLS framework for the Zorp proxies as well. This SSL framework replaces and extends the functionality of the Pssl proxy, providing support for STARTTLS as well. The Pssl proxy has become obsolete, but still provides a compatibility layer for older configuration files, but you are recommended to update your configuration to use the new SSL framework as soon as possible. The SSL framework is described in Chapter 3, The Zorp SSL framework.

[Note] Note

STARTTLS support is currently available only for the Ftp proxy to support FTPS sessions and for the SMTP proxy.

Name Value
SSL_VERIFY_NONE Automatic certificate verification is disabled.
SSL_VERIFY_OPTIONAL_UNTRUSTED Certificate is optional, if present, both trusted and untrusted certificates are accepted.
SSL_VERIFY_OPTIONAL_TRUSTED Certificate is optional, but if a certificate is present, only certificates signed by a trusted CA are accepted.
SSL_VERIFY_REQUIRED_UNTRUSTED Valid certificate is required, both trusted and untrusted certificates are accepted.
SSL_VERIFY_REQUIRED_TRUSTED Certificate is required, only valid certificates signed by a trusted CA are accepted.

Table 5.54.  Certificate verification settings


Name Value
SSL_METHOD_SSLV2 Permit the use of SSLv2 exclusively.
SSL_METHOD_SSLV3 Permit the use of SSLv3 exclusively.
SSL_METHOD_TLSV1 Permit the use of TLSv1 exclusively.
SSL_METHOD_ALL Permit the use of all the supported (SSLv2, SSLv3, and TLSv1) protocols.

Table 5.55.  Constants for SSL/TLS protocol selection


Name Value
SSL_CIPHERS_ALL Permit the use of all supported ciphers, including the 40 and 56 bit exportable ciphers.
SSL_CIPHERS_HIGH Permit only the use of ciphers which use at least 128 bit long keys.
SSL_CIPHERS_MEDIUM Permit only the use of ciphers which use 128 bit long keys.
SSL_CIPHERS_LOW Permit only the use of ciphers which use keys shorter then 128 bits.

Table 5.56.  Constants for cipher selection


Name Value
SSL_HSO_CLIENT_SERVER Perform the SSL-handshake with the client first.
SSL_HSO_SERVER_CLIENT Perform the SSL-handshake with the server first.

Table 5.57.  Handshake order.


Name Value
SSL_NONE Disable encryption between Zorp and the peer.
SSL_FORCE_SSL Require encrypted communication between Zorp and the peer.
SSL_ACCEPT_STARTTLS Permit STARTTLS sessions. Currently supported only in the Ftp proxy.

Table 5.58.  Client connection security type.


Name Value
SSL_NONE Disable encryption between Zorp and the peer.
SSL_FORCE_SSL Require encrypted communication between Zorp and the peer.
SSL_FORWARD_STARTTLS Forward STARTTLS requests to the server. Currently supported only in the Ftp proxy.

Table 5.59.  Server connection security type.


Name Value
SSL_ERROR n/a
SSL_DEBUG n/a

Table 5.60.  Verbosity level of the log messages


Name Value
SSL_HS_ACCEPT 0
SSL_HS_REJECT 1
SSL_HS_POLICY 6
SSL_HS_VERIFIED 10

Table 5.61.  Handshake policy decisions


5.11.1. Functions in module Proxy

Function Description
proxyLog Function to send a proxy-specific message to the system log.

Table 5.62. Function summary


5.11.2. Classes in the Proxy module

Class Description
Proxy Class encapsulating the abstract Zorp proxy.

Table 5.63. Classes of the Proxy module


5.11.3. Functions

5.11.3.1. Function proxyLog(self, type, level, msg, args)

Arguments of proxyLog
level (integer)
Default: n/a
Verbosity level of the log message.

msg (string)
Default: n/a
The text of the log message.

type (string)
Default: n/a
The class of the log message.

This function sends a message into the system log. All messages start with the session_id that uniquely identifies the connection.

5.11.4. Class Proxy

This class serves as the abstact base class for all proxies implemented in Zorp. When an instance of the Proxy class is created, it loads and starts a protocol-specific proxy. Proxies operate in their own threads, so this constructor returns immediately.

5.11.4.1. Attributes of Proxy

auth_inband_defer (boolean)
Default: FALSE
Set this parameter to TRUE to enable the protocol-specific proxy to perform inband authentication. This has effect only if the AuthenticationPolicy used in the service requests InbandAuthentication.

language (string)
Default: en
Determines the language used for user-visible error messages. Supported languages: en - English; de - German; hu - Hungarian.

ssl.client_ca_directory (string)
Default: ""
Directory where the trusted CA certificates are stored. Note that every certificate in this directory is loaded when the proxy is starting up. If ssl.client_verify_type is set to verify client certificates, Zorp sends the subject names of CA certificates stored in this directory to the client to request a certificate from these CAs. Unless you are authenticating the clients based on their certificates, use the self.ssl.client_verify_ca_directory option instead.

ssl.client_cagroup_directories (cagroup)
Default: ""
A tuple of the trusted CA certificate directory and the corresponding CRL directory. This option sets both self.ssl.client_ca_directory and self.ssl.client_crl_directory. Unless you are authenticating the clients based on their certificates, use the self.ssl.client_verify_cagroup_directories option instead.

ssl.client_cert_file (string)
Default: ""
File containing the client-side certificate.

ssl.client_connection_security (enum)
Default: SSL_NONE
Enable SSL on the client side of the proxy. This requires setting up a client private key and a certificate.

ssl.client_crl_directory (string)
Default: ""
Directory where the CRLs associated with trusted CAs are stored. Note that every CRL in this directory is loaded when the proxy is starting up and this might require a huge amount of memory. Unless you are authenticating the clients based on their certificates, use the self.ssl.client_verify_crl_directory option instead.

ssl.client_disable_proto_sslv2 (boolean)
Default: TRUE
Specifies that SSLv2 should be disabled even if the method selection would otherwise support SSLv2.

ssl.client_disable_proto_sslv3 (boolean)
Default: FALSE
Specifies that SSLv3 should be disabled even if the method selection would otherwise support SSLv3.

ssl.client_disable_proto_tlsv1 (boolean)
Default: FALSE
Specifies that TLSv1 should be disabled even if the method selection would otherwise support TLSv1.

ssl.client_key_file (string)
Default: ""
File containing the client-side private key.

ssl.client_keypair_files (certificate)
Default: ""
A tuple of two file names containing the certificate and key files. Using ssl.client_keypair_files is an alternative to using the ssl.client_cert_file and ssl.client_key_file attributes.

ssl.client_keypair_generate (boolean)
Default: FALSE
Enables keybridging towards the clients. (Specifies whether to generate new certificates.)

ssl.client_local_privatekey (certificate)
Default: empty
The private key of the firewall on the client side. Specified as a string in PEM format.

ssl.client_local_privatekey_passphrase (string)
Default: n/a
Passphrase used to access ssl.client_local_privatekey.

ssl.client_ssl_cipher (enum)
Default: SSL_CIPHERS_ALL
Specifies the allowed ciphers on the client side.

ssl.client_ssl_method (enum)
Default: SSL_METHOD_ALL
Specifies the allowed SSL/TLS protocols on the client side.

ssl.client_trusted_certs_directory (string)
Default: ""
A directory where trusted IP - certificate assignments are stored. When a specific IP address introduces itself with the certificate stored in this directory, it is accepted regardless of its expiration or issuer CA. Each file in the directory should contain a certificate in PEM format and have the name of the IP address.

ssl.client_verify_ca_directory (string)
Default: ""
Directory where the trusted CA certificates are stored. CA certificates are loaded on-demand from this directory when verifying the client certificate. Use this option instead of self.ssl.client_ca_directory unless you are authenticating the clients based on their certificates. Note that when using the ssl.client_verify_ca_directory option, Zorp does not send the list of accepted CAs to the client if the certificate of the client is verified.

Available only in Zorp version 3.4.3 and later.

ssl.client_verify_cagroup_directories (cagroup)
Default: ""
A tuple of the trusted CA certificate directory and the corresponding CRL directory. This option sets both self.ssl.client_verify_ca_directory and self.ssl.client_verify_crl_directory. Unless you are authenticating the clients based on their certificates, use this option instead of self.ssl.client_cagroup_directories.

Available only in Zorp version 3.4.3 and later.

ssl.client_verify_crl_directory (string)
Default: ""
Directory where the CRLs associated with trusted CAs are stored. CRLs are loaded on-demand from this directory when verifying the client certificate. Unless you are authenticating the clients based on their certificates, use this option instead of self.ssl.client_crl_directory.

Available only in Zorp version 3.4.3 and later.

ssl.client_verify_depth (integer)
Default: 4
The longest accepted CA verification chain.

ssl.client_verify_type (enum)
Default: SSL_VERIFY_REQUIRED_TRUSTED
Verification setting of the peer certificate on the client side.

ssl.handshake_seq (enum)
Default: SSL_HSO_CLIENT_SERVER
Handshake order. SSL_HSO_CLIENT_SERVER performs the client side handshake first, SSL_HSO_SERVER_CLIENT the server side.

ssl.handshake_timeout (integer)
Default: 30000
SSL handshake timeout in milliseconds.

ssl.key_generator (class)
Default: n/a
An instance of a X509KeyManager or derived class to generate keys automatically based on the keys on one of the other peers. Use X509KeyBridge to generate certificates automatically with a firewall hosted local CA.

ssl.permit_invalid_certificates (boolean)
Default: FALSE
Accept any kind of verification failure when UNTRUSTED verify_type is set. E.g.: accept expired, self-signed, etc. certificates.

ssl.permit_missing_crl (boolean)
Default: TRUE
This option has effect only if the CRL directories are set using the ssl.client_verify_crl_directory or ssl.server_verify_crl_directory parameters. If Zorp does not find a CRL in these directories that matches the CAs in the certificate chain and ssl.permit_missing_crl is set to FALSE, Zorp rejects the certificate. Otherwise, the certificate is accepted even if no matching CRL is found.

Available only in Zorp version 3.4.3 and later.

ssl.server_ca_directory (string)
Default: ""
Directory where the trusted CA certificates are stored. Please note that all certificates in the directory are loaded when the proxy is starting up. Unless you are authenticating the clients based on their certificates, use the self.ssl.server_verify_ca_directory option instead.

ssl.server_cagroup_directories (cagroup)
Default: ""
A tuple of the trusted CA certificate directory and the corresponding CRL directory. This option sets both self.ssl.server_ca_directory and self.ssl.server_crl_directory. Unless you are authenticating the clients based on their certificates, use the self.ssl.server_verify_cagroup_directories option instead.

ssl.server_cert_file (string)
Default: ""
File containing the server-side certificate.

ssl.server_check_subject (boolean)
Default: TRUE
Specifies whether the Subject of the server side certificate is checked against application layer information (e.g.: whether it matches the hostname in the URL). See also Section 3.2.3.5, Certificate verification options .

ssl.server_connection_security (enum)
Default: SSL_NONE
Enable SSL on the server side of the proxy. This requires setting up a private key and a certificate on Zorp.

ssl.server_crl_directory (string)
Default: ""
Directory where the CRLs associated with the trusted CAs are stored. Please note that all CRLs in the directory are loaded when the proxy is starting up and this might require a huge amount of memory. Unless you are authenticating the clients based on their certificates, use the self.ssl.server_verify_crl_directory option instead.

ssl.server_disable_proto_sslv2 (boolean)
Default: TRUE
Specifies that SSLv2 should be disabled even if the method selection would otherwise support SSLv2.

ssl.server_disable_proto_sslv3 (boolean)
Default: FALSE
Specifies that SSLv3 should be disabled even if the method selection would otherwise support SSLv3.

ssl.server_disable_proto_tlsv1 (boolean)
Default: FALSE
Specifies that TLSv1 should be disabled even if the method selection would otherwise support TLSv1.

ssl.server_key_file (string)
Default: ""
File containing the server-side private key.

ssl.server_keypair_files (certificate)
Default: ""
A tuple of two file names containing the certificate and key files. Using ssl.server_keypair_files is an alternative to using the ssl.server_cert_file and ssl.server_key_file attributes.

ssl.server_keypair_generate (boolean)
Default: FALSE
Enables keybridging towards the server. (Specifies whether to generate new certificates.)

ssl.server_local_privatekey (certificate)
Default: empty
The private key of the firewall on the server side, specified as a string in PEM format. Server side key and certificate are optional.

ssl.server_local_privatekey_passphrase (string)
Default: n/a
Passphrase used to access ssl.server_local_privatekey.

ssl.server_ssl_cipher (enum)
Default: SSL_CIPHERS_ALL
Specifies the ciphers allowed on the server side.

ssl.server_ssl_method (enum)
Default: SSL_METHOD_ALL
Specifies the SSL/TLS protocols allowed on the server side.

ssl.server_trusted_certs_directory (string)
Default: ""
A directory where trusted IP:port - certificate assignments are stored. When a specific IP address introduces itself with the certificate stored in this directory, it is accepted regardless of its expiration or issuer CA. Each file in the directory should contain a certificate in PEM format and should be named as 'IP:PORT'.

ssl.server_verify_ca_directory (string)
Default: ""
Directory where the trusted CA certificates are stored. CA certificates are loaded on-demand from this directory when verifying the server certificate. Unless you are authenticating the clients based on their certificates, use this option instead of self.ssl.server_ca_directory.

Available only in Zorp version 3.4.3 and later.

ssl.server_verify_cagroup_directories (cagroup)
Default: ""
A tuple of the trusted CA certificate directory and the corresponding CRL directory. This option sets both self.ssl.server_verify_ca_directory and self.ssl.server_verify_crl_directory. Unless you are authenticating the clients based on their certificates, use this option instead of self.ssl.server_cagroup_directories.

Available only in Zorp version 3.4.3 and later.

ssl.server_verify_crl_directory (string)
Default: ""
Directory where the CRLs associated with trusted CAs are stored. CRLs are loaded on-demand from this directory when verifying the server certificate. Unless you are authenticating the clients based on their certificates, use this option instead of self.ssl.server_crl_directory.

Available only in Zorp version 3.4.3 and later.

ssl.server_verify_depth (integer)
Default: 4
The longest accepted CA verification chain.

ssl.server_verify_type (enum)
Default: SSL_VERIFY_REQUIRED_TRUSTED
Verification settings of the peer certificate on the server side.

5.11.4.2. Proxy methods

Method Description
config(self) Function called by the proxy core to initialize the proxy instance.
connectServer(self) Function called by the proxy instance to establish the server-side connection.
getCredentials(self, method, username, domain, target, port) Function called when proxy requires credentials for server side authentication.
setServerAddress(self, host, port) Function called by the proxy instance to set the address of the destination server.
userAuthenticated(self, entity, groups, auth_info) Function called when inband authentication is successful.

Table 5.64. Method summary


Method config(self)

This function is called during proxy startup. It sets the attributes of the proxy instance according to the configuration of the proxy.

Method connectServer(self)

This function is called to establish the server-side connection. The function either connects a proxy to the destination server, or an embedded proxy to its parent proxy. The proxy may set the address of the destination server using the setServerAddress function.

The connectServer function calls the chainer specified in the service definition to connect to the remote server using the host name and port parameters.

The connectServer function returns the descriptor of the server-side data stream.

Method getCredentials(self, method, username, domain, target, port)

Arguments of getCredentials
domain (string)
Default: n/a
Domain the user name belongs to.

method (string)
Default: n/a
Method that will be used for authentication on target server.

port (integer)
Default: n/a
Target server port.

target (string)
Default: n/a
Target server hostname.

username (string)
Default: n/a
Username that will be used for authentication on target server.

The proxy instance calls this function to retrieve authentication credentials for authentication method method and the target user username.

Method setServerAddress(self, host, port)

Arguments of setServerAddress
host (string)
Default: n/a
The host name of the server.

port (integer)
Default: n/a
The Port number of the server.

The proxy instance calls this function to set the address of the destination server. This function attempts to resolve the hostname of the server using the DNS; the result is stored in the session.server_address parameter. The address of the server may be modified later by the router of the service. See Section 5.13, Module Router for details.

[Note] Note

The setServerAddress function has effect only when InbandRouter is used.

Method userAuthenticated(self, entity, groups, auth_info)

Arguments of userAuthenticated
entity (unknown)
Default: n/a
Username of the authenticated client.

The proxy instance calls this function to indicate that the inband authentication was successfully performed. The name of the client is stored in the entity parameter.

5.12. Module Resolver

This module defines the AbstractResolver interface and various derived classes to perform name lookups.

5.12.1. Classes in the Resolver module

Class Description
AbstractResolver Class encapsulating the abstract Resolver interface.
DNSResolver Class encapsulating DNS-based name resolution.
HashResolver Class encapsulating hash-based name resolution.
ResolverPolicy Class encapsulating a Resolver which can be referenced using its identifier

Table 5.65. Classes of the Resolver module


5.12.2. Class AbstractResolver

This class encapsulates an interface for application level name resolution.

5.12.3. Class DNSResolver

DNSResolver policies query the domain name server used by Zorp in general to resolve domain names.

[Example] Example 5.25. A simple DNSResolver policy

Below is a simple DNSResolver policy enabled to return multiple 'A' records.

ResolverPolicy(name="Mailservers", resolver=DNSResolver(multi=TRUE))

5.12.3.1. DNSResolver methods

Method Description
__init__(self, multi) Constructor to initialize a DNSResolver instance.

Table 5.66. Method summary


Method __init__(self, multi)

Arguments of __init__
multi (boolean)
Default: FALSE
Enable this attribute to retrieve multiple IP addresses from the DNS server if the domain name has multiple A records.

This constructor initializes a DNSResolver instance.

5.12.4. Class HashResolver

HashResolver policies are used to locally store the IP addresses belonging to a domain name. A domain name (Hostname) and one or more corresponding IP addresses (Addresses) can be stored in a hash. If the domain name to be resolved is not included in the hash, the name resolution will fail. The HashResolver can be used to direct incoming connections to specific servers based on the target domain name.

[Example] Example 5.26. A simple HashResolver policy

The resolver policy below associates the IP addresses 192.168.1.12 and 192.168.1.13 with the mail.example.com domain name.

ResolverPolicy(name="DMZ", 	resolver=HashResolver(mapping={"mail.example.com":	("192.168.1.12", "192.168.1.13")}))
        

5.12.4.1. HashResolver methods

Method Description
__init__(self, mapping) Constructor to initialize a HashResolver instance.

Table 5.67. Method summary


Method __init__(self, mapping)

Arguments of __init__
mapping (complex)
Default: n/a
Mapping that describes hostname->IP address pairs.

This constructor initializes a HashResolver instance.

5.12.5. Class ResolverPolicy

Resolvers and resolver policies specify how a Zorp service should resolve the domain names in client requests; resolvers are used whenever Zorp needs to resolve domain names in order to perform connection processing. Such an event occurs when InbandRouter is used and the Zorp proxy has a DNS name to establish connection to. Names are usually resolved using the domain name server ( DNSResolver class), or the HashResolver class when the dependence on DNS has to be avoided.

To actually perform name resolution, you have to use a ResolverPolicy instance that contains a configured Resolver class. Resolver policies provide a way to re-use Resolver instances whithout having to define a Resolver for each service individually.

5.12.5.1. ResolverPolicy methods

Method Description
__init__(self, name, resolver) n/a

Table 5.68. Method summary


Method __init__(self, name, resolver)

Arguments of __init__
name (string)
Default: n/a
Name identifying the Resolver policy.

resolver (class)
Default: n/a
Resolver object which performs name resolution.

n/a

5.13. Module Router

Routers define the target IP address and port of the destination server, based on information that is available before the Zorp proxy is started. The simplest router (DirectedRouter) selects a preset destination as the server address, while the most commonly used TransparentRouter connects to the IP address requested by the client. Other routers may make more complex decisions. The destination address selected by the router may be overridden by the proxy and the DNAT classes used in the service.

5.13.1. The source address used in the server-side connection

Routers also define source address and port of the server-side connection. This is the IP address that Zorp uses to connect the server. The server sees that the connection originates from this address. The following two parameters determine the source address used in the server-side connection:

forge_addr: If set to TRUE, Zorp uses the client's source address as the source of the server-side connection. Otherwise, Zorp uses the IP address of the interface connected to the server.

forge_port: This parameter defines the source port that Zorp uses in the server-side connection. Specify a port number as an integer value, or use one of the following options:

Name Description
Z_PORT_ANY Selected a random port between 1024 and 65535. This is the default behavior of every router.
Z_PORT_GROUP Select a random port in the same group as the port used by the client. The following groups are defined: 0-513, 514-1024, 1025-.
Z_PORT_EXACT Use the same port as the client.
Z_PORT_RANDOM Select a random port using a cryptographically secure function.

Table 5.69.  Options defining the source port of the server-side connection


5.13.2. Classes in the Router module

Class Description
AbstractRouter Class encapsulating the abstract router.
DirectedRouter Class encapsulating a Router which explicitly defines the target address.
InbandRouter Class encapsulating the Router which extracts the destination address from the application-level protocol.
TransparentRouter Class encapsulating a Router which provides transparent services.

Table 5.70. Classes of the Router module


5.13.3. Class AbstractRouter

AbstractRouter implements an abstract router that determines the destination address of the server-side connection. Service definitions should refer to a customized class derived from AbstractRouter, or one of the predefined router classes, such as TransparentRouter or DirectedRouter. Different implementations of this interface perform Transparent routing (directing the client to its original destination), and Directed routing (directing the client to a given destination).

A proxy can override the destination selected by the router using the the setServerAddress method.

5.13.3.1. Attributes of AbstractRouter

forge_addr (boolean)
Default: n/a
If set to TRUE, Zorp uses the client's source address as the source of the server-side connection.

forge_port (unknown)
Default: n/a

Defines the source port that Zorp uses in the server-side connection. See Section 5.13.1, The source address used in the server-side connection for details.

5.13.4. Class DirectedRouter

This class implements directed routing, which means that the destination address is a preset address for each session.

[Example] Example 5.27. DirectedRouter example

The following service uses a DirectedRouter that redirects every connection to the /var/sample.socket Unix domain socket.

Service(name="demo_service", proxy_class=HttpProxy, router=DirectedRouter(dest_addr=SockAddrUnix('/var/sample.socket'), overrideable=FALSE, forge_addr=FALSE))
            

The following service uses a DirectedRouter that redirects every connection to the 192.168.2.24:8080 IP address.

Service(name="demo_service", proxy_class=HttpProxy, router=DirectedRouter(dest_addr=SockAddrInet('192.168.2.24', 8080), overrideable=FALSE, forge_addr=FALSE))
            

5.13.4.1. Attributes of DirectedRouter

dest_addr (unknown)
Default: n/a
The destination address to connect to.

5.13.4.2. DirectedRouter methods

Method Description
__init__(self, dest_addr, forge_addr, overrideable, forge_port) Constructor to initialize a DirectedRouter.

Table 5.71. Method summary


Method __init__(self, dest_addr, forge_addr, overrideable, forge_port)

Arguments of __init__
dest_addr (complex)
Default: n/a
The destination address to connect to.

forge_addr (boolean)
Default: FALSE
If set to TRUE, Zorp uses the client's source address as the source of the server-side connection.

forge_port (complex)
Default: Z_PORT_ANY

Defines the source port that Zorp uses in the server-side connection. See Section 5.13.1, The source address used in the server-side connection for details.

overrideable (boolean)
Default: FALSE
If set to TRUE, the proxy may override the selected destination. Enable this option when the proxy builds multiple connections to the destination server, and the proxy knows the address of the destination server, for example, because it receives a redirect request. This situation is typical for the SQLNet proxy.

This constructor initializes an instance of the DirectedRouter class.

5.13.5. Class InbandRouter

This class implements inband routing, which means that the destination address will be determined by the protocol. Inband routing works only for protocols that can send routing information within the protocol, and is mainly used for non-transparent proxying. The InbandRouter class currently supports only the HTTP and FTP protocols.

[Example] Example 5.28. InbandRouter example

The following service uses an InbandRouter to extract the destination from the protocol.

Service(name="demo_service", proxy_class=HttpProxy, router=InbandRouter(forge_addr=FALSE))
            

5.13.5.1. InbandRouter methods

Method Description
__init__(self, forge_addr, forge_port) Constructor to initialize a InbandRouter.

Table 5.72. Method summary


Method __init__(self, forge_addr, forge_port)

Arguments of __init__
forge_addr (boolean)
Default: FALSE
If set to TRUE, Zorp uses the client's source address as the source of the server-side connection.

forge_port (complex)
Default: Z_PORT_ANY

Defines the source port that Zorp uses in the server-side connection. See Section 5.13.1, The source address used in the server-side connection for details.

This constructor initializes an instance of the InbandRouter class.

5.13.6. Class TransparentRouter

This class implements transparent routing, which means that the destination server is the original destination requested by the client.

[Example] Example 5.29. TransparentRouter example

The following service uses a TransparentRouter that connects to the 8080 port of the server and uses the client's IP address as the source of the server-side connection.

Service(name="demo_service", proxy_class=HttpProxy, router=TransparentRouter(forced_port=8080, overrideable=FALSE, forge_addr=TRUE))
            

5.13.6.1. Attributes of TransparentRouter

forced_port (unknown)
Default: n/a

Defines the source port that Zorp uses in the server-side connection. See Section 5.13.1, The source address used in the server-side connection for details.

forge_addr (unknown)
Default: n/a
If set to TRUE, Zorp uses the client's source address as the source of the server-side connection.

5.13.6.2. TransparentRouter methods

Method Description
__init__(self, forced_port, forge_addr, overrideable, forge_port) Constructor to initialize an instance of the TransparentRouter class.

Table 5.73. Method summary


Method __init__(self, forced_port, forge_addr, overrideable, forge_port)

Arguments of __init__
forced_port (integer)
Default: 0
Modify the destination port to this value. Default value: 0 (do not modify the target port)

forge_addr (boolean)
Default: FALSE
If set to TRUE, Zorp uses the client's source address as the source of the server-side connection.

forge_port (complex)
Default: Z_PORT_ANY

Defines the source port that Zorp uses in the server-side connection. See Section 5.13.1, The source address used in the server-side connection for details.

overrideable (boolean)
Default: FALSE
If set to TRUE, the proxy may override the selected destination. Enable this option when the proxy builds multiple connections to the destination server, and the proxy knows the address of the destination server, for example, because it receives a redirect request. This situation is typical for the SQLNet proxy.

This constructor creates a new TransparentRouter instance which can be associated with a Service.

5.14. Module Service

This module defines classes encapsulating service descriptions. Zorp services define how incoming connection requests are handled. When a connection is accepted by a Dispatchers, the service bound to the Dispatcher creates an instance of itself. This instance handles the connection and proxies the traffic between the client and the server. The instance of the selected service is created using the 'startInstance()' method.

A service does not perform useful activity on its own, it needs a Dispatcher to bind the service to a network interface of the firewall. New instances of the service are started as the Dispatcher accepts new connections.

5.14.1. Naming services

The name of the service must be a unique identifier; dispatchers refer to this unique ID.

Use clear, informative, and consistent service names. Include the following information in the service name:

  • Source zones, indicating which clients may use the service (e.g., intranet).

  • The protocol permitted in the traffic (e.g., HTTP).

  • Destination zones, indicating which servers may be accessed using the service (e.g., Internet).

[Tip] Tip

Name the service that allows internal users to browse the Web intra_HTTP_internet. Use dots to indicate child zones, e.g., intra.marketing_HTTP_inter.

5.14.2. Determining the server and client zone

The client's IP address identifies a client zone and the access control information associated by the client zone determines whether a service identified by a given name is permitted. Similarly when the server side connection is established the same service name is used to determine whether the service is permitted to target a server in the zone of the server.

5.14.3. Classes in the Service module

Class Description
AbstractService Class encapsulating the abstract Service properties.
PFService Class encapsulating a packet-filter service definition.
Service Class encapsulating a service definition.

Table 5.74. Classes of the Service module


5.14.4. Class AbstractService

AbstractService implements an abstract service. Service definitions should be based on a customized class derived from AbstractService, or on the predefined Service class.

5.14.4.1. Attributes of AbstractService

name (string)
Default: n/a
The name of the service.

5.14.4.2. AbstractService methods

Method Description
__init__(self, name) Constructor to initialize an instance of the AbstractService class.

Table 5.75. Method summary


Method __init__(self, name)

Arguments of __init__
name (string)
Default: n/a
The name of the service.

This constructor creates an AbstractService instance and sets the attributes of the instance according to the received arguments. It also registers the Service to the services hash so that dispatchers can find the service instance.

5.14.5. Class PFService

[Note] Note

The PFService class transfers packet-filter level services. To transfer connections on the application-level (proxy), use the PFService class.

[Example] Example 5.30. PFService example

The following packet-filtering service transfers TCP connections that arrive to port 5555.

PFService(name="intranet_PF5555_internet", router=TransparentRouter(forge_addr=FALSE))

The following example defines the Zorp classes required for a service to work: the client and server zones and the services they can accept; the dispatcher that starts the service, and the service itself.

InetZone('internet', ['0.0.0.0/0'],
    inbound_services=[
        "intranet_PF5555_internet"])

InetZone('intranet', [],
    outbound_services=[
        "intranet_PF5555_internet"])

def demo() :
    PFService(name="intranet_PF5555_internet", router=TransparentRouter(forge_addr=FALSE))
    Dispatcher(transparent=TRUE, bindto=DBIface(protocol=ZD_PROTO_TCP, port=55555, iface="eth0", ip="192.168.0.15"), rule_port="55555", service="intranet_PF5555_internet")

5.14.5.1. Attributes of PFService

dnat_policy (class)
Default: n/a
Name of the NAT policy instance used to translate the destination addresses of the sessions. See Section 5.9, Module NAT for details.

router (class)
Default: n/a
A router instance used to determine the destination address of the server. See Section 5.13, Module Router for details.

snat_policy (class)
Default: n/a
Name of the NAT policy instance used to translate the source addresses of the sessions. See Section 5.9, Module NAT for details.

5.14.5.2. PFService methods

Method Description
__init__(self, name, router, snat_policy, dnat_policy) Constructor to initialize a PFService instance.

Table 5.76. Method summary


Method __init__(self, name, router, snat_policy, dnat_policy)

This constructor defines a packetfilter-service with the specified parameters.

5.14.6. Class Service

A service is one of the fundamental objects in Zorp. It stores the names of proxy related parameters, and is also used for access control purposes to decide what kind of traffic is permitted.

[Note] Note

The Service class transfers application-level (proxy) services. To transfer connections on the packet-filter level, use the PFService class.

[Example] Example 5.31. Service example

The following service transfers HTTP connections. Every parameter is left at its default.

Service(name="demo_http, proxy_class=HttpProxy, router=TransparentRouter(forge_addr=FALSE))
           

The following service handles HTTP connections. This service uses authentication and authorization, and network address translation on the client addresses (SNAT).

Service(name="demo_http", proxy_class=HttpProxy, authentication_policy="demo_authentication_policy", authorization_policy="demo_permituser", snat_policy="demo_natpolicy", router=TransparentRouter(overrideable=FALSE, forge_addr=FALSE))

The following example defines the Zorp classes required for a service to work: the client and server zones and the services they can accept; the dispatcher that starts the service, and the service itself.

InetZone('internet', ['0.0.0.0/0'],
    inbound_services=[
        "office_http_inter"],
    outbound_services=[])

InetZone('office', ['192.168.1.0/32', '192.168.2.0/32'],
    outbound_services=[
        "office_http_inter"])

def demo_instance() :
    Service(name="office_http_inter", proxy_class=HttpProxy, router=TransparentRouter(forge_addr=FALSE))
    Dispatcher(transparent=TRUE, bindto=DBIface(protocol=ZD_PROTO_TCP, iface="eth0", ip="192.168.1.1", port=50080), service="office_http_inter")

5.14.6.1. Attributes of Service

auth_name (string)
Default: n/a
Authentication name of the service. This string informs the users of the Zorp Authentication Agent about which service they are authenticating for. Default value: the name of the service.

authentication_policy (class)
Default: n/a
Name of the AuthenticationPolicy instance used to authenticate the clients. See Section 5.1, Module Auth for details.

authorization_policy (class)
Default: n/a
Name of the AuthorizationPolicy instance used to authorize the clients. See Section 5.1, Module Auth for details.

chainer (class)
Default: n/a
A chainer instance used to connect to the destination server. See Section 5.3, Module Chainer for details.

dnat_policy (class)
Default: n/a
Name of the NAT policy instance used to translate the destination addresses of the sessions. See Section 5.9, Module NAT for details.

instance_id (integer)
Default: n/a
The sequence number of the last session started

keepalive (integer)
Default: n/a
The TCP keepalive option, one of the Z_KEEPALIVE_NONE, Z_KEEPALIVE_CLIENT, Z_KEEPALIVE_SERVER, Z_KEEPALIVE_BOTH values.

max_instances (integer)
Default: n/a
Permitted number of concurrent instances of this service. Usually each service instance handles one connection. The default value is 0, which allows unlimited number of instances.

max_sessions (integer)
Default: n/a
Maximum number of concurrent sessions handled by one thread.

num_instances (integer)
Default: n/a
The current number of running instances of this service.

proxy_class (class)
Default: n/a
Name of the proxy class instance used to analyze the traffic transferred in the session. See Section 5.11, Module Proxy for details.

resolver_policy (unknown)
Default: n/a
Name of the ResolvePolicy instance used to resolve the destination domain names. See Section 5.12, Module Resolver for details. Default value: DNSResolver

router (class)
Default: n/a
A router instance used to determine the destination address of the server. See Section 5.13, Module Router for details.

snat_policy (class)
Default: n/a
Name of the NAT policy instance used to translate the source addresses of the sessions. See Section 5.9, Module NAT for details.

5.14.6.2. Service methods


Method __init__(self, name, proxy_class, router, chainer, snat_policy, snat, dnat_policy, dnat, authentication_policy, authorization_policy, max_instances, max_sessions, auth_name, resolver_policy, auth, auth_policy, keepalive)

Arguments of __init__
auth_name (string)
Default: None
Authentication name of the service. This string informs the users of the Zorp Authentication Agent about which service they are authenticating for. Default value: the name of the service.

authentication_policy (class)
Default: None
Name of the AuthenticationPolicy instance used to authenticate the clients. See Section 5.1, Module Auth for details.

authorization_policy (class)
Default: None
Name of the AuthorizationPolicy instance used to authorize the clients. See Section 5.1, Module Auth for details.

chainer (class)
Default: None
Name of the chainer instance used to connect to the destination server. Defaults to ConnectChainer if no other chainer is specified.

dnat_policy (class)
Default: None
Name of the NAT policy instance used to translate the destination addresses of the sessions. See Section 5.9, Module NAT for details.

keepalive (integer)
Default: n/a
The TCP keepalive option, one of the Z_KEEPALIVE_NONE, Z_KEEPALIVE_CLIENT, Z_KEEPALIVE_SERVER, Z_KEEPALIVE_BOTH values.

max_instances (integer)
Default: 0
Permitted number of concurrent instances of this service. Usually each service instance handles one connection. Default value: 0 (unlimited).

max_sessions (integer)
Default: n/a
Maximum number of concurrent sessions handled by one thread.

name (string)
Default: n/a
The name identifying the service.

proxy_class (class)
Default: n/a
Name of the proxy class instance used to analyze the traffic transferred in the session. See Section 5.11, Module Proxy for details.

resolver_policy (class)
Default: None
Name of the ResolvePolicy instance used to resolve the destination domain names. See Section 5.12, Module Resolver for details. Default value: DNSResolver.

router (class)
Default: None
Name of the router instance used to determine the destination address of the server. Defaults to TransparentRouter if no other router is specified.

snat_policy (class)
Default: None
Name of the NAT policy instance used to translate the source addresses of the sessions. See Section 5.9, Module NAT for details.

This contructor defines a Service with the specified parameters.

5.15. Module Session

This module defines the abstract session interface in a class named AbstractSession, and two descendants MasterSession and StackedSession.

Sessions are hierarchically stacked into each other just like proxies. All sessions except the master session have a parent session from which child sessions inherit variables. Child sessions are stacked into their master sessions, so stacked sessions can inherit data from the encapsulating proxy instances. (Inheritance is implemented using a simple getattr wrapper.)

Instances of the Session classes store the parameters of the client-side and server-side connections in a session object (for example, the IP addresses and zone of the server and the client, and the username and group memberships of the user when authentication is used). Other components of Zorp refer to this data when making various policy-based decisions.

5.15.1. Classes in the Session module

Class Description
StackedSession Class encapsulating a subsession.

Table 5.78. Classes of the Session module


5.15.2. Class StackedSession

This class represents a stacked session, e.g., a session within the session hierarchy. Every subsession inherits session-wide parameters from its parent.

5.15.2.1. Attributes of StackedSession

chainer (class)
Default: n/a
The chainer used to connect to the parent proxy. If unset, the server_stream parameter must be set.

owner (class)
Default: n/a
The parent session of the current session.

5.16. Module SockAddr

This module implements inet_ntoa and inet_aton. The module also provides an interface to the SockAddr services of the Zorp core. SockAddr is used for example to define the bind address of Dispatchers, or the address of the ZAS server in AuthenticationProvider policies.

5.16.1. Functions in module SockAddr

Function Description
inet_ntoa Function to convert a 32-bit integer into an IPv4 address.
inet_aton Function to convert an internet address to a 32-bit integer.

Table 5.79. Function summary


5.16.2. Classes in the SockAddr module

Class Description
SockAddrInet Class encapsulating an IPv4 address:port pair.
SockAddrInetRange Class encapsulating an IPv4 address and a port range.
SockAddrUnix Class encapsulating a UNIX domain socket.

Table 5.80. Classes of the SockAddr module


5.16.3. Functions

5.16.3.1. Function inet_ntoa(ip)

Arguments of inet_ntoa
ip (unknown)
Default: n/a
The IP address as a 32-bit integer (network byte order).

This function converts an IP address from network byte order into its string representation (dotted quad). Returns string representation of the IP address.

5.16.3.2. Function inet_aton(ip)

Arguments of inet_aton
ip (string)
Default: n/a
A dotted-quad string

This function converts the string representation of an IPv4 address to an integer in network byte order. Returns unsigned long in network byte order.

5.16.4. Class SockAddrInet

This class encapsulates an IPv4 address:port pair, similarly to the sockaddr_in struct in C. The class is implemented and exported by the Zorp core. The SockAddrInet Python class serves only documentation purposes, and has no real connection to the behavior implemented in C.

[Example] Example 5.32. SockAddrInet example

The following example defines an IPv4 address:port pair.

SockAddrInet('192.168.10.10', 80)            	
         	

The following example uses SockAddrInet in a dispatcher. See Section 5.5.5, Class Dispatcher for details on Dispatchers.

Dispatcher(transparent=TRUE, bindto=DBSockAddr(protocol=ZD_PROTO_TCP, sa=SockAddrInet('192.168.11.11', 50080)), service="intra_HTTP_inter", backlog=255, rule_port="50080")
         	

5.16.4.1. Attributes of SockAddrInet

ip (unknown)
Default: n/a
IP address (network byte order).

ip_s (unknown)
Default: n/a
IP address in string representation.

port (unknown)
Default: n/a
Port number (network byte order).

type (string)
Default: n/a
The inet value that indicates an address in the AF_INET domain.

5.16.5. Class SockAddrInetRange

A specialized SockAddrInet class which allocates a new port within the given range of ports when a dispatcher bounds to it. The class is implemented and exported by the Zorp core. The SockAddrInetRange Python class serves only documentation purposes, and has no real connection to the behavior implemented in C.

5.16.5.1. Attributes of SockAddrInetRange

ip (unknown)
Default: n/a
IP address (network byte order).

ip_s (unknown)
Default: n/a
IP address in string representation.

port (unknown)
Default: n/a
Port number (network byte order).

type (string)
Default: n/a
The inet value that indicates an address in the AF_INET domain.

5.16.6. Class SockAddrUnix

This class encapsulates a UNIX domain socket endpoint. The socket is represented by a filename. The SockAddrUnix Python class serves only documentation purposes, and has no real connection to the behavior implemented in C.

[Example] Example 5.33. SockAddrUnix example

The following example defines a Unix domain socket.

SockAddrUnix('/var/sample.socket')          	
         	

The following example uses SockAddrUnix in a DirectedRouter.

Service(name="demo_service", proxy_class=HttpProxy, router=DirectedRouter(dest_addr=SockAddrUnix('/var/sample.socket'), overrideable=FALSE, forge_addr=FALSE))           	
         	

5.16.6.1. Attributes of SockAddrUnix

type (string)
Default: n/a
The unix value that indicates an address in the UNIX domain.

5.17. Module Stack

Zorp is capable of stacking, that is, handing over parts of the traffic to other modules for further inspection (e.g., to other proxies to inspect embedded protocols, to content vectoring modules for virus filtering, etc.). The Stack module defines the classes required for this functionality.

Stacking in Zorp services is performed using StackingProvider policies, which reference the host that performs the stacked operations using the RemoteStackingBackend class.

5.17.1. Classes in the Stack module

Class Description
AbstractStackingBackend This is an abstract class, currently without any functionality.
RemoteStackingBackend Constructor to initialize an instance of the RemoteStackingBackend class.
StackingProvider This is a policy class that is used to reference a configured stacking provider in service definitions.

Table 5.81. Classes of the Stack module


5.17.2. Class AbstractStackingBackend

This is an abstract class, currently without any functionality.

5.17.3. Class RemoteStackingBackend

This class contains the address of the host that performs the stacked operations. It is typically used to access the Zorp Content Vectoring Server (ZCV) to perform virus filtering in the traffic. The remote backend can be accessed using the TCP protocol or a local socket, e.g., RemoteStackingBackend(addrs=(SockAddrInet('192.168.2.3', 1318),)) or RemoteStackingBackend(addrs=(SockAddrUnix('/var/run/zcv/zcv.sock'),)). .

5.17.3.1. RemoteStackingBackend methods

Method Description
__init__(self, addrs)

Table 5.82. Method summary


Method __init__(self, addrs)

Arguments of __init__
addrs (complex)
Default: n/a
The address of the remote backend in SockAddrInet or SockAddrUnix format. Separate addresses with commas to list more than one address for a backend. Zorp will connect to these addresses in a failover fashion.

5.17.4. Class StackingProvider

Instances of the StackingProvider class are policies that define which remote stacking backend a particular service uses to inspect the contents of the traffic.

[Example] Example 5.34. A simple StackingProvider class

The following class creates a simple stacking provider that can be referenced in service definitions. The remote host that provides the stacking services is located under the 192.168.12.12 IP address.

StackingProvider(name="demo_stackingprovider", backend=RemoteStackingBackend(addrs=(SockAddrInet('192.168.12.12', 1318),)))
[Example] Example 5.35. Using a StackingProvider in an FTP proxy

The following classes define a stacking provider that can be accesses a local ZCV instance using a domain socket. This service provider is then used to filter FTP traffic. The configuration of the ZCV (i.e., what modules it uses to filter the traffic is not discussed here).

class StackingFtpProxy(FtpProxy):
    def config(self):
        super(StackingFtpProxy, self).config()
        self.request_stack["RETR"]=(FTP_STK_DATA, (Z_STACK_PROVIDER, "demo_stackingprovider", "default_rulegroup"))        

StackingProvider(name="demo_stackingprovider_socket", backend=RemoteStackingBackend(addrs=(SockAddrUnix('/var/run/zcv/zcv.sock'),)))

5.17.4.1. StackingProvider methods

Method Description
__init__(self, name, backend) Constructor to initialize an instance of the StackingProvider class.

Table 5.83. Method summary


Method __init__(self, name, backend)

Arguments of __init__
backend (class)
Default: n/a
A configured RemoteStackingBackend class containing the address of the remote stacking backend, e.g., RemoteStackingBackend(addrs=(SockAddrInet('192.168.2.3', 1318),)) or RemoteStackingBackend(addrs=(SockAddrUnix('/var/run/zcv/zcv.sock'),)). .

name (string)
Default: n/a
Name of the Stacking provider policy. This name can be referenced in the service definitions.

This constructor creates a StackingProvider instance and sets the attributes of the instance according to the received arguments.

5.18. Module Stream

This module defines the Stream class, encapsulating file descriptors and related functions.

5.18.1. Classes in the Stream module

Class Description
Stream Class encapsulating the file descriptor and related functions.

Table 5.84. Classes of the Stream module


5.18.2. Class Stream

This class encapsulates a full-duplex data tunnel, represented by a UNIX file descriptor. Proxies communicate with its peers through instances of this class. The client_stream and server_stream attributes of the Session class contain a Stream instance.

5.18.2.1. Attributes of Stream

bytes_recvd (integer)
Default: n/a
The number of bytes received in the stream.

bytes_sent (integer)
Default: n/a
The number of bytes sent in the stream.

fd (integer)
Default: n/a
The file descriptor associated to the stream.

name (string)
Default: n/a
The name of the stream.

5.18.2.2. Stream methods

Method Description
__init__(self, fd, name) Constructor to initialize a stream.

Table 5.85. Method summary


Method __init__(self, fd, name)

Arguments of __init__
fd (integer)
Default: n/a
The file descriptor associated to the stream.

name (string)
Default: n/a
The name of the stream.

This constructor initializes a Stream instance setting its attributes according to arguments.

5.19. Module Zone

This module defines the Zone class and other related classes.

Zones are the basis of access control in Zorp. A zone consists of a set of IP addresses or address ranges. For example, a zone can contain an IPv4 subnet.

Zones are organized into a hierarchy created by the Zorp administrator. Children zones inherit the security attributes (set of permitted services etc.) from their parents. The administrative hierarchy often reflects the organization of the company, with zones assigned to the different departments.

Zone definitions also determine which Zorp services can be started from the zone (outbound_services) and which services can enter the zone (inbound_services).

When Zorp has to determine which zone a client belongs to, it selects the most specific zone containing the searched IP address. If an IP address belongs to two different zones, the straitest match is the most specific zone.

[Example] Example 5.36. Finding IP networks

Suppose there are three zones configured: Zone_A containing the 10.0.0.0/8 network, Zone_B containing the 10.0.0.0/16 network, and Zone_C containing the 10.0.0.25 IP address. Searching for the 10.0.44.0 network returns Zone_B, because that is the most specific zone matching the searched IP address. Similarly, searching for 10.0.0.25 returns only Zone_C.

This approach is used in the service definitions as well: when a client sends a connection request, Zorp looks for the most specific zone containing the IP address of the client. Suppose that the clients in Zone_A are allowed to use HTTP. If a client with IP 10.0.0.50 (thus belonging to Zone_B) can only use HTTP if Zone_B is the child of Zone_A, or if a service definition explicitly permits Zone_B to use HTTP.

[Example] Example 5.37. Zone examples

The following example defines a simple zone hierarchy. The following zones are defined:

  • internet: This zone contains every possible IP addresses, if an IP address does not belong to another zone, than it belongs to the internet zone. This zone accepts HTTP requests coming from the office zone, and can access the public HTTP and FTP services of the DMZ zone.

  • office: This zone contains the 192.168.1.0/32 and 192.168.2.0/32 networks. The office zone can access the HTTP services of the internet zone, and use FTP to access the DMZ zone. External connections are not permitted to enter the zone (no inbound_services are defined).

  • management: This zone is separated from the office zone, because it contans an independent subnet 192.168.3.0/32 . But from the Zorp administrator's view, it is the child zone of the office zone, meaning that it can use (and accept) the same services as the office zone: HTTP to the internet zone, and FTP to the DMZ zone.

  • DMZ: This zone can accept connections HTTP and FTP connections from other zones, but cannot start external connections.

InetZone('internet', ['0.0.0.0/0'],
    inbound_services=[
        "office_http_inter"],
    outbound_services=[
        "inter_http_dmz",
        "inter_ftp_dmz"])

InetZone('office', ['192.168.1.0/32', '192.168.2.0/32'],
    outbound_services=[
        "office_http_inter",
        "office_ftp_dmz"])

InetZone('management', ['192.168.3.0/32'],
    admin_parent='office')

InetZone('DMZ', ['10.50.0.0/32'],
    inbound_services=[
        "office_ftp_dmz",
        "inter_http_dmz",
        "inter_ftp_dmz"])

5.19.1. Classes in the Zone module

Class Description
InetZone Class encapsulating IPv4 zones.

Table 5.86. Classes of the Zone module


5.19.2. Class InetZone

This class encapsulates an IPv4 zone; each zone contains one or more IPv4 subnets. An IP address always belongs to the most specific zone.

[Example] Example 5.38. Determining the zone of an IP address

An IP address always belongs to the most specific zone. Suppose that Zone A includes the IP network 10.0.0.0/8 and Zone B includes the network 10.0.1.0/24. In this case, a client machine with the 10.0.1.100/32 IP address belongs to both zones from an IP addressing point of view. But Zone B is more specific (in CIDR terms), so the client machine belongs to Zone B in Zorp.

5.19.2.1. InetZone methods

Method Description
__init__(self, name, addr, inbound_services, outbound_services, admin_parent, umbrella, inherit_name) Constructor to initialize an InetZone instance

Table 5.87. Method summary


Method __init__(self, name, addr, inbound_services, outbound_services, admin_parent, umbrella, inherit_name)

Arguments of __init__
addr (complex)
Default: n/a
A string representing an address range interpreted by the domain class (last argument), *or* a list of strings representing multiple address ranges.

admin_parent (string)
Default: n/a
Name of the administrative parent zone. If set, the current zone inherits the lists of permitted inbound and outbound services from its administrative parent zone.

inbound_services (complex)
Default: n/a
A comma-separated list of services permitted to enter the zone.

name (string)
Default: n/a
Name of the zone.

outbound_services (complex)
Default: n/a
A comma-separated list of services permitted to leave the zone.

umbrella (boolean)
Default: n/a
Enable this option for umbrella zones. Umbrella zones do not inherit the security attributes (list of permitted services) of their administrative parents.

This constructor initializes an InetZone object.

5.20. Module Zorp

This module defines global constants (e.g., TRUE and FALSE) used by other Zorp components, and interface entry points to the Zorp core.

5.20.1. Functions in module Zorp

Function Description
log Function to send a message to the system log.

Table 5.88. Function summary


5.20.2. Functions

5.20.2.1. Function log(sessionid, logclass, verbosity, msg, args)

Arguments of log
args (string)
Default: n/a
Optional printf-style argument tuple added to the message.

logclass (string)
Default: n/a
Hierarchical log class as described in the zorp(8) manual page

msg (string)
Default: n/a
The message text.

sessionid (string)
Default: n/a
The ID of the session the message belongs to.

verbosity (integer)
Default: n/a
Verbosity level of the message.

This function can be used to send a message to the system log.

Appendix 1. Additional proxy information

1.1. NNTP appendix

Predefined constants are available for NNTP response codes for easier use. These are listed in the following table.

Name Value
NNTP_S_HELP_TEXT 100
NNTP_S_DATE_RESPONSE 111
NNTP_S_DEBUG 199
NNTP_S_SERVER_READY_POSTING 200
NNTP_S_SERVER_READY_NO_POSTING 201
NNTP_S_SLAVE_NOTED 202
NNTP_S_STREAMING_OK 203
NNTP_S_CLOSING 205
NNTP_S_GROUP_SELECTED 211
NNTP_S_ART_LIST_FOLLOWS 211
NNTP_S_LIST_GROUPS_FOLLOWS 215
NNTP_S_TIN_INDEX_FOLLOWS 218
NNTP_S_ART_RETR_HEAD_BODY_FOLLOWS 220
NNTP_S_ART_RETR_HEAD_FOLLOWS 221
NNTP_S_ART_RETR_BODY_FOLLOWS 222
NNTP_S_ART_RETR_REQUEST_SEPARATELY 223
NNTP_S_PATH_REPLY 223
NNTP_S_OVERVIEW_FOLLOWS 224
NNTP_S_LIST_NEW_ART_FOLLOWS 230
NNTP_S_LIST_NEW_GROUPS_FOLLOWS 231
NNTP_S_ART_TRANS_OK 235
NNTP_S_NO_SUCH_ARTICLE_SEND_IT 238
NNTP_S_ART_TRANS_OK_TAKETHIS 239
NNTP_S_ART_POSTED_OK 240
NNTP_S_AUTH_SIMPLE_ACCEPTED 250
NNTP_S_AUTH_ACCEPTED 281
NNTP_S_LIST_GROUPS_DESC_FOLLOWS 282
NNTP_S_BIN_DATA_FOLLOWS 288
NNTP_S_SEND_ART_TRANS 335
NNTP_S_SEND_ART_POSTED 340
NNTP_S_AUTH_SIMPLE_CONTINUE 350
NNTP_S_MORE_AUTH_INFO_REQUIRED 381
NNTP_S_SERVICE_DISCONTINUED 400
NNTP_S_NO_SUCH_GROUP 411
NNTP_S_NO_CURRENT_GROUP 412
NNTP_S_NO_TIN_INDEX 418
NNTP_S_NO_CURRENT_ART 420
NNTP_S_NO_NEXT_ART 421
NNTP_S_NO_PREV_ART 422
NNTP_S_NO_SUCH_ART_NUMBER 423
NNTP_S_NO_SUCH_ART_FOUND 430
NNTP_S_TRY_SENDING_LATER 431
NNTP_S_ART_NOT_WANTED 435
NNTP_S_TRANS_FAILED_TRY_AGAIN 436
NNTP_S_ART_REJECTED 437
NNTP_S_HAVE_IT_DONT_SEND 438
NNTP_S_TRANS_FAILED_TAKETHIS 439
NNTP_S_POST_NOT_ALLOWED 440
NNTP_S_POSTING_FAILED 441
NNTP_S_AUTH_SIMPLE_REQUIRED 450
NNTP_S_AUTH_SIMPLE_REJECTED 452
NNTP_S_TRANS_PERM_DENIED 480
NNTP_S_AUTH_REQUIRED 480
NNTP_S_GROUP_DESC_UNAVAILABLE 481
NNTP_S_AUTH_REJECTED 482
NNTP_S_COMMAND_NOT_RECOGNIZED 500
NNTP_S_SYNTAX_ERROR 501
NNTP_S_PERM_DENIED 502
NNTP_S_PROGRAM_FAULT 503

Table 1.1.  Constants for NNTP responses


1.2. RADIUS appendix

The list of RADIUS attributes as defined by the RADIUS RFC with their symbolic names:

Name Value
RADIUS_USER_name "1"
RADIUS_USER_PASSWORD "2"
RADIUS_CHAP_PASSWORD "3"
RADIUS_NAS_IP_ADDRESS "4"
RADIUS_NAS_PORT "5"
RADIUS_SERVICE_TYPE "6"
RADIUS_FRAMED_PROTOCOL "7"
RADIUS_FRAMED_IP_ADDRESS "8"
RADIUS_FRAMED_IP_NETMASK "9"
RADIUS_FRAMED_ROUTING "10"
RADIUS_FILTER_ID "11"
RADIUS_FRAMED_MTU "12"
RADIUS_FRAMED_COMPRESSION "13"
RADIUS_LOGIN_IP_HOST "14"
RADIUS_LOGIN_SERVICE "15"
RADIUS_LOGIN_TCP_PORT "16"
RADIUS_REPLY_MESSAGE "18"
RADIUS_CALLBACK_NUMBER "19"
RADIUS_CALLBACK_ID "20"
RADIUS_FRAMED_ROUTE "22"
RADIUS_FRAMED_IPX_NETWORK "23"
RADIUS_STATE "24"
RADIUS_CLASS "25"
RADIUS_VENDOR_SPECIFIC "26"
RADIUS_SESSION_TIMEOUT "27"
RADIUS_IDLE_TIMEOUT "28"
RADIUS_TERMINATION_ACTION "29"
RADIUS_CALLED_STATION_ID "30"
RADIUS_CALLING_STATION_ID "31"
RADIUS_NAS_IDENTIFIER "32"
RADIUS_PROXY_STATE "33"
RADIUS_LOGIN_LAT_SERVICE "34"
RADIUS_LOGIN_LAT_NODE "35"
RADIUS_LOGIN_LAT_GROUP "36"
RADIUS_FRAMED_APPLETALK_LINK "37"
RADIUS_FRAMED_APPLETALK_NETWORK "38"
RADIUS_FRAMED_APPLETALK_ZONE "39"
RADIUS_ACCT_STATUS_TYPE "40"
RADIUS_ACCT_DELAY_TIME "41"
RADIUS_ACCT_INPUT_OCTETS "42"
RADIUS_ACCT_OUTPUT_OCTETS "43"
RADIUS_ACCT_SESSION_ID "44"
RADIUS_ACCT_AUTHENTIC "45"
RADIUS_ACCT_SESSION_TIME "46"
RADIUS_ACCT_INPUT_PACKETS "47"
RADIUS_ACCT_OUTPUT_PACKETS "48"
RADIUS_ACCT_TERMINATE_CAUSE "49"
RADIUS_ACCT_MULTI_SESSION_ID "50"
RADIUS_ACCT_LINK_COUNT "51"
RADIUS_ACCT_INPUT_GIGAWORDS "52"
RADIUS_ACCT_OUTPUT_GIGAWORDS "53"
RADIUS_EVENT_TIMESTAMP "55"
RADIUS_CHAP_CHALLENGE "60"
RADIUS_NAS_PORT_TYPE "61"
RADIUS_PORT_LIMIT "62"
RADIUS_LOGIN_LAT_PORT "63"
RADIUS_TUNNEL_TYPE "64"
RADIUS_TUNNEL_MEDIUM_TYPE "65"
RADIUS_TUNNEL_CLIENT_ENDPOINT "66"
RADIUS_TUNNEL_SERVER_ENDPOINT "67"
RADIUS_ACCT_TUNNEL_CONNECTION "68"
RADIUS_TUNNEL_PASSWORD "69"
RADIUS_ARAP_PASSWORD "70"
RADIUS_ARAP_FEATURES "71"
RADIUS_ARAP_ZONE_ACCESS "72"
RADIUS_ARAP_SECURITY "73"
RADIUS_ARAP_SECURITY_DATA "74"
RADIUS_PASSWORD_RETRY "75"
RADIUS_PROMPT "76"
RADIUS_CONNECT_INFO "77"
RADIUS_CONFIGURATION_TOKEN "78"
RADIUS_EAP_MESSAGE "79"
RADIUS_MESSAGE_AUTHENTICATOR "80"
RADIUS_TUNNEL_PRIVATE_GROUP_ID "81"
RADIUS_TUNNEL_ASSIGNMENT_ID "82"
RADIUS_TUNNEL_PREFERENCE "83"
RADIUS_ARAP_CHALLENGE_RESPONSE "84"
RADIUS_ACCT_INTERIM_INTERVAL "85"
RADIUS_ACCT_TUNNEL_PACKETS_LOST "86"
RADIUS_NAS_PORT_ID "87"
RADIUS_FRAMED_POOL "88"
RADIUS_TUNNEL_CLIENT_AUTH_ID "90"
RADIUS_TUNNEL_SERVER_AUTH_ID "91"

Table 1.2.  RADIUS Protocol Attribute types described in RFC 2865.


Action Attribute Attribute policy
radius_access_request radius_user_name RADIUS_ATR_MAXONE
radius_access_request radius_user_password RADIUS_ATR_MAXONE
radius_access_request radius_chap_password RADIUS_ATR_MAXONE
radius_access_request radius_nas_ip_address RADIUS_ATR_MAXONE
radius_access_request radius_nas_port RADIUS_ATR_MAXONE
radius_access_request radius_service_type RADIUS_ATR_MAXONE
radius_access_request radius_framed_protocol RADIUS_ATR_MAXONE
radius_access_request radius_framed_ip_address RADIUS_ATR_MAXONE
radius_access_request radius_framed_ip_netmask RADIUS_ATR_MAXONE
radius_access_request radius_framed_routing RADIUS_ATR_ZERO
radius_access_request radius_filter_id RADIUS_ATR_ZERO
radius_access_request radius_framed_mtu RADIUS_ATR_MAXONE
radius_access_request radius_framed_compression RADIUS_ATR_MANY
radius_access_request radius_login_ip_host RADIUS_ATR_MANY
radius_access_request radius_login_service RADIUS_ATR_ZERO
radius_access_request radius_login_tcp_port RADIUS_ATR_ZERO
radius_access_request radius_reply_message RADIUS_ATR_ZERO
radius_access_request radius_callback_number RADIUS_ATR_MAXONE
radius_access_request radius_callback_id RADIUS_ATR_ZERO
radius_access_request radius_framed_route RADIUS_ATR_ZERO
radius_access_request radius_framed_ipx_network RADIUS_ATR_ZERO
radius_access_request radius_state RADIUS_ATR_MAXONE
radius_access_request radius_class RADIUS_ATR_ZERO
radius_access_request radius_vendor_specific RADIUS_ATR_MANY
radius_access_request radius_session_timeout RADIUS_ATR_ZERO
radius_access_request radius_idle_timeout RADIUS_ATR_ZERO
radius_access_request radius_termination_action RADIUS_ATR_ZERO
radius_access_request radius_called_station_id RADIUS_ATR_MAXONE
radius_access_request radius_calling_station_id RADIUS_ATR_MAXONE
radius_access_request radius_nas_identifier RADIUS_ATR_MAXONE
radius_access_request radius_proxy_state RADIUS_ATR_MANY
radius_access_request radius_login_lat_service RADIUS_ATR_MAXONE
radius_access_request radius_login_lat_node RADIUS_ATR_MAXONE
radius_access_request radius_login_lat_group RADIUS_ATR_MAXONE
radius_access_request radius_framed_appletalk_link RADIUS_ATR_ZERO
radius_access_request radius_framed_appletalk_network RADIUS_ATR_ZERO
radius_access_request radius_framed_appletalk_zone RADIUS_ATR_ZERO
radius_access_request radius_chap_challenge RADIUS_ATR_MAXONE
radius_access_request radius_nas_port_type RADIUS_ATR_MAXONE
radius_access_request radius_port_limit RADIUS_ATR_MAXONE
radius_access_request radius_login_lat_port RADIUS_ATR_MAXONE
radius_access_request radius_tunnel_type RADIUS_ATR_MANY
radius_access_request radius_tunnel_medium_type RADIUS_ATR_MANY
radius_access_request radius_tunnel_client_endpoint RADIUS_ATR_MANY
radius_access_request radius_tunnel_server_endpoint RADIUS_ATR_MANY
radius_access_request radius_tunnel_password RADIUS_ATR_ZERO
radius_access_request radius_arap_password RADIUS_ATR_MAXONE
radius_access_request radius_arap_features RADIUS_ATR_ZERO
radius_access_request radius_arap_zone_access RADIUS_ATR_ZERO
radius_access_request radius_arap_security RADIUS_ATR_MAXONE
radius_access_request radius_arap_security_data RADIUS_ATR_MANY
radius_access_request radius_password_retry RADIUS_ATR_ZERO
radius_access_request radius_prompt RADIUS_ATR_ZERO
radius_access_request radius_connect_info RADIUS_ATR_MAXONE
radius_access_request radius_configuration_token RADIUS_ATR_ZERO
radius_access_request radius_eap_message RADIUS_ATR_MANY
radius_access_request radius_message_authenticator RADIUS_ATR_MAXONE
radius_access_request radius_tunnel_private_group_id RADIUS_ATR_MANY
radius_access_request radius_tunnel_assignment_id RADIUS_ATR_ZERO
radius_access_request radius_tunnel_preference RADIUS_ATR_MANY
radius_access_request radius_arap_challenge_response RADIUS_ATR_ZERO
radius_access_request radius_acct_interim_interval RADIUS_ATR_ZERO
radius_access_request radius_nas_port_id RADIUS_ATR_MAXONE
radius_access_request radius_framed_pool RADIUS_ATR_ZERO
radius_access_request radius_tunnel_client_auth_id RADIUS_ATR_MANY
radius_access_request radius_tunnel_server_auth_id RADIUS_ATR_MANY
radius_access_accept radius_user_name RADIUS_ATR_MAXONE
radius_access_accept radius_user_password RADIUS_ATR_ZERO
radius_access_accept radius_chap_password RADIUS_ATR_ZERO
radius_access_accept radius_nas_ip_address RADIUS_ATR_ZERO
radius_access_accept radius_nas_port RADIUS_ATR_ZERO
radius_access_accept radius_service_type RADIUS_ATR_MAXONE
radius_access_accept radius_framed_protocol RADIUS_ATR_MAXONE
radius_access_accept radius_framed_ip_address RADIUS_ATR_MAXONE
radius_access_accept radius_framed_ip_netmask RADIUS_ATR_MAXONE
radius_access_accept radius_framed_routing RADIUS_ATR_MAXONE
radius_access_accept radius_filter_id RADIUS_ATR_MANY
radius_access_accept radius_framed_mtu RADIUS_ATR_MAXONE
radius_access_accept radius_framed_compression RADIUS_ATR_MANY
radius_access_accept radius_login_ip_host RADIUS_ATR_MANY
radius_access_accept radius_login_service RADIUS_ATR_MAXONE
radius_access_accept radius_login_tcp_port RADIUS_ATR_MAXONE
radius_access_accept radius_reply_message RADIUS_ATR_MANY
radius_access_accept radius_callback_number RADIUS_ATR_MAXONE
radius_access_accept radius_callback_id RADIUS_ATR_MAXONE
radius_access_accept radius_framed_route RADIUS_ATR_MANY
radius_access_accept radius_framed_ipx_network RADIUS_ATR_MAXONE
radius_access_accept radius_state RADIUS_ATR_MAXONE
radius_access_accept radius_class RADIUS_ATR_MANY
radius_access_accept radius_vendor_specific RADIUS_ATR_MANY
radius_access_accept radius_session_timeout RADIUS_ATR_MAXONE
radius_access_accept radius_idle_timeout RADIUS_ATR_MAXONE
radius_access_accept radius_termination_action RADIUS_ATR_MAXONE
radius_access_accept radius_called_station_id RADIUS_ATR_ZERO
radius_access_accept radius_calling_station_id RADIUS_ATR_ZERO
radius_access_accept radius_nas_identifier RADIUS_ATR_ZERO
radius_access_accept radius_proxy_state RADIUS_ATR_MANY
radius_access_accept radius_login_lat_service RADIUS_ATR_MAXONE
radius_access_accept radius_login_lat_node RADIUS_ATR_MAXONE
radius_access_accept radius_login_lat_group RADIUS_ATR_MAXONE
radius_access_accept radius_framed_appletalk_link RADIUS_ATR_MAXONE
radius_access_accept radius_framed_appletalk_network RADIUS_ATR_MANY
radius_access_accept radius_framed_appletalk_zone RADIUS_ATR_MAXONE
radius_access_accept radius_chap_challenge RADIUS_ATR_ZERO
radius_access_accept radius_nas_port_type RADIUS_ATR_ZERO
radius_access_accept radius_port_limit RADIUS_ATR_MAXONE
radius_access_accept radius_login_lat_port RADIUS_ATR_MAXONE
radius_access_accept radius_tunnel_type RADIUS_ATR_MANY
radius_access_accept radius_tunnel_medium_type RADIUS_ATR_MANY
radius_access_accept radius_tunnel_client_endpoint RADIUS_ATR_MANY
radius_access_accept radius_tunnel_server_endpoint RADIUS_ATR_MANY
radius_access_accept radius_tunnel_password RADIUS_ATR_MANY
radius_access_accept radius_arap_password RADIUS_ATR_ZERO
radius_access_accept radius_arap_features RADIUS_ATR_MAXONE
radius_access_accept radius_arap_zone_access RADIUS_ATR_MAXONE
radius_access_accept radius_arap_security RADIUS_ATR_ZERO
radius_access_accept radius_arap_security_data RADIUS_ATR_ZERO
radius_access_accept radius_password_retry RADIUS_ATR_ZERO
radius_access_accept radius_prompt RADIUS_ATR_ZERO
radius_access_accept radius_connect_info RADIUS_ATR_ZERO
radius_access_accept radius_configuration_token RADIUS_ATR_MANY
radius_access_accept radius_eap_message RADIUS_ATR_MANY
radius_access_accept radius_message_authenticator RADIUS_ATR_MAXONE
radius_access_accept radius_tunnel_private_group_id RADIUS_ATR_MANY
radius_access_accept radius_tunnel_assignment_id RADIUS_ATR_MANY
radius_access_accept radius_tunnel_preference RADIUS_ATR_MANY
radius_access_accept radius_arap_challenge_response RADIUS_ATR_MAXONE
radius_access_accept radius_acct_interim_interval RADIUS_ATR_MAXONE
radius_access_accept radius_nas_port_id RADIUS_ATR_ZERO
radius_access_accept radius_framed_pool RADIUS_ATR_MAXONE
radius_access_accept radius_tunnel_client_auth_id RADIUS_ATR_MANY
radius_access_accept radius_tunnel_server_auth_id RADIUS_ATR_MANY
radius_access_reject radius_user_name RADIUS_ATR_ZERO
radius_access_reject radius_user_password RADIUS_ATR_ZERO
radius_access_reject radius_chap_password RADIUS_ATR_ZERO
radius_access_reject radius_nas_ip_address RADIUS_ATR_ZERO
radius_access_reject radius_nas_port RADIUS_ATR_ZERO
radius_access_reject radius_service_type RADIUS_ATR_ZERO
radius_access_reject radius_framed_protocol RADIUS_ATR_ZERO
radius_access_reject radius_framed_ip_address RADIUS_ATR_ZERO
radius_access_reject radius_framed_ip_netmask RADIUS_ATR_ZERO
radius_access_reject radius_framed_routing RADIUS_ATR_ZERO
radius_access_reject radius_filter_id RADIUS_ATR_ZERO
radius_access_reject radius_framed_mtu RADIUS_ATR_ZERO
radius_access_reject radius_framed_compression RADIUS_ATR_ZERO
radius_access_reject radius_login_ip_host RADIUS_ATR_ZERO
radius_access_reject radius_login_service RADIUS_ATR_ZERO
radius_access_reject radius_login_tcp_port RADIUS_ATR_ZERO
radius_access_reject radius_reply_message RADIUS_ATR_MANY
radius_access_reject radius_callback_number RADIUS_ATR_ZERO
radius_access_reject radius_callback_id RADIUS_ATR_ZERO
radius_access_reject radius_framed_route RADIUS_ATR_ZERO
radius_access_reject radius_framed_ipx_network RADIUS_ATR_ZERO
radius_access_reject radius_state RADIUS_ATR_ZERO
radius_access_reject radius_class RADIUS_ATR_ZERO
radius_access_reject radius_vendor_specific RADIUS_ATR_ZERO
radius_access_reject radius_session_timeout RADIUS_ATR_ZERO
radius_access_reject radius_idle_timeout RADIUS_ATR_ZERO
radius_access_reject radius_termination_action RADIUS_ATR_ZERO
radius_access_reject radius_called_station_id RADIUS_ATR_ZERO
radius_access_reject radius_calling_station_id RADIUS_ATR_ZERO
radius_access_reject radius_nas_identifier RADIUS_ATR_ZERO
radius_access_reject radius_proxy_state RADIUS_ATR_MANY
radius_access_reject radius_login_lat_service RADIUS_ATR_ZERO
radius_access_reject radius_login_lat_node RADIUS_ATR_ZERO
radius_access_reject radius_login_lat_group RADIUS_ATR_ZERO
radius_access_reject radius_framed_appletalk_link RADIUS_ATR_ZERO
radius_access_reject radius_framed_appletalk_network RADIUS_ATR_ZERO
radius_access_reject radius_framed_appletalk_zone RADIUS_ATR_ZERO
radius_access_reject radius_chap_challenge RADIUS_ATR_ZERO
radius_access_reject radius_nas_port_type RADIUS_ATR_ZERO
radius_access_reject radius_port_limit RADIUS_ATR_ZERO
radius_access_reject radius_login_lat_port RADIUS_ATR_ZERO
radius_access_reject radius_tunnel_type RADIUS_ATR_ZERO
radius_access_reject radius_tunnel_medium_type RADIUS_ATR_ZERO
radius_access_reject radius_tunnel_client_endpoint RADIUS_ATR_ZERO
radius_access_reject radius_tunnel_server_endpoint RADIUS_ATR_ZERO
radius_access_reject radius_tunnel_password RADIUS_ATR_ZERO
radius_access_reject radius_arap_password RADIUS_ATR_ZERO
radius_access_reject radius_arap_features RADIUS_ATR_ZERO
radius_access_reject radius_arap_zone_access RADIUS_ATR_ZERO
radius_access_reject radius_arap_security RADIUS_ATR_ZERO
radius_access_reject radius_arap_security_data RADIUS_ATR_ZERO
radius_access_reject radius_password_retry RADIUS_ATR_MAXONE
radius_access_reject radius_prompt RADIUS_ATR_ZERO
radius_access_reject radius_connect_info RADIUS_ATR_ZERO
radius_access_reject radius_configuration_token RADIUS_ATR_ZERO
radius_access_reject radius_eap_message RADIUS_ATR_MANY
radius_access_reject radius_message_authenticator RADIUS_ATR_MAXONE
radius_access_reject radius_tunnel_private_group_id RADIUS_ATR_ZERO
radius_access_reject radius_tunnel_assignment_id RADIUS_ATR_ZERO
radius_access_reject radius_tunnel_preference RADIUS_ATR_ZERO
radius_access_reject radius_arap_challenge_response RADIUS_ATR_ZERO
radius_access_reject radius_acct_interim_interval RADIUS_ATR_ZERO
radius_access_reject radius_nas_port_id RADIUS_ATR_ZERO
radius_access_reject radius_framed_pool RADIUS_ATR_ZERO
radius_access_reject radius_tunnel_client_auth_id RADIUS_ATR_ZERO
radius_access_reject radius_tunnel_server_auth_id RADIUS_ATR_ZERO
radius_accounting_request radius_user_name RADIUS_ATR_MAXONE
radius_accounting_request radius_user_password RADIUS_ATR_ZERO
radius_accounting_request radius_chap_password RADIUS_ATR_ZERO
radius_accounting_request radius_nas_ip_address RADIUS_ATR_MAXONE
radius_accounting_request radius_nas_port RADIUS_ATR_MAXONE
radius_accounting_request radius_service_type RADIUS_ATR_MAXONE
radius_accounting_request radius_framed_protocol RADIUS_ATR_MAXONE
radius_accounting_request radius_framed_ip_address RADIUS_ATR_MAXONE
radius_accounting_request radius_framed_ip_netmask RADIUS_ATR_MAXONE
radius_accounting_request radius_framed_routing RADIUS_ATR_MAXONE
radius_accounting_request radius_filter_id RADIUS_ATR_MANY
radius_accounting_request radius_framed_mtu RADIUS_ATR_MAXONE
radius_accounting_request radius_framed_compression RADIUS_ATR_MANY
radius_accounting_request radius_login_ip_host RADIUS_ATR_MANY
radius_accounting_request radius_login_service RADIUS_ATR_MAXONE
radius_accounting_request radius_login_tcp_port RADIUS_ATR_MAXONE
radius_accounting_request radius_reply_message RADIUS_ATR_ZERO
radius_accounting_request radius_callback_number RADIUS_ATR_MAXONE
radius_accounting_request radius_callback_id RADIUS_ATR_MAXONE
radius_accounting_request radius_framed_route RADIUS_ATR_MANY
radius_accounting_request radius_framed_ipx_network RADIUS_ATR_MAXONE
radius_accounting_request radius_state RADIUS_ATR_ZERO
radius_accounting_request radius_class RADIUS_ATR_MANY
radius_accounting_request radius_vendor_specific RADIUS_ATR_MANY
radius_accounting_request radius_session_timeout RADIUS_ATR_MAXONE
radius_accounting_request radius_idle_timeout RADIUS_ATR_MAXONE
radius_accounting_request radius_termination_action RADIUS_ATR_MAXONE
radius_accounting_request radius_called_station_id RADIUS_ATR_MAXONE
radius_accounting_request radius_calling_station_id RADIUS_ATR_MAXONE
radius_accounting_request radius_nas_identifier RADIUS_ATR_MAXONE
radius_accounting_request radius_proxy_state RADIUS_ATR_MANY
radius_accounting_request radius_login_lat_service RADIUS_ATR_MAXONE
radius_accounting_request radius_login_lat_node RADIUS_ATR_MAXONE
radius_accounting_request radius_login_lat_group RADIUS_ATR_MAXONE
radius_accounting_request radius_framed_appletalk_link RADIUS_ATR_MAXONE
radius_accounting_request radius_framed_appletalk_network RADIUS_ATR_MAXONE
radius_accounting_request radius_framed_appletalk_zone RADIUS_ATR_MAXONE
radius_accounting_request radius_acct_status_type RADIUS_ATR_ONE
radius_accounting_request radius_acct_delay_time RADIUS_ATR_MAXONE
radius_accounting_request radius_acct_input_octets RADIUS_ATR_MAXONE
radius_accounting_request radius_acct_output_octets RADIUS_ATR_MAXONE
radius_accounting_request radius_acct_session_id RADIUS_ATR_ONE
radius_accounting_request radius_acct_authentic RADIUS_ATR_MAXONE
radius_accounting_request radius_acct_session_time RADIUS_ATR_MAXONE
radius_accounting_request radius_acct_input_packets RADIUS_ATR_MAXONE
radius_accounting_request radius_acct_output_packets RADIUS_ATR_MAXONE
radius_accounting_request radius_acct_terminate_cause RADIUS_ATR_MAXONE
radius_accounting_request radius_acct_multi_session_id RADIUS_ATR_MANY
radius_accounting_request radius_acct_link_count RADIUS_ATR_MANY
radius_accounting_request radius_acct_input_gigawords RADIUS_ATR_MAXONE
radius_accounting_request radius_acct_output_gigawords RADIUS_ATR_MAXONE
radius_accounting_request radius_event_timestamp RADIUS_ATR_MAXONE
radius_accounting_request radius_chap_challenge RADIUS_ATR_ZERO
radius_accounting_request radius_nas_port_type RADIUS_ATR_MAXONE
radius_accounting_request radius_port_limit RADIUS_ATR_MAXONE
radius_accounting_request radius_login_lat_port RADIUS_ATR_MAXONE
radius_accounting_request radius_tunnel_type RADIUS_ATR_MAXONE
radius_accounting_request radius_tunnel_medium_type RADIUS_ATR_MAXONE
radius_accounting_request radius_tunnel_client_endpoint RADIUS_ATR_MAXONE
radius_accounting_request radius_tunnel_server_endpoint RADIUS_ATR_MAXONE
radius_accounting_request radius_acct_tunnel_connection RADIUS_ATR_MAXONE
radius_accounting_request radius_tunnel_password RADIUS_ATR_ZERO
radius_accounting_request radius_arap_password RADIUS_ATR_ZERO
radius_accounting_request radius_arap_features RADIUS_ATR_ZERO
radius_accounting_request radius_arap_zone_access RADIUS_ATR_ZERO
radius_accounting_request radius_arap_security RADIUS_ATR_ZERO
radius_accounting_request radius_arap_security_data RADIUS_ATR_ZERO
radius_accounting_request radius_password_retry RADIUS_ATR_ZERO
radius_accounting_request radius_prompt RADIUS_ATR_ZERO
radius_accounting_request radius_connect_info RADIUS_ATR_MANY
radius_accounting_request radius_configuration_token RADIUS_ATR_ZERO
radius_accounting_request radius_eap_message RADIUS_ATR_ZERO
radius_accounting_request radius_message_authenticator RADIUS_ATR_ZERO
radius_accounting_request radius_tunnel_private_group_id RADIUS_ATR_MAXONE
radius_accounting_request radius_tunnel_assignment_id RADIUS_ATR_MAXONE
radius_accounting_request radius_tunnel_preference RADIUS_ATR_ZERO
radius_accounting_request radius_arap_challenge_response RADIUS_ATR_ZERO
radius_accounting_request radius_acct_interim_interval RADIUS_ATR_ZERO
radius_accounting_request radius_acct_tunnel_packets_lost RADIUS_ATR_MAXONE
radius_accounting_request radius_nas_port_id RADIUS_ATR_MAXONE
radius_accounting_request radius_framed_pool RADIUS_ATR_ZERO
radius_accounting_request radius_tunnel_client_auth_id RADIUS_ATR_MAXONE
radius_accounting_request radius_tunnel_server_auth_id RADIUS_ATR_MAXONE
radius_accounting_response radius_user_name RADIUS_ATR_ZERO
radius_accounting_response radius_user_password RADIUS_ATR_ZERO
radius_accounting_response radius_chap_password RADIUS_ATR_ZERO
radius_accounting_response radius_nas_ip_address RADIUS_ATR_ZERO
radius_accounting_response radius_nas_port RADIUS_ATR_ZERO
radius_accounting_response radius_service_type RADIUS_ATR_ZERO
radius_accounting_response radius_framed_protocol RADIUS_ATR_ZERO
radius_accounting_response radius_framed_ip_address RADIUS_ATR_ZERO
radius_accounting_response radius_framed_ip_netmask RADIUS_ATR_ZERO
radius_accounting_response radius_framed_routing RADIUS_ATR_ZERO
radius_accounting_response radius_filter_id RADIUS_ATR_ZERO
radius_accounting_response radius_framed_mtu RADIUS_ATR_ZERO
radius_accounting_response radius_framed_compression RADIUS_ATR_ZERO
radius_accounting_response radius_login_ip_host RADIUS_ATR_ZERO
radius_accounting_response radius_login_service RADIUS_ATR_ZERO
radius_accounting_response radius_login_tcp_port RADIUS_ATR_ZERO
radius_accounting_response radius_reply_message RADIUS_ATR_ZERO
radius_accounting_response radius_callback_number RADIUS_ATR_ZERO
radius_accounting_response radius_callback_id RADIUS_ATR_ZERO
radius_accounting_response radius_framed_route RADIUS_ATR_ZERO
radius_accounting_response radius_framed_ipx_network RADIUS_ATR_ZERO
radius_accounting_response radius_state RADIUS_ATR_ZERO
radius_accounting_response radius_class RADIUS_ATR_ZERO
radius_accounting_response radius_vendor_specific RADIUS_ATR_MANY
radius_accounting_response radius_session_timeout RADIUS_ATR_ZERO
radius_accounting_response radius_idle_timeout RADIUS_ATR_ZERO
radius_accounting_response radius_termination_action RADIUS_ATR_ZERO
radius_accounting_response radius_called_station_id RADIUS_ATR_ZERO
radius_accounting_response radius_calling_station_id RADIUS_ATR_ZERO
radius_accounting_response radius_nas_identifier RADIUS_ATR_ZERO
radius_accounting_response radius_proxy_state RADIUS_ATR_MANY
radius_accounting_response radius_login_lat_service RADIUS_ATR_ZERO
radius_accounting_response radius_login_lat_node RADIUS_ATR_ZERO
radius_accounting_response radius_login_lat_group RADIUS_ATR_ZERO
radius_accounting_response radius_framed_appletalk_link RADIUS_ATR_ZERO
radius_accounting_response radius_framed_appletalk_network RADIUS_ATR_ZERO
radius_accounting_response radius_framed_appletalk_zone RADIUS_ATR_ZERO
radius_accounting_response radius_acct_status_type RADIUS_ATR_ZERO
radius_accounting_response radius_acct_delay_time RADIUS_ATR_ZERO
radius_accounting_response radius_acct_input_octets RADIUS_ATR_ZERO
radius_accounting_response radius_acct_output_octets RADIUS_ATR_ZERO
radius_accounting_response radius_acct_session_id RADIUS_ATR_ZERO
radius_accounting_response radius_acct_authentic RADIUS_ATR_ZERO
radius_accounting_response radius_acct_session_time RADIUS_ATR_ZERO
radius_accounting_response radius_acct_input_packets RADIUS_ATR_ZERO
radius_accounting_response radius_acct_output_packets RADIUS_ATR_ZERO
radius_accounting_response radius_acct_terminate_cause RADIUS_ATR_ZERO
radius_accounting_response radius_acct_multi_session_id RADIUS_ATR_ZERO
radius_accounting_response radius_acct_link_count RADIUS_ATR_ZERO
radius_accounting_response radius_chap_challenge RADIUS_ATR_ZERO
radius_accounting_response radius_nas_port_type RADIUS_ATR_ZERO
radius_accounting_response radius_port_limit RADIUS_ATR_ZERO
radius_accounting_response radius_login_lat_port RADIUS_ATR_ZERO
radius_accounting_response radius_tunnel_type RADIUS_ATR_ZERO
radius_accounting_response radius_tunnel_medium_type RADIUS_ATR_ZERO
radius_accounting_response radius_tunnel_client_endpoint RADIUS_ATR_ZERO
radius_accounting_response radius_tunnel_server_endpoint RADIUS_ATR_ZERO
radius_accounting_response radius_acct_tunnel_connection RADIUS_ATR_ZERO
radius_accounting_response radius_tunnel_password RADIUS_ATR_ZERO
radius_accounting_response radius_tunnel_private_group_id RADIUS_ATR_ZERO
radius_accounting_response radius_tunnel_assignment_id RADIUS_ATR_ZERO
radius_accounting_response radius_tunnel_preference RADIUS_ATR_ZERO
radius_accounting_response radius_acct_tunnel_packets_lost RADIUS_ATR_ZERO
radius_access_challenge radius_user_name RADIUS_ATR_ZERO
radius_access_challenge radius_user_password RADIUS_ATR_ZERO
radius_access_challenge radius_chap_password RADIUS_ATR_ZERO
radius_access_challenge radius_nas_ip_address RADIUS_ATR_ZERO
radius_access_challenge radius_nas_port RADIUS_ATR_ZERO
radius_access_challenge radius_service_type RADIUS_ATR_ZERO
radius_access_challenge radius_framed_protocol RADIUS_ATR_ZERO
radius_access_challenge radius_framed_ip_address RADIUS_ATR_ZERO
radius_access_challenge radius_framed_ip_netmask RADIUS_ATR_ZERO
radius_access_challenge radius_framed_routing RADIUS_ATR_ZERO
radius_access_challenge radius_filter_id RADIUS_ATR_ZERO
radius_access_challenge radius_framed_mtu RADIUS_ATR_ZERO
radius_access_challenge radius_framed_compression RADIUS_ATR_ZERO
radius_access_challenge radius_login_ip_host RADIUS_ATR_ZERO
radius_access_challenge radius_login_service RADIUS_ATR_ZERO
radius_access_challenge radius_login_tcp_port RADIUS_ATR_ZERO
radius_access_challenge radius_reply_message RADIUS_ATR_MANY
radius_access_challenge radius_callback_number RADIUS_ATR_ZERO
radius_access_challenge radius_callback_id RADIUS_ATR_ZERO
radius_access_challenge radius_framed_route RADIUS_ATR_ZERO
radius_access_challenge radius_framed_ipx_network RADIUS_ATR_ZERO
radius_access_challenge radius_state RADIUS_ATR_MAXONE
radius_access_challenge radius_class RADIUS_ATR_ZERO
radius_access_challenge radius_vendor_specific RADIUS_ATR_MANY
radius_access_challenge radius_session_timeout RADIUS_ATR_MAXONE
radius_access_challenge radius_idle_timeout RADIUS_ATR_MAXONE
radius_access_challenge radius_termination_action RADIUS_ATR_ZERO
radius_access_challenge radius_called_station_id RADIUS_ATR_ZERO
radius_access_challenge radius_calling_station_id RADIUS_ATR_ZERO
radius_access_challenge radius_nas_identifier RADIUS_ATR_ZERO
radius_access_challenge radius_proxy_state RADIUS_ATR_MANY
radius_access_challenge radius_login_lat_service RADIUS_ATR_ZERO
radius_access_challenge radius_login_lat_node RADIUS_ATR_ZERO
radius_access_challenge radius_login_lat_group RADIUS_ATR_ZERO
radius_access_challenge radius_framed_appletalk_link RADIUS_ATR_ZERO
radius_access_challenge radius_framed_appletalk_network RADIUS_ATR_ZERO
radius_access_challenge radius_framed_appletalk_zone RADIUS_ATR_ZERO
radius_access_challenge radius_chap_challenge RADIUS_ATR_ZERO
radius_access_challenge radius_nas_port_type RADIUS_ATR_ZERO
radius_access_challenge radius_port_limit RADIUS_ATR_ZERO
radius_access_challenge radius_login_lat_port RADIUS_ATR_ZERO
radius_access_challenge radius_tunnel_type RADIUS_ATR_ZERO
radius_access_challenge radius_tunnel_medium_type RADIUS_ATR_ZERO
radius_access_challenge radius_tunnel_client_endpoint RADIUS_ATR_ZERO
radius_access_challenge radius_tunnel_server_endpoint RADIUS_ATR_ZERO
radius_access_challenge radius_tunnel_password RADIUS_ATR_ZERO
radius_access_challenge radius_arap_password RADIUS_ATR_ZERO
radius_access_challenge radius_arap_features RADIUS_ATR_MAXONE
radius_access_challenge radius_arap_zone_access RADIUS_ATR_ZERO
radius_access_challenge radius_arap_security RADIUS_ATR_MAXONE
radius_access_challenge radius_arap_security_data RADIUS_ATR_MANY
radius_access_challenge radius_password_retry RADIUS_ATR_ZERO
radius_access_challenge radius_prompt RADIUS_ATR_MAXONE
radius_access_challenge radius_connect_info RADIUS_ATR_ZERO
radius_access_challenge radius_configuration_token RADIUS_ATR_ZERO
radius_access_challenge radius_eap_message RADIUS_ATR_MANY
radius_access_challenge radius_message_authenticator RADIUS_ATR_MAXONE
radius_access_challenge radius_tunnel_private_group_id RADIUS_ATR_ZERO
radius_access_challenge radius_tunnel_assignment_id RADIUS_ATR_ZERO
radius_access_challenge radius_tunnel_preference RADIUS_ATR_ZERO
radius_access_challenge radius_arap_challenge_response RADIUS_ATR_MAXONE
radius_access_challenge radius_acct_interim_interval RADIUS_ATR_ZERO
radius_access_challenge radius_nas_port_id RADIUS_ATR_ZERO
radius_access_challenge radius_framed_pool RADIUS_ATR_ZERO
radius_access_challenge radius_tunnel_client_auth_id RADIUS_ATR_ZERO
radius_access_challenge radius_tunnel_server_auth_id RADIUS_ATR_ZERO

Table 1.3.  Default attribute policy in RadiusProxyStrict


1.3.  SQL*Net appendix

[Example] Example 1.1.  An example for the SQL*Net connection string
No.     Time        Source                Destination           Protocol Info
344 48.463276   127.0.0.1             127.0.0.1             TNS      Request, Connect (1), Connect

Frame 344 (269 bytes on wire, 269 bytes captured)
    Arrival Time: Dec 20, 2005 11:10:58.166023000
    Time delta from previous packet: 0.001255000 seconds
    Time since reference or first frame: 48.463276000 seconds
    Frame Number: 344
    Packet Length: 269 bytes
    Capture Length: 269 bytes
    Protocols in frame: eth:ip:tcp:tns
Ethernet II, Src: 00:00:00:00:00:00, Dst: 00:00:00:00:00:00
    Destination: 00:00:00:00:00:00 (00:00:00_00:00:00)
    Source: 00:00:00:00:00:00 (00:00:00_00:00:00)
    Type: IP (0x0800)
Internet Protocol, Src Addr: 127.0.0.1 (127.0.0.1), Dst Addr: 127.0.0.1 (127.0.0.1)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..0. = ECN-Capable Transport (ECT): 0
        .... ...0 = ECN-CE: 0
    Total Length: 255
    Identification: 0x86bc (34492)
    Flags: 0x04 (Don't Fragment)
        0... = Reserved bit: Not set
        .1.. = Don't fragment: Set
        ..0. = More fragments: Not set
    Fragment offset: 0
    Time to live: 64
    Protocol: TCP (0x06)
    Header checksum: 0xb53a (correct)
    Source: 127.0.0.1 (127.0.0.1)
    Destination: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 44404 (44404), Dst Port: 1521 (1521), Seq: 1, Ack: 1, Len: 203
    Source port: 44404 (44404)
    Destination port: 1521 (1521)
    Sequence number: 1    (relative sequence number)
    Next sequence number: 204    (relative sequence number)
    Acknowledgement number: 1    (relative ack number)
    Header length: 32 bytes
    Flags: 0x0018 (PSH, ACK)
        0... .... = Congestion Window Reduced (CWR): Not set
        .0.. .... = ECN-Echo: Not set
        ..0. .... = Urgent: Not set
        ...1 .... = Acknowledgment: Set
        .... 1... = Push: Set
        .... .0.. = Reset: Not set
        .... ..0. = Syn: Not set
        .... ...0 = Fin: Not set
    Window size: 32767
    Checksum: 0xfef3 (incorrect, should be 0x5c50)
    Options: (12 bytes)
        NOP
        NOP
        Time stamp: tsval 35686106, tsecr 35686106
Transparent Network Substrate Protocol
    Packet Length: 203
    Packet Checksum: 0x0000
    Packet Type: Connect (1)
    Reserved Byte: 00
    Header Checksum: 0x0000
    Connect
        Version: 312
        Version (Compatible): 300
        Service Options: 0x0c01
            ..0. .... .... .... = Broken Connect Notify: False
            ...0 .... .... .... = Packet Checksum: False
            .... 1... .... .... = Header Checksum: True
            .... .1.. .... .... = Full Duplex: True
            .... ..0. .... .... = Half Duplex: False
            .... ...0 .... .... = Don't Care: False
            .... .... 0... .... = Don't Care: False
            .... .... ...0 .... = Direct IO to Transport: False
            .... .... .... 0... = Attention Processing: False
            .... .... .... .0.. = Can Receive Attention: False
            .... .... .... ..0. = Can Send Attention: False
        Session Data Unit Size: 2048
        Maximum Transmission Data Unit Size: 32767
        NT Protocol Characteristics: 0x7f08
            0... .... .... .... = Hangon to listener connect: False
            .1.. .... .... .... = Confirmed release: True
            ..1. .... .... .... = TDU based IO: True
            ...1 .... .... .... = Spawner running: True
            .... 1... .... .... = Data test: True
            .... .1.. .... .... = Callback IO supported: True
            .... ..1. .... .... = ASync IO Supported: True
            .... ...1 .... .... = Packet oriented IO: True
            .... .... 0... .... = Can grant connection to another: False
            .... .... .0.. .... = Can handoff connection to another: False
            .... .... ..0. .... = Generate SIGIO signal: False
            .... .... ...0 .... = Generate SIGPIPE signal: False
            .... .... .... 1... = Generate SIGURG signal: True
            .... .... .... .0.. = Urgent IO supported: False
            .... .... .... ..0. = Full duplex IO supported: False
            .... .... .... ...0 = Test operation: False
        Line Turnaround Value: 0
        Value of 1 in Hardware: 0100
        Length of Connect Data: 145
        Offset to Connect Data: 58
        Maximum Receivable Connect Data: 512
        Connect Flags 0: 0x41
            ...0 .... = NA services required: False
            .... 0... = NA services linked in: False
            .... .0.. = NA services enabled: False
            .... ..0. = Interchange is involved: False
            .... ...1 = NA services wanted: True
        Connect Flags 1: 0x41
            ...0 .... = NA services required: False
            .... 0... = NA services linked in: False
            .... .0.. = NA services enabled: False
            .... ..0. = Interchange is involved: False
            .... ...1 = NA services wanted: True
        Trace Cross Facility Item 1: 0x00000000
        Trace Cross Facility Item 2: 0x00000000
        Trace Unique Connection ID: 0x0000660c007e4a09
        Connect Data: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=OPT.BALABIT)(CID=(PROGRAM=)(HOST=crm)(USER=oracle))))

1.4. TELNET appendix

The constants defined for the easier use of TELNET options and suboptions are listed in the table below. Suboptions are listed directly under the option they refer to. All suboptions have the TELNET_SB prefix. The RFC describing the given option is also shown in the table.

Name Constant value of option/suboption Detailed in RFC #
TELNET_BINARY 0 856
TELNET_ECHO 1 857
TELNET_SUPPRESS_GO_AHEAD 3 858
TELNET_STATUS 5 859
TELNET_SB_STATUS_SB_IS 0  
TELNET_SB_STATUS_SB_SEND 1  
TELNET_TIMING_MARK 6 860
TELNET_RCTE 7 726
TELNET_NAOCRD 10 652
TELNET_SB_NAOCRD_DR 0  
TELNET_SB_NAOCRD_DS 1  
TELNET_NAOHTS 11 653
TELNET_SB_NAOHTS_DR 0  
TELNET_SB_NAOHTS_DS 1  
TELNET_NAOHTD 12 654
TELNET_SB_NAOHTD_DR 0  
TELNET_SB_NAOHTD_DS 1  
TELNET_NAOFFD 13 655
TELNET_SB_NAOFFD_DR 0  
TELNET_SB_NAOFFD_DS 1  
TELNET_NAOVTS 14 656
TELNET_SB_NAOVTS_DR 0  
TELNET_SB_NAOVTS_DS 1  
TELNET_NAOVTD 15 657
TELNET_SB_NAOVTD_DR 0  
TELNET_SB_NAOVTD_DS 1  
TELNET_NAOLFD 16 658
TELNET_SB_NAOLFD_DR 0  
TELNET_SB_NAOLFD_DS 1  
TELNET_EXTEND_ASCII 17 698
TELNET_LOGOUT 18 727
TELNET_BM 19 735
TELNET_SB_BM_DEFINE 1  
TELNET_SB_BM_ACCEPT 2  
TELNET_SB_BM_REFUSE 3  
TELNET_SB_BM_LITERAL 4  
TELNET_SB_BM_CANCEL 5  
TELNET_DET 20 1043, 732
TELNET_SB_DET_DEFINE 1  
TELNET_SB_DET_ERASE 2  
TELNET_SB_DET_TRANSMIT 3  
TELNET_SB_DET_FORMAT 4  
TELNET_SB_DET_MOVE_CURSOR 5  
TELNET_SB_DET_SKIP_TO_LINE 6  
TELNET_SB_DET_SKIP_TO_CHAR 7  
TELNET_SB_DET_UP 8  
TELNET_SB_DET_DOWN 9  
TELNET_SB_DET_LEFT 10  
TELNET_SB_DET_RIGHT 11  
TELNET_SB_DET_HOME 12  
TELNET_SB_DET_LINE_INSERT 13  
TELNET_SB_DET_LINE_DELETE 14  
TELNET_SB_DET_CHAR_INSERT 15  
TELNET_SB_DET_CHAR_DELETE 16  
TELNET_SB_DET_READ_CURSOR 17  
TELNET_SB_DET_CURSOR_POSITION 18  
TELNET_SB_DET_REVERSE_TAB 19  
TELNET_SB_DET_TRANSMIT_SCREEN 20  
TELNET_SB_DET_TRANSMIT_UNPROTECTED 21  
TELNET_SB_DET_TRANSMIT_LINE 22  
TELNET_SB_DET_TRANSMIT_FIELD 23  
TELNET_SB_DET_TRANSMIT_REST_SCREEN 24  
TELNET_SB_DET_TRANSMIT_REST_LINE 25  
TELNET_SB_DET_TRANSMIT_REST_FIELD 26  
TELNET_SB_DET_TRANSMIT_MODIFIED 27  
TELNET_SB_DET_DATA_TRANSMIT 28  
TELNET_SB_DET_ERASE_SCREEN 29  
TELNET_SB_DET_ERASE_LINE 30  
TELNET_SB_DET_ERASE_FIELD 31  
TELNET_SB_DET_ERASE_REST_SCREEN 32  
TELNET_SB_DET_ERASE_REST_LINE 33  
TELNET_SB_DET_ERASE_REST_FIELD 34  
TELNET_SB_DET_ERASE_UNPROTECTED 35  
TELNET_SB_DET_FORMAT_DATA 36  
TELNET_SB_DET_REPEAT 37  
TELNET_SB_DET_SUPPRESS_PROTECTION 38  
TELNET_SB_DET_FIELD_SEPARATOR 39  
TELNET_SB_DET_FN 40  
TELNET_SB_DET_ERROR 41  
TELNET_SUPDUP 21 736, 734
TELNET_SUPDUP_OUTPUT 22 749
TELNET_SEND_LOCATION 23 779
TELNET_TERMINAL_TYPE 24 1091
TELNET_SB_TERMINAL_TYPE_IS 0  
TELNET_SB_TERMINAL_TYPE_SEND 1  
TELNET_EOR 25 885
TELNET_TUID 26 927
TELNET_OUTMRK 27 933
TELNET_TTYLOC 28 946  
TELNET_3270_REGIME 29 1041
TELNET_SB_3270_REGIME_IS 0  
TELNET_SB_3270_REGIME_ARE 1  
TELNET_X3_PAD 30 1053
TELNET_SB_X3_PAD_SET 0  
TELNET_SB_X3_PAD_RESPONSE_SET 1  
TELNET_SB_X3_PAD_IS 2  
TELNET_SB_X3_PAD_RESPONSE_IS 3  
TELNET_SB_X3_PAD_SEND 4  
TELNET_NAWS 31 1073
TELNET_TERMINAL_SPEED 32 1079
TELNET_SB_TERMINAL_SPEED_IS 0  
TELNET_SB_TERMINAL_SPEED_SEND 1  
TELNET_TOGGLE_FLOW_CONTROL 33 1372
TELNET_SB_TOGGLE_FLOW_CONTROL_OFF 0  
TELNET_SB_TOGGLE_FLOW_CONTROL_ON 1  
TELNET_SB_TOGGLE_FLOW_CONTROL_RESTART_ANY 2  
TELNET_SB_TOGGLE_FLOW_CONTROL_RESTART_XON 3  
TELNET_LINEMODE 34 1184
TELNET_SB_LINEMODE_MODE 1  
TELNET_SB_LINEMODE_FORWARDMASK 2  
TELNET_SB_LINEMODE_SLC 3  
TELNET_X_DISPLAY_LOCATION 35 1096
TELNET_SB_X_DISPLAY_LOCATION_IS 0  
TELNET_SB_X_DISPLAY_LOCATION_SEND 1  
TELNET_OLD_ENVIRONMENT 36 1408
TELNET_SB_OLD_ENVIRONMENT_IS 0  
TELNET_SB_OLD_ENVIRONMENT_SEND 1  
TELNET_SB_OLD_ENVIRONMENT_INFO 2  
TELNET_AUTHENTICATION 37 2941
TELNET_SB_AUTHENTICATION_IS 0  
TELNET_SB_AUTHENTICATION_SEND 1  
TELNET_SB_AUTHENTICATION_REPLY 2  
TELNET_SB_AUTHENTICATION_NAME 3  
TELNET_ENCRYPT 38 2946
TELNET_SB_ENCRYPT_IS 0  
TELNET_SB_ENCRYPT_SUPPORT 1  
TELNET_SB_ENCRYPT_REPLY 2  
TELNET_SB_ENCRYPT_START 3  
TELNET_SB_ENCRYPT_END 4  
TELNET_SB_ENCRYPT_REQUEST_START 5  
TELNET_SB_ENCRYPT_REQUEST_END 6  
TELNET_SB_ENCRYPT_ENC_KEYID 7  
TELNET_SB_ENCRYPT_DEC_KEYID 8  
TELNET_ENVIRONMENT 39 1572
TELNET_SB_ENVIRONMENT_IS 0  
TELNET_SB_ENVIRONMENT_SEND 1  
TELNET_SB_ENVIRONMENT_INFO 2  
TELNET_TN3270E 40 1647
TELNET_SB_TN3270E_ASSOCIATE 0  
TELNET_SB_TN3270E_CONNECT 1  
TELNET_SB_TN3270E_DEVICE_TYPE 2  
TELNET_SB_TN3270E_FUNCTIONS 3  
TELNET_SB_TN3270E_IS 4  
TELNET_SB_TN3270E_REASON 5  
TELNET_SB_TN3270E_REJECT 6  
TELNET_SB_TN3270E_REQUEST 7  
TELNET_SB_TN3270E_SEND 8  
TELNET_CHARSET 42 2066
TELNET_SB_CHARSET_REQUEST 1  
TELNET_SB_CHARSET_ACCEPTED 2  
TELNET_SB_CHARSET_REJECTED 3  
TELNET_SB_CHARSET_TTABLE_IS 4  
TELNET_SB_CHARSET_TTABLE_REJECTED 5  
TELNET_SB_CHARSET_TTABLE_ACK 6  
TELNET_SB_CHARSET_TTABLE_NAK 7  
TELNET_COM_PORT 44 2217
TELNET_SB_COM_PORT_CLI_SET_BAUDRATE 1  
TELNET_SB_COM_PORT_CLI_SET_DATASIZE 2  
TELNET_SB_COM_PORT_CLI_SET_PARITY 3  
TELNET_SB_COM_PORT_CLI_SET_STOPSIZE 4  
TELNET_SB_COM_PORT_CLI_SET_CONTROL 5  
TELNET_SB_COM_PORT_CLI_NOTIFY_LINESTATE 6  
TELNET_SB_COM_PORT_CLI_NOTIFY_MODEMSTATE 7  
TELNET_SB_COM_PORT_CLI_FLOWCONTROL_SUSPEND 8  
TELNET_SB_COM_PORT_CLI_FLOWCONTROL_RESUME 9  
TELNET_SB_COM_PORT_CLI_SET_LINESTATE_MASK 10  
TELNET_SB_COM_PORT_CLI_SET_MODEMSTATE_MASK 11  
TELNET_SB_COM_PORT_CLI_PURGE_DATA 12  
TELNET_SB_COM_PORT_SVR_SET_BAUDRATE 101  
TELNET_SB_COM_PORT_SVR_SET_DATASIZE 102  
TELNET_SB_COM_PORT_SVR_SET_PARITY 103  
TELNET_SB_COM_PORT_SVR_SET_STOPSIZE 104  
TELNET_SB_COM_PORT_SVR_SET_CONTROL 105  
TELNET_SB_COM_PORT_SVR_NOTIFY_LINESTATE 106  
TELNET_SB_COM_PORT_SVR_NOTIFY_MODEMSTATE 107  
TELNET_SB_COM_PORT_SVR_FLOWCONTROL_SUSPEND 108  
TELNET_SB_COM_PORT_SVR_FLOWCONTROL_RESUME 109  
TELNET_SB_COM_PORT_SVR_SET_LINESTATE_MASK 110  
TELNET_SB_COM_PORT_SVR_SET_MODEMSTATE_MASK 111  
TELNET_SB_COM_PORT_SVR_PURGE_DATA 112  
TELNET_KERMIT 47 2840
TELNET_SB_KERMIT_START_SERVER 0  
TELNET_SB_KERMIT_STOP_SERVER 1  
TELNET_SB_KERMIT_REQ_START_SERVER 2  
TELNET_SB_KERMIT_REQ_STOP_SERVER 3  
TELNET_SB_KERMIT_SOP 4  
TELNET_SB_KERMIT_RESP_START_SERVER 8  
TELNET_SB_KERMIT_RESP_STOP_SERVER 9  
TELNET_EXOPL 255 861
TELNET_SUBLIMINAL_MSG 257 1097

Table 1.4. TELNET options and suboptions


Appendix 2. Manual pages

Name

zorp — Zorp Firewall Suite

Synopsis

zorp [options]

Description

The zorp command is the main entry point for a Zorp instance, and as such it is generally called by zorpctl(8) with command line parameters specified in instances.conf(5) .

Options

--version or -V

Display version number and compilation information.

--as <name> or -a <name>

Set instance name to <name>. Instance names may consist of the characters [a-zA-Z0-9_] and must begin with a letter. Log messages of this instance are prefixed with this name.

--also-as <name> or -A <name>

Add a secondary instance named <name>. Secondary instances share the same Zorp process but they have a separate section in the configuration file.

--policy <name> or -p <name>

Use the file called <name> as policy. This file must be a valid policy file.

--verbose <verbosity> or -v <verbosity>

Set verbosity level to <verbosity>, or if <verbosity> is omitted increment it by one. Default the verbosity level is 3; possible values are 0-10.

--pidfile <pidfile> or -P <pidfile>

Set path to the PID file where the pid of the main process is stored.

--foreground or -F

Do not daemonize, run in the foreground.

--process-mode <mode>

Set processing mode to one of background, safe-background or foreground.

--no-syslog or -l

Send log messages to the standard output instead of syslog.

--log-tags or -T

Prepend log category and log level to each message.

--log-escape

Escape non-printable characters to avoid binary log files. Each character less than 0x20 and greater than 0x7F are escaped in the form <XX>.

--log-spec <spec> or -s <spec>

Set verbosity mask on a per category basis. Each log message has an assigned multi-level category, where levels are separated by a dot. For example, HTTP requests are logged under http.request. <spec> is a comma separated list of log specifications. A single log specification consists of a wildcard matching log category, a colon, and a number specifying the verbosity level of that given category. Categories match from left to right. E.g.: --logspec 'http.*:5,core:3'. The last matching entry will be used as the verbosity of the given category. If no match is found the default verbosity specified with --verbose is used.

--threads <num> or -t <num>

Set the maximum number of threads that can be used in parallel by this Zorp instance.

--idle-threads <num> or -I

Set the maximum number of idle threads; this option has effect only if threadpools are enabled (see the option --threadpools).

--threadpools or -O

Enable the use of threadpools, which means that threads associated with sessions are not automatically freed, only if the maximum number of idle threads is exceeded.

--user <user> or -u <user>

Switch to the supplied user after starting up.

--group <group> or -g <group>

Switch to the supplied group after starting up.

--chroot <dir> or -R <dir>

Change root to the specified directory before reading the configuration file. The directory must be set up accordingly.

--caps <caps> or -C <caps>

Switch to the supplied set of capabilities after starting up. This should contain the required capabilities in the permitted set. For the syntax of capability description see the man page cap_from_text(3).

--no-caps or -N

Do not change capabilities at all.

--crypto-engine <engine> or -E <engine>

Set the OpenSSL crypto engine to be used for hardware accelerated crypto support.

--stack-size <size> or -S <size>

Set the maximum stack size used by threads. Note that the maximum number of parallel threads is influenced by the size specified here. The default stack size is 512 KB, the maximum you can set is 8192 KB.

Files

/etc/zorp/

/etc/zorp/policy.py

/etc/zorp/instances.conf

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

kzorp — Tool for the kzorp kernel module

Synopsis

kzorp [options]

Description

The kzorp tool is a command-line application that can display the active policy information (zone, dispatcher, and packet-filtering service information) currently used by the kzorp kernel module, and can also upload new information to the kzorp kernel module. Uploading the new information is required whenever the configuration of Zorp is reloaded or restarted.

Options

-v

Display version number and compilation information.

-h

Display this help and exit.

-q

Quiet operation.

-z

Display current zones. The flags parameter returned may indicate that the zone has the umbrella option enabled.

-s

Display current services. The type parameter returned indicates the type of the service, which can be:Service or PFService.

The flags parameter returned may indicate that the service is transparent, and that the forge_addr option is enabled.

-d

Display current dispatchers. The type parameter returned indicates the type of the dispatcher, which can be: DBInet, DBIface, or DBIfaceGroup.

The flags parameter returned may indicate that the dispatcher is transparent, and that the follow_parent option is enabled.

-u <filename>

Upload the information from the policy file specified in the <filename> parameter into the kzorp kernel module.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

instances.conf — zorp(8) instances database

Description

The instances.conf file describes the zorp(8) instances to be run on the system. It is processed by zorpctl(8) line by line, each line having the structure described below. Empty lines and lines beginning with '#' are comments ignored by zorpctl.

Structure

instance-name parameters [-- zorpctl-options]

instance-name is the name of the Zorp instance to be started; it is passed to zorp with its --as parameter. Instance names may consist of the characters [a-zA-Z0-9_] and must begin with a letter.

parameters are space separated parameters entered into the zorp command-line. For details on these command-line parameters see zorp(8).

zorpctl-options are space separated parameters control startup specific options. They are processed by zorpctl itself. The following zorpctl options are available:

--auto-restart or -A

Enable the automatic restart feature of zorpctl. When an instance is in auto-restart mode, it is restarted automatically in case the instance exits.

--no-auto-restart or -a

Disable automatic restart for this instance.

--fd-limit <number> or -f <number>

Set the file descriptor limit to <number>. The file descriptor limit defaults to the number of threads (specified by the --threads parameter of zorp(8)) multiplied by 4.

--process-limit <number> or -p <number>

Set the process limit to <number>. The process limit defaults to the number of threads (specified by the --threads parameter of zorp(8)) multiplied by 2.

--enable-core

Explicitly enable core dumps for Zorp processes. The core limit is inherited from the local starting environment (e.g.: starting shell) if not specified.

Examples

zorp_ftp --policy /etc/zorp/policy.py --verbose 5

The line above describes a zorp instance named zorp_ftp using policy file /etc/zorp/policy.py, and having verbosity level 5.

zorp_intra -v4 -p /etc/zorp/policy.py --threads 500 --no-auto-restart --fd-limit 1024 --process-limit 512

This line describes a zorp instance named zorp_intra using the policy file /etc/zorp/policy.py, verbosity level 4. The maximum number of threads is set to 500, file descriptor limit to 1024, process limit to 512.

Files

The default location of instances.conf is /etc/zorp/instances.conf. Defaults for zorpctl tunables can be specified in /etc/zorp/zorpctl.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

policy.py — zorp(8) policy file.

Description

The policy.py file is a Python module containing the zone and service definitions and other policy related settings used by zorp(8) . Empty lines and lines beginning with '#' are comments and are ignored.

The policy.py file is generated automatically by ZMC, the Zorp Management Console, or it can be edited manually.

IMPORTANT: Do not edit manually a file generated by ZMC, because the manual changes will not be retained by ZMC and will be lost when re-generating the file.

Files

The default location of policy.py is /etc/zorp/policy.py.

See Also

For further information on policy.py refer to the following sources:

A tutorial on manually editing the policy.py file can be found at http://www.balabit.com/network-security/zorp-gateway/gpl/tutorial/.

Additional information can also be found in the Zorp Administrator's Guide, the Zorp Reference Guide, and in the various tutorials available at the BalaBit Documentation Page at http://www.balabit.com/support/documentation/.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zorpctl — Start and stop zorp instances.

Synopsis

zorpctl command [options [instances/@instance-list-file]]

Description

zorpctl starts and stops zorp(8) instances based on the contents of the instances.conf(5) file. Multiple instance names can be specified in the command-line or in a file to start or stop several instances. If an error occurs while stopping or starting an instance, an exclamation mark is appended to the instance name as zorpctl processes the request, and a summary is printed when the program exits. If no instance is specified, the command is executed on all instances. The instances to be controlled can be specified in a file instead of listing them in the command line, e.g.: zorpctl command options instances.txt. The instances.txt should contain every instance name in a new line.

Commands

start

Starts the specified Zorp instance(s).

force-start

Starts the specified Zorp instance(s) even if they are disabled.

stop

Stops the specified Zorp instance(s).

force-stop

Forces the specified Zorp instance(s) to stop using the KILL signal.

restart

Restart the specified Zorp instance(s).

force-restart

Forces the specified Zorp instance(s) to restart by stopping them using the KILL signal.

reload

Reload the specified Zorp instance(s).

status

Display the status of the specified Zorp instance(s).

--verbose or -v

Display detailed status information.

gui-status

Display the status of the specified Zorp instance(s) in an internal format easily parsable by ZMC. NOTE: This command is mainly used internally within Zorp, and the structure of its output may change.

version

Display version information on Zorp.

inclog

Raise the verbosity (log) level of the specified Zorp instance(s) by one.

declog

Decrease the verbosity (log) level of the specified Zorp instance(s) by one.

log

Change various log related settings in the specified Zorp instance(s) using the following options:

--vinc or -i

Increase verbosity level by one.

--vdec or -d

Decrease verbosity level by one.

--vset <verbosity> or -s <verbosity>

Set verbosity level to <verbosity>.

--log-spec <spec> or -S <spec>

Set verbosity mask on a per category basis. The format of this value is described in zorp(8).

--help or -h

Display this help screen on the options of the log command.

szig

Display internal information from the specified Zorp instance(s). The information to be disblayed can be specified with the following options:

--walk or -w

Walk the specified tree.

--root [node] or -r [node]

Set the root node of the walk operation to [node].

--help or -h

Display a brief help on the options of the szig command.

help

Display a brief help message.

Examples

zorpctl start zorp_ftp

The command above starts the zorp instance named zorp-ftp with parameters described in the instances.conf file.

Files

The default location for instances.conf is /etc/zorp/instances.conf.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zorpctl.conf — zorpctl(8) configuration file.

Description

The zorpctl.conf file describes various global options ifluencing the behavior of zorpctl(8) . zorpctl(8) processes the file line by line, each line having the structure described below. Empty lines and lines beginning with '#' are comments and are ignored.

Structure

variable name = variable value

Each non-empty line specifies a variable name and its value separated by the equal sign ('='). The following variables are available:

AUTO_RESTART

Enable the automatic restart feature of zorpctl. Instances in auto-restart mode are restarted automatically when they exit. Default value: 1 (TRUE).

AUTO_RESTART_TIME_THRESHOLD

If a restarted instance exits within this interval (specified in seconds), the restart attempt is considered a failure. Default value: 60 seconds.

AUTO_RESTART_MAX_COUNT

Maximum number of restart attempts. If the instance is not successfully restarted from AUTO_RESTART_MAX_COUNT attempts, the event is logged. Default value: 3.

AUTO_RESTART_DELAY

Wait AUTO_RESTART_DELAY seconds before attempting to restart the Zorp instance.

STOP_CHECK_DELAY

The rate (delay in seconds) to check a stopping Zorp instance at. Default value: 1.

STOP_CHECK_TIMEOUT

The number of seconds to wait for a stopping Zorp instance. Default value: 3.

START_CHECK_TIMEOUT

In auto-restart mode there is no real way to detect whether Zorp failed to load or not. Zorpctl waits START_CHECK_TIMEOUT seconds and assumes that Zorp loaded successfully if it did not exit within this interval. Default value: 5 seconds.

START_WAIT_TIMEOUT

In no-auto-restart mode the successful loading of a Zorp instance can be verified by instructing Zorp to daemonize itself and waiting for the parent to exit. This parameter specifies the number of seconds to wait for Zorp to daemonize itself. Default value: 60 seconds.

PROCESS_LIMIT_MIN

The minimum process limit (ulimit -u) used by Zorp in the case when the process limit (calculated from the --threads parameter) would result a lower value. Default value: 256.

PROCESS_LIMIT_RESERVE

The number of extra processes to be allocated (e.g.: for proxy modules that are known to spawn new processes). Default value: 64. This parameter is added to the regular (calculated as the sum of the processes of a program allowed to run per user) process limit.

FD_LIMIT_THRESHOLD

The expected maximal number of file descriptors openened by the threads. The global fd limit is FD_LIMIT_THRESHOLD multiplied by the thread limit. Default value: 64.

FD_LIMIT_MIN

The minimum fd limit (ulimit -n) used by Zorp in the case when the process limit (calculated from the --threads and FD_LIMIT_THRESHOLD parameters) would result a lower value. Default value: 1024.

ZORP_APPEND_ARGS

Zorp-specific arguments to be appended to the command line of each Zorp instance. Also recognised as APPEND_ARGS (deprecated). Default value: "".

ZORPCTL_APPEND_ARGS

Zorpctl-specific arguments to be appended to the command line of each instance. Default value: "".

CHECK_PERMS

Specifies whether to check the permissions of the Zorp configuration directory. If set, Zorp refuses to run if the /etc/zorp directory can be written by user other then zorp Default value: 1 (TRUE).

CONFIG_DIR

The path to the Zorp configuration directory to check if CHECK_PERMS is enabled. NOTE: it does not change the Zorp policy file argument, this parameter is only used by the permission validating code. Default value: ${prefix}/etc/zorp .

CONFIG_DIR_OWNER, CONFIG_DIR_GROUP, CONFIG_DIR_MODE

The owner/group/permissions values considered valid for the configuration directory. zorpctl fails if the actual owner/group/permissions values conflict the ones set here. Default values: root.zorp, 0750 .

PIDFILE_DIR

The path to the Zorp pid file directory. The directory is created automatically prior to starting Zorp if it does not already exist.It is created if it does not exist, before NOTE: No --pidfile argument is passed to Zorp, only texistance of the directory is verified. Default value: /var/run/zorp.

PIDFILE_DIR_OWNER, PIDFILE_DIR_GROUP, PIDFILE_DIR_MODE

The owner/group/permission values the pidfile directory is created with if it does not exist. Default values: root.root, 0700.

Files

The default location for zorpctl.conf is /etc/zorp/zorpctl.conf.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zms — Zorp Management Server engine

Synopsis

zms [options]

Description

zms is the server component of Zorp Management System, which is a distributed management system for Zorp firewalls. The server component is responsible for storing configuration data, distributing keys and certificates, and accepting administrator changes via the ZMC graphical user interface.

Options

--version or -V

Display version information.

--foreground or -F

Do not daemonize, run in the foreground.

--no-syslog or -l

Send log messages to the standard output instead of syslog.

--verbose <level> or -v <level>

Set the verbosity level of logging to <level>. Default value: 3.

--tags or -t

Enable tag logging.

--config <file> or -c <file>

Use the configuration file <file> instead of the default file.

--log-spec <spec> or -s <spec>

Set verbosity mask on a per category basis. The format of this value is described in zorp(8).

--bootstrap or -b

Bootstrap the engine.

--help or -h

Display a brief help message.

Files

Configuration information for zms(8) is stored in /etc/zms/zms.conf.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zms.conf — Configuration file format for the Zorp Management Server (zms(8).

Description

The zms.conf file controls the operation of the Zorp Management Server zms(8). It is rarely needed to modify the configuration manually.

WARNING: The settings stored in zms.conf are managed by the ZMS engine via ZMC. Do not modify the settings manually unless you know exactly what you are doing.

Structure

zms.conf uses an XML-like format to describe various configuration settings. The exact structure is configuration/section/<setting>, where the "name" attribute of the configuration block identifies the subsystem described by the nested tags.

Main configuration blocks are found in the default configuration block, with related options grouped into sections such as global, log, and ssl.

WARNING: The settings stored in the zms.conf file are used internally within Zorp; the structure of the file and the individual options may change between the different Zorp releases.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zms-integrity — ZMS Database Integrity Checker

Synopsis

zms-integrity [options]

Description

zms-integrity is a tool for checking the integrity of the ZMS database. It can also be used for recovery if the database contains errors.

Options

--datadir <dir> or -d <dir>

Database directory. Default value: /var/lib/zms.

--recover or -r

Try to recover database if integrity check fails. If not set, the integrity check will only report the errors found.

--syslog or -l

Use syslog for logging.

--verbose <level> or -v <level>

Set the verbosity level of logging to <level>. Default value: 3.

--help or -h

Display a brief help message.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zms-transfer-agent — ZMS Transfer Agent

Synopsis

zms-transfer-agent [options]

Description

Communication between the Zorp Management Server (ZMS) and the Zorp firewall hosts is realized via management agents. Transfer agents are capable of executing configuration commands (e.g.: start, stop, restart) and deploying configuration files on the manage hosts. Their behavior is controlled by the zmsagent.conf(5) configuration file.

As the management agents are involved in the internal communication procedures of Zorp, it is rarely needed to use them manually.

Options

--foreground or -F

Do not daemonize, run in the foreground.

--no-syslog or -l

Send log messages to the standard output instead of syslog.

--verbose <num> or -v <num>

Set verbosity level to <num>. Valid values are 0-10; default value is 3.

--log-tags or -T

Enable logging of message tags.

--config <file> or -c <file>

Use <file> as configuration file instead of the default /etc/zms/zmsagent.conf.

--unix-socket or -u

--one-time-password or -p

Use the provided one-time-password (OTP) for authentication instead of the regular SSL certificate based authentication. Useful for initial or recovery connections.

--help or -h

Display a brief help message.

Files

Settings of zms-transfer-agent(8) can be configured in the /etc/zms/zmsagent.conf configuration file.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zmsagent.conf — Configuration file format for the Zorp Management Agents (zms-transfer-agent(8) and zms-monitor-agent(8)).

Description

The zmsagent.conf file controls the operation of the the Zorp Management Agents zms-transfer-agent(8) and zms-monitor-agent(8). Communication between the Zorp Management Server (ZMS) and the Zorp firewall hosts is realized via management agents. As the management agents are involved in the internal communication procedures of Zorp, it is rarely needed to modify their configuration manually.

WARNING: The settings stored in zmsagent.conf are managed by the ZMS engine via ZMC. Do not modify the settings manually unless you know exactly what you are doing.

Structure

zmsagent.conf uses an XML-like format to describe various configuration settings. The exact structure is configuration/section/<setting>, where the "name" attribute of the configuration block identifies the agent subsystem described by the nested tags.

Main configuration blocks are found in the default configuration block, with related options grouped into sections such as global, log, and ssl. Agent-specific settings are located in the transferagent and monitoragent configuration blocks.

WARNING: The settings stored in the zmsagent.conf file are used internally within Zorp; the structure of the file and the individual options may change between the different Zorp releases.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zms-monitor-agent — ZMS Monitor Agent

Synopsis

zms-monitor-agent [options]

Description

Communication between the Zorp Management Server (ZMS) and the Zorp firewall hosts is realized via management agents. Monitor agents are capable of running plugins to obtain information about the status of the manage hosts and their various components. Their behavior is controlled by the zmsagent.conf(5) configuration file.

As the management agents are involved in the internal communication procedures of Zorp, it is rarely needed to use them manually.

Options

--foreground or -F

Do not daemonize, run in the foreground.

--no-syslog or -l

Send log messages to the standard output instead of syslog.

--verbose <num> or -v <num>

Set verbosity level to <num>. Valid values are 0-10; default value is 3.

--log-tags or -T

Enable logging of message tags.

--config <file> or -c <file>

Use <file> as configuration file instead of the default /etc/zms/zmsagent.conf.

--help or -h

Display a brief help message.

Files

Settings of zms-monitor-agent(8) can be configured in the /etc/zms/zmsagent.conf configuration file.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zas — Zorp Authentication Server

Synopsis

zas [options]

Description

ZAS is an authentication server providing authentication services to a Zorp based firewall. Its behaviour is controlled by zas.cfg(5) and router.cfg.

Options

--foreground or -F

Do not daemonize, run in the foreground.

--no-syslog or -l

Send log messages to the standard output instead of syslog.

--verbose <num> or -v <num>

Set verbosity level to <num>. Valid values are 0-10; default value is 3.

--log-tags or -T

Enable logging of message tags.

--log-spec <spec> or -s <spec>

Set verbosity mask on a per category basis. The format of this value is described in zorp(8).

--config <file> or -c <file>

Use <file> as configuration file instead of the default /etc/zas/zas.cfg.

--help or -h

Display a brief help message.

Files

/etc/zas/

/etc/zas/zas.cfg

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zas.cfg — zas(8) configuration file.

Description

The zas.cfg file controls the operation of Zorp Authentication Server.

Structure

The file uses an XML-like format to describe various configuration settings. It uses a configuration/section/<setting> structure where the "name" attribute of the configuration block identifies the ZAS subsystem described by the nested tags. The example below sets the global options used by ZAS, broken down to three different sections: "log" for log related settings, "router" to set the path to the router.cfg file and "ssl" for SSL related settings.


      <configuration name="zas"> 
        <section name="log">
          <loglevel>3</loglevel>
          <use_syslog>1</use_syslog>
          <logtags>1</logtags> 
        </section> 
        <section name="router"> 
          <router>/etc/zas/router.cfg</router>
        </section> 
        <section name="ssl">
          <use_ssl>0</use_ssl>
          <key>/etc/zas/zas.key</key>
          <cert>/etc/zas/zas.crt</cert>
          <verify_mode>0</verify_mode> 
        </section>
       </configuration>
    

The ZAS plugins (backends) have a slightly different structure. The name attribute in the configuration tag of the ZAS plugin and the section name identifies an instance of that plugin. Each instance can be run with a different parameter set. The example below shows a complete configuration block for the PAM backend with two instances: intra and internet:


      <configuration name="pam"> 
         <section name="intra">
          <service>zas_intra</service>
          <sleep_time>0</sleep_time>
          <fake_user>0</fake_user> 
        </section> 
        <section name="internet"> 
          <service>zas_internet</service>
          <sleep_time>10</sleep_time>
          <fake_user>1</fake_user> 
        </section>
      </configuration>
    

The router.cfg file

The router.cfg file controls the backend instance selection in ZAS. When a new authentication request is initiated by zorp(8), ZAS selects an authentication backend and an instance based on the meta-information that Zorp supplies. Each line in router.cfg comprises from a condition and an action, separated by whitespace. When an incoming request matches a condition, the corresponding the action identifies the authentication backend and its instance to be used.

The condition is a comma separated list of constraints, each constraint identifying an authentication header and an expected value in the header=match,header=match,... format. Wildcard characters like '*' and '?' can be included in the matches.The following headers are currently defined:

Client-Zone

The name of the zone the client belongs to.

Client-IP

The original IP address of the client initiating the connection to be authenticated.

Service

The name of the service the client is authenticating for.

The action identifies the ZAS backend to use (e.g.: zas_db, pam, etc.) and the specific instance of that backend. The backend and instance names are separeated by colon (:). Instances are identified by simple names and are used distinguish between various setups of the same backend.

The example below selects the intra instance of the zas_db backend. If the configuration block for this backend is not found, or the condition does not match, the zas_db:default instance is used.


          Client-Zone=intra      zas_db:intra 
          zas_db:default
        

Global ZAS options

The global configuration options of ZAS are described in the zas configuration block. The related options are grouped into sections. The following options are available:

Section log

use_syslog

Use syslog for logging.

logtags

Enable the logging of message tags.

loglevel

Level of verbosity for logging messages. Default value: 3.

Section bind

ip

IP address to which ZAS binds. Default value: 0.0.0.0.

port

Port to which ZAS binds. Default value: 1317.

Section ssl

use_ssl

Enable SSL encryption.

cert

The certificate file used to authenticate ZAS.

key

The private key file of the certificate used to authenticate ZAS.

ca_dir

Path to the directory where the certificates of the trusted CAs are stored.

crl_dir

Path to the directory where the certificate revocation lists are stored.

verify_depth

The maximum length of the verification chain. Default value: 3.

verify_mode

Method how the certificates of the connections incoming to ZAS are verified.

0

No certificate is needed.

1

Certificate is optional, but has to be valid if present.

2

A valid certificate is required, untrusted (but valid) certificates are also accepted.

3

A valid, trusted certificate is required.

Section router

router

Path to the router.cfg file.

Section misc

trust_connection

Permit password-based authentication methods even for unencrypted connections. Default value: 0 (false).

Backends

ZAS operates using several authentication backends, each with its own set of parameters. Currently the following backends are available:

zas_db

Database based backend which currently provides the most features. It has a backing database (called "storage") and a set of authentication methods (called "methods"). The name of the configuration block is zas_db

pam

Authenticates users against the local PAM libraries on the host running ZAS itself. The name of the configuration block is pam.

htpass

Authenticates users against an Apache htpasswd style password file. The name of the configuration block is htpass.

radius

Authenticates users against a RADIUS server. The name of the configuration block is radius.

tacacs

Authenticates users against a TACACS+ server. The name of the configuration block is tacacs.

All backends are capable of authentication faking. This is a method to hide the valid usernames, so that they cannot be guessed (for example using brute-force methods). If somebody tries to authenticate with a non-existing username, the attempt is not immediately rejected: the full authentication process is simulated (e.g.: password is requested, etc.), and rejected only at the end of the process. That way it is not possible to determine if the username itself was valid or not.

The Zas_db backend

The zas_db backend interprets the following parameters in its configuration block.

storage

Specifies the database plugin to use. Currently only the ldap database is supported.

methods

Specifies a space separated list of enabled authentication methods. The following authentication plugins are available: passwd, skey, rb1, x509, ldapbind, and none.

fake_user

Enables authentication faking.

fake_user_name

Specifies a user name which is used for faking authentication. This has to be an existing user name, used exclusively for this purpose.

sleep_time

Wait at least that many seconds after a failed authentication attempt.

Storage plugins

The zas_db backend authenticates against an abstract database, the actual implementation is specified using the storage parameter. The only storage plugin currently supported is ldap.

ldap

The ldap storage plugin uses the Lightweight Directory Access Protocol (LDAP) to access a directory based database. It has a separate configuration block identified by the name zas_db_storage_ldap.

The LDAP storage plugin

The LDAP storage plugin connects to an LDAP server, authenticates using a user-independent, service account and runs queries against the database to provide a zas_db dependent view on the directory. It uses a ZAS specific LDAP scheme available in the zas package.

use_ssl

Enables SSL/TLS when connecting to the LDAP server.

hostname

Specifies the LDAP host to use.

port

Specifies port of the LDAP server to use.

bind_dn

Bind to this DN before accessing the database.

bind_pw

Use this password when binding to LDAP.

base_dn

Perform queries using this base DN.

filter

Search for an account using this filter expression. Defaults to '(uid=%u)'; %u is expanded to the username being searched for.

scope

Specifies the scope of the search. base, sub, and one are acceptable values, specifying LDAP_SCOPE_BASE, LDAP_SCOPE_SUB, and LDAP_SCOPE_ONE, respectively.

user_is_dn

Specify that the incoming username is a fully qualified DN.

scheme

Specify LDAP scheme to use: posix for POSIX, ad for ActiveDirectory, or nds for Novell eDirectory/NDS style directory layout.

ldapbind_description

When the ldapbind authentication method is used for authentication, the value of this string is returned as method description to the user. NOTE: This parameter is OBSOLETE, it must be set in the ldapbind authentication method.

usercert_description

When the directory contains user keys in the userCertificate attribute and it is used for X.509 based authentication, the value of this string will be returned as method description to the user. OBSOLETE. Set it in x509 authentication method.

follow_referral

If this option is set, ZAS will respect the referral response from the LDAP server when looking up a user.

Authentication method plugins

The zas_db backend is general enough to allow the use of several different authentication methods. The set of permitted authentication methods is defined using the methods configuration option as described in the previous section. All pligins have a priority attribute. This attribute is used by the Satyr authentication client: the authentication methods available to the user are displayed in the order of the priority (starting with the highest value).

The following method plugins are available:

passwd

Implements password authentication. Password authentication is available only if the connection between Zorp and ZAS is secure. The name of the configuration block is zas_db_method_passwd.

The password authentication method has the following parameters:

priority

Priority of the authentication type.

skey

Implements S/Key authentication. The name of the configuration block is zas_db_method_skey.

The S/Key authentication method has the following parameters:

priority

Priority of the authentication type.

rb1

Implements CryptoCard RB1 hardware token based authentication. The name of the configuration block is zas_db_method_rb1.

The RB1 authentication method has the following parameters:

priority

Priority of the authentication type.

x509

Implements X.509 certificate based authentication. The name of the configuration block is zas_db_method_x509.

The X.509 authentication method has the following parameters:

compare_cert

Compare the stored certificate bit-by-bit to the certificate supplied by the client. The authentication will fail when the certificates do not match, even if the new certificate is trusted by the CA. Default value: 1 (TRUE).

trusted_ca_list

Send a list of trusted certificates to the client to choose from to narrow the list of available certificates. Default value: 1 (TRUE).

verify_cert

Verify the validity of the certificate (i.e. the certificate has to be issued by one of the trusted CAs and not revoked). This is verification is independent from the compare_cert setting, so if both parameters are set, both conditions must be fulfilled to accept the certificate. Default value: 1 (TRUE).

ca_locations

A list of space separated URLs to the trusted CAs. The file:// and ldap:// URLs are supported.

crl_locations

A list of space separated URLs to the CRLs issued by the trusted CAs. The file:// and ldap:// URLs are supported.

verify_depth

The maximum length of the verification chain.

priority

Priority of the authentication type.

ldapbind

Implements authentication against the target LDAP server. Only password authentication is supported by this method, therefore it is only available if the connection between ZAS and Zorp is secured with SSL. The name of the configuration block is zas_db_method_ldapbind.

The LDAP authentication method has the following parameters:

priority

Priority of the authentication type.

description

The value of this string is returned as method description to the user.

none

Implements NO authentication. This method accept every authentication request if the user is exists in the database. The main advantage of this method is when the authentication is done somwhere outside of this program but the groups information is needed. The name of the configuration block is zas_db_method_none.

The None authentication method has the following parameters:

priority

Priority of the authentication type.

description

The value of this string is returned as method description to the user.

gssapi

Implements GSSAPI based authentication. NOTE: The Kerberos5 keytab file to be used can be specified via the standard KRB5_KTNAME environment variable. The name of the configuration block is zas_db_method_gssapi.

The gssapi authentication method has the following parameters:

priority

Priority of the authentication type.

description

The value of this string is returned as method description to the user.

principal_name

Specifies the GSSAPI principal name which this authentication service represents. Make sure that the keys associated with this principal are present in /etc/krb5.keytab. Changing the keytab location is currently not possible.

The PAM backend

The PAM backend implements authentication based on the local authentication settings of the host running ZAS. It basically authenticates the users against the local PAM installation and/or using GSSAPI/krb5. The PAM backend has the following parameters:

use_local_accounts

Use the local passwd/group database to query group membership of a given account. The Name Service Switch can also be used, so integrating other naming services is possible. Defaults value: 0 (FALSE).

enable_pam_auth

Enable PAM authentication. Default value: 1 (TRUE).

pam_service

Specifies the PAM service to use for authentication. This option is an alias for the now deprecated service option. Defaults value: zas.

enable_gssapi_auth

Enable GSSAPI/krb5 authentication in this backend. Defaults value: 0 (FALSE). NOTE: The Kerberos5 keytab file to be used can be specified via the standard KRB5_KTNAME environment variable.

gssapi_princ_name

Specifies the GSSAPI principal name which this authentication service represents. Make sure that the keys associated with this principal are present in /etc/krb5.keytab. Changing the keytab location is currently not possible.

description

The value of this string is returned as method description to the user.

fake_user

Enables authentication faking.

sleep_time

Wait at least that many seconds after a failed authentication attempt.

The Htpass backend

The htpass backend has the following parameters:

filename

The file to be read as password file. The file should contain two columns separated by colon (':'), with the first column containing the username, the second the crypt(3)-ed password. This file can be created/maintained by the Apache htpasswd(1) utility.

fake_user

Enables authentication faking.

sleep_time

Wait at least that many seconds after a failed authentication attempt.

The Radius backend

The Radius backend has the following parameters:

hostname

The hostname of the RADIUS server.

hostport

The port of the RADIUS server.

secret

The shared secret between the authentication server and ZAS.

description

The value of this string is returned as method description to the user.

fake_user

Enables authentication faking.

sleep_time

Wait at least that many seconds after a failed authentication attempt.

The TACACS+ backend

The TACACS backend has the following parameters:

hostname

The hostname of the TACACS+ server.

hostport

The port of the TACACS+ server, defaults to 49.

secret

The shared secret between the authentication server and ZAS.

description

The value of this string is returned as method description to the user.

fake_user

Enables authentication faking.

sleep_time

Wait at least that many seconds after a failed authentication attempt.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zcv — Zorp Content Vectoring Server

Synopsis

zcv [options]

Description

The Zorp Content Vectoring Server (ZCV) is a content scanning framework providing stream and file scanning services for zorp(8). ZCV runs as a separate application and can be accessed over TCP, UNIX domain sockets and standard input and output file handles. The behaviour of ZCV can be controlled via the zcv.cfg(5) configuration file.

Options

--verbose <verbosity> or -v <verbosity>

Set verbosity level to <verbosity>, or if <verbosity> is omitted increment it by one. Default the verbosity level is 3; possible values are 0-10.

--no-syslog or -l

Send log messages to the standard output instead of syslog.

--log-spec <spec> or -s <spec>

Set verbosity mask on a per category basis. The format of this value is described in zorp(8).

--log-tags or -T

Enable logging of message tags.

--foreground or -F

Do not daemonize, run in the foreground.

--help or -h

Display a brief help message.

--zorp-mode <ctrl-fd> or -z <ctrl-fd>

Start in Zorp mode using the <ctrl-fd> file descriptor and remain in the foreground. In this mode only a single scan is performed on the data on the standard input. Results are sent to the standard output. (Naturally, log messages are not sent to the standard output in this mode, as this would interfere with the scanning results.) This mode is used mainly for testing purposes.

--rule-group <rule-group> or -R <rule-group>

The value for the zcv_rule_group routing variable in Zorp mode.

--config <file> or -c <file>

Use the configuration file <file> instead of the default /etc/zcv/zcv.cfg file.

--pidfile <file> or -P <file>

Use <file> as pid file instead of the default /var/run/zcv/zcv.pid file.

Operation

ZCV scans the contents of incoming streams. ZCV has multiple channels, each performing a possibly different set of actions on the incoming stream. These channels are called "scanpaths", i.e. a scanpath is an ordered set of modules and their associated settings. The scanpath to be used is selected based on meta information provided by Zorp and meta information gathered about the stream by ZCV itself. This scanpath selection mechanism is called "routing decision" and is controlled by the router rules.

To summarize, ZCV operates as follows: A connection is established between Zorp and ZCV. ZCV selects a scanpath (i.e. makes the routing decision) based the collected information, the router rules and information received from Zorp. The scanpath determines the modules to use and their associated settings. After the modules process the data received in the stream, the result of the scanning operation is sent back to Zorp.

Files

/etc/zcv/

The routing and configuration file formats are described in /etc/zcv/zcv.cfg and /etc/zcv/router.cfg.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zcv.cfg — zcv(8) configuration file format

Description

The zcv.cfg file controls the operation of ZCV, the Zorp Content Vectoring Server.

Structure

zcv.cfg uses an XML-like format to describe various configuration settings. The exact structure is configuration/section/<setting>, where the "name" attribute of the configuration block identifies the ZCV subsystem described by the nested tags.

The main configuration blocks of the file are the following:

zcv

Global options of zcv.

scanpaths

Definitions and settings of the scanpaths.

vbuster, html, etc.

Definitions and instance-specific settings of the modules.

module-options

Global settings of the modules that apply to every instance of the module.

The example below sets the global options used by ZCV, broken down to three different sections: log for log related settings, router for setting the path to the router.cfg file and misc for miscellaneous parameters.


      <configuration name="zcv"> 
        <section name="log">
        <loglevel>3</loglevel>
        <use_syslog>true</use_syslog>
        <logtags>true</logtags> 
      </section> 
      <section name="router"> 
        <router>/etc/zcv/router.cfg</router>
      </section> 
      <section name="misc">
        <magic_length>2048</magic_length> 
      </section>
      </configuration> 

The ZCV modules have a slightly different structure. The name attribute in the configuration tag of the ZCV module and the section name identifies an instance of that module. Each instance can be run with a different parameter set. The example below shows a complete configuration block for the vbuster module, with an instance named intranet having normal, and another named internet having paranoid sensitivity.


    <configuration name="vbuster"> 
      <section name="internet">
        <heuristic_sensitivity>paranoid</heuristic_sensitivity>
      </section> 
      <section name="intranet">
        <heuristic_sensitivity>normal</heuristic_sensitivity>
      </section> 
     </configuration> 
    

Remember that both the intranet and the internet vbuster instances are influenced by the global parameters of the vbuster module defined in the vbuster section of the module-options configuration block.


      <configuration name="module-options">
        <section name="vbuster">
          <archive_max_size>12</archive_max_size>
          <archive_max_ratio>100</archive_max_ratio>
          <vdb_error_soft_fail>0</vdb_error_soft_fail>
        </section>
      </configuration>
    

The router.cfg file

The router.cfg file controls the scanpath selection in ZCV. ZCV selects the scanpath based on the meta-information that Zorp supplies. Each line in router.cfg comprises from a condition and an action, separated by whitespace. When an incoming request matches a condition, the corresponding the action identifies the scanpath and its instance to be used.

The condition is a comma separated list of constraints, each constraint identifying a variable and an expected value in the header=match,header=match,... format. Wildcard characters like '*' and '?' can be included in the matches.The following variables are currently defined:

zcv_rule_group

The name of the rule group that the peer requests. Its value is specified the -R command line option in Zorp mode, or is supplied by the peer during the handshake.

content_type_detected

MIME type detected based on the first bytes of the file.

content_type_uncompressed

MIME type detected based on the first bytes of the file looking into a compressed file header and decompressing it if necessary.

content_type

MIME type as specified by the peer.

file_name

File name or URL.

file_extension

File extension. Please note that this information might not be accurate as some URLs do not contain file extension in which case this variable is empty. For example it is common to reference directories in HTTP which implicitly map to a server defined content and the URL does not contain a filename extension as in http://domain.com/directory/. It is better to use content_type or content_type_detected for content specific scanning.

file_xfer_direction

File transfer direction, either "upload" or "download".

zorp_protocol

Protocol that was used to transfer the checked file.

zorp_session_id

Zorp session id that requested content vectoring.

zorp_proxy_class

The name of the proxy class that requested content vectoring.

zorp_auth_user

The authenticated username.

zorp_client_address

Client address in AF_INET(>ipaddr<, >port<) format.

zorp_client_address.ip

Client IP address.

zorp_client_address.port

Client TCP/UDP port.

zorp_client_zone

The name of the client zone.

zorp_server_address

Server address in AF_INET(>ipaddr<, >port<) format.

zorp_server_address.ip

Server IP address.

zorp_server_address.port

Server TCP/UDP port.

zorp_server_zone

The name of the server zone.

smtp_envelope_sender

The envelope sender address in SMTP.

smtp_envelope_recipients

Space separated list of envelope recipient addresses in SMTP.

nntp_group_name

The name of the NNTP newsgroup name.

Furthermore, virtually all defined Zorp variables can be used as variables with the 'zorp.' prefix, which denotes the 'session' object of the stacking proxy. For example: > zorp.session_id, zorp.client_address.ip_s, etc.

The action identifies the ZCV scanpath to use.

The example below selects the html scanpath for all files which are recognized as "text/html" files, and rejects everything else. An object is scanned only by the scanpath of the first matching condition.


          content_type="text/html" html
  content_type_detected="text/html"     html
          REJECT
        

Global Options

Global options are stored in the configuration block named zcv. Related options are grouped into sections.

Section log

use_syslog

Use syslog for logging.

logtags

Enable the logging of message tags.

loglevel

Level of verbosity for logging messages. Default value: 3.

logspec

Set verbosity mask on a per category basis. The format of this value is described in zorp(8).

Section misc

magic_length

This parameter determines the amount of data (in bytes) read from MIME objects to detect their MIME-type. Higher value increases the precision of MIME-type detection. Default value: 0.

tempdir

Location of the temporal directory (used for swap files, etc.). Default value: /var/lib/zorp/tmp

Section router

router

Location of the router.cfg file. Default value: /etc/zcv/router.cfg

Section bind

ip

IP address to which ZCV binds. Default value: 0.0.0.0.

port

Port to which ZCV binds. Default value: 1318.

unix

Bind to a unix domain socket. If only the empty tag is present, the default socket (/var/run/zcv/zcv.sock) is used.

When binding to a unix domain socket, the owner and the permissions of the socket can be set using the following paramters:

owner

The owner of the socket. By default its value is NULL, meaning that the owner of the socket is the user running ZCV.

group

The owner group of the socket. Default value: zorpstate.

perm

The permission settings of the socket in Unix-style. Default value: 770.

Section blob

hiwat

ZCV tries to store everything in the memory if possible. If the memory usage of ZCV reaches hiwat, it starts to swap the data onto the hard disk, until the memory usage reaches lowat. Default value: 128*0x100000 (128 MB).

lowat

Lower threshold of data swapping. Default value: 96*0x100000 (96 MB).

max_disk_usage

The maximum amount of hard disk space that ZCV is allowed to use. Default value: 1024*0x100000 (1 GB).

max_mem_usage

The maximum amount of memory that ZCV is allowed to use. Default value: 256*0x100000 (256 MB).

noswap_max

Objects smaller than this value (in bytes) are never swapped to hard disk. Default value: 16384.

Scanpath Options

The scanpath options are stored in the configuration block named scanpaths. Each section in this block has the name of a scanpath and contains settings specific for the given scanpath.

Settings to control trickling can also be configured here. Content filtering cannot be performed on partial files: the entire file has to be available on the firewall. Sending of the file to the client is started only if no virus was found (or the file was successfully disinfected). Instead of receiving the data in a continuous stream, as when connecting to the server “regularly”, the client does not receive any data for a while, then “suddenly” it starts to flow. This phenomena is not a problem for small files, since these are transmitted and checked fast, probably without the user ever noticing the delay, but can be an issue for larger files when the client application might time out. Another source of annoyance can be when the bandwidth of the network on the client and server side of the firewall is significantly different. In order to avoid time outs, a solution called trickling is used. This means that the firewall starts to send small pieces of data to the client so it feels that it is receiving something and does not time out. For further information on trickling, see the Virus filtering and HTTP Technical White Paper available at the BalaBit Documentation Page at http://www.balabit.com/products/zorp/docs/

The following options are available for each scanpath:

plugins

Space-separated list of colon separated pairs that list the modules to be executed in the scanpath. The colon-separated pairs specify the module and its instance (for example, html:filterscripts, vbuster:paranoid).

quarantine_mode

Quarantine mode to be used. Always the original file is quarantined.

always

Quarantine all objects rejected for any reason.

rejected

Quarantine objects that could not be disinfected.

modified+rejected

Quarantine only the original version of the files which were successfully disinfected. E.g.: if an infected object is found but it is successfully disinfected, the original (infected) object is quarantined. That way, the object is retained even if the disinfection eliminates some important information.

never

Disable quarantining, objects rejected for any reason are dropped.

threshold_oversize

Objects larger than threshold_oversize (in bytes) are not scanned, because of performance/resource reasons (i.e. large archives, ISO files, etc.).

trickle_mode

Mode of trickling to be used. Default: NONE.

none

Trickling is disabled.

percent

Determine the amount of data to be trickled based on the size of the object. Data is sent to the client only when ZCV receives new data; the size of the data trickled is the set percentage of the total data received so far. This is the recommended method to use.

steady

Trickle fixed amount of data in fixed time intervals.

trickle_percent

Amount of data to be trickled (percentage). Defailt value: 10.

trickle_steady_initial_delay

When an object is downloaded, trickling is started after this period (in seconds). Default value: 10.

trickle_steady_delay

Period (in seconds) between trickling data chunks.

trickle_steady_bytes

Amount of data (in bytes) that is sent to the client in a chunk during trickling. Default value: 128 bytes.

Modules

The following modules are available in ZCV:

sed

Filters and rewrites the input in stream similarly to the operation of the UNIX 'sed' command.

vbuster

Performs virus scanning on the incoming data with the VirusBuster engine. The data is processed in file mode.

nod32

Performs virus scanning on the incoming data with the NOD32 engine. The data is processed in file mode.

clamav

Performs virus scanning on the incoming data with the Clam AntiVirus engine. The data is processed in file mode.

html

Performs JavaScript/Java/ActiveX filtering of HTML data in stream mode.

spamassassin

Performs spam filtering on the incoming e-mails with the SpamAssassin engine. The data is processed in file mode.

mail-hdr

Performs filtering and manipulation on the headers of e-mail messages. The data can be processed both in file and stream mode.

program

Performs filtering and/or manipulation of the data with an external 3rd-party application. The data can be processed either in file and stream mode.

The Sed module

The configuration name of the sed module is sed. This module has the following instance-specific options:

filter

The stucture of this string is the following: a slash (/), the string to be replaced, a slash (/), the replacement string, and the options. Slashes in the string have to be escaped with backslashes.The folowing options are available:

-g

Replace all occurances of the string.

-i

Run in case insensitive mode.

For example, the /example/sample/-g filter replaces all occurances of 'example' to 'sample'.

commtouch

Performs spam filtering on the incoming e-mails with the CommTouch engine. The data is processed in file mode.

The VBuster module

The configuration name of the vbuster module is vbuster. The vbuster module has the following module options:

temp_directory

Temporary directory used by the vbuster engine (e.g.: for uncompressing archives, etc.). Default value: /var/lib/zorp/tmp

database_path

The filename of the vbuster engine to be used. Default value: /var/lib/vbengine/vbengine8.vdb

archive_max_size

Archives larger than the specified value (in megabytes) are not scanned. Default value: 10.

archive_max_ratio

Ratio used to detect archive exploits (i.e. archives that are very small, but become very large if uncompressed). The parameter expects the desired ratio multiplied by ten. E.g.: if an archive with a compression ratio better than 1:100 should be detected as an exploit, the parameter has to be set to 1000. Default value: 1000.

vdb_error_soft_fail

If enabled and the virus database cannot be read, all objects are accepted. Default value: FALSE.

The vbuster module has the following instance-specific options:

heuristic_level

Level of heuristic sensitivity. The available levels are OFF, NORMAL, HIGH, and PARANOID. Default value: NORMAL.

scan_level

Level of database based virus scanning. The available levels are FAST, STRICT, and FULL. Default value: STRICT.

disinfect

Attempt disinfection if a virus is found. Default value: NO.

scan_suspicious

Perform virus scanning on suspicious files (e.g.: suspicious files are often new variants of known viruses). Default value: NO.

scan_packed

Perform virus scanning on archived files. Default value: YES.

remove_all_macros

Remove all macros from the objects. Default value: NO.

remove_all_ole_objects

Remove all ole objects from the files. Default value: NO.

The NOD32 module

The configuration name of the NOD32 module is nod32. The module has the following module options:

daemon_socket

The domain socket used to communicate with the nod32 engine. Default value: /var/run/nod32d.sock

daemon_timeout

Timeout value in milliseconds.

temp_directory

Temporary directory used by the nod32 engine (e.g.: for uncompressing archives, etc.). Default value: /var/lib/zorp/tmp

archive_max_size

Archives larger than the specified value (in megabytes) are not scanned. Default value: 10.

The nod32 module has the following instance-specific options:

heuristic_level

Level of heuristic sensitivity. The available levels are OFF, NORMAL, and HIGH. Default value: OFF.

disinfect

Attempt disinfection if a virus is found. Default value: NO.

scan_suspicious

Perform virus scanning on suspicious files (e.g.: suspicious files are often new variants of known viruses). Default value: NO.

scan_packed

Perform virus scanning on archived files. Default value: YES.

The clamav module

The configuration name of the Clam AntiVirus module is clamav. The module has the following module options:

daemon_socket

The domain socket used to communicate with the clamav engine. Default value: /var/run/clamav/clamd.ctl

The clamav module has the following instance-specific options:

scan_packed

Perform virus scanning on archived files. Default value: YES.

The SpamAssassin module

The configuration name of the SpamAssassin module is spamassassin. The module has the following instance-specific options::

check_only

Only check the e-mails, but do not make any modification to the e-mail. The result of the spam filtering is returned to ZCV separately. Default value: FALSE.

host and port

The hostname and port number of the machine SpamAssassin is running on, if different from the ZCV host.

socketpath

The domain socket used to communicate with SpamAssassin if it is running on the ZCV host. Default value: /var/run/spamassassin.sock

username

The user under which SpamAssassin should filter e-mails. Default value: not set, the user running SpamAssassin is used (nobody).

timeout

Timeout value for the scanning requests in milliseconds. Default value: -1 (unlimited).

[Note] Note

If the timeout is set to unlimited, a 60 second timeout value is used for the connection if SpamAssassin is running on a remote host.

threshold

The default value of this parameter equals the required_score of SpamAssassin (default value: 5). By default, ZCV rejects all e-mails SpamAssassin detects as spam. However, to minimize the impacts of false positive alarms, if the spam status of an e-mail (as calculated by SpamAssassin) is over the required_score, but below the value set in threshold, ZCV only marks the e-mail as spam, but does reject it. If the spam status of an e-mail is above the threshold, it is automatically rejected.

The HTML module

The configuration name of the html module is html.

The html module has the following instance-specific options:

filter_javascript

Remove javascript from HTML pages. Default value: NO. Enabling this option removes all javascript and script tags, and the conditional value prefixes (e.g.: onclick, onreset, etc.).

filter_activex

Remove ActiveX components from HTML pages. Default value: NO. Enabling this option removes the applet tags and the classid value prefix.

filter_java

Remove java from HTML pages. Default value: NO. Enabling this option removes the java: and application/java-archive inclusions, as well as the applet tags.

filter_css

Remove CSS (cascading style sheets) from HTML pages. Default value: NO. Enabling this option removes the single link tags, the style tags and options, as well as the class options.

filter_custom

A whitespace-separated value of colon separated pairs, specifying the headers, tags, etc. to be removed based on their names or their values.

The following HTML elements can be filtered:

Tags: Remove everything between the specified tag and its closing tag. Embedded structures are also handled. E.g.: closed-tag:ul

Single tags: Remove all occurrences of the specified single tag (img, hr, etc.). E.g.: tag:hr

Options: Remove options (e.g.: width, etc.) and their values. E.g.: option:width

Prefixes: Remove all options starting with the set prefix. E.g.: prefix:on will remove all options like onclick, etc.

buffer_size

This attribute control the size of the internal buffer of this module

The mail header module

The configuration name of the mail header module is mail-hdr. A filter contains a pattern (i.e. the header line to be found) enclosed within backslashes (/), a whitespace, the action to be performed on the header line, and an optional argument. The pattern and the argument can be regular expressions. To search for the pattern in case insensitive mode, add an i character after the closing backslash of the pattern. The following actions can be performed on the mail headers:

  • Append: Add the argument of the filter as a new header line after the match.

  • Discard: Discard the entire e-mail message. The argument is returned to the mail server sending the message as an error message.

  • Ignore: Remove the matching header line from the message.

  • Pass: Accept the matching header line. This action can be used to create exceptions from other filter rules.

  • Prepend: Add the argument of the filter as a new header line before the match.

  • Reject: Reject the entire e-mail message. The argument is returned to the sender of the message as an error message.

  • Replace: Replace the mathing header line to the argument of the filter.

The module has the following instance-specific options::

filter

The list of filters to be applied on the mail headers. For example:


            <filter>
                /^Subject: hello$/i          DISCARD
                /^Date: (.*)/                     APPEND "X-Date: \1 \1"            
            <filter>            
          

header_wrap_length

If a manipulated header line is longer than this value (in bytes), is will be broken into a new lines. These new lines will not be longer then header_wrap_length. Default value: .

max_line_length

This attribute control the maximum length of a header line

The CommTouch module

The configuration name of the CommTouch module is commtouch. The commtouch module has the following module options:

enable_spam_filter

Enable spam filtering using the CommTouch module.

enable_virus_filter

Enable virus detection using the CommTouch module.

use_proxy

The CommTouch module communicates with the central CommTouch server via HTTP. Enable this option if ZCV must use an HTTP proxy server to access the CommTouch server.

proxy_host

Host name of the proxy server.

proxy_port

Port number of the proxy server.

proxy_user

If the proxy server requires authentication, provide the username here.

proxy_password

If the proxy server requires authentication, provide the password here.

The commtouch module has the following instance-specific options:

spam_level

The level of spam probability above which the mail is regarded as spam. The possible values are: off, suspect, bulk, confirmed.

virus_level

The level of virus spreading attack probability above which the data is regarded as infected. The possible values are: off, medium, high.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zqc — Zorp Quarantine Checker

Synopsis

zqc [options]

Description

Check a quarantine directory and manage the files it contains.

There are no mandatory arguments; the settings may be specified as command-line options.

Options

-h

Display a brief help message.

--quarantine <quarantine> or -q <quarantine>

Directory used as quarantine. Default value: /var/lib/zorp/quarantine.

--format <format> or -t <format>

Chooses output format (txt or xml). Default value: xml.

--verbose or -v

Makes the output more verbose.

Selection options

--expr <expression> or -e <expression>

Select only the objects matching <expression>.

NOTE: This option may not be used together with --id.

--id <id0, id1, ...> or -i <id0, id1, ...>

Select only the objects having the specified ids.

NOTE: This option may not be used together with --expr.

Restrictive options

--older-than <days>, or -o <days>

Select files older than <days> days.

--bigger-than <Bytes>, or -b <Bytes>

Select only files larger than <Bytes> bytes. The size is specified in bytes by default, the 'k' suffix means kilobytes, etc.

--more-than <Number>, or -m <Number>

Select only objects above the total count limit <Number>.

Action options

--list_str <field0, field1, ...>, or -l <field0, field1, ...>

List the selected objects. Only the specified fields (<field0, field1, ...>) are displayed.

--preview <Bytes>, or -p <Bytes>

Dump the selected objects, or only the first <Bytes> bytes of each object if <Bytes> is specified.

--delete, or -d

Delete the selected objects.

--attachment-to <email address>, or -a <email address>

Send the selected objects as attachment to <email address>,

--subject <subject text>, or -s <subject text>

Subject for email sent by --attachment-to, empty by default.

--forward-to <email address>, or -f <email address>
Forward the selected objects to <email address>.

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zavupdate — Updates the various AntiVirus engine's databases and optionally the VirusBuster engine as well.

Synopsis

zavupdate [options]

Description

zavupdate updates the databases of the various AntiVirus engines (Clamav, Kaspersky, VirusBuster, NOD32) and optionally the engine of the VirusBuster virus filtering component used by Zorp and ZCV to filter the contents of the incoming and outgoing traffic.

Updating Virusbuster

When run for the first time for Virusbuster, zavupdate filters the relevant content of the /etc/apt/sources.list file into /etc/zorp/vbuster.conf. Only the sources suitable to update VirusBuster packages are used. If /etc/zorp/vbuster.list is empty, zavupdate will exit with an error message. This file can be edited manually, the changes will be preserved. zavupdate was designed to run regularly as a cron job. However, it can be run manually if needed - it is recommended to run manually with a higher verbosity level to track down problems encountered during upgrading.

Options

-v <verbosity_level>

The verbosity level of the program. Default value: 3.

  • 0: No messages.

  • 1: Show only error messages.

  • 2: Report successful database updates.

  • 3: Show also progress indicator messages.

  • 4: Show all messages. (NOTE: The output can be very large.)

-u <update_selection>

Specifies the components to update. Default value: 0

  • 0: Update the database only.

  • 1: Update the database and the engine.

Only meaningful for the Virusbuster updater.

-f

Force the execution of zavupdate, with this option the HRS settings in /etc/zorp/*.options can be overridden.

-V

Display the version number of zavupdate.

-s

Use syslog for logging (otherwise zavupdate logs into the file /var/log/zavupdate.log).

-h

Display a brief help message.

Files

/etc/zorp/zavupdate.conf

/etc/zorp/vbuster.list

/var/log/zavupdate.log

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Name

zavupdate.conf, clamav.options, nod32.options, virusbuster.options — zavupdate(8) configuration files.

Description

zavupdate reads its configuration from the /etc/zorp/zavupdate.conf file and the various .options files in the /etc/zorp directory. zavupdate was designed to run regularly as a cron job.

Options

ADMINEMAIL

The e-mail address(es) of the administrator(s). Leaving this field blank suppresses the sending of notification e-mails.

VERBOSE

The verbosity level of the program.

  • 0: no messages;

  • 1: show only error messages;

  • 2: report successful database upgrades;

  • 3: show also progress indicator messages;

  • 4: show all messages (NOTE: The output can be huge.).

SYSLOG

When set to 1, zavupdate use syslog for logging (otherwise zavupdate logs into the file /var/log/zavupdate.log).

FTPPROXY

If access to FTP servers has to go through a proxy and the individual AV engine's package does not handle proxy server setttings(e.g: Upgrade of the VirusBuster engine and database), the following setting has to be used: FTPPROXY="http://proxyhost:proxyport/" . If the proxy requires authentication, specify the username and the password as well: FTPPROXY="http://username:password@proxyhost:proxyport/.

HTTPPROXY

Access HTTP servers via proxy. The syntax is the same as the FTPPROXY's.

SUBJPREFIX

An optional prefix which will be written to the subject line of the e-mail messages sent by the program. When using zavupdate on multiple hosts, this setting can be used to differentiate between the hosts. It is recommended to set this parameter to the hostname of the host zavupdate is running on.

HRS

The hours when zavupdate will run the database update for the specied AV engine. Example: HRS="5 11 17 23". If the HRS parameter is left blank, zavupdate will updates the database every time it is invoked. It has to be specified in the per-engine .options files.

DOENGINEUPGRADE

Specifies the components to upgrade. When set to 1 (TRUE), then the engine package (libvbengine4) will be also upgraded. Only meaningful in the /etc/zorp/vbuster.options file.

Engine specific configuration files

Engine specific settings for the different AV engines are specified in the various .options files under /etc/zorp. This files contain per-engine settings for zavupdate, most notably the HRS setting.

Files

/etc/zorp/zavupdate.conf

/etc/zorp/vbuster.options

/etc/zorp/clamav.options

/etc/zorp/nod32.options

Author

This manual page was written by the BalaBit Documentation Team <documentation@balabit.com>.

Copyright

Copyright © 2006-2008 BalaBit IT Security Ltd. All rights reserved. For more information about the legal status of this document please read: http://www.balabit.com/support/documentation/legal_notice.bbq

Appendix 3. Monitoring jobs reference

The input and output parameters of the monitoring jobs available in Zorp are described in this appendix. For details on monitoring, see Chapter 19, Monitoring hosts and servers in the Zorp Administrator's Guide.

Name

connect

Description

A connect job establishes a TCP connection with the specified remote host. The response of the host (i.e. the reply banner) can be checked against a preset banner message.

Job parameters

Port

The port of the remote host to establish the connection on.

Timeout

Connection timeout in seconds; if the connection cannot be established during this period, the remote host is assumed to be unreachable/dead.

Regexp

The first line of the reply sent by the remote host when the connection is established is compared to this expression. This feature can be used to check the banners of applications (e.g.: check the type of the FTP server) running on the remote host.

Icase

Enable/disable case sensitive comparison of the host reply.

Output parameters

match

The result of comparing the banner in the remote machine's reply to the Regexp input parameter. Contains 1 for a matching banner, 0 for a different banner.

response_time

The total time required to connect the remote machine and retrieve the banner.

Name

diskfree

Description

diskfree reports the amount of free disk space available on a partition or mount point. The parameter of the job is the partition or the mount point (e.g.: /dev/hda2 or /var).

Job parameters

Mount point

The mount point or the label of the disk volume.

Output parameters

total_bytes

Total available space in bytes.

free_bytes

Available free space in bytes.

used_bytes

The amount of stored data in bytes.

total_inodes

Total number of i-nodes.

free_inodes

The number of free i-nodes.

used_inodes

The number of used i-nodes.

Name

hastatus

Description

hastatus returns the status of the specified resource of a cluster, i.e. on which node is it active at the moment.

Job parameters

resource

The name of the heartbeat resource.

Output parameters

resource_status

Status of the resource:

  • 0 = not running;

  • 1 = running.

resource_status_description

Textual form of the resource status:

  • Running; or

  • Not running.

Name

iface

Description

iface reports statistical information (e.g.: number of bytes sent/received, errors encountered, etc.) about the specified interface.

Job parameters

iface

The name of the network interface to monitor.

Output parameters

rbytes

Number of received bytes.

rpackets

Number of received packets.

rerrors

Number of received packets containing error.

rdrop

Number of received packets that were dropped.

rfifo

Number of received fifo packets.

rframe

Number of received packets containing frame error.

rcomp

Number of received compressed packets.

rmcast

Number of received multicast packets.

sbytes

Number of sent bytes.

spackets

Number of sent packets.

serrors

Number of sent packets containing error.

sdrop

Number of sent packets that were dropped.

sfifo

Number of sent fifo packets.

scoll

Number of collisions encountered while sending packets.

scarr

Number of carrier errors encountered while sending packets.

scomp

Number of sent compressed packets.

Name

load

Description

load reports the average load of the host and the number of running processes, as well as the total number of processes (i.e. the information contained in /proc/loadavg).

Job parameters

This job has no additional parameters.

Output parameters

load1

Average load of the last 1 minute.

load5

Average load of the last 5 minutes.

load15

Average load of the last 15 minutes.

Name

mem

Description

mem reports information about the memory usage of the host (i.e. the information contained in /proc/meminfo).

Job parameters

This job has no additional parameters.

Output parameters

total

Total amount of the physical memory in kilobytes.

used

The amount of the used physical memory in kilobytes.

free

The amount of the free physical memory in kilobytes.

total_swap

Total amount of the swap memory in kilobytes.

used_swap

The amount of the used swap memory in kilobytes.

free_swap

The amount of the free swap memory in kilobytes.

Name

mysql

Description

As of Zorp 3.3R3, this plugin has been removed from Zorp, because the license of the libraries used by the plugin has been changed.

Name

ping

Description

ping executes the ping command the number of times set in Frequency within the period set in Interval and returns the average of the measured results.

Job parameters

resource

The name of the heartbeat resource.

interval

The length of a probe in seconds.

freq

The frequency of echo request, specified in seconds. E.g., if freq is 1, one echo request is sent every second.

Output parameters

avg_rtt

Average roundtrip time in milliseconds.

max_rtt

Maximum roundtrip time in milliseconds.

min_rtt

Minimum roundtrip time in milliseconds.

lost

Ratio of lost packets (percentage).

Name

postfix

Description

postfix returns information about the status of Postfix on the monitored host, including the number of mails in the queue, the size of the queue, etc.

Job parameters

resource

The name of the heartbeat resource.

Output parameters

mailstatus

Status of the mail system:

  • 1 = running;

  • 0 = not running.

size

Size of the mail queue in kilobytes.

requests

Number of requests in the mail queue.

active

Number of active requests in the mail queue.

Name

proc

Description

proc returns the number of processes running with the specified name.

Job parameters

name

The name of the process to monitor.

Output parameters

name

The name of the monitored process.

number

The number of processes running with the specified name.

Name

raid

Description

raid executes the /proc/mdstat command for the specified volume and returns type and status information. See the manual pages of mdstat for details.

Job parameters

volume

Name of the raid volume to monitor (e.g.: /dev/md0).

Output parameters

volume

Name of the monitored raid volume.

raidtype

Type of the monitored raid volume.

active

State of the monitored raid volume:

  • 1 = active;

  • 0 = inactive.

raidstat

Status of the monitored raid volume:

  • 1 = running;

  • 0 = resync;

  • -1 = failure;

  • -2 = internal error.

comment

Comment about the status of the monitored raid volume.

Name

smtp

Description

smtp establishes an SMTP connection to the specified remote host.

Job parameters

port

The port number the remote SMTP server is accepting connections on (usually port 25).

timeout

Connection timeout in seconds; if the connection cannot be established within this period, the remote SMTP server is assumed to be dead.

Output parameters

respnumber

Response number of the SMTP banner.

resptime

The total time required to connect the server and retrieve the banner.

Name

urlcheck

Description

urlcheck tests the availability of the specified Url. Although the job is executed on the host selected for the job, it also appears as a remote job on the host specified in the Remote host field. This job supports ftp and http connections; the Url has to be specified accordingly (i.e. starting with ftp:// or http://).

Job parameters

url

The target URL to test. Only ftp and http protocols are supported.

timeout

Connection timeout in seconds; if the connection cannot be established within this period, the URL is assumed to be unavailable.

Output parameters

This job has no output parameters.

Name

vmstat

Description

vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity using the vmstat utility. See the manual pages of vmstat for details.

Job parameters

This job has no additional parameters.

Output parameters

procr

The number of processes waiting for runtime.

procb

The number of processes in uninterruptible sleep.

procs

The number of processes swapped to disk.

memswpd

The amount of virtual memory used.

memfree

The amount of idle memory.

membuff

The amount of memory used as buffer.

memcache

The amount of memory used as cache.

swapin

The amount of memory swapped in from disk.

swapout

The amount of memory swapped to disk.

iobi

The number of blocks received from a block device (blocks/s).

iobo

The number of blocks sent to a block device (blocks/s).

sysint

The number of interrupts per second, including the clock.

syscs

The number of context switches per second.

cpuuser

Time spent running non-kernel code. (User time, including nice time.)

cpusys

Time spent running kernel code. (system time)

cpuidle

Time spent idle.

Name

zorp

Description

zorp returns information about the status of the specified Zorp instance, e.g.: the number of total/running threads, etc.

Job parameters

instance

The Zorp instance to monitor.

Output parameters

inst_state

Status of the instance:

  • running: The instance is running normally.

  • stopped: The instance has stopped.

  • missing: The instance has a PID file, but the process is not running.

  • noszig: The instance is not accessible.

run_threads

Number of running threads.

total_threads

Maximum number of threads allowed within the instance.

thread_load1

Average number of threads in the last 1 minute. (thread load)

thread_load5

Average number of threads in the last 5 minutes. (thread load)

thread_load15

Average number of threads in the last 15 minutes. (thread load)

Appendix 4. Global options of Zorp

Zorp has a number of global options and variables that are used during the initialization of the engine, before any proxies or services are started. These options control the swapping of large data chunks (blobs) to disk, the handling of audit trails, and other miscellaneous parameters. To set these options, complete the following steps:

4.1. Procedure – Setting global options of Zorp

  1. Select the Zorp ZMC component, then select Variables > New.

  2. Enter the name of the global option into the Name field, and select the type of the option in the Type field.

  3. Select OK, then Edit.

  4. Enter the desired value of the option, then select OK.

[Note] Note

Global options can be also set at the beginning of the Config.py file if managing the configuration of Zorp manually.

Name

blob

Description

These options control the handling of large data chunks (blobs), determine when the are swapped to disk, and also how much disk space and memory can be used by Zorp.

Blob options

config.blob.temp_directory

The directory where the blobs are swapped to. Default value: /var/lib/zorp/tmp/

config.blob.hiwat

Zorp tries to store everything in the memory if possible. If the memory usage of Zorp reaches hiwat, it starts to swap the data onto the hard disk, until the memory usage reaches lowat. Default value: 128*0x100000 (128 MB)

config.blob.lowat

Global options can be also set at the beginning of the Config.py file if managing the configuration of Zorp manually.

Lower threshold of data swapping. Default value: 96*0x100000 (96 MB)

config.blob.max_disk_usage

The maximum amount of hard disk space that Zorp is allowed to use. Default value: 1024*0x100000 (1 GB)

config.blob.max_mem_usage

The maximum amount of memory that Zorp is allowed to use. Default value: 256*0x100000 (256 MB)

config.blob.noswap_max

Objects smaller than this value (in bytes) are never swapped to hard disk. Default value: 16384

Name

audit

Description

These options control the handling of audit trails in Zorp.

Audit options

config.audit.compress

Enable the compression of audit trail files. The level of compression can be set via the config.audit.compress_level parameter. Default value: TRUE

config.audit.compress_level

The level of compression ranging from 1 (lowest, default) to 9 (highest). Please note that higher compression levels use significantly more CPU, therefore it is usually not recommended to set it to higher than 4. Default value: 1

config.audit.encrypt

Encrypt the audit trail files using the key provided in the config.audit.encrypt_certificate parameter. Default value: FALSE

config.audit.encrypt_certificate

The X.509 PEM certificate used to encrypt the audit trail files. Default value: empty.

The certificate should be placed in the following format:

-----BEGIN CERTIFICATE-----
insert key here
-----END CERTIFICATE-----

config.audit.encrypt_certificate_file

Name and path of the file containing the X.509 PEM certificate used to encrypt the audit trail files. If this parameter is set, it overrides the settings of config.audit.encrypt_certificate. Default value: empty.

config.audit.reopen_size_threshold

The maximum size of a single audit trail file in bytes. Default value: 2000000000L (2 GB)

config.audit.per_session

Store each session in its own audit file. Default value: FALSE

config.audit.reopen_time_threshold

The maximum time frame of a single audit file in seconds. Default value: 28800 (8 hours)

config.audit.rate_limit

Zorp considers it abnormal if the size of an audit trail is increasing faster than this value in byte/second. Default value: 2097152 (2 MB)

config.audit.rate_notification_interval

Time in seconds before repeating the notification about abnormally growing audit trails. Default value: 300 (5 minutes)

config.audit.write_size_max

Maximum size of an audit trail file in bytes. Default value: 52428800 (50 MB)

config.audit.terminate_on_max_size

If set to TRUE, Zorp terminates the connection if the corresponding audit trail file reaches the size limit set in config.audit.write_size_max. Default value: FALSE

Name

options

Description

These options control various behavior of Zorp.

Options

config.options.dscp_prio_mapping

Priority mapping for transferring Differentiated Services Code Point (DSCP, also known as Type of Service or ToS). The low (0), normal (1), high (2), and urgent (3) priorities can be assigned to the DSCP classes. The assigned priority determines the priority of the Zorp thread that handles the connection. The mapping is actually a hash table consisting of the DSCP class ID, a colon (:), the priority of the class (0-3), and a comma (,) except for the last row. For example:

config.options.dscp_mapping =  { 1: 3, 
                                 2: 2, 
                                 3: 2, 
                                 4: 0 }
config.options.language

The default language used to display user-visible messages, e.g., HTTP error pages. Default value: en (English). Other supported languages: de (German); hu (Hungarian).

config.options.timeout_server_connect

The timeout (in milliseconds) used when establishing server-side connections. Default value: 30000 (30 sec)

Cache options

Zorp caches certain data (e.g., to which zone a particular IP address belongs to) to decrease the time required to process a connection. The following parameters determine the size of these caches (the number of decisions stored in the cache). Adjusting these parameters is required only in environments having very complex zone structure and a large number of services. The following log message indicates that a cache is full: Cache over shift-threshold, shifting

config.zone_dispatcher_shift_threshold

Stores dispatcher-zone pairs, and if the dispatcher can be accessed from the zone. Default value: 1000

config.zone_cache_shift_threshold

Stores IP addresses and the zone they belong to. Default value: 1000

config.inbound_service_cache_threshold

Stores service-zone pairs, and if the service is permitted to enter the zone. Default value: 1000

config.outbound_service_cache_threshold

Stores service-zone pairs, and if the service is permitted to leave the zone. Default value: 1000

Index of Proxy attributes

F

Finger
AbstractFingerProxy
max_hop_count, Attributes of AbstractFingerProxy
max_hostname_length, Attributes of AbstractFingerProxy
max_line_length, Attributes of AbstractFingerProxy
max_username_length, Attributes of AbstractFingerProxy
request_detailed, Attributes of AbstractFingerProxy
request_hostnames, Attributes of AbstractFingerProxy
request_username, Attributes of AbstractFingerProxy
response_footer, Attributes of AbstractFingerProxy
response_header, Attributes of AbstractFingerProxy
strict_username_check, Attributes of AbstractFingerProxy
timeout, Attributes of AbstractFingerProxy
fingerRequest
hostname, Arguments of fingerRequest
username, Arguments of fingerRequest
Ftp
AbstractFtpProxy
active_connection_mode, Attributes of AbstractFtpProxy
buffer_size, Attributes of AbstractFtpProxy
data_mode, Attributes of AbstractFtpProxy
data_port_max, Attributes of AbstractFtpProxy
data_port_min, Attributes of AbstractFtpProxy
features, Attributes of AbstractFtpProxy
hostname, Attributes of AbstractFtpProxy
hostport, Attributes of AbstractFtpProxy
masq_address_client, Attributes of AbstractFtpProxy
masq_address_server, Attributes of AbstractFtpProxy
max_continuous_line, Attributes of AbstractFtpProxy
max_hostname_length, Attributes of AbstractFtpProxy
max_line_length, Attributes of AbstractFtpProxy
max_password_length, Attributes of AbstractFtpProxy
max_username_length, Attributes of AbstractFtpProxy
password, Attributes of AbstractFtpProxy
permit_client_bounce_attack, Attributes of AbstractFtpProxy
permit_empty_command, Attributes of AbstractFtpProxy
permit_server_bounce_attack, Attributes of AbstractFtpProxy
permit_unknown_command, Attributes of AbstractFtpProxy
proxy_password, Attributes of AbstractFtpProxy
proxy_username, Attributes of AbstractFtpProxy
request, Attributes of AbstractFtpProxy
request_command, Attributes of AbstractFtpProxy
request_parameter, Attributes of AbstractFtpProxy
request_stack, Attributes of AbstractFtpProxy
response, Attributes of AbstractFtpProxy
response_parameter, Attributes of AbstractFtpProxy
response_status, Attributes of AbstractFtpProxy
response_strip_msg, Attributes of AbstractFtpProxy
strict_port_checking, Attributes of AbstractFtpProxy
target_port_range, Attributes of AbstractFtpProxy
timeout, Attributes of AbstractFtpProxy
transparent_mode, Attributes of AbstractFtpProxy
username, Attributes of AbstractFtpProxy
valid_chars_username, Attributes of AbstractFtpProxy

H

Http
AbstractHttpProxy
auth_by_cookie, Attributes of AbstractHttpProxy
auth_cache_time, Attributes of AbstractHttpProxy
auth_cache_update, Attributes of AbstractHttpProxy
auth_forward, Attributes of AbstractHttpProxy
auth_realm, Attributes of AbstractHttpProxy
buffer_size, Attributes of AbstractHttpProxy
connection_mode, Attributes of AbstractHttpProxy
connect_proxy, Attributes of AbstractHttpProxy
current_header_name, Attributes of AbstractHttpProxy
current_header_value, Attributes of AbstractHttpProxy
default_port, Attributes of AbstractHttpProxy
enable_url_filter, Attributes of AbstractHttpProxy
enable_url_filter_dns, Attributes of AbstractHttpProxy
error_files_directory, Attributes of AbstractHttpProxy
error_headers, Attributes of AbstractHttpProxy
error_info, Attributes of AbstractHttpProxy
error_msg, Attributes of AbstractHttpProxy
error_silent, Attributes of AbstractHttpProxy
error_status, Attributes of AbstractHttpProxy
keep_persistent, Attributes of AbstractHttpProxy
language, Attributes of AbstractHttpProxy
max_auth_time, Attributes of AbstractHttpProxy
max_body_length, Attributes of AbstractHttpProxy
max_chunk_length, Attributes of AbstractHttpProxy
max_header_lines, Attributes of AbstractHttpProxy
max_hostname_length, Attributes of AbstractHttpProxy
max_keepalive_requests, Attributes of AbstractHttpProxy
max_line_length, Attributes of AbstractHttpProxy
max_url_length, Attributes of AbstractHttpProxy
parent_proxy, Attributes of AbstractHttpProxy
parent_proxy_port, Attributes of AbstractHttpProxy
permit_both_connection_headers, Attributes of AbstractHttpProxy
permit_ftp_over_http, Attributes of AbstractHttpProxy
permit_http09_responses, Attributes of AbstractHttpProxy
permit_invalid_hex_escape, Attributes of AbstractHttpProxy
permit_null_response, Attributes of AbstractHttpProxy
permit_proxy_requests, Attributes of AbstractHttpProxy
permit_server_requests, Attributes of AbstractHttpProxy
permit_unicode_url, Attributes of AbstractHttpProxy
request, Attributes of AbstractHttpProxy
request_count, Attributes of AbstractHttpProxy
request_header, Attributes of AbstractHttpProxy
request_method, Attributes of AbstractHttpProxy
request_mime_type, Attributes of AbstractHttpProxy
request_stack, Attributes of AbstractHttpProxy
request_url, Attributes of AbstractHttpProxy
request_url_file, Attributes of AbstractHttpProxy
request_url_host, Attributes of AbstractHttpProxy
request_url_passwd, Attributes of AbstractHttpProxy
request_url_port, Attributes of AbstractHttpProxy
request_url_proto, Attributes of AbstractHttpProxy
request_url_scheme, Attributes of AbstractHttpProxy
request_url_username, Attributes of AbstractHttpProxy
require_host_header, Attributes of AbstractHttpProxy
rerequest_attempts, Attributes of AbstractHttpProxy
reset_on_close, Attributes of AbstractHttpProxy
response, Attributes of AbstractHttpProxy
response_header, Attributes of AbstractHttpProxy
response_mime_type, Attributes of AbstractHttpProxy
response_stack, Attributes of AbstractHttpProxy
rewrite_host_header, Attributes of AbstractHttpProxy
strict_header_checking, Attributes of AbstractHttpProxy
strict_header_checking_action, Attributes of AbstractHttpProxy
target_port_range, Attributes of AbstractHttpProxy
timeout, Attributes of AbstractHttpProxy
timeout_request, Attributes of AbstractHttpProxy
timeout_response, Attributes of AbstractHttpProxy
transparent_mode, Attributes of AbstractHttpProxy
url_category, Attributes of AbstractHttpProxy
use_canonicalized_urls, Attributes of AbstractHttpProxy
use_default_port_in_transparent_mode, Attributes of AbstractHttpProxy
HttpProxyURIFilter
matcher, Attributes of HttpProxyURIFilter

L

Ldap
AbstractLdapProxy
max_message_size, Attributes of AbstractLdapProxy
max_pending_request, Attributes of AbstractLdapProxy
max_search_response_number, Attributes of AbstractLdapProxy
permit_sasl_transport, Attributes of AbstractLdapProxy
request, Attributes of AbstractLdapProxy
response_overrun_action, Attributes of AbstractLdapProxy
timeout, Attributes of AbstractLdapProxy
Lp
AbstractLpProxy
max_line_length, Attributes of AbstractLpProxy
request, Attributes of AbstractLpProxy
timeout, Attributes of AbstractLpProxy

P

Plug
AbstractPlugProxy
bandwidth_to_client, Attributes of AbstractPlugProxy
bandwidth_to_server, Attributes of AbstractPlugProxy
buffer_size, Attributes of AbstractPlugProxy
copy_to_client, Attributes of AbstractPlugProxy
copy_to_server, Attributes of AbstractPlugProxy
packet_stats_interval_packet, Attributes of AbstractPlugProxy
packet_stats_interval_time, Attributes of AbstractPlugProxy
secondary_mask, Attributes of AbstractPlugProxy
secondary_sessions, Attributes of AbstractPlugProxy
shutdown_soft, Attributes of AbstractPlugProxy
stack_proxy, Attributes of AbstractPlugProxy
timeout, Attributes of AbstractPlugProxy
packetStats
client_bytes, Arguments of packetStats
client_pkts, Arguments of packetStats
server_bytes, Arguments of packetStats
server_pkts, Arguments of packetStats
Pop3
AbstractPop3Proxy
max_authline_count, Attributes of AbstractPop3Proxy
max_password_length, Attributes of AbstractPop3Proxy
max_request_line_length, Attributes of AbstractPop3Proxy
max_response_line_length, Attributes of AbstractPop3Proxy
max_username_length, Attributes of AbstractPop3Proxy
password, Attributes of AbstractPop3Proxy
permit_longline, Attributes of AbstractPop3Proxy
permit_unknown_command, Attributes of AbstractPop3Proxy
reject_by_mail, Attributes of AbstractPop3Proxy
request, Attributes of AbstractPop3Proxy
request_command, Attributes of AbstractPop3Proxy
request_param, Attributes of AbstractPop3Proxy
response_multiline, Attributes of AbstractPop3Proxy
response_param, Attributes of AbstractPop3Proxy
response_stack, Attributes of AbstractPop3Proxy
response_value, Attributes of AbstractPop3Proxy
session_timestamp, Attributes of AbstractPop3Proxy
timeout, Attributes of AbstractPop3Proxy
username, Attributes of AbstractPop3Proxy

S

Sip
AbstractSipProxy
max_keepalive_size, Attributes of AbstractSipProxy
max_message_size, Attributes of AbstractSipProxy
media_connection_mark, Attributes of AbstractSipProxy
secondary_mask, Attributes of AbstractSipProxy
secondary_sessions, Attributes of AbstractSipProxy
timeout, Attributes of AbstractSipProxy
SipProxy
media, Attributes of SipProxy
permit_rtp_zones, Attributes of SipProxy
rtp_endpoint_rewrite_nat_policy, Attributes of SipProxy
Smtp
AbstractSmtpProxy
active_extensions, Attributes of AbstractSmtpProxy
add_received_header, Attributes of AbstractSmtpProxy
append_domain, Attributes of AbstractSmtpProxy
autodetect_domain_from, Attributes of AbstractSmtpProxy
domain_name, Attributes of AbstractSmtpProxy
extensions, Attributes of AbstractSmtpProxy
interval_transfer_noop, Attributes of AbstractSmtpProxy
max_auth_request_length, Attributes of AbstractSmtpProxy
max_request_length, Attributes of AbstractSmtpProxy
max_response_length, Attributes of AbstractSmtpProxy
permit_long_responses, Attributes of AbstractSmtpProxy
permit_omission_of_angle_brackets, Attributes of AbstractSmtpProxy
permit_unknown_command, Attributes of AbstractSmtpProxy
request, Attributes of AbstractSmtpProxy
request_command, Attributes of AbstractSmtpProxy
request_param, Attributes of AbstractSmtpProxy
request_stack, Attributes of AbstractSmtpProxy
require_crlf, Attributes of AbstractSmtpProxy
resolve_host, Attributes of AbstractSmtpProxy
response, Attributes of AbstractSmtpProxy
response_param, Attributes of AbstractSmtpProxy
response_value, Attributes of AbstractSmtpProxy
timeout, Attributes of AbstractSmtpProxy
tls_passthrough, Attributes of AbstractSmtpProxy
unconnected_response_code, Attributes of AbstractSmtpProxy
SmtpProxy
error_soft, Attributes of SmtpProxy
permit_exclamation_mark, Attributes of SmtpProxy
permit_percent_hack, Attributes of SmtpProxy
recipient_matcher, Attributes of SmtpProxy
relay_check, Attributes of SmtpProxy
relay_domains, Attributes of SmtpProxy
relay_domains_matcher, Attributes of SmtpProxy
relay_zones, Attributes of SmtpProxy
sender_matcher, Attributes of SmtpProxy
SQLNet
AbstractSQLNetProxy
connect_data, Attributes of AbstractSQLNetProxy
server_address, Attributes of AbstractSQLNetProxy
server_port, Attributes of AbstractSQLNetProxy
split_connect_threshold, Attributes of AbstractSQLNetProxy
strict_redirect_parsing, Attributes of AbstractSQLNetProxy
timeout, Attributes of AbstractSQLNetProxy
connectRequest
connect_data, Arguments of connectRequest
SQLNetProxy
transparent_mode, Attributes of SQLNetProxy
Ssh
AbstractSshProxy
audit_channels, Attributes of AbstractSshProxy
auth_agent_forward, Attributes of AbstractSshProxy
auth_methods, Attributes of AbstractSshProxy
check_insane_settings, Attributes of AbstractSshProxy
client_channel, Attributes of AbstractSshProxy
client_cipher_algos, Attributes of AbstractSshProxy
client_comp_algos, Attributes of AbstractSshProxy
client_hostkey_algos, Attributes of AbstractSshProxy
client_kex_algos, Attributes of AbstractSshProxy
client_mac_algos, Attributes of AbstractSshProxy
client_request, Attributes of AbstractSshProxy
connection_start, Attributes of AbstractSshProxy
greeting, Attributes of AbstractSshProxy
host_key_x509_dss, Attributes of AbstractSshProxy
host_key_x509_dss_certificate, Attributes of AbstractSshProxy
host_key_x509_dss_files, Attributes of AbstractSshProxy
host_key_x509_rsa, Attributes of AbstractSshProxy
host_key_x509_rsa_certificate, Attributes of AbstractSshProxy
host_key_x509_rsa_files, Attributes of AbstractSshProxy
id_comment, Attributes of AbstractSshProxy
max_kbdint_prompts, Attributes of AbstractSshProxy
max_kbdint_prompt_len, Attributes of AbstractSshProxy
max_kbdint_response_len, Attributes of AbstractSshProxy
server_channel, Attributes of AbstractSshProxy
server_cipher_algos, Attributes of AbstractSshProxy
server_comp_algos, Attributes of AbstractSshProxy
server_hostkey_algos, Attributes of AbstractSshProxy
server_kex_algos, Attributes of AbstractSshProxy
server_mac_algos, Attributes of AbstractSshProxy
server_request, Attributes of AbstractSshProxy
software_version, Attributes of AbstractSshProxy
timeout, Attributes of AbstractSshProxy
transparent_mode, Attributes of AbstractSshProxy
userauth_banner, Attributes of AbstractSshProxy
SshProxy
enable_agent_forward, Attributes of SshProxy
enable_port_forward, Attributes of SshProxy
enable_x11_forward, Attributes of SshProxy
host_key_dss_file, Attributes of SshProxy
host_key_rsa_file, Attributes of SshProxy
server_hostkeys_dir, Attributes of SshProxy
server_hostkeys_verify, Attributes of SshProxy
SshSFtpProxy
timeout, Attributes of SshSFtpProxy

Index of Core attributes

P

Proxy
getCredentials
domain, Arguments of getCredentials
method, Arguments of getCredentials
port, Arguments of getCredentials
target, Arguments of getCredentials
username, Arguments of getCredentials
Proxy
auth_inband_defer, Attributes of Proxy
language, Attributes of Proxy
ssl.client_cagroup_directories, Attributes of Proxy
ssl.client_ca_directory, Attributes of Proxy
ssl.client_cert_file, Attributes of Proxy
ssl.client_connection_security, Attributes of Proxy
ssl.client_crl_directory, Attributes of Proxy
ssl.client_disable_proto_sslv2, Attributes of Proxy
ssl.client_disable_proto_sslv3, Attributes of Proxy
ssl.client_disable_proto_tlsv1, Attributes of Proxy
ssl.client_keypair_files, Attributes of Proxy
ssl.client_keypair_generate, Attributes of Proxy
ssl.client_key_file, Attributes of Proxy
ssl.client_local_privatekey, Attributes of Proxy
ssl.client_local_privatekey_passphrase, Attributes of Proxy
ssl.client_ssl_cipher, Attributes of Proxy
ssl.client_ssl_method, Attributes of Proxy
ssl.client_trusted_certs_directory, Attributes of Proxy
ssl.client_verify_cagroup_directories, Attributes of Proxy
ssl.client_verify_ca_directory, Attributes of Proxy
ssl.client_verify_crl_directory, Attributes of Proxy
ssl.client_verify_depth, Attributes of Proxy
ssl.client_verify_type, Attributes of Proxy
ssl.handshake_seq, Attributes of Proxy
ssl.handshake_timeout, Attributes of Proxy
ssl.key_generator, Attributes of Proxy
ssl.permit_invalid_certificates, Attributes of Proxy
ssl.permit_missing_crl, Attributes of Proxy
ssl.server_cagroup_directories, Attributes of Proxy
ssl.server_ca_directory, Attributes of Proxy
ssl.server_cert_file, Attributes of Proxy
ssl.server_check_subject, Attributes of Proxy
ssl.server_connection_security, Attributes of Proxy
ssl.server_crl_directory, Attributes of Proxy
ssl.server_disable_proto_sslv2, Attributes of Proxy
ssl.server_disable_proto_sslv3, Attributes of Proxy
ssl.server_disable_proto_tlsv1, Attributes of Proxy
ssl.server_keypair_files, Attributes of Proxy
ssl.server_keypair_generate, Attributes of Proxy
ssl.server_key_file, Attributes of Proxy
ssl.server_local_privatekey, Attributes of Proxy
ssl.server_local_privatekey_passphrase, Attributes of Proxy
ssl.server_ssl_cipher, Attributes of Proxy
ssl.server_ssl_method, Attributes of Proxy
ssl.server_trusted_certs_directory, Attributes of Proxy
ssl.server_verify_cagroup_directories, Attributes of Proxy
ssl.server_verify_ca_directory, Attributes of Proxy
ssl.server_verify_crl_directory, Attributes of Proxy
ssl.server_verify_depth, Attributes of Proxy
ssl.server_verify_type, Attributes of Proxy
setServerAddress
host, Arguments of setServerAddress
port, Arguments of setServerAddress
userAuthenticated
entity, Arguments of userAuthenticated

S

Service
AbstractService
name, Attributes of AbstractService
PFService
dnat_policy, Attributes of PFService
router, Attributes of PFService
snat_policy, Attributes of PFService
Service
authentication_policy, Attributes of Service
authorization_policy, Attributes of Service
auth_name, Attributes of Service
chainer, Attributes of Service
dnat_policy, Attributes of Service
instance_id, Attributes of Service
keepalive, Attributes of Service
max_instances, Attributes of Service
max_sessions, Attributes of Service
num_instances, Attributes of Service
proxy_class, Attributes of Service
resolver_policy, Attributes of Service
router, Attributes of Service
snat_policy, Attributes of Service
__init__
authentication_policy, Arguments of __init__
authorization_policy, Arguments of __init__
auth_name, Arguments of __init__
chainer, Arguments of __init__
dnat_policy, Arguments of __init__
keepalive, Arguments of __init__
max_instances, Arguments of __init__
max_sessions, Arguments of __init__
name, Arguments of __init__, Arguments of __init__
proxy_class, Arguments of __init__
resolver_policy, Arguments of __init__
router, Arguments of __init__
snat_policy, Arguments of __init__
Session
StackedSession
chainer, Attributes of StackedSession
owner, Attributes of StackedSession
SockAddr
SockAddrInet
ip, Attributes of SockAddrInet
ip_s, Attributes of SockAddrInet
port, Attributes of SockAddrInet
type, Attributes of SockAddrInet
SockAddrInetRange
ip, Attributes of SockAddrInetRange
ip_s, Attributes of SockAddrInetRange
port, Attributes of SockAddrInetRange
type, Attributes of SockAddrInetRange
SockAddrUnix
type, Attributes of SockAddrUnix

Z

Zone
__init__
addr, Arguments of __init__
admin_parent, Arguments of __init__
inbound_services, Arguments of __init__
name, Arguments of __init__
outbound_services, Arguments of __init__
umbrella, Arguments of __init__

Index of all attributes

A

acl, Arguments of __init__
active_connection_mode, Attributes of AbstractFtpProxy
active_extensions, Attributes of AbstractSmtpProxy
addr, Arguments of __init__, Arguments of __init__, Arguments of __init__, Arguments of __init__
addresses, Arguments of __init__
addrs, Arguments of performTranslation, Arguments of __init__
add_received_header, Attributes of AbstractSmtpProxy
admin_parent, Arguments of __init__
append_domain, Attributes of AbstractSmtpProxy
append_object, Attributes of AbstractMimeProxy
args, Arguments of log
attribute_desc, Attributes of AbstractRadiusProxy
attribute_usage, Attributes of AbstractRadiusProxy
audit_channels, Attributes of AbstractRdpProxy, Attributes of AbstractSshProxy
auth, Attributes of AbstractSocksProxy
authentication, Arguments of __init__
authentication_policy, Attributes of Service, Arguments of __init__
authorization, Arguments of __init__
authorization_policy, Attributes of Service, Arguments of __init__
authorize_policy, Arguments of __init__
auth_agent_forward, Attributes of AbstractSshProxy
auth_by_cookie, Attributes of AbstractHttpProxy
auth_cache_time, Attributes of AbstractHttpProxy
auth_cache_update, Attributes of AbstractHttpProxy
auth_forward, Attributes of AbstractHttpProxy
auth_inband_defer, Attributes of Proxy
auth_methods, Attributes of AbstractSshProxy
auth_name, Attributes of Service, Arguments of __init__
auth_realm, Attributes of AbstractHttpProxy
auth_server, Attributes of AbstractRdpProxy, Attributes of AbstractSocksProxy
autodetect_domain_from, Attributes of AbstractSmtpProxy

C

cache, Arguments of __init__
cacheable, Arguments of __init__
cache_directory, Attributes of X509KeyBridge, Arguments of __init__
cache_timeout, Arguments of __init__
capability, Attributes of AbstractImapProxy
cert_cache_directory, Attributes of RdpProxy
chainer, Attributes of Service, Arguments of __init__, Attributes of StackedSession
channel_policy, Attributes of AbstractRdpProxy
check_insane_settings, Attributes of AbstractSshProxy
check_mode, Attributes of AbstractXmlsecProxy
cleanup_threshold, Arguments of __init__
client_bytes, Arguments of packetStats
client_channel, Attributes of AbstractSshProxy
client_cipher_algos, Attributes of AbstractSshProxy
client_comp_algos, Attributes of AbstractSshProxy
client_hostkey_algos, Attributes of AbstractSshProxy
client_kex_algos, Attributes of AbstractSshProxy
client_mac_algos, Attributes of AbstractSshProxy
client_pkts, Arguments of packetStats
client_request, Attributes of AbstractSshProxy
client_secret, Attributes of AbstractRadiusProxy
client_username, Attributes of AbstractRshProxy
command, Attributes of AbstractRshProxy
command_timeout, Attributes of AbstractMSRpcProxy
connection_mode, Attributes of AbstractHttpProxy
connection_start, Attributes of AbstractSshProxy
connect_data, Attributes of AbstractSQLNetProxy, Arguments of connectRequest
connect_proxy, Attributes of AbstractHttpProxy
connect_server, Attributes of AbstractSocksProxy
connect_timeout, Arguments of __init__
copy_to_client, Attributes of AbstractPlugProxy
copy_to_server, Attributes of AbstractPlugProxy
current_header_name, Attributes of AbstractHttpProxy
current_header_value, Attributes of AbstractHttpProxy
current_var_name, Attributes of AbstractTelnetProxy
current_var_value, Attributes of AbstractTelnetProxy

M

mapping, Arguments of __init__, Arguments of __init__, Arguments of __init__
mask, Attributes of Inet6Domain, Attributes of InetDomain
mask_bits, Attributes of Inet6Domain, Attributes of InetDomain
masq_address_client, Attributes of AbstractFtpProxy
masq_address_server, Attributes of AbstractFtpProxy
match, Attributes of RegexpMatcher
matcher, Attributes of HttpProxyURIFilter, Attributes of NntpProxyGroupFilter
match_date, Attributes of RegexpFileMatcher
match_file, Attributes of RegexpFileMatcher
match_fname, Arguments of __init__
match_list, Arguments of __init__
max_authline_count, Attributes of AbstractPop3Proxy
max_auth_request_length, Attributes of AbstractSmtpProxy
max_auth_time, Attributes of AbstractHttpProxy
max_body_length, Attributes of AbstractHttpProxy
max_bpp, Attributes of AbstractRdpProxy
max_chunk_length, Attributes of AbstractHttpProxy
max_command_length, Attributes of AbstractRshProxy
max_content_length, Attributes of AbstractXmlsecProxy
max_continuous_line, Attributes of AbstractFtpProxy
max_header_length, Attributes of AbstractMimeProxy
max_header_lines, Attributes of AbstractHttpProxy, Attributes of AbstractMimeProxy
max_header_line_length, Attributes of AbstractMimeProxy
max_height, Attributes of AbstractRdpProxy
max_hop_count, Attributes of AbstractFingerProxy
max_hostname_length, Attributes of AbstractFingerProxy, Attributes of AbstractFtpProxy, Attributes of AbstractHttpProxy
max_instances, Attributes of Service, Arguments of __init__
max_kbdint_prompts, Attributes of AbstractSshProxy
max_kbdint_prompt_len, Attributes of AbstractSshProxy
max_kbdint_response_len, Attributes of AbstractSshProxy
max_keepalive_requests, Attributes of AbstractHttpProxy
max_keepalive_size, Attributes of AbstractSipProxy
max_line_length, Attributes of AbstractFingerProxy, Attributes of AbstractFtpProxy, Attributes of AbstractHttpProxy, Attributes of AbstractImapProxy, Attributes of AbstractLpProxy, Attributes of AbstractNntpProxy, Attributes of AbstractWhoisProxy
max_literal_count, Attributes of AbstractImapProxy
max_literal_length, Attributes of AbstractImapProxy
max_message_size, Attributes of AbstractLdapProxy, Attributes of AbstractSipProxy
max_multipart_level, Attributes of AbstractMimeProxy
max_multipart_number, Attributes of AbstractMimeProxy
max_packet_length, Attributes of AbstractRadiusProxy
max_password_length, Attributes of AbstractFtpProxy, Attributes of AbstractImapProxy, Attributes of AbstractNntpProxy, Attributes of AbstractPop3Proxy
max_pending_count, Attributes of AbstractImapProxy
max_pending_request, Attributes of AbstractLdapProxy
max_request_length, Attributes of AbstractSmtpProxy, Attributes of AbstractWhoisProxy
max_request_line_length, Attributes of AbstractPop3Proxy
max_respond_lines, Attributes of AbstractImapProxy
max_response_length, Attributes of AbstractSmtpProxy
max_response_line_length, Attributes of AbstractPop3Proxy
max_search_response_number, Attributes of AbstractLdapProxy
max_sessions, Attributes of Service, Arguments of __init__
max_url_length, Attributes of AbstractHttpProxy
max_username_length, Attributes of AbstractFingerProxy, Attributes of AbstractFtpProxy, Attributes of AbstractImapProxy, Attributes of AbstractNntpProxy, Attributes of AbstractPop3Proxy, Attributes of AbstractRshProxy
max_width, Attributes of AbstractRdpProxy
media, Attributes of SipProxy
media_connection_mark, Attributes of AbstractSipProxy
method, Arguments of getCredentials
mime_message_path, Attributes of AbstractMimeProxy
msg, Arguments of proxyLog, Arguments of log
multi, Arguments of __init__

P

packet_stats_interval_packet, Attributes of AbstractPlugProxy
packet_stats_interval_time, Attributes of AbstractPlugProxy
parent_proxy, Attributes of AbstractHttpProxy
parent_proxy_port, Attributes of AbstractHttpProxy
password, Attributes of AbstractFtpProxy, Attributes of AbstractImapProxy, Attributes of AbstractPop3Proxy
permit_bad_continuous_line, Attributes of AbstractMimeProxy
permit_both_connection_headers, Attributes of AbstractHttpProxy
permit_client_bounce_attack, Attributes of AbstractFtpProxy
permit_empty_command, Attributes of AbstractFtpProxy
permit_empty_headers, Attributes of AbstractMimeProxy
permit_exclamation_mark, Attributes of SmtpProxy
permit_ftp_over_http, Attributes of AbstractHttpProxy
permit_http09_responses, Attributes of AbstractHttpProxy
permit_invalid_hex_escape, Attributes of AbstractHttpProxy
permit_longline, Attributes of AbstractPop3Proxy
permit_long_responses, Attributes of AbstractSmtpProxy
permit_null_response, Attributes of AbstractHttpProxy
permit_omission_of_angle_brackets, Attributes of AbstractSmtpProxy
permit_percent_hack, Attributes of SmtpProxy
permit_proxy_requests, Attributes of AbstractHttpProxy
permit_rtp_zones, Attributes of SipProxy
permit_sasl_transport, Attributes of AbstractLdapProxy
permit_server_bounce_attack, Attributes of AbstractFtpProxy
permit_server_requests, Attributes of AbstractHttpProxy
permit_trailing_zeroes, Attributes of AbstractRadiusProxy
permit_unicode_url, Attributes of AbstractHttpProxy
permit_unknown_command, Attributes of AbstractFtpProxy, Attributes of AbstractPop3Proxy, Attributes of AbstractSmtpProxy
pki, Arguments of __init__
pki_ca, Arguments of __init__
pki_cert, Arguments of __init__
port, Arguments of requestForward, Arguments of __init__, Class DBIface, Class DBIfaceGroup, Class DBSockAddr, Arguments of getCredentials, Arguments of setServerAddress, Attributes of SockAddrInet, Attributes of SockAddrInetRange
protocol, Arguments of __init__, Arguments of __init__, Arguments of __init__, Arguments of __init__, Class DBIface, Class DBIfaceGroup, Class DBSockAddr, Attributes of Dispatcher
provider, Arguments of __init__
proxy_class, Attributes of Service, Arguments of __init__
proxy_password, Attributes of AbstractFtpProxy
proxy_username, Attributes of AbstractFtpProxy

R

readonly, Attributes of AbstractVncProxy
rebuild_packets, Attributes of AbstractRadiusProxy
recipient, Attributes of EmailNotificationMethod
recipient_matcher, Attributes of SmtpProxy
reject_by_mail, Attributes of AbstractPop3Proxy
relay_check, Attributes of SmtpProxy
relay_domains, Attributes of SmtpProxy
relay_domains_matcher, Attributes of SmtpProxy
relay_zones, Attributes of SmtpProxy
request, Attributes of AbstractFtpProxy, Attributes of AbstractHttpProxy, Attributes of AbstractImapProxy, Attributes of AbstractLdapProxy, Attributes of AbstractLpProxy, Attributes of AbstractNntpProxy, Attributes of AbstractPop3Proxy, Attributes of AbstractRadiusProxy, Attributes of AbstractSmtpProxy, Attributes of AbstractTFtpProxy, Attributes of AbstractWhoisProxy
request_command, Attributes of AbstractFtpProxy, Attributes of AbstractNntpProxy, Attributes of AbstractPop3Proxy, Attributes of AbstractSmtpProxy
request_count, Attributes of AbstractHttpProxy
request_detailed, Attributes of AbstractFingerProxy
request_header, Attributes of AbstractHttpProxy
request_hostnames, Attributes of AbstractFingerProxy
request_method, Attributes of AbstractHttpProxy
request_mime_type, Attributes of AbstractHttpProxy
request_param, Attributes of AbstractNntpProxy, Attributes of AbstractPop3Proxy, Attributes of AbstractSmtpProxy
request_parameter, Attributes of AbstractFtpProxy
request_stack, Attributes of AbstractFtpProxy, Attributes of AbstractHttpProxy, Attributes of AbstractNntpProxy, Attributes of AbstractSmtpProxy
request_url, Attributes of AbstractHttpProxy
request_url_file, Attributes of AbstractHttpProxy
request_url_host, Attributes of AbstractHttpProxy
request_url_passwd, Attributes of AbstractHttpProxy
request_url_port, Attributes of AbstractHttpProxy
request_url_proto, Attributes of AbstractHttpProxy
request_url_scheme, Attributes of AbstractHttpProxy
request_url_username, Attributes of AbstractHttpProxy
request_username, Attributes of AbstractFingerProxy
require_auth_v5, Attributes of AbstractSocksProxy
require_crlf, Attributes of AbstractSmtpProxy
require_host_header, Attributes of AbstractHttpProxy
require_privileged_port, Attributes of AbstractRshProxy
rerequest_attempts, Attributes of AbstractHttpProxy
reset_on_close, Attributes of AbstractHttpProxy
resolver, Arguments of __init__
resolver_policy, Attributes of Service, Arguments of __init__
resolve_host, Attributes of AbstractSmtpProxy
response, Attributes of AbstractFtpProxy, Attributes of AbstractHttpProxy, Attributes of AbstractImapProxy, Attributes of AbstractNntpProxy, Attributes of AbstractRadiusProxy, Attributes of AbstractSmtpProxy
response_footer, Attributes of AbstractFingerProxy, Attributes of AbstractWhoisProxy
response_header, Attributes of AbstractFingerProxy, Attributes of AbstractHttpProxy, Attributes of AbstractWhoisProxy
response_mime_type, Attributes of AbstractHttpProxy
response_multiline, Attributes of AbstractPop3Proxy
response_overrun_action, Attributes of AbstractLdapProxy
response_param, Attributes of AbstractNntpProxy, Attributes of AbstractPop3Proxy, Attributes of AbstractSmtpProxy
response_parameter, Attributes of AbstractFtpProxy
response_stack, Attributes of AbstractHttpProxy, Attributes of AbstractPop3Proxy
response_status, Attributes of AbstractFtpProxy
response_strip_msg, Attributes of AbstractFtpProxy
response_value, Attributes of AbstractNntpProxy, Attributes of AbstractPop3Proxy, Attributes of AbstractSmtpProxy
return, Arguments of requestForward
rewrite_host_header, Attributes of AbstractHttpProxy
right_chainer, Attributes of SideStackChainer, Arguments of __init__
right_class, Attributes of SideStackChainer, Arguments of __init__
router, Attributes of PFService, Attributes of Service, Arguments of __init__
rtp_endpoint_rewrite_nat_policy, Attributes of SipProxy

S

secondary_mask, Attributes of AbstractPlugProxy, Attributes of AbstractRadiusProxy, Attributes of AbstractSipProxy
secondary_port_max, Attributes of AbstractMSRpcProxy
secondary_port_min, Attributes of AbstractMSRpcProxy
secondary_sessions, Attributes of AbstractPlugProxy, Attributes of AbstractRadiusProxy, Attributes of AbstractSipProxy
self, Arguments of __init__
sender_address, Arguments of __init__
sender_matcher, Attributes of SmtpProxy
server, Arguments of __init__, Arguments of __init__
serveraddr, Arguments of __init__
server_address, Attributes of AbstractSQLNetProxy
server_bytes, Arguments of packetStats
server_certs_dir, Attributes of RdpProxy
server_certs_verify, Attributes of RdpProxy
server_channel, Attributes of AbstractSshProxy
server_cipher_algos, Attributes of AbstractSshProxy
server_comp_algos, Attributes of AbstractSshProxy
server_hostkeys_dir, Attributes of SshProxy
server_hostkeys_verify, Attributes of SshProxy
server_hostkey_algos, Attributes of AbstractSshProxy
server_kex_algos, Attributes of AbstractSshProxy
server_mac_algos, Attributes of AbstractSshProxy
server_name, Arguments of __init__
server_pkts, Arguments of packetStats
server_port, Attributes of AbstractSQLNetProxy, Arguments of __init__
server_request, Attributes of AbstractSshProxy
server_secret, Attributes of AbstractRadiusProxy
server_username, Attributes of AbstractRshProxy
service, Attributes of Dispatcher, Arguments of __init__
services, Attributes of CSZoneDispatcher, Arguments of __init__
service_equiv, Arguments of __init__
session, Arguments of performTranslation
sessionid, Arguments of log
session_timestamp, Attributes of AbstractPop3Proxy
shutdown_soft, Attributes of AbstractPlugProxy
silent_drop, Attributes of AbstractMimeProxy
snat_policy, Attributes of PFService, Attributes of Service, Arguments of __init__
soap_namespace_uri, Attributes of AbstractXmlsecProxy
software_version, Attributes of AbstractSshProxy
split_connect_threshold, Attributes of AbstractSQLNetProxy
ssl.client_cagroup_directories, Attributes of Proxy
ssl.client_ca_directory, Attributes of Proxy
ssl.client_cert_file, Attributes of Proxy
ssl.client_connection_security, Attributes of Proxy
ssl.client_crl_directory, Attributes of Proxy
ssl.client_disable_proto_sslv2, Attributes of Proxy
ssl.client_disable_proto_sslv3, Attributes of Proxy
ssl.client_disable_proto_tlsv1, Attributes of Proxy
ssl.client_keypair_files, Attributes of Proxy
ssl.client_keypair_generate, Attributes of Proxy
ssl.client_key_file, Attributes of Proxy
ssl.client_local_privatekey, Attributes of Proxy
ssl.client_local_privatekey_passphrase, Attributes of Proxy
ssl.client_ssl_cipher, Attributes of Proxy
ssl.client_ssl_method, Attributes of Proxy
ssl.client_trusted_certs_directory, Attributes of Proxy
ssl.client_verify_cagroup_directories, Attributes of Proxy
ssl.client_verify_ca_directory, Attributes of Proxy
ssl.client_verify_crl_directory, Attributes of Proxy
ssl.client_verify_depth, Attributes of Proxy
ssl.client_verify_type, Attributes of Proxy
ssl.handshake_seq, Attributes of Proxy
ssl.handshake_timeout, Attributes of Proxy
ssl.key_generator, Attributes of Proxy
ssl.permit_invalid_certificates, Attributes of Proxy
ssl.permit_missing_crl, Attributes of Proxy
ssl.server_cagroup_directories, Attributes of Proxy
ssl.server_ca_directory, Attributes of Proxy
ssl.server_cert_file, Attributes of Proxy
ssl.server_check_subject, Attributes of Proxy
ssl.server_connection_security, Attributes of Proxy
ssl.server_crl_directory, Attributes of Proxy
ssl.server_disable_proto_sslv2, Attributes of Proxy
ssl.server_disable_proto_sslv3, Attributes of Proxy
ssl.server_disable_proto_tlsv1, Attributes of Proxy
ssl.server_keypair_files, Attributes of Proxy
ssl.server_keypair_generate, Attributes of Proxy
ssl.server_key_file, Attributes of Proxy
ssl.server_local_privatekey, Attributes of Proxy
ssl.server_local_privatekey_passphrase, Attributes of Proxy
ssl.server_ssl_cipher, Attributes of Proxy
ssl.server_ssl_method, Attributes of Proxy
ssl.server_trusted_certs_directory, Attributes of Proxy
ssl.server_verify_cagroup_directories, Attributes of Proxy
ssl.server_verify_ca_directory, Attributes of Proxy
ssl.server_verify_crl_directory, Attributes of Proxy
ssl.server_verify_depth, Attributes of Proxy
ssl.server_verify_type, Attributes of Proxy
ssl_verify_depth, Arguments of __init__
stack, Attributes of AbstractImapProxy
stack_proxy, Attributes of AbstractPlugProxy
strict_header_checking, Attributes of AbstractHttpProxy
strict_header_checking_action, Attributes of AbstractHttpProxy
strict_port_checking, Attributes of AbstractFtpProxy
strict_redirect_parsing, Attributes of AbstractSQLNetProxy
strict_username_check, Attributes of AbstractFingerProxy

T

target, Arguments of getCredentials
target_port_range, Attributes of AbstractFtpProxy, Attributes of AbstractHttpProxy
timeout, Attributes of AbstractFingerProxy, Attributes of AbstractFtpProxy, Attributes of AbstractHttpProxy, Attributes of AbstractImapProxy, Attributes of AbstractLdapProxy, Attributes of AbstractLpProxy, Attributes of AbstractMimeProxy, Attributes of AbstractMSRpcProxy, Attributes of AbstractNntpProxy, Attributes of AbstractPlugProxy, Attributes of AbstractPop3Proxy, Attributes of AbstractRadiusProxy, Attributes of AbstractRdpProxy, Attributes of AbstractRshProxy, Attributes of AbstractSipProxy, Attributes of AbstractSmtpProxy, Attributes of AbstractSocksProxy, Attributes of AbstractSQLNetProxy, Attributes of AbstractSshProxy, Attributes of SshSFtpProxy, Attributes of AbstractTelnetProxy, Attributes of AbstractTFtpProxy, Attributes of AbstractWhoisProxy, Attributes of AbstractXmlsecProxy, Arguments of __init__, Arguments of __init__
timeout_connect, Arguments of __init__, Arguments of __init__, Arguments of __init__, Arguments of __init__
timeout_request, Attributes of AbstractHttpProxy
timeout_response, Attributes of AbstractHttpProxy
timeout_state, Arguments of __init__, Arguments of __init__
timeout_stderr_connect, Attributes of AbstractRshProxy
tls_passthrough, Attributes of AbstractSmtpProxy
to_domain, Arguments of __init__
transparent, Arguments of __init__
transparent_mode, Attributes of AbstractFtpProxy, Attributes of AbstractHttpProxy, Attributes of SQLNetProxy, Attributes of AbstractSshProxy
trusted_ca_directory, Attributes of AbstractXmlsecProxy
trusted_ca_files, Attributes of X509KeyBridge, Arguments of __init__
type, Arguments of proxyLog, Attributes of SockAddrInet, Attributes of SockAddrInetRange, Attributes of SockAddrUnix

V

valid_chars_username, Attributes of AbstractFtpProxy
verbosity, Arguments of log

© 2007-2012 BalaBit IT Security
Please send your comments or documentation bugs to: documentation@balabit.com