[php-src] Issue #8939: PHP8 - SNMPv3 authPriv and authNoPriv Issue (CentOS 9 Stream x86_64)
| From: | PAamac | Date: | Wed, 06 Jul 2022 16:06:18 +0000 |
| Subject: | [php-src] Issue #8939: PHP8 - SNMPv3 authPriv and authNoPriv Issue (CentOS 9 Stream x86_64) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241870@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8939
Author: PAamac
### Description
The following code:
```php
<?php
snmp3_get([host], [user], 'authPriv', 'SHA', '[auth_pw]',
'AES', '[priv_pw]', [mib])
snmp3_walk([host], [user], 'authPriv', 'SHA', [auth_pw], 'AES',
[priv_pw]', [mib]));
snmp3_real_walk([host], [user], 'authPriv', 'SHA', [auth_pw], 'AES',
[priv_pw], [mib]);
>?
```
Resulted in this output:
```
All snmp3 commands that use "authPriv" or "authNoPriv" (i.e. do not use
"noAuthNoPriv"), whether SHA or MD5 is chosen, immediately return "false"
without producing any error message or attempting to contact the host. It seems superficially as
though there is some issue when introducing crypto for auth.
This has been tested on a CentOS 9 Stream system that can successfully use the snmp3 PHP functions
when "noAuthNoPriv" is used instead of an "authPriv" or "authNoPriv"
(traffic is sent to the host), and can successfully use a standalone snmpwalk against the same host
with an "auth" method.
Anecdotally, the same occurred previously on Fedora 35 x86_64 after an inline upgrade from Fedora
34, resulting in a OS upgrade revert, as the snmp3 commands in the same scripts worked on Fedora 34
x86_64 using PHP 7 but not on Fedora 35 with PHP 8 and other newer packages for SNMP, OpenSSL, etc.
For CentOS 9 Stream, here are the details of the php, openssl, and snmp packages and modules:
php-snmp-8.0.13-1.el9.x86_64
php-8.0.13-1.el9.x86_64
openssl-3.0.1-18.el9.x86_64
net-snmp-libs-5.9.1-7.el9.x86_64
net-snmp-agent-libs-5.9.1-7.el9.x86_64
net-snmp-5.9.1-7.el9.x86_64
net-snmp-utils-5.9.1-7.el9.x86_64
ldd /usr/lib64/php/modules/snmp.so
linux-vdso.so.1 (0x00007ffca8c68000)
libnetsnmp.so.40 => /lib64/libnetsnmp.so.40 (0x00007f9186b8d000)
libm.so.6 => /lib64/libm.so.6 (0x00007f9186ab2000)
libssl.so.3 => /lib64/libssl.so.3 (0x00007f9186a0d000)
libcrypto.so.3 => /lib64/libcrypto.so.3 (0x00007f91865e1000)
libc.so.6 => /lib64/libc.so.6 (0x00007f91863da000)
/lib64/ld-linux-x86-64.so.2 (0x00007f9186c8f000)
libz.so.1 => /lib64/libz.so.1 (0x00007f91863c0000)
CentOS 9 Stream uname = Linux [hostname] 5.14.0-101.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri May 27
10:28:26 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Also of note, the same issue does not occur when using Ubuntu server 22.04 x86_64 with PHP 8
having the following packages installed, as snmp3 functions work as intended in that set-up:
php-snmp/jammy,now 2:8.1+92ubuntu1 all
php/jammy,now 2:8.1+92ubuntu1 all
php8.1-snmp/jammy-updates,jammy-security,now 8.1.2-1ubuntu2.1 amd64
openssl/jammy-updates,jammy-security,now 3.0.2-0ubuntu1.6 amd64
libsnmp-base/jammy-updates,now 5.9.1+dfsg-1ubuntu2.1 all
libsnmp40/jammy-updates,now 5.9.1+dfsg-1ubuntu2.1 amd64
ldd /usr/lib/php/20210902/snmp.so
linux-vdso.so.1 (0x00007ffd35176000)
libnetsnmp.so.40 => /lib/x86_64-linux-gnu/libnetsnmp.so.40 (0x00007f3fd8f5b000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3fd8d33000)
libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007f3fd8c8f000)
libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007f3fd884d000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3fd9050000)
```
But I expected this output instead:
```
Expected the commands to result in a SNMPv3 connection attempt to target host and work normally when
"authPriv" or "authNoPriv" options are used, and to at least provide appropriate
error message output instead of just returning "false" immediately with no error details.
The two different issues are SNMPv3 commands not working with
"auth"/"authNoPriv" and separate to that why there are no error messages being
generated when the commands immediately return "false".
```
### PHP Version
PHP SNMP 8.0.13 (CentOS 9 Stream Package php-snmp-8.0.13-1.el9.x86_64)
### Operating System
CentOS 9 Stream