5.6. System Settings

This page describes the classes and methods to read, modify and update the system.

Settings classes are not instantiated directly, but instead are accessed via a NetShark instance. The following table lists the available settings related classes and the accessor name:

Settings Class Accessor Attribute API Versions
Basic Basic ns.settings.basic v4.x, v5.x
Auth Auth ns.settings.auth v4.x, v5.x
Audit Audit ns.settings.audit v4.x, v5.x
Licenses Licenses ns.settings.licenses v4.x, v5.x
Firewall Firewall ns.settings.firewall v4.x, v5.x
Certificates Certificates ns.settings.certificates v4.x, v5.x
Profiler Export ProfilerExport ns.settings.profiler_export v4.x, v5.x
CORS Domain CorsDomain ns.settings.cors_domain v4.x, v5.x
Users Users ns.settings.users v4.x, v5.x
Groups Groups ns.settings.groups v4.x, v5.x
Update Update ns.settings.update v4.x, v5.x
Storage Storage ns.settings.storage v4.x, v5.x
Port Definitions Port Definitions ns.settings.port_definitions v5.x
Port Groups Port Groups ns.settings.port_groups v5.x
Layer 4 Mappings L4Mapping ns.settings.l4_mappings v5.x
Custom Applications CustomApplications ns.settings.custom_application v5.x
Alerts Alerts ns.settings.alerts v5.x

For example, modifying basic settings can be accomplished as follows:

>>> ns = NetShark(...)
>>> basic = ns.settings.basic
>>> basic.get()
>>> basic.data['primary_dns'] = '10.1.2.3'
>>> basic.save()

5.6.1. Base Classes

class steelscript.netshark.core._settings4.BasicSettingsFunctionality(api)

This class is used as a base for all the settings related classes.

cancel(*args, **kwds)

Cancel pending changes and reload the configuration from server.

download(*args, **kwds)

Download settings and save to a file.

get(force=False)

Gets the configuration from the server

Parameters:force (bool) – set to true to ignore a cached copy
Returns:a dictionary of settings
load(path_or_obj, save=True)

Load the configuration from a path or dict

Parameters:
  • path_or_obj – a string representing a path or a dict/list representing the configuration
  • save (bool) – if true, automatically save to the server after load, default to True

On success, this discards any changes to data.

save(*args, **kwds)

Save configuration to the server.

class steelscript.netshark.core._settings4.NoBulk

Base class to force get of new configuration in not bulk update capable settings

This basically overrides the save method such that it doesn’t perform a bulk update on the resource but fetches the new data from the server only

5.6.2. Basic Settings

class steelscript.netshark.core._settings4.Basic(api)

Bases: steelscript.netshark.core._settings4.BasicSettingsFunctionality

Wrapper class around basic system settings.

5.6.3. Auth Settings

class steelscript.netshark.core._settings4.Auth(api)

Bases: steelscript.netshark.core._settings4.BasicSettingsFunctionality

Wrapper class around authentication settings.

5.6.4. Audit Settings

class steelscript.netshark.core._settings4.Audit(api)

Bases: steelscript.netshark.core._settings4.BasicSettingsFunctionality

Wrapper class around audit configuration.

5.6.5. Licenses

class steelscript.netshark.core._settings4.Licenses(api)

Bases: steelscript.netshark.core._settings4.NoBulk, steelscript.netshark.core._settings4.BasicSettingsFunctionality

Wrapper class around license configuration.

add(*args, **kwds)

Add a license key.

clear(*args, **kwds)

Clear all license keys.

remove(*args, **kwds)

Remove a license key.

status(*args, **kwds)

Return the license status.

5.6.6. Firewall

class steelscript.netshark.core._settings4.Firewall(api)

Bases: steelscript.netshark.core._settings4.BasicSettingsFunctionality

Wrapper class around firewall settings.

5.6.7. Certificates Settings

class steelscript.netshark.core._settings4.Certificates(api)

Bases: steelscript.netshark.core._settings4.NoBulk, steelscript.netshark.core._settings4.BasicSettingsFunctionality

Wrapper class around the certificates configuration

add_profiler_trusted_certificate(*args, **kwds)

Adds the given PEM certificate to the list of trusted certificates under the given name

generate_new_certificate_for_profiler_export(*args, **kwds)

Generates a new certificate for netprofiler export

generate_new_certificate_for_web(*args, **kwds)

Generates a new certificate for the webui

remove_profiler_trusted_certificate(*args, **kwds)

Removes the name of a PEM certificate that is trusted, removes from the list of trusted certificates

set_certificate_for_profiler_export(*args, **kwds)

Give a certificate in PEM format, uploads to the server and sets as netprofiler export certificate

The PEM certificate must contain both private key and CA-signed public certificate

set_certificate_for_web(*args, **kwds)

Given a certificate in PEM format, uploads to the server and sets as webui certificate.

The PEM certificate must contain both private key and CA-signed public certificate

use_profiler_export_certificate_for_web(*args, **kwds)

Copies netprofiler export certificate and use it for webui

use_web_interface_certificate_for_profiler_export(*args, **kwds)

Copies webui certificate and use it for netprofiler export

5.6.8. ProfilerExport Settings

class steelscript.netshark.core._settings5.ProfilerExport(api)

Bases: steelscript.netshark.core._settings4.ProfilerExport

Wrapper class around Profiler Export

sync_dpi_with_profiler(*args, **kwds)

Helper method to select the current profiler to sync DPI with.

This method modifes self.data to reflect the changes. save() must be called to push the changes to the NetShark.

unsync_dpi_with_profiler(*args, **kwds)

Helper method to select the current profiler to sync DPI with.

This method modifes self.data to reflect the changes. save() must be called to push the changes to the NetShark.

5.6.9. CorsDomain Settings

class steelscript.netshark.core._settings4.CorsDomain(api)

Bases: steelscript.netshark.core._settings4.BasicSettingsFunctionality

Wrapper class around CORS Domain settings.

5.6.10. Users Settings

class steelscript.netshark.core._settings4.Users(api)

Bases: steelscript.netshark.core._settings4.NoBulk, steelscript.netshark.core._settings4.BasicSettingsFunctionality

Wrapper class around Users configuration settings.

add(*args, **kwds)

Adds a user to the NetShark

username is a string representing the username

groups is the group the user should be added in. Administrators is the administrators group. Add user to that group to make the user with administator privileges.

can_be_locked is a boolean representing if the user can be locked out from the system or not

change_password(*args, **kwds)

Change password of an user

delete(*args, **kwds)

Delete user from the system

username is the username of the user to be deleted

5.6.11. Groups Settings

class steelscript.netshark.core._settings4.Groups(api)

Bases: steelscript.netshark.core._settings4.NoBulk, steelscript.netshark.core._settings4.BasicSettingsFunctionality

Wrapper class around settings for user groups.

add(*args, **kwds)

Adds a new group to the system

Parameters:
  • name (str) – the name of the group
  • description (str) – the description of the group
  • capabilities (list) –

    a list of permissions the group has. They can be:

    • CAPABILITY_ADMINISTRATOR,
    • CAPABILITY_APPLY_VIEWS_ON_FILES,
    • CAPABILITY_APPLY_VIEWS_ON_INTERFACES,
    • CAPABILITY_SHARE_VIEWS,
    • CAPABILITY_CREATE_FILES,
    • CAPABILITY_IMPORT_FILES,
    • CAPABILITY_EXPORT_FILES,
    • CAPABILITY_CREATE_JOBS,
    • CAPABILITY_SCHEDULE_WATCHES,
    • CAPABILITY_ACCESS_PROBE_FILES
delete(*args, **kwds)

Removes group from the groups in the NetShark

5.6.12. Update Settings

class steelscript.netshark.core._settings4.Update(api)

Bases: steelscript.netshark.core._settings4.NoBulk, steelscript.netshark.core._settings4.BasicSettingsFunctionality

Manage system update, ISOs and settings.

delete_iso(*args, **kwds)

Clear any ISO that the NetShark is configured to use.

load_iso_from_url(url)

Instruct the NetShark to upload a new ISO from a URL.

update(*args, **kwds)

Initiate an update using the configured ISO.

upload_iso(f)

Upload a new ISO From a file.

Parameters:f (file) – file descriptor to read from

5.6.13. Storage Settings

class steelscript.netshark.core._settings4.Storage(api)

Bases: steelscript.netshark.core._settings4.NoBulk, steelscript.netshark.core._settings4.BasicSettingsFunctionality

format(percentage_reserved_space=0)

Formats the packet storage

Warning

This operation will lose all packets in every job

Parameters:percentage_reserved_space (int) – percentage of disk reserved starting from the outher boundaries of the disk.

Since I/O operations at the farmost parts of the disk have higher latency this is often used to increase performances of the packet recorder. percentage_reserved_space can be any value from 0 (default) to 95.

reinitialize()

Reinitializes the packet storage

Warning

This operation will lose all packets in every job

5.6.14. Port Definitions

New in version API: 5.x

class steelscript.netshark.core._settings5.PortDefinitions(api, srt_ports_api)

Bases: steelscript.netshark.core._settings5.DPIResource

Wrapper class and port definitions.

add(*args, **kwds)

Add a port definition

Parameters:
  • name (str) – a name for the port
  • port (int) – the port number
  • protocol (str) – is the protocol the name is associated to can be tcp or udp
  • srt (bool) – indicates if the port to be enabled as srt port
remove(*args, **kwds)

Remove port identified by name and port number from the Port Definitions

Parameters:
  • name (str) – a name for the port
  • port (int) – the port number

5.6.15. Port Group Definitions

New in version API: 5.x

class steelscript.netshark.core._settings5.PortGroups(api)

Bases: steelscript.netshark.core._settings5.DPIResource

Wrapper class and port group definitions.

remove(*args, **kwds)

Remove a port group by name or by priority

It accepts one of name or priority. If name and priority are issued it will remove the rule named name only if it matches priority

Parameters:
  • name (str) – the name of the port group
  • priority (int) – the priority of the port group

5.6.16. Layer 4 Port Mappings

New in version API: 5.x

class steelscript.netshark.core._settings5.L4Mapping(api)

Bases: steelscript.netshark.core._settings5.PortGroups

Wrapper class around Layer 4 Mappings.

add(*args, **kwds)

Add a l4 mapping rule

Parameters:
  • name (str) – the name of the rule
  • hosts (str) – comma separated list of hosts with optional subnet mask
  • tcp_ports (str) – comma separated list of ports or port range
  • udp_ports (str) – comma separated list of ports or port range
remove(*args, **kwds)

Remove a l4 mapping rule

It accepts one of name or priority. If name and priority are issued it will remove the rule named name only if it matches priority

Parameters:
  • name (str) – the name of the l4 mapping
  • priority (int) – the priority of the l4 mapping

5.6.17. Custom Applications

New in version API: 5.x

class steelscript.netshark.core._settings5.CustomApplications(api)

Bases: steelscript.netshark.core._settings5.DPIResource

Wrapper class around custom application definitions.

add(*args, **kwds)

Add a custom application rule

Parameters:
  • name (str) – the name of the rule
  • uri (str) – a string representing a uri
remove(*args, **kwds)

Remove a custom application rule

Parameters:name (str) – the name of the rule

5.6.18. Alerts

New in version API: 5.x

class steelscript.netshark.core._settings5.Alerts(api)

Bases: steelscript.netshark.core._settings4.BasicSettingsFunctionality

test_smtp(address, to_address, from_address, port=25)

Sends a test email via SMTP.

test_snmp(obj)

Sends a test SNMP trap

Parameters:obj (dict) – object representing the trap to send.

The obj must be of the form:

{"address":"trap.riverbed.com","version":"V1","community":"test"}

or

{"address":"trap.riverbed.com","community":"public","version":"V2C"}

or

{
    "address": "trap.riverbed.com",
    "version": "V3",
    "username": "test",
    "engine_id": "testengine",
    "security_level": "AUTH_PRIVACY",
    "authentication": {"protocol":"MD5",
                       "passphrase":"testpassword"},
    "privacy": {"protocol":"DES",
                "passphrase":"testpassword"}
}