(PHP 5 >= 5.4.0, PHP 7, PHP 8)
SNMP::setSecurity — Configures security-related SNMPv3 session parameters
$securityLevel,$authProtocol = "",$authPassphrase = "",$privacyProtocol = "",$privacyPassphrase = "",$contextName = "",$contextEngineId = ""setSecurity configures security-related session parameters used in SNMP protocol version 3
securityLevelThe security level: "noAuthNoPriv",
"authNoPriv", or "authPriv".
authProtocolThe authentication protocol: "MD5", "SHA",
"SHA256", or "SHA512".
authPassphraseThe authentication passphrase.
privacyProtocolThe privacy protocol: "DES", or "AES",
also accepted as "AES128". "AES192", "AES192C",
"AES256", and "AES256C" are accepted when supported by the
Net-SNMP library.
privacyPassphraseThe privacy passphrase.
contextNamethe context name
contextEngineIdthe context EngineID
| Versione | Descrizione |
|---|---|
| 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.
|
Example #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');
?>