Aunque ya viene de atrás, a día de hoy siguen existiendo instalaciones todavía afectadas por la vulnerabilidad conocida como «TNS Listener Poison Attack», según se publica en el boletín las alertas de seguridad Oracle: CVE-2012-1675.

   Así de inicio puede parecer muy complejo al profundizar sobre ello, por tratarse de mitigar amenazas, pero nada más lejos de la realidad.

   En entornos Oracle RAC con versiones 11.2.0.4 o superiores, se introduce el concepto VNCR (Valid Node Checking for Registration) tal y como se documenta en la nota Oracle Support Document: 1914282.1 (How to Enable VNCR on RAC Database to Register only Local Instances).

   De esta forma, simplemente añadiendo las líneas necesarias en el fichero de configuración listener.ora de los nodos que componen el cluster, y recargando a continuación la configuración del listener y de los SCAN listeners (sin producirse corte en el acceso) estaríamos restringiendo el registro de los servicios según nos convenga.

   En el siguiente ejemplo, se detalla la operativa necesaria en los nodos de un cluster para limitar dicho registro a sólo los dos miembros del mismo:

-- add listener.ora: node hostname1 and hostname2
 VALID_NODE_CHECKING_REGISTRATION_LISTENER=LOCAL
 VALID_NODE_CHECKING_REGISTRATION_LISTENER_SCAN1=LOCAL
 VALID_NODE_CHECKING_REGISTRATION_LISTENER_SCAN2=LOCAL
 VALID_NODE_CHECKING_REGISTRATION_LISTENER_SCAN3=LOCAL

 REGISTRATION_INVITED_NODES_LISTENER_SCAN1=(hostname1,hostname2)
 REGISTRATION_INVITED_NODES_LISTENER_SCAN2=(hostname1,hostname2)
 REGISTRATION_INVITED_NODES_LISTENER_SCAN3=(hostname1,hostname2)

-- reload conf listener and scan listeners
 oracle@hostname1$ ps -fe | grep lsnr
 oracle 2421 1 0 Jan02 ? 00:00:50 /u01/app/11.2.0.4/grid/bin/tnslsnr LISTENER_SCAN3 -inherit
 oracle 26063 1 0 Jan02 ? 00:00:49 /u01/app/11.2.0.4/grid/bin/tnslsnr LISTENER_SCAN2 -inherit
 oracle 26081 1 0 Jan02 ? 00:00:32 /u01/app/11.2.0.4/grid/bin/tnslsnr LISTENER -inherit

oracle@hostname1$ lsnrctl reload LISTENER_SCAN2
 ...
 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))
 The command completed successfully

oracle@hostname1$ lsnrctl reload LISTENER_SCAN3
 ...
 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3)))
 The command completed successfully

oracle@hostname1$ lsnrctl reload LISTENER
 ...
 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
 The command completed successfully

oracle@hostname2$ ps -fe | grep lsnr
 oracle 12100 1 0 Jan02 ? 00:00:40 /u01/app/11.2.0.4/grid/bin/tnslsnr LISTENER -inherit
 oracle 12166 1 0 Jan02 ? 00:00:51 /u01/app/11.2.0.4/grid/bin/tnslsnr LISTENER_SCAN1 -inherit

oracle@hostname2$ lsnrctl reload listener_scan1
 ...
 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
 The command completed successfully

oracle@hostname2$ lsnrctl reload listener
 ...
 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
 The command completed successfully

oracle@hostname2$ tail -f listener_scan1.log
 ...
 08-JAN-2018 10:02:20 * service_register * test1 * 0
 08-JAN-2018 10:02:20 * service_register * test2 * 0

 

   Una vez se hacen efectivos los valores asignados a estos parámetros (VALID_NODE_CHECKING_REGISTRATION_LISTENER, VALID_NODE_CHECKING_REGISTRATION_LISTENER_SCAN* y REGISTRATION_INVITED_NODES_LISTENER_SCAN*) bases de datos remotas ya no podrán registrarse en el listener.

   Si una instancia ajena a las permitidas lo intenta, aparecerán en el log del listener errores de rechazo de la petición:

oracle@hostname2$ tail -f listener_scan1.log
 ...
 Tue Jan 08 10:50:26 2018
 Listener(VNCR option 1) rejected Registration request from destination XXX.XXX.XXX.XXX
 08-JAN-2018 10:50:26 * service_register_NSGR * 1182
 TNS-01182: Listener rejected registration of service ""