Configuration Management#
Logging In#
- Edge.login(username, password)
Log in
- Parameters:
username (str) – Username
password (str) – Password
edge.login('admin', 'G3neralZ0d!')
- Edge.logout()
Log out
edge.logout()
Device Configuration#
- Config.get_hostname()
Get the hostname of the Edge Filer
- Return str:
The hostname of the Edge Filer
hostname = edge.config.get_hostname()
- Config.set_hostname(hostname)
Set the hostname of the Edge Filer
- Parameters:
hostname (str) – New hostname to set
- Return str:
The new hostname
edge.config.set_hostname('Chopin')
- Config.get_location()
Get the location of the Edge Filer
- Return str:
The location of the Edge Filer
location = edge.config.get_location()
- Config.set_location(location)
Set the location of the Edge Filer
- Parameters:
location (str) – New location to set
- Return str:
The new location
edge.config.set_location('Jupiter')
- Config.disable_wizard()
Disable the first time wizard
edge.config.disable_wizard()
- Config.export(destination=None)
Export the Edge Filer configuration
- Parameters:
destination (str,optional) – File destination, defaults to the default directory
edge.config.export()
- Config.import_config(config, exclude=None)
Import the Edge Filer configuration
- Parameters:
config (str) – A string or a path to the Edge Filer configuration file
delete_attrs (list[str],optional) – List of configuration properties to exclude from import
"""Import Edge Filer configuration from file"""
edge.config.import_config(r'C:\Users\bwayne\Downloads\EdgeFiler.xml')
"""Import configuration without network settings"""
edge.config.import_config(r'C:\Users\bwayne\Downloads\EdgeFiler.xml', exclude=[
'/config/network'
])
"""Import configuration without the 'logs' and 'public' shares"""
edge.config.import_config(r'C:\Users\bwayne\Downloads\EdgeFiler.xml', exclude=[
'/config/fileservices/share/logs',
'/config/fileservices/share/public'
])
Storage#
Format Drives#
- Drive.format(name)
Format a drive
- Parameters:
name (str) – The name of the drive to format
edge.drive.format('SATA1')
- Drive.format_all()
Format all drives
edge.drive.format_all()
Volume Management#
- Volumes.add(name, size=None, filesystem='xfs', device=None, passphrase=None)
Add a Volume.
- Parameters:
name (str) – Name of the new volume
size (int,optional) – Size of the new volume, defaults to the device’s size
filesystem (str,optional) – Filesystem to use, defaults to xfs
device (str,optional) – Name of the device to use for the new volume, can be left as None if there’s only one device available
passphrase (str,optional) – Passphrase for the volume
- Returns:
Edge Filer response
edge.volumes.add('localcache')
- Volumes.delete(name)
Delete a volume
- Parameters:
name (str) – Name of the volume to delete
edge.volumes.delete('localcache')
- Volumes.delete_all()
Delete all volumes
edge.volumes.delete_all()
Deduplication#
- Dedup.enable(reboot=False, wait=False)
Enable local deduplication
- Parameters:
reboot (bool) – Reboot, defaults to
False
wait (bool,optional) – Wait for reboot to complete, defaults to False
"""Enable local de-duplication without rebooting the Edge Filer"""
edge.dedup.enable()
"""Enable local de-duplication and wait for reboot to complete"""
edge.dedup.enable(reboot=True, wait=True)
- Dedup.disable(reboot=False, wait=False)
Disable local deduplication
- Parameters:
reboot (bool) – Reboot, defaults to
False
wait (bool,optional) – Wait for reboot to complete, defaults to False
"""Disable local de-duplication without rebooting the Edge Filer"""
edge.dedup.disable()
"""Disable local de-duplication and wait for reboot to complete"""
edge.dedup.disable(reboot=True, wait=True)
- Dedup.status()
Get the de-duplication status
- Returns:
An object including the deduplication status
- Return type:
print(edge.dedup.status())
- Regeneration.run()
Run the regeneration process
edge.dedup.regen.run()
- Regeneration.status()
Get the regeneration process statistics
print(edge.dedup.regen.status())
Local Users#
- Users.add(username, password, full_name=None, email=None, uid=None)
Add a user of the Gateway
- Parameters:
username (str) – User name for the new user
password (str) – Password for the new user
full_name (str,optional) – The full name of the new user, defaults to None
email (str,optional) – E-mail address of the new user, defaults to None
uid (str,optional) – The uid of the new user, defaults to None
edge.users.add('Clark', 'Kryptonite1!') # without a full name, email or custom uid
edge.users.add('alice', 'W!z4rd0fOz!', 'Alice Wonderland') # including a full name
edge.users.add('Bruce', 'GothamCity1!', 'Bruce Wayne', 'bruce.wayne@we.com', uid = 1940) # all
- Users.modify(username, password=None, full_name=None, email=None, uid=None)
Modify an existing user of the Gateway
- Parameters:
username (str) – User name to modify
password (str,optional) – New password, defaults to None
full_name (str,optional) – The full name of the user, defaults to None
email (str,optional) – E-mail address of the user, defaults to None
uid (str,optional) – The uid of the user, defaults to None
edge.users.modify('Clark', 'Passw0rd1!') # Change a user's password
edge.users.modify('Clark', email='clark.kent@krypton.com') # Change a user's email
- Users.delete(username)
Delete an existing user
- Parameters:
username (str) – User name of the user to delete
edge.users.delete('alice')
- Users.add_first_user(username, password, email='')
Add the first user of the Edge Filer and login
- Parameters:
username (str) – User name for the new user
password (str) – Password for the new user
email (str,optional) – E-mail address of the new user, defaults to an empty string
edge.users.add_first_user('admin', 'L3tsG3tR34dyT0Rumbl3!')
Local Groups#
- Groups.add_members(group, members)
Add members to a group
- Parameters:
group (str) – Name of the group
members (list[cterasdk.edge.types.UserGroupEntry]) – List of users and groups to add to the group
"""Add Bruce Wayne to the local Administrators group"""
member = edge_types.UserGroupEntry(edge_enum.PrincipalType.DU, 'bruce.wayne@we.com')
edge.groups.add_members('Administrators', [member])
"""Add Bruce Wayne and Domain Admins to the local Administrators group"""
domain_user = edge_types.UserGroupEntry(edge_enum.PrincipalType.DU, 'bruce.wayne@we.com')
domain_group = edge_types.UserGroupEntry(edge_enum.PrincipalType.DG, 'WE\Domain Admins')
edge.groups.add_members('Administrators', [domain_user, domain_group])
- Groups.remove_members(group, members)
Remove members from a group
- Parameters:
group (str) – Name of the group
members (list[cterasdk.edge.types.UserGroupEntry]) – List of users and groups to remove from the group
"""Remove Bruce Wayne from the local Administrators group"""
edge.groups.remove_members('Administrators', [('DU', 'bruce.wayne@we.com')])
"""Remove Bruce Wayne and Domain Admins from the local Administrators group"""
edge.groups.remove_members('Administrators', [('DU', 'bruce.wayne@we.com'), ('DG', 'WE\Domain Admins')])
Active Directory#
- DirectoryService.connect(domain, username, password, ou=None, check_connection=False)
Connect the Edge Filer to an Active Directory
- Parameters:
domain (str) – The active directory domain to connect to
username (str) – The user name to use when connecting to the active directory services
password (str) – The password to use when connecting to the active directory services
ou (str,optional) – The OU path to use when connecting to the active directory services, defaults to None
check_connection (bool,optional) – Check connectivity before attempting to connect to directory services, defaults to False
edge.directoryservice.connect('ctera.local', 'administrator', 'B4tMob!l3')
"""Connect to the EMEA Organizational Unit"""
edge.directoryservice.connect('ctera.local', 'administrator', 'B4tMob!l3', 'ou=EMEA, dc=ctera, dc=local')
Note
the ou parameter must specify the distinguished name of the organizational unit
- DirectoryService.get_advanced_mapping()
Retrieve directory services advanced mapping configuration
- Returns:
A dictionary of domain mapping objects
- Return type:
dict
for domain, mapping in edge.directoryservice.get_advanced_mapping().items():
print(domain)
print(mapping)
Note
to retrieve a list of domain flat names, use cterasdk.edge.directoryservice.domains()
- DirectoryService.set_advanced_mapping(mappings)
Configure advanced mapping
- Parameters:
mappings (list[cterasdk.common.types.ADDomainIDMapping]) – List of domains and their UID/GID mapping range
"""Create a list of domain mappings"""
advanced_mapping = [
common_types.ADDomainIDMapping('CTERA-PRD', 1000001, 2000000),
common_types.ADDomainIDMapping('CTERA-LAB', 2000001, 3000000),
common_types.ADDomainIDMapping('CTERA-LDR', 3000001, 4000000)
]
edge.directoryservice.set_advanced_mapping(advanced_mapping) # this function will skip domains that are not found
Note
to retrieve a list of domain flat names, use cterasdk.edge.directoryservice.domains()
- DirectoryService.disconnect()
Disconnect from Active Directory Service
edge.directoryservice.disconnect()
- DirectoryService.domains()
Get all domains
- Return list(str):
List of names of all discovered domains
domains = edge.directoryservice.domains()
print(domains)
- DirectoryService.set_static_domain_controller(dc)
Configure the Edge Filer to use a static domain controller
- Parameters:
dc (str) – The FQDN, hostname or ip address of the domain controller
- Returns:
The FQDN, hostname or ip address of the domain controller
- Return type:
str
edge.directoryservice.set_static_domain_controller('192.168.90.1')
- DirectoryService.get_static_domain_controller()
Retrieve the static domain controller configuration
- Returns:
A FQDN, hostname or ip address of the domain controller
- Return type:
str
domain_controller = edge.directoryservice.get_static_domain_controller()
print(domain_controller)
- DirectoryService.remove_static_domain_controller()
Delete the static domain controller configuration
edge.directoryservice.remove_static_domain_controller()
Connecting to CTERA Portal#
- Services.connect(server, user, password, ctera_license='EV16')
Connect to a Portal.
- The connect method will first validate the license argument,
ensure the Edge Filer can establish a TCP connection over port 995 to the Portal and verify the Portal does not require device activation via code. TCP connection verification over port 995 is skipped when the Edge Filer is configured to use a proxy.
- Parameters:
server (str) – Address of the Portal
user (str) – User for the Portal connection
password (str) – Password for the Portal connection
ctera_license (cterasdk.edge.enum.License,optional) – CTERA License, defaults to cterasdk.edge.enum.License.EV16
Warning
To ignore certificate errors when connecting to CTERA Portal, use: cterasdk.settings.sessions.management.edge.services.ssl = False
edge.services.connect('tenant.ctera.com', 'svc_account', 'Th3AmazingR4ce!', 'EV32') # activate as an EV32
edge.services.connect('52.204.15.122', 'svc_account', 'Th3AmazingR4ce!', 'EV64') # activate as an EV64
- Services.activate(server, user, code, ctera_license='EV16')
Enroll the Edge Filer with CTERA Portal using an activation code
- Parameters:
server (str) – Address of the Portal
user (str) – User for the Portal connection
code (str) – Activation code for the Portal connection
ctera_license (cterasdk.edge.enum.License,optional) – CTERA License, defaults to cterasdk.edge.enum.License.EV16
This method’s behavior is identical to
cterasdk.edge.services.Services.connect()
edge.services.activate('tenant.ctera.com', 'svc_account', 'fd3a-301b-88d5-e1a9-cbdb') # activate as an EV16
- Services.reconnect()
Reconnect to the Portal
edge.services.reconnect()
- Services.disconnect()
Disconnect from the Portal
edge.services.disconnect()
- Services.enable_sso()
Enable SSO connection
Configuring a License#
- Licenses.apply(ctera_license)
Apply a license
- Parameters:
ctera_license (cterasdk.edge.enum.License) – License type
edge.license.apply('EV32')
Note
A license can also be specified upon connecting the Edge Filer to the Portal. See cterasdk.edge.services.Services.connect()
for more details.
Cache Management#
- Cache.enable()
Enable caching
edge.cache.enable()
- Cache.disable()
Disable caching
edge.cache.disable()
Warning
All data synchronized from the cloud will be deleted and all unsynchronized changes will be lost.
- Cache.force_eviction()
Force eviction
edge.cache.force_eviction()
Subfolder Pinning#
- Cache.pin(path)
Pin a folder
- Parameters:
path (str) – Directory path
""" Pin a cloud folder named 'data' owned by 'Service Account' """
edge.cache.pin('users/Service Account/data')
- Cache.pin_exclude(path)
Exclude a sub-folder from a pinned folder
- Parameters:
path (str) – Directory path
""" Exclude a subfolder from a pinned cloud folder """
edge.cache.pin_exclude('users/Service Account/data/accounting')
- Cache.remove_pin(path)
Remove a pin from a previously pinned folder
- Parameters:
path (str) – Directory path
""" Remove a pin from a previously pinned folder """
edge.cache.remove_pin('users/Service Account/data')
- Cache.pin_all()
Pin all folders
""" Pin all folders """
edge.cache.pin_all()
- Cache.unpin_all()
Remove all folder pins
""" Remove all folder pins """
edge.cache.unpin_all()
Cloud Backup#
- Backup.configure(passphrase=None)
Edge Filer backup configuration
- Parameters:
passphrase (str,optional) – Passphrase for the backup, defaults to None
"""Configure backup without a passphrase"""
edge.backup.configure()
- Backup.start()
Start backup
edge.backup.start()
- Backup.suspend()
Suspend backup
edge.backup.suspend()
- Backup.unsuspend()
Unsuspend backup
edge.backup.unsuspend()
Backup Selection#
- BackupFiles.unselect_all()
Unselect all files from backup
edge.backup.files.unselect_all()
Cloud Synchronization#
- Sync.suspend(wait=True)
Suspend Cloud Sync
- Parameters:
wait (bool) – Wait for synchronization to stop
edge.sync.suspend()
- Sync.unsuspend()
Unsuspend Cloud Sync
edge.sync.unsuspend()
- Sync.exclude_files(extensions=None, filenames=None, paths=None, custom_exclusion_rules=None)
Exclude files from Cloud Sync. This method will override any existing file exclusion rules Use
cterasdk.common.types.FileFilterBuilder()
to build custom file exclusion rules`- Parameters:
extensions (list[str]) – List of file extensions
filenames (list[str]) – List of file names
paths (list[str]) – List of file paths
rules (list[cterasdk.common.types.FilterBackupSet]) – Set of custom exclusion rules
edge.sync.exclude_files(['exe', 'cmd', 'bat']) # exclude file extensions
edge.sync.exclude_files(filenames=['Cloud Sync.lnk', 'The quick brown fox.docx']) # exclude file names
"""Exclude file extensions and file names"""
edge.sync.exclude_files(['exe', 'cmd'], ['Cloud Sync.lnk'])
"""
Create a custom exclusion rule
Exclude files that their name starts with 'tmp' and smaller than 1 MB (1,048,576 bytes)
"""
name_filter_rule = common_types.FileFilterBuilder.name().startswith('tmp')
size_filter_rule = common_types.FileFilterBuilder.size().less_than(1048576)
exclusion_rule = common_types.FilterBackupSet('Custom exclusion rule', filter_rules=[name_filter_rule, size_filter_rule])
edge.sync.exclude_files(custom_exclusion_rules=[exclusion_rule])
- Sync.remove_file_exclusion_rules()
Remove previously configured sync exclusion rules
edge.sync.remove_file_exclusion_rules()
- Sync.evict(path, wait=False)
Evict a directory from the Edge Filer
- Parameters:
path (str) – Directory path
wait (bool) – Wait for eviction task to complete, defaults to
False
- Returns:
A reference to the background task
- Return type:
str
"""Evict a directory"""
background_task_ref = edge.sync.evict('/Share/path/to/sub/directory') # non-blocking call
print(background_task_ref)
"""Evict a directory and wait for eviction to complete - blocking"""
edge.sync.evict('/Share/path/to/sub/directory', wait=True) # blocking call
Bandwidth Throttling#
- CloudSyncBandwidthThrottling.get_policy()
Get the bandwidth throttling policy
- Returns:
a list of bandwidth throttling rules
- Return type:
- CloudSyncBandwidthThrottling.set_policy(rules)
Set the bandwidth throttling policy
- Parameters:
rules (list[cterasdk.common.types.ThrottlingRule]) – List of bandwidth throttling rules
"""Throttle bandwidth during business hours on week days: Monday - Friday"""
schedule1 = common_types.TimeRange().start('07:00:00').end('19:00:00').days(common_enum.DayOfWeek.Weekdays).build()
rule1 = common_types.ThrottlingRuleBuilder().upload(50).download(50).schedule(schedule1).build()
"""Throttle bandwidth off business hours on week days: Monday - Friday"""
schedule2 = common_types.TimeRange().start('19:00:00').end('07:00:00').days(common_enum.DayOfWeek.Weekdays).build()
rule2 = common_types.ThrottlingRuleBuilder().upload(100).download(100).schedule(schedule2).build()
"""Throttle bandwidth during weekends: Saturday, Sunday"""
schedule3 = common_types.TimeRange().start('00:00:00').end('23:59:00').days(common_enum.DayOfWeek.Weekend).build()
rule3 = common_types.ThrottlingRuleBuilder().upload(500).download(500).schedule(schedule3).build()
edge.sync.throttling.set_policy([rule1, rule2, rule3])
File Access Protocols#
- FTP.disable()
Disable FTP
edge.ftp.disable()
- AFP.disable()
Disable AFP
edge.afp.disable()
- NFS.disable()
Disable NFS
edge.nfs.disable()
- RSync.disable()
Disable FTP
edge.rsync.disable()
Windows File Sharing (CIFS/SMB)#
- SMB.enable()
Enable SMB
edge.smb.enable()
- SMB.disable()
Disable SMB
edge.smb.disable()
- SMB.set_packet_signing(packet_signing)
Set Packet signing
- Parameters:
packet_signing (cterasdk.edge.enum.CIFSPacketSigning) – Packet signing type
edge.smb.set_packet_signing('If client agrees')
- SMB.enable_abe()
Enable ABE
edge.smb.enable_abe()
- SMB.disable_abe()
Disable ABE
edge.smb.disable_abe()
- AIO.enable()
Enable AIO
edge.aio.enable()
- AIO.disable()
Disable AIO
edge.aio.disable()
Network#
- Network.set_static_ipaddr(address, subnet, gateway, primary_dns_server, secondary_dns_server=None)
Set a Static IP Address
- Parameters:
address (str) – The static address
subnet (str) – The subnet for the static address
gateway (str) – The default gateway
primary_dns_server (str) – The primary DNS server
secondary_dns_server (str,optinal) – The secondary DNS server, defaults to None
edge.network.set_static_ipaddr('10.100.102.4', '255.255.255.0', '10.100.102.1', '10.100.102.1')
edge.show('/status/network/ports/0/ip') # will print the IP configuration
- Network.set_static_nameserver(primary_dns_server, secondary_dns_server=None)
Set the DNS Server addresses statically
- Parameters:
primary_dns_server (str) – The primary DNS server
secondary_dns_server (str,optinal) – The secondary DNS server, defaults to None
edge.network.set_static_nameserver('10.100.102.1') # to set the primary name server
edge.network.set_static_nameserver('10.100.102.1', '10.100.102.254') # to set both primary and secondary
- Network.enable_dhcp()
Enable DHCP
edge.network.enable_dhcp()
Proxy Settings#
- Proxy.get_configuration()
Get Proxy Configuration
configuration = edge.network.proxy.get_configuration()
print(configuration)
- Proxy.is_enabled()
Check if Proxy Configuration is Enabled
- Returns:
True
if a proxy server was configured andFalse
otherwise.- Return type:
bool
if edge.network.proxy.is_enabled():
print('Proxy Server is Enabled')
- Proxy.modify(address, port=None, username=None, password=None)
Modify Proxy Configuration
- Parameters:
address (str) – Proxy address
port (int,optional) – Proxy port, defaults to
8080
username (str,optional) – Username
password (str,optional) – Password
- Returns:
Proxy settings
- Return type:
edge.network.proxy.modify('192.168.11.11', 8081, 'proxy-user', 'proxy-user-password')
- Proxy.disable()
Disable Proxy
- Returns:
Proxy settings
- Return type:
edge.network.proxy.disable()
MTU#
- MTU.modify(mtu)
Set a custom network maximum transmission unit (MTU)
- Parameters:
mtu (int) – Maximum transmission unit
edge.network.mtu.modify(1320) # set the maximum transmission unit (MTU) to 1320
edge.network.mtu.modify(9000) # configure 'jumbo' frames (MTU: 9000)
- MTU.reset()
Set the default maximum transmission unit (MTU) settings
edge.network.mtu.reset() # disable custom mtu configuration and restore default setting (1500)
Static Routes#
- StaticRoutes.get()
Get All Static Routes
# get static routes
edge.network.routes.get()
- StaticRoutes.add(source_ip, destination_ip_mask)
Add a Static Route
- Parameters:
source_ip (str) – The source IP (192.168.15.55)
destination_ip_mask (str) – The destination IP and CIDR block (10.5.0.1/32)
# add static route from 10.10.12.1 to 192.168.55.7/32
edge.network.routes.add('10.10.12.1', '192.168.55.7/32')
# add static route from 10.100.102.4 to 172.18.100.0/24
edge.network.routes.add('10.100.102.4', '172.18.100.0/24')
- StaticRoutes.remove(destination_ip_mask)
Remove a Static Route
- Parameters:
destination_ip_mask (str) – The destination IP and CIDR block (10.5.0.1/32)
# remove static route 192.168.55.7/32
edge.network.routes.remove('192.168.55.7/32')
- StaticRoutes.clear()
Clear All Static routes
# remove all static routes - (clean)
edge.network.routes.clear()
Diagnostics#
- Network.tcp_connect(service)
Test a TCP connection between the Edge Filer and the provided host address
- Parameters:
service (cterasdk.edge.types.TCPService) – A service, identified by a host and a port
- Returns:
A named-tuple including the host, port and a boolean value indicating whether TCP connection can be established
- Return type:
cttp_service = edge_types.TCPService('tenant.ctera.com', 995)
result = edge.network.tcp_connect(cttp_service)
if result.is_open:
print('Success')
# do something...
else:
print('Failure')
ldap_service = edge_types.TCPService('dc.ctera.com', 389)
edge.network.tcp_connect(ldap_service)
- Network.diagnose(services)
Test a TCP connection to a host over a designated port
- Parameters:
services (list[cterasdk.edge.types.TCPService]) – List of services, identified by a host and a port
- Returns:
A list of named-tuples including the host, port and a boolean value indicating whether TCP connection can be established
- Return type:
services = []
services.append(edge_types.TCPService('192.168.90.1', 389)) # LDAP
services.append(edge_types.TCPService('ctera.portal.com', 995)) # CTTP
services.append(edge_types.TCPService('ctera.portal.com', 443)) # HTTPS
result = edge.network.diagnose(services)
for result in results:
print(result.host, result.port, result.is_open)
- Network.iperf(address, port=5201, threads=1, protocol='TCP', direction='Upload', retries=120, seconds=1)
Invoke a network throughput test
- Parameters:
address (str) – The host running the iperf server
port (int,optional) – The iperf server port, defaults to 5201
threads (int,optional) – The number of threads, defaults to 1
protocol (cterasdk.edge.enum.IPProtocol,optional) – IP protocol, defaults to ‘TCP’
direction (cterasdk.edge.enum.Traffic,optional) – Traffic direction, defaults to ‘Upload’
retries (int,optional) – Number of retries when sampling the iperf task status, defaults to 120
seconds (int,optional) – Number of seconds to wait between retries, defaults to 1
- Returns:
A string containing the iperf output
- Return type:
str
edge.network.iperf('192.168.1.145') # iperf server: 192.168.1.145, threads: 1, measure upload over TCP port 5201
edge.network.iperf('192.168.1.145', port=85201, threads=5) # Customized port and number of threads
edge.network.iperf('192.168.1.145', direction=edge_enum.Traffic.Download) # Measure download speed
edge.network.iperf('192.168.1.145', protocol=edge_enum.IPProtocol.UDP) # Use UDP
Mail Server#
- Mail.enable(smtp_server, port=25, username=None, password=None, use_tls=True)
Enable e-mail delivery using a custom SMTP server
- Parameters:
smtp_server (str) – Address of the SMTP Server
port (int,optional) – The listening port of the SMTP Server, defaults to 25
username (str,optional) – The user name of the SMTP Server, defaults to None
password (str,optional) – The password of the SMTP Server, defaults to None
use_tls (bool,optional) – Use TLS when connecting to the SMTP Server, defaults to True
edge.mail.enable('smtp.ctera.com') # default settings
edge.mail.enable('smtp.ctera.com', 465) # custom port number
"""Use default port number, use authentication and require TLS"""
edge.mail.enable('smtp.ctera.com', username = 'user', password = 'secret', useTLS = True)
- Mail.disable()
Disable e-mail delivery using a custom SMTP server
edge.mail.disable()
Logging#
- Logs.settings(retention, min_severity=None)
Configure log settings
- Parameters:
retention (int) – Log retention period in days
min_severity (cterasdk.edge.enum.Severity,optional) – Minimal log severity
- Logs.logs(topic, include=None, minSeverity='info')
Fetch Edge Filer logs
- Parameters:
topic (str) – Log Topic to fetch
include (list[str],optional) – List of fields to include in the response, defailts to Logs.default_include
minSeverity (cterasdk.edge.enum.Severity,optional) – Minimal log severity to fetch, defaults to cterasdk.edge.enum.Severity.INFO
- Returns:
Log entries
- Return type:
- Syslog.enable(server, port=514, proto='UDP', min_severity='info')
Enable Syslog
- Parameters:
server (str) – Server address to send syslog logs
port (int,optional) – Syslog server communication port, defaults to 514
proto (cterasdk.edge.enum.IPProtocol,optional) – Syslog server communication protocol, defaults to cterasdk.edge.enum.IPProtocol.UDP
min_severity (cterasdk.edge.enum.Severity,optional) – Minimal log severity to fetch, defaults to cterasdk.edge.enum.Severity.INFO
edge.syslog.enable('syslog.ctera.com') # default settings
edge.syslog.enable('syslog.ctera.com', proto = 'TCP') # use TCP
edge.syslog.enable('syslog.ctera.com', 614, minSeverity = 'error') # use 614 UDP, severity >= error
- Syslog.disable()
Disable Syslog
edge.syslog.disable()
CIFS/SMB Audit Logs#
- Audit.enable(path, auditEvents=None, logKeepPeriod=30, maxLogKBSize=102400, maxRotateTime=1440, includeAuditLogTag=True, humanReadableAuditLog=False)
Enable Edge Filer Audit log
- Parameters:
path (str) – Path to save the audit log
auditEvents (list[cterasdk.edge.enum.AuditEvents],optional) – List of audit event types to save, defaults to Audit.defaultAuditEvents
logKeepPeriod (int,optional) – Period to key the logs in days, defaults to 30
maxLogKBSize (int,optional) – The maximum size of the log file in KB, defailts to 102400 (100 MB)
maxRotateTime (int,optional) – The maximal time before rotating the log file in Minutes, defaults to 1440 (24 hours)
includeAuditLogTag (bool,optional) – Include audit log tag, defailts to True
humanReadableAuditLog (bool,optional) – Human readable audit log, defailts to False
edge.audit.enable('/logs')
- Audit.disable()
Disable Edge Filer Audit log
edge.audit.disable()
Reset to Defaults#
- Power.reset(wait=False)
Reset the Edge Filer setting
- Parameters:
wait (bool,optional) – Wait for reset to complete, defaults to False
edge.power.reset() # will reset and immediately return
edge.power.reset(wait=True) # will reset and wait for the Edge Filer to boot
See also
Create the first admin account after resetting the Edge Filer to its default settings: cterasdk.edge.users.Users.add_first_user()
SSL Certificate#
SSL management commands supported starting Edge Filer v7.8 or higher:
- ServerCertificate.get()
Get Server Cerificate.
server_certificate = edge.ssl.server.get()
print(server_certificate.fingerprint)
- ServerCertificate.regenerate()
Generate a Self Signed Certificate.
edge.ssl.server.regenerate() # generate a self-signed server certificate
- ServerCertificate.import_certificate(private_key, *certificates)
Import the Edge Filer’s server SSL certificate
- Parameters:
private_key (str) – The PEM-encoded private key, or a path to the PEM-encoded private key file
certificates (list[str]) – The PEM-encoded certificates, or a list of paths to the PEM-encoded certificates
edge.ssl.server.import_certificate(
r'C:/users/username/certificate/private.key',
r'C:/users/username/certificate/certificate.crt',
r'C:/users/username/certificate/intermediate1.crt',
r'C:/users/username/certificate/intermediate2.crt',
r'C:/users/username/certificate/root.crt'
)
- TrustedCAs.all()
List Trusted CAs.
for ca_certificate in edge.ssl.ca.all():
print(ca_certificate.fingerprint)
- TrustedCAs.add(ca)
Add Trusted CA.
- Parameters:
certificate (str) – The PEM-encoded certificate or a path to the PEM-encoded server certificate file
edge.ssl.ca.add(r'C:/users/username/certificate/ca.crt') # add Trusted CA certificate
- TrustedCAs.remove(ca)
Remove Trusted CA.
- Parameters:
ca (object) – CA fingerprint as str, or a trusted CA object.
certificate_fingerprint = '04:a0:56:a9:87:64:bb:dc:96:bf:6d:b0:49:fa:80:81:ed:06:8a:1e'
edge.ssl.ca.remove(certificate_fingerprint)
- TrustedCAs.clear()
Remove all Trusted CAs.
edge.ssl.ca.clear()
SSL management commands supported up to Edge Filer v7.6:
- SSLv1.get_storage_ca()
Get object storage trusted CA certificate
- SSLv1.remove_storage_ca()
Remove object storage trusted CA certificate
- SSLv1.import_certificate(private_key, *certificates)
Import the Edge Filer’s web server’s SSL certificate
- Parameters:
private_key (str) – The PEM-encoded private key, or a path to the PEM-encoded private key file
certificates (list[str]) – The PEM-encoded certificates, or a list of paths to the PEM-encoded certificates
"""
certificate = './certs/certificate.crt'
intermediate_cert = './certs/certificate1.crt'
ca_certificate = './certs/certificate2.crt'
private_key = './certs/private.key'
"""
"""
Specify certificates in the following order: domain cert, intermediary certs, CA cert
You may include as many intermediate certificates as needed
"""
edge.ssl.import_certificate(private_key, certificate, intermediate_cert, ca_certificate)
SSL management commands supported in all Edge Filer versions:
- SSL.disable_http()
Disable HTTP access
edge.ssl.disable_http()
- SSL.enable_http()
Enable HTTP access
edge.ssl.enable_http()
- SSL.is_http_disabled()
Check if HTTP access is disabled
edge.ssl.is_http_disabled()
- SSL.is_http_enabled()
Check if HTTP access is enabled
edge.ssl.is_http_enabled()
Power Management#
- Power.reboot(wait=False)
Reboot the Gateway
- Parameters:
wait (bool,optional) – Wait for reboot to complete, defaults to False
edge.power.reboot() # will reboot and immediately return
edge.power.reboot(wait=True) # will reboot and wait
- Power.shutdown()
Shutdown the Edge Filer
edge.power.shutdown()
SNMP#
- SNMP.is_enabled()
Check if SNMP is enabled
- Returns:
True is SNMP is enabled, else False
- Return type:
bool
edge.snmp.is_enabled()
- SNMP.enable(port=161, community_str=None, username=None, auth_password=None, privacy_password=None)
Enable SNMP
- Parameters:
port (int,optional) – SNMP server port, defaults to 161
community_str (str,optional) – SNMPv2c community string
username (str,optional) – SNMPv3 username
auth_password (str,optional) – SNMPv3 authentication password
privacy_password (str,optional) – SNMPv3 privacy password
edge.snmp.enable(community_str='MpPcKl2sArSdTLZ4URj4') # enable SNMP v2c
edge.snmp.enable(username='snmp_user', auth_password='gVQBaHSOGV', privacy_password='VG0zbn5aJ') # enable SNMP v3
- SNMP.disable()
Disable SNMP
edge.snmp.disable()
- SNMP.modify(port=None, community_str=None, username=None, auth_password=None, privacy_password=None)
Modify current SNMP configuration. Only configurations that are not None will be changed. SNMP must be enabled
- Parameters:
port (int,optional) – SNMP server port, defaults to 161
community_str (str,optional) – SNMPv2c community string
username (str,optional) – SNMPv3 username
auth_password (str,optional) – SNMPv3 authentication password
privacy_password (str,optional) – SNMPv3 privacy password
edge.snmp.modify(community_str=’L0K2zGpgmOQH2CXaUSuB’, username=’snmp_user’, auth_password=’gVQBaHSOGV’, privacy_password=’VG0zbn5aJ’)
- SNMP.get_configuration()
edge.snmp.get_configuration()
Troubleshooting#
Support Report#
- Support.get_support_report()
Download support report
Debug Level#
- Support.set_debug_level(*levels)
Set the debug level
edge.support.set_debug_level('backup', 'process', 'cttp', 'samba')
edge.support.set_debug_level('info')
edge.support.set_debug_level('caching', 'evictor')
Telnet#
- Telnet.enable(code)
Enable Telnet
edge.telnet.enable('a7df639a')
- Telnet.disable()
Disable Telnet
edge.telnet.disable()
SSH#
- SSH.enable(public_key=None, public_key_file=None, exponent=65537, key_size=2048)
Enable the Edge Filer’s SSH daemon
- Parameters:
public_key (str,optional) – A PEM-encoded public key in OpenSSH format. If neither a public key nor public key file were specified, an RSA key pair will be generated automatically. The PEM-encoded private key will be saved to the default Downloads directory
public_key_file (str,optional) – A path to the public key file
exponent (int,optional) – The public exponent of the new key, defaults to 65537
key_size (int,optional) – The length of the modulus in bits, defaults to 2048
"""Enable SSH access"""
edge.ssh.enable()
"""Enable SSH access using a public key file"""
edge.ssh.enable(public_key_file='./public_key.pub') # relative to the current directory
edge.ssh.enable(public_key_file='C:\\Users\\jsmith\\Desktop\\public_key.pub') # full path
"""Generate an RSA key pair and enable SSH access"""
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, PublicFormat, NoEncryption
private_key = rsa.generate_private_key(public_exponent=exponent, key_size=key_size)
public_key = private_key.public_key().public_bytes(Encoding.OpenSSH, PublicFormat.OpenSSH).decode('utf-8')
edge.ssh.enable(public_key)
"""Print PEM-encoded RSA private key"""
print(private_key.private_bytes(Encoding.PEM, PrivateFormat.OpenSSH, NoEncryption()).decode('utf-8'))
"""Print OpenSSH formatted RSA public key"""
print(public_key)
- SSH.disable()
edge.ssh.disable()
Miscellaneous#
- Edge.test()
edge.test()
- Edge.whoami()
Return the name of the logged in user.
- Return cterasdk.common.object.Object:
The session object of the current user
edge.whoami()