SNMP::setSecurity

(PHP 5 >= 5.4.0, PHP 7, PHP 8)

SNMP::setSecurityConfigures security-related SNMPv3 session parameters

说明

public function SNMP::setSecurity(
    string $securityLevel,
    string $authProtocol = "",
    string $authPassphrase = "",
    string $privacyProtocol = "",
    string $privacyPassphrase = "",
    string $contextName = "",
    string $contextEngineId = ""
): bool

setSecurity configures security-related session parameters used in SNMP protocol version 3

参数

securityLevel

The security level: "noAuthNoPriv", "authNoPriv", or "authPriv".

authProtocol

The authentication protocol: "MD5", "SHA", "SHA256", or "SHA512".

authPassphrase

The authentication passphrase.

privacyProtocol

The privacy protocol: "DES", or "AES", also accepted as "AES128". "AES192", "AES192C", "AES256", and "AES256C" are accepted when supported by the Net-SNMP library.

privacyPassphrase

The privacy passphrase.

contextName

the context name

contextEngineId

the context EngineID

返回值

成功时返回 true, 或者在失败时返回 false

更新日志

版本 说明
8.6.0 The privacy protocol now accepts "AES192", "AES192C", "AES256", and "AES256C" when supported by the Net-SNMP library.
8.1.0 The authentication protocol now accepts "SHA256" and "SHA512" when supported by the Net-SNMP library.

示例

示例 #1 SNMP::setSecurity() example

<?php
  $session = new SNMP(SNMP::VERSION_3, $hostname, $rwuser, $timeout, $retries);
  $session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '', 'aeeeff');
?>

参见

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。