Remote calls don't need to use privilege ports
Subsystems (2)
cover Remote calls don't need to use privilege ports
Over the weekend I did some experimenting with the remote call code in rpcbind. The code does functionally work but is very antiquated when it comes to the latest NFS versions.
Since only UDP sockets are used to do remote calls using the documented interfaces pmap_rmtcall() and callrpc() calls to NFS will fail (actual times out) since UDP is no longer supported.
The undocumented interface rpc_call() can be used to call into NFS since the protocol can specified, which also means the PMAPPROC_CALLIT protocol is not used.
It turns out privilege port are not needed to make remote calls, at least with my testing. I'm thinking the only reason privilege ports were being uses was a side effect of create_rmtcall_fd() calling svc_tli_create() with an unbound socket.
So the following patch simply binds the socket before calling svc_tli_create() which means a non-privilege port will be reserved for remote calls.
I'm thinking this is the simplest way to
not pollute the privilege port space.
Steve Dickson (1):
rmtcalls: Don't use privileged ports for remote calls.
src/rpcb_svc_com.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
Signature · 1 line
2.14.3
PATCH 1/1 rmtcalls: Don't use privileged ports for remote calls.
Sockets use for remote calls are preallocated which mean the a port will be tied up for as long as rpcbind runs. Make sure that port is not a privileged port by binding the socket before calling svc_tli_create()
--- src/rpcb_svc_com.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
src/rpcb_svc_com.c +18 -1
@@ -501,9 +501,12 @@ static struct rmtcallfd_list *rmttail;int create_rmtcall_fd (struct netconfig *nconf) { -int fd; +int fd, cc;struct rmtcallfd_list *rmt;SVCXPRT *xprt; +struct __rpc_sockinfo si; +struct sockaddr_storage ss; +struct t_bind bindaddr;if ((fd =__rpc_nconf2fd (nconf)) ==-1 ) {if (debugging)
@@ -512,6 +515,20 @@ create_rmtcall_fd(struct netconfig *nconf) nconf->nc_device, errno);return (-1 ); } + +if (!__rpc_nconf2sockinfo (nconf, &si)) { +xlog (LOG_ERR ,"create_rmtcall_fd: cannot get information for %s" , + nconf->nc_netid); +return (-1 ); + } +memset (&ss,0 ,sizeof ss); + ss.ss_family = si.si_af; + cc =bind (fd, (struct sockaddr *)(void *)&ss, + (socklen_t )si.si_alen); +if (cc <0 ) { +xlog (LOG_ERR ,"create_rmtcall_fd: could not bind to anonymous port" ); +return (-1 ); + } xprt =svc_tli_create (fd,0 , (struct t_bind *)0 ,0 ,0 );if (xprt ==NULL ) {if (debugging)
Signature · 1 line
2.14.3
Heya Steve-
Quoted 10 lines · Steve Dickson
=20
Over the weekend I did some experimenting with
the remote call code in rpcbind. The code does=20 functionally work but is very antiquated when
it comes to the latest NFS versions.=20
=20
Since only UDP sockets are used to do remote calls using the documented interfacespmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no=20
Quoted 8 lines
longer supported.=20
=20
The undocumented interfacerpc_call()can be used to=20 call into NFS since the protocol can specified, which=20 also means thePMAPPROC_CALLITprotocol is not used. =20
It turns out privilege port are not needed to make remote calls, at least with my testing.
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?
I claim that is true for all RPC listeners.
Quoted 4 lines
I'm thinking=20
the only reason privilege ports were being uses was=20 a side effect ofcreate_rmtcall_fd()calling=20svc_tli_create()with an unbound socket.
Privileged listener ports are being created because svc_tli_create is using bindresvport when the passed in socket is not already bound.
svc_tli_create should use bind instead, and it needs to choose a port higher than 49151.
=
https://www.iana.org/assignments/service-names-port-numbers/service-names-=
port-numbers.xhtml
Quoted 7 lines
So the following patch simply binds the socket before calling
svc_tli_create()which means a non-privilege port will be reserved for remote calls.=20
=20
I'm thinking this is the simplest way to
not pollute the privilege port space.=20
This is going in the right direction, but the problem needs to be addressed in svc_tli_create, not in each application that calls svc_tli_create.
This is the same issue that Guillem Jover was trying to address by making bindresvport skip well-known ports.
In other words: this code in src/svc_generic.c is wrong:
218 /*
219 * If the fd is unbound, try to bind it.
220 */
221 if (madefd || !__rpc_sockisbound(fd)) {
222 if (bindaddr =3D=3D NULL) {
223 if (bindresvport(fd, NULL) < 0) {
^^^^^^^^^^^^224 memset(&ss, 0, sizeof ss); 225 ss.ss_family =3D si.si_af; 226 if (bind(fd, (struct sockaddr =
*)(void *)&ss,
227 (socklen_t)si.si_alen) < 0) {
228 warnx(
229 "svc_tli_create: could not bind to anonymous =
port");
230 goto freedata;
231 }
232 }
233 listen(fd, SOMAXCONN);
234 } else {
235 if (bind(fd,
236 (struct sockaddr *)bindaddr->addr.buf,
237 (socklen_t)si.si_alen) < 0) {
238 warnx(
239 "svc_tli_create: could not bind to requested =
address");
240 goto freedata;
241 }
242 listen(fd, (int)bindaddr->qlen);
243 }
244=20
245 }
Quoted 5 lines
Steve Dickson (1):
rmtcalls: Don't use privileged ports for remote calls.
=20src/rpcb_svc_com.c| 19 ++++++++++++++++++-1 file changed, 18 insertions(+), 1 deletion(-)
--
Chuck Lever
Tom Talpey
reviewerQuoted 18 lines · Chuck Lever
Heya Steve-
Quoted 16 lines · Steve Dickson
Over the weekend I did some experimenting with the remote call code in rpcbind. The code does functionally work but is very antiquated when it comes to the latest NFS versions.
Since only UDP sockets are used to do remote calls using the documented interfaces
pmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no longer supported.The undocumented interface
rpc_call()can be used to call into NFS since the protocol can specified, which also means thePMAPPROC_CALLITprotocol is not used.
Quoted 8 lines
Quoted 2 lines
It turns out privilege port are not needed to make remote calls, at least with my testing.
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?
I claim that is true for all RPC listeners.
Why in the world is the remote-call interface even still supported? It is and was a mammoth security hole allowing machine impersonation, and to my knowledge no actual services or applications depends on it. Why not bury it under some compatibility option, default=off??
Tom.
Quoted 83 lines
Quoted 5 lines
I'm thinking
the only reason privilege ports were being uses was a side effect ofcreate_rmtcall_fd()callingsvc_tli_create()with an unbound socket.Privileged listener ports are being created because
svc_tli_createis using bindresvport when the passed in socket is not already bound.
svc_tli_createshould use bind instead, and it needs to choose a port higher than 49151.https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
Quoted 7 lines
So the following patch simply binds the socket before calling
svc_tli_create()which means a non-privilege port will be reserved for remote calls.I'm thinking this is the simplest way to
not pollute the privilege port space.This is going in the right direction, but the problem needs to be addressed in
svc_tli_create, not in each application that callssvc_tli_create.This is the same issue that Guillem Jover was trying to address by making bindresvport skip well-known ports.
In other words: this code in
src/svc_generic.cis wrong:218 /*
219 * If the fd is unbound, try to bind it.
220 */
221 if (madefd || !__rpc_sockisbound(fd)) {
222 if (bindaddr == NULL) {223 if (bindresvport(fd, NULL) < 0) { ^^^^^^^^^^^^224 memset(&ss, 0, sizeof ss); 225 ss.ss_family = si.si_af; 226 if (bind(fd, (struct sockaddr *)(void *)&ss,227 (socklen_t)si.si_alen) < 0) {
228 warnx(
229 "svc_tli_create: could not bind to anonymous port");
230 goto freedata;
231 }
232 }
233listen(fd, SOMAXCONN);
234 } else {
235 if (bind(fd,
236 (struct sockaddr *)bindaddr->addr.buf,
237 (socklen_t)si.si_alen) < 0) {
238 warnx(
239 "svc_tli_create: could not bind to requested address");
240 goto freedata;
241 }
242listen(fd, (int)bindaddr->qlen);
243 }
244
245 }Quoted 5 lines
Steve Dickson (1):
rmtcalls: Don't use privileged ports for remote calls.
src/rpcb_svc_com.c| 19 ++++++++++++++++++-1 file changed, 18 insertions(+), 1 deletion(-)--
Chuck Lever--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Tom Talpey
=20
Quoted 2 lines · Chuck Lever
Heya Steve-
Quoted 1 line
On Feb 5, 2018, at 11:36 AM, Steve Dickson <[email protected]> =
Quoted 21 lines · wrote:
Quoted 17 lines
Quoted 9 lines
=20
Over the weekend I did some experimenting with
the remote call code in rpcbind. The code does functionally work but is very antiquated when
it comes to the latest NFS versions.
=20
Since only UDP sockets are used to do remote calls using the documented interfacespmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is noQuoted 8 lines
longer supported.
=20
The undocumented interfacerpc_call()can be used to call into NFS since the protocol can specified, which also means thePMAPPROC_CALLITprotocol is not used. =20
It turns out privilege port are not needed to make remote calls, at least with my testing.Quoted 4 lines
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged? I claim that is true for all RPC listeners.
Quoted 6 lines
=20
=20
Why in the world is the remote-call interface even still supported? It is and was a mammoth security hole allowing machine impersonation, and to my knowledge no actual services or applications depends on it. Why not bury it under some compatibility option, default=3Doff??
I agree, and that has been proposed (just last week in this thread).
Quoted 13 lines
Tom.
=20
=20Quoted 10 lines
Quoted 4 lines
I'm thinking
the only reason privilege ports were being uses was a side effect ofcreate_rmtcall_fd()callingsvc_tli_create()with an unbound socket.Privileged listener ports are being created because
svc_tli_createis using bindresvport when the passed in socket is not already bound.svc_tli_createshould use bind instead, and it needs to choose a port higher than 49151.
=
https://www.iana.org/assignments/service-names-port-numbers/service-names-=
port-numbers.xhtml
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
So the following patch simply binds the socket before calling
svc_tli_create()which means a non-privilege port will be reserved for remote calls.
=20
I'm thinking this is the simplest way to
not pollute the privilege port space.
Quoted 16 lines
Quoted 11 lines
This is going in the right direction, but the problem needs to be addressed in
svc_tli_create, not in each application that callssvc_tli_create.
This is the same issue that Guillem Jover was trying to address by making bindresvport skip well-known ports. In other words: this code insrc/svc_generic.cis wrong:
218 /*
219 * If the fd is unbound, try to bind it.
220 */
221 if (madefd || !__rpc_sockisbound(fd)) {
222 if (bindaddr =3D=3D NULL) {Quoted 5 lines
223 if (bindresvport(fd, NULL) < 0) { ^^^^^^^^^^^^ 224 memset(&ss, 0, sizeof ss); 225 ss.ss_family =3D si.si_af; 226 if (bind(fd, (struct sockaddr =
*)(void *)&ss,
Quoted 3 lines
Quoted 3 lines
227 (socklen_t)si.si_alen) < 0) {
228 warnx(
229 "svc_tli_create: could not bind to =
anonymous port");
Quoted 7 lines
Quoted 7 lines
230 goto freedata;
231 }
232 }
233listen(fd, SOMAXCONN);
234 } else {
235 if (bind(fd,
236 (struct sockaddr =
*)bindaddr->addr.buf,
Quoted 3 lines
Quoted 3 lines
237 (socklen_t)si.si_alen) < 0) {
238 warnx(
239 "svc_tli_create: could not bind to requested =
address");
Quoted 11 lines
Quoted 11 lines
240 goto freedata;
241 }
242listen(fd, (int)bindaddr->qlen);
243 }
244
245 }Quoted 5 lines
Steve Dickson (1):
rmtcalls: Don't use privileged ports for remote calls.
=20src/rpcb_svc_com.c| 19 ++++++++++++++++++-1 file changed, 18 insertions(+), 1 deletion(-)
Quoted 4 lines
Quoted 4 lines
--
Chuck Lever
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
Quoted 2 lines
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Chuck Lever
Quoted 26 lines · Tom Talpey
Quoted 25 lines · Chuck Lever
Heya Steve-
Quoted 12 lines · Steve Dickson
Over the weekend I did some experimenting with
the remote call code in rpcbind. The code does
functionally work but is very antiquated when
it comes to the latest NFS versions.Since only UDP sockets are used to do remote calls using the documented interfaces
pmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no longer supported.Quoted 6 lines
The undocumented interface
rpc_call()can be used to call into NFS since the protocol can specified, which also means thePMAPPROC_CALLITprotocol is not used.It turns out privilege port are not needed to make remote calls, at least with my testing.
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?
Quoted 7 lines
Quoted 1 line
I claim that is true for all RPC listeners.
Why in the world is the remote-call interface even still supported? It is and was a mammoth security hole allowing machine impersonation, and to my knowledge no actual services or applications depends on it. Why not bury it under some compatibility option, default=off??
I did not realize it was a security hole since the info returned can be gotten in other ways... But I do see Netapp has disabled the procedure.
steved.
Quoted 19 lines · Tom Talpey
Quoted 18 lines · Chuck Lever
Heya Steve-
Quoted 16 lines · Steve Dickson
Over the weekend I did some experimenting with the remote call code in rpcbind. The code does functionally work but is very antiquated when it comes to the latest NFS versions.
Since only UDP sockets are used to do remote calls using the documented interfaces
pmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no longer supported.The undocumented interface
rpc_call()can be used to call into NFS since the protocol can specified, which also means thePMAPPROC_CALLITprotocol is not used.
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
It turns out privilege port are not needed to make remote calls, at least with my testing.
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?
rpcbind listens for CALLIT on port 111.
Listening on some other port wouldn't ever get the messges...
Quoted 8 lines
Quoted 2 lines
I claim that is true for all RPC listeners.
Why in the world is the remote-call interface even still supported? It is and was a mammoth security hole allowing machine impersonation, and to my knowledge no actual services or applications depends on it. Why not bury it under some compatibility option, default=off??
Is "ybind --broadcast" still used?
Even it is it, the port that rpcbind uses to forward the request doesn't need to be privileged.
NeilBrown
Quoted 91 lines
Tom.
Quoted 77 lines
Quoted 5 lines
I'm thinking
the only reason privilege ports were being uses was a side effect ofcreate_rmtcall_fd()callingsvc_tli_create()with an unbound socket.Privileged listener ports are being created because
svc_tli_createis using bindresvport when the passed in socket is not already bound.
svc_tli_createshould use bind instead, and it needs to choose a port higher than 49151.https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
Quoted 7 lines
So the following patch simply binds the socket before calling
svc_tli_create()which means a non-privilege port will be reserved for remote calls.I'm thinking this is the simplest way to
not pollute the privilege port space.This is going in the right direction, but the problem needs to be addressed in
svc_tli_create, not in each application that callssvc_tli_create.This is the same issue that Guillem Jover was trying to address by making bindresvport skip well-known ports.
In other words: this code in
src/svc_generic.cis wrong:218 /*
219 * If the fd is unbound, try to bind it.
220 */
221 if (madefd || !__rpc_sockisbound(fd)) {
222 if (bindaddr == NULL) {223 if (bindresvport(fd, NULL) < 0) { ^^^^^^^^^^^^224 memset(&ss, 0, sizeof ss); 225 ss.ss_family = si.si_af; 226 if (bind(fd, (struct sockaddr *)(void *)&ss,227 (socklen_t)si.si_alen) < 0) {
228 warnx(
229 "svc_tli_create: could not bind to anonymous port");
230 goto freedata;
231 }
232 }
233listen(fd, SOMAXCONN);
234 } else {
235 if (bind(fd,
236 (struct sockaddr *)bindaddr->addr.buf,
237 (socklen_t)si.si_alen) < 0) {
238 warnx(
239 "svc_tli_create: could not bind to requested address");
240 goto freedata;
241 }
242listen(fd, (int)bindaddr->qlen);
243 }
244
245 }Quoted 5 lines
Steve Dickson (1):
rmtcalls: Don't use privileged ports for remote calls.
src/rpcb_svc_com.c| 19 ++++++++++++++++++-1 file changed, 18 insertions(+), 1 deletion(-)--
Chuck LeverQuoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · NeilBrown
=20
On Mon, Feb 05 2018, Tom Talpey wrote:
=20Quoted 4 lines · Chuck Lever
Quoted 3 lines
Heya Steve-
=20Quoted 1 line
On Feb 5, 2018, at 11:36 AM, Steve Dickson <[email protected]> =
Quoted 17 lines · wrote:
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
=20
Over the weekend I did some experimenting with
the remote call code in rpcbind. The code does functionally work but is very antiquated when
it comes to the latest NFS versions.
=20
Since only UDP sockets are used to do remote calls using the documented interfacespmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no longer supported.
=20
The undocumented interfacerpc_call()can be used to call into NFS since the protocol can specified, which also means thePMAPPROC_CALLITprotocol is not used. =20
It turns out privilege port are not needed to make remote calls, at least with my testing.
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
=20
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?=20
rpcbind listens for CALLIT on port 111.
Right, my bad. CALLIT is an RPC procedure, not an RPC program.
Quoted 1 line
Listening on some other port wouldn't ever get the messges...
Then we still do not understand why rpcbind is opening and registering a second listener port. I can't think of any reason it should do this other than that there is a bug.
Quoted 11 lines
Quoted 8 lines
Quoted 2 lines
=20
I claim that is true for all RPC listeners.=20
=20
Why in the world is the remote-call interface even still supported? It is and was a mammoth security hole allowing machine impersonation, and to my knowledge no actual services or applications depends on it. Why not bury it under some compatibility option, default=3Doff??=20
Is "ybind --broadcast" still used?
Even it is it, the port that rpcbind uses to forward the request =
doesn't
Quoted 23 lines
need to be privileged.
=20
NeilBrown
=20
=20Quoted 18 lines
=20
Tom.
=20
=20Quoted 14 lines
=20
Quoted 4 lines
I'm thinking
the only reason privilege ports were being uses was a side effect ofcreate_rmtcall_fd()callingsvc_tli_create()with an unbound socket.=20
Privileged listener ports are being created becausesvc_tli_createis using bindresvport when the passed in socket is not already bound.
=20svc_tli_createshould use bind instead, and it needs to choose a port higher than 49151.
=20
=
https://www.iana.org/assignments/service-names-port-numbers/service-names-=
port-numbers.xhtml
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
=20
=20Quoted 7 lines
So the following patch simply binds the socket before calling
svc_tli_create()which means a non-privilege port will be reserved for remote calls.
=20
I'm thinking this is the simplest way to
not pollute the privilege port space.=20
This is going in the right direction, but the problem needs to be addressed insvc_tli_create, not in each application that callssvc_tli_create.
=20
This is the same issue that Guillem Jover was trying to address by making bindresvport skip well-known ports. =20
In other words: this code insrc/svc_generic.cis wrong:
=20
218 /*
219 * If the fd is unbound, try to bind it.
220 */
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
221 if (madefd || !__rpc_sockisbound(fd)) {
222 if (bindaddr =3D=3D NULL) {223 if (bindresvport(fd, NULL) < 0) { ^^^^^^^^^^^^ =20 224 memset(&ss, 0, sizeof ss); 225 ss.ss_family =3D si.si_af; 226 if (bind(fd, (struct sockaddr =
*)(void *)&ss,
Quoted 1 line
Quoted 1 line
Quoted 1 line
227 (socklen_t)si.si_alen) < 0) =
{
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
228 warnx(
229 "svc_tli_create: could not bind to =
anonymous port");
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
230 goto freedata;
231 }
232 }
233listen(fd, SOMAXCONN);
234 } else {
235 if (bind(fd,
236 (struct sockaddr =
*)bindaddr->addr.buf,
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
237 (socklen_t)si.si_alen) < 0) {
238 warnx(
239 "svc_tli_create: could not bind to requested =
address");
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
240 goto freedata;
241 }
242listen(fd, (int)bindaddr->qlen);
243 }
244
245 }
=20
=20Quoted 5 lines
Steve Dickson (1):
rmtcalls: Don't use privileged ports for remote calls.
=20src/rpcb_svc_com.c| 19 ++++++++++++++++++-1 file changed, 18 insertions(+), 1 deletion(-)
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
=20
=20
--
Chuck Lever
=20
=20
=20
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
=20
=20--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
Quoted 2 lines
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Chuck Lever
Quoted 36 lines · Chuck Lever
Quoted 23 lines · NeilBrown
Quoted 19 lines · Tom Talpey
Quoted 18 lines · Chuck Lever
Heya Steve-
Quoted 16 lines · Steve Dickson
Over the weekend I did some experimenting with
the remote call code in rpcbind. The code does
functionally work but is very antiquated when
it comes to the latest NFS versions.Since only UDP sockets are used to do remote calls using the documented interfaces
pmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no longer supported.The undocumented interface
rpc_call()can be used to call into NFS since the protocol can specified, which also means thePMAPPROC_CALLITprotocol is not used.Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
It turns out privilege port are not needed to make remote calls, at least with my testing.
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?
rpcbind listens for CALLIT on port 111.
Right, my bad. CALLIT is an RPC procedure, not an RPC program.
Quoted 6 lines
Quoted 1 line
Listening on some other port wouldn't ever get the messges...
Then we still do not understand why rpcbind is opening and registering a second listener port. I can't think of any reason it should do this other than that there is a bug.
This is a port on which it forwards CALLIT messages and listens for replies, which it then sends back to the originator. In order to be able to handle CALLIT asynchronously with other requests, it needs to register the port with the internal listening framework. For comparison, portmap handles CALLIT asynchronously by forking.
Thanks,
NeilBrown
Quoted 49 lines · NeilBrown
Quoted 36 lines · Chuck Lever
Quoted 23 lines · NeilBrown
Quoted 19 lines · Tom Talpey
Quoted 18 lines · Chuck Lever
Heya Steve-
Quoted 16 lines · Steve Dickson
Over the weekend I did some experimenting with
the remote call code in rpcbind. The code does
functionally work but is very antiquated when
it comes to the latest NFS versions.Since only UDP sockets are used to do remote calls using the documented interfaces
pmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no longer supported.The undocumented interface
rpc_call()can be used to call into NFS since the protocol can specified, which also means thePMAPPROC_CALLITprotocol is not used.Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
It turns out privilege port are not needed to make remote calls, at least with my testing.
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?
rpcbind listens for CALLIT on port 111.
Right, my bad. CALLIT is an RPC procedure, not an RPC program.
Quoted 6 lines
Quoted 1 line
Listening on some other port wouldn't ever get the messges...
Then we still do not understand why rpcbind is opening and registering a second listener port. I can't think of any reason it should do this other than that there is a bug.
Quoted 4 lines
This is a port on which it forwards CALLIT messages and listens for replies, which it then sends back to the originator. In order to be able to handle CALLIT asynchronously with other requests, it needs to register the port with the internal listening framework.
Sorry, this is still not making sense to me. Can you create a ladder diagram that shows the exchange of Call and Reply messages?
Quoted 4 lines
For comparison, portmap handles CALLIT asynchronously by forking.
Thanks,
NeilBrown
--
Chuck Lever
Quoted 47 lines · Chuck Lever
Quoted 47 lines · NeilBrown
Quoted 42 lines · Chuck Lever
Quoted 23 lines · NeilBrown
Quoted 19 lines · Tom Talpey
Quoted 18 lines · Chuck Lever
Heya Steve-
Quoted 16 lines · Steve Dickson
Over the weekend I did some experimenting with
the remote call code in rpcbind. The code does
functionally work but is very antiquated when
it comes to the latest NFS versions.Since only UDP sockets are used to do remote calls using the documented interfaces
pmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no longer supported.The undocumented interface
rpc_call()can be used to call into NFS since the protocol can specified, which also means thePMAPPROC_CALLITprotocol is not used.Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
It turns out privilege port are not needed to make remote calls, at least with my testing.
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?
rpcbind listens for CALLIT on port 111.
Right, my bad. CALLIT is an RPC procedure, not an RPC program.
Quoted 1 line
Listening on some other port wouldn't ever get the messges...
Then we still do not understand why rpcbind is opening and registering a second listener port. I can't think of any reason it should do this other than that there is a bug.
Quoted 7 lines
Quoted 4 lines
This is a port on which it forwards CALLIT messages and listens for replies, which it then sends back to the originator. In order to be able to handle CALLIT asynchronously with other requests, it needs to register the port with the internal listening framework.
Sorry, this is still not making sense to me. Can you create a ladder diagram that shows the exchange of Call and Reply messages?
Firstly, portmap binds 2 sockets (ignoring tcp for now), one on port 111 and one on an ephemeral port (EP). It registers both of these internally so incoming packets get noticed.
If it receives SET or UNSET or GETADDR etc on 111, it replies directly. CALLIT is a bit more complete.
remote-client rpcbind local-service
111
send CALLIT(XX) ------>rpcbproc_callit_com() EP
unwrap/send XX ----------------->handle
EP
111 handle_reply()<----------------send replyreceive reply<-------wrap-and-send
does that help? The callit request/reply to/from port 111 has some other request/reply embeded in it.
This embedded request/reply is sent/received unwrapped on the ephemeral port.
NeilBrown
Quoted 8 lines
Quoted 5 lines
For comparison, portmap handles CALLIT asynchronously by forking.
Thanks,
NeilBrown--
Chuck Lever
Quoted 18 lines · NeilBrown
=20
On Wed, Feb 07 2018, Chuck Lever wrote:
=20Quoted 12 lines
Quoted 12 lines · NeilBrown
=20
On Wed, Feb 07 2018, Chuck Lever wrote:
=20Quoted 8 lines
Quoted 8 lines · NeilBrown
=20
On Mon, Feb 05 2018, Tom Talpey wrote:
=20Quoted 4 lines · Chuck Lever
Quoted 3 lines
Heya Steve-
=20Quoted 1 line
On Feb 5, 2018, at 11:36 AM, Steve Dickson <[email protected]> =
Quoted 34 lines · wrote:
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
=20
Over the weekend I did some experimenting with
the remote call code in rpcbind. The code does functionally work but is very antiquated when
it comes to the latest NFS versions.
=20
Since only UDP sockets are used to do remote calls using the documented interfacespmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no longer supported.
=20
The undocumented interfacerpc_call()can be used to call into NFS since the protocol can specified, which also means thePMAPPROC_CALLITprotocol is not used. =20
It turns out privilege port are not needed to make remote calls, at least with my testing.Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
=20
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?=20
rpcbind listens for CALLIT on port 111.=20
Right, my bad. CALLIT is an RPC procedure, not an RPC program.
=20
=20Quoted 1 line
Listening on some other port wouldn't ever get the messges...
=20
Then we still do not understand why rpcbind is opening and registering a second listener port. I can't think of any reason it should do this other than that there is a bug.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
=20
This is a port on which it forwards CALLIT messages and listens for replies, which it then sends back to the originator. In order to be able to handle CALLIT asynchronously with other requests, it needs =
to
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
register the port with the internal listening framework.
=20
Sorry, this is still not making sense to me. Can you create a ladder diagram that shows the exchange of Call and Reply messages?=20
Firstly, portmap binds 2 sockets (ignoring tcp for now), one on port =
111
Quoted 1 line
and one on an ephemeral port (EP). It registers both of these =
internally so
Quoted 1 line
incoming packets get noticed.
So we have:
1 listener bound to 111. This is the main rpcbind service, and it is "registered" with the rpcbind service so that it is advertised to other RPC clients.
1 ephemeral port bound to N. This is an RPC client. This socket should be completely invisible to remote systems; ie. it is not "registered" with the rpcbind service, it is not a passive listener.
I don't understand what you mean by "registers both of these internally."
What was reported (in another email thread) is that there appears to be a second rpcbind registration on another port visible in the rpcinfo listing. I'm trying to understand what that port is for (and secondarily why it is using a port < 1024).
https://marc.info/?l=3Dlinux-nfs&m=3D151705744428289&w=3D2
I still don't see the point of the listener on port 831. I don't expect that ephemeral "client" socket to be visible in the rpcinfo listing, for example.
Quoted 1 line
If it receives SET or UNSET or GETADDR etc on 111, it replies =
directly.
Quoted 8 lines
CALLIT is a bit more complete.
=20
remote-client rpcbind local-service111 send CALLIT(XX) ------>rpcbproc_callit_com() EP unwrap/send XX ----------------->handle EP 111 handle_reply()<----------------send reply
Quoted 6 lines
receive reply<-------wrap-and-send
=20
=20
does that help? The callit request/reply to/from port 111 has some other request/reply embeded in it.
This embedded request/reply is sent/received unwrapped on the =
ephemeral
Quoted 1 line
port.
That aligns with my understanding of how CALLIT works. The second socket is not a listener, as I understand it, unless you're suggesting that rpcbind sets up the second socket as a listener to receive only replies to forwarded CALLIT requests?
The bug, then, would be that the second socket shouldn't be registered with the official rpcbind service, so that it will not be displayed in rpcinfo output.
Clients have "port 111" nailed in as the portmapper, so I can't see what use a second rpcbind registration would provide.
Quoted 12 lines
NeilBrown
=20
=20
=20Quoted 8 lines
=20
Quoted 4 lines
For comparison, portmap handles CALLIT asynchronously by forking. =20
Thanks,
NeilBrown=20
--
Chuck Lever
--
Chuck Lever
Quoted 69 lines · Chuck Lever
Quoted 56 lines · NeilBrown
Quoted 52 lines · Chuck Lever
Quoted 51 lines · NeilBrown
Quoted 36 lines · Chuck Lever
Quoted 23 lines · NeilBrown
Quoted 19 lines · Tom Talpey
Quoted 18 lines · Chuck Lever
Heya Steve-
Quoted 16 lines · Steve Dickson
Over the weekend I did some experimenting with
the remote call code in rpcbind. The code does
functionally work but is very antiquated when
it comes to the latest NFS versions.Since only UDP sockets are used to do remote calls using the documented interfaces
pmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no longer supported.The undocumented interface
rpc_call()can be used to call into NFS since the protocol can specified, which also means thePMAPPROC_CALLITprotocol is not used.Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
It turns out privilege port are not needed to make remote calls, at least with my testing.
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?
rpcbind listens for CALLIT on port 111.
Right, my bad. CALLIT is an RPC procedure, not an RPC program.
Quoted 6 lines
Quoted 1 line
Listening on some other port wouldn't ever get the messges...
Then we still do not understand why rpcbind is opening and registering a second listener port. I can't think of any reason it should do this other than that there is a bug.
This is a port on which it forwards CALLIT messages and listens for replies, which it then sends back to the originator. In order to be able to handle CALLIT asynchronously with other requests, it needs to register the port with the internal listening framework.
Quoted 6 lines
Quoted 2 lines
Sorry, this is still not making sense to me. Can you create a ladder diagram that shows the exchange of Call and Reply messages?
Firstly, portmap binds 2 sockets (ignoring tcp for now), one on port 111 and one on an ephemeral port (EP). It registers both of these internally so incoming packets get noticed.
So we have:
1 listener bound to 111. This is the main rpcbind service, and it is "registered" with the rpcbind service so that it is advertised to other RPC clients.
Quoted 6 lines
1 ephemeral port bound to N. This is an RPC client. This socket should be completely invisible to remote systems; ie. it is not "registered" with the rpcbind service, it is not a passive listener.
I don't understand what you mean by "registers both of these internally."
Maybe we are using the word "register" a bit differently because .....
Quoted 5 lines
What was reported (in another email thread) is that there appears to be a second rpcbind registration on another port visible in the rpcinfo listing. I'm trying to understand what that port is for (and secondarily why it is using a port < 1024).
.... I can see no evidence of what you say.
Quoted 2 lines
the "listing" is this email message is *not* an rpcinfo listing. "rpcinfo" is not mentioned in the email.
The listing results "when I do netstat".
If I run
netstat -uanp | grep rpcbind
I see a very similar listing, though only of the non-111 port (702 on my desktop).
The 111 port is attributed to systemd, which is expected when rpcbind was started by systemd's socket-activation.
Thanks,
NeilBrown
Quoted 22 lines · NeilBrown
=20
On Wed, Feb 07 2018, Chuck Lever wrote:
=20Quoted 16 lines
Quoted 16 lines · NeilBrown
=20
On Wed, Feb 07 2018, Chuck Lever wrote:
=20Quoted 12 lines
Quoted 12 lines · NeilBrown
=20
On Wed, Feb 07 2018, Chuck Lever wrote:
=20Quoted 8 lines
Quoted 8 lines · NeilBrown
=20
On Mon, Feb 05 2018, Tom Talpey wrote:
=20Quoted 4 lines · Chuck Lever
Quoted 3 lines
Heya Steve-
=20Quoted 1 line
On Feb 5, 2018, at 11:36 AM, Steve Dickson =
Quoted 28 lines · <[email protected]> wrote:
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
=20
Over the weekend I did some experimenting with
the remote call code in rpcbind. The code does functionally work but is very antiquated when
it comes to the latest NFS versions.
=20
Since only UDP sockets are used to do remote calls using the documented interfacespmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no longer supported.
=20
The undocumented interfacerpc_call()can be used to call into NFS since the protocol can specified, which also means thePMAPPROC_CALLITprotocol is not used. =20
It turns out privilege port are not needed to make remote calls, at least with my testing.Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
=20
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?=20
rpcbind listens for CALLIT on port 111.=20
Right, my bad. CALLIT is an RPC procedure, not an RPC program.
=20
=20
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Listening on some other port wouldn't ever get the messges...
=20
Then we still do not understand why rpcbind is opening and registering a second listener port. I can't think of any reason it should do this other than that there is a bug.=20
This is a port on which it forwards CALLIT messages and listens =
for
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
replies, which it then sends back to the originator. In order to =
be
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
able to handle CALLIT asynchronously with other requests, it needs =
to
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
register the port with the internal listening framework.
=20
Sorry, this is still not making sense to me. Can you create a ladder diagram that shows the exchange of Call and Reply messages?=20
Firstly, portmap binds 2 sockets (ignoring tcp for now), one on port =
111
Quoted 1 line
Quoted 1 line
Quoted 1 line
and one on an ephemeral port (EP). It registers both of these =
internally so
Quoted 27 lines
Quoted 14 lines
Quoted 1 line
incoming packets get noticed.
=20
So we have:
=20
1 listener bound to 111. This is the main rpcbind service, and it is "registered" with the rpcbind service so that it is advertised to other RPC clients.
=20
1 ephemeral port bound to N. This is an RPC client. This socket should be completely invisible to remote systems; ie. it is not "registered" with the rpcbind service, it is not a passive listener. =20
I don't understand what you mean by "registers both of these internally."=20
Maybe we are using the word "register" a bit differently because ..... =20Quoted 5 lines
=20
What was reported (in another email thread) is that there appears to be a second rpcbind registration on another port visible in the rpcinfo listing. I'm trying to understand what that port is for (and secondarily why it is using a port < 1024).=20
.... I can see no evidence of what you say.
=20Quoted 2 lines
=20
https://marc.info/?l=3Dlinux-nfs&m=3D151705744428289&w=3D2
Quoted 9 lines
=20
the "listing" is this email message is *not* an rpcinfo listing. "rpcinfo" is not mentioned in the email.
The listing results "when I do netstat".
=20
If I run
netstat -uanp | grep rpcbind
=20
I see a very similar listing, though only of the non-111 port (702 on =
my
Quoted 3 lines
desktop).
The 111 port is attributed to systemd, which is expected when rpcbind was started by systemd's socket-activation.
The clouds are lifted. Thanks.
--
Chuck Lever
Quoted 18 lines · Chuck Lever
Heya Steve-
Quoted 16 lines · Steve Dickson
Over the weekend I did some experimenting with the remote call code in rpcbind. The code does functionally work but is very antiquated when it comes to the latest NFS versions.
Since only UDP sockets are used to do remote calls using the documented interfaces
pmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no longer supported.The undocumented interface
rpc_call()can be used to call into NFS since the protocol can specified, which also means thePMAPPROC_CALLITprotocol is not used.
Quoted 6 lines
Quoted 2 lines
It turns out privilege port are not needed to make remote calls, at least with my testing.
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?
Right...
Quoted 2 lines
I claim that is true for all RPC listeners.
It could be true..
Quoted 10 lines
Quoted 6 lines
I'm thinking
the only reason privilege ports were being uses was a side effect ofcreate_rmtcall_fd()callingsvc_tli_create()with an unbound socket.Privileged listener ports are being created because
svc_tli_createis using bindresvport when the passed in socket is not already bound.
Right... So handing svc_tli_create a bound socket will cause the bindresvport not to happen.
Quoted 3 lines
svc_tli_createshould use bind instead, and it needs
to choose a port higher than 49151.Actual it does when at_bindstructure is passed in.
But more to the point, I thought about changing svc_tli_create but that would effect all the callers of the routine which I didn't think was a good idea for code that is basically not used.
Also, now that libtirpc is the only Linux RPC implementation (the RPC code has been removed from glibc) I'm a bit sensitive to changing functionality unless its a clear bug or security issue.
Quoted 2 lines
https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
Hmm... I have been conveniently ignoring Thorsten's blacklist patch. Maybe we should take another look at that.
Quoted 10 lines
Quoted 9 lines
So the following patch simply binds the socket before calling
svc_tli_create()which means a non-privilege port will be reserved for remote calls.I'm thinking this is the simplest way to
not pollute the privilege port space.
Quoted 8 lines
This is going in the right direction, but the problem needs to be addressed in
svc_tli_create, not in each application that callssvc_tli_create.This is the same issue that Guillem Jover was trying to address by making bindresvport skip well-known ports.
In other words: this code in
src/svc_generic.cis wrong:
It could be... but the API allows for the bindresvport (or any bind) to not happen... So changing how it is called I think is appropriate... Plus its been working this way for a long to so I'm very resistant to change functionality basically for no reason.
But I do think we should look into bindresvport using a black list since it is already established in SuSE
steved.
Quoted 45 lines
218 /*
219 * If the fd is unbound, try to bind it.
220 */
221 if (madefd || !__rpc_sockisbound(fd)) {
222 if (bindaddr == NULL) {223 if (bindresvport(fd, NULL) < 0) { ^^^^^^^^^^^^224 memset(&ss, 0, sizeof ss); 225 ss.ss_family = si.si_af; 226 if (bind(fd, (struct sockaddr *)(void *)&ss,227 (socklen_t)si.si_alen) < 0) {
228 warnx(
229 "svc_tli_create: could not bind to anonymous port");
230 goto freedata;
231 }
232 }
233listen(fd, SOMAXCONN);
234 } else {
235 if (bind(fd,
236 (struct sockaddr *)bindaddr->addr.buf,
237 (socklen_t)si.si_alen) < 0) {
238 warnx(
239 "svc_tli_create: could not bind to requested address");
240 goto freedata;
241 }
242listen(fd, (int)bindaddr->qlen);
243 }
244
245 }Quoted 5 lines
Steve Dickson (1):
rmtcalls: Don't use privileged ports for remote calls.
src/rpcb_svc_com.c| 19 ++++++++++++++++++-1 file changed, 18 insertions(+), 1 deletion(-)--
Chuck Lever
Hi Steve-
Quoted 8 lines · Steve Dickson
=20
=20
=20Quoted 3 lines · Chuck Lever
Heya Steve-
=20Quoted 1 line
On Feb 5, 2018, at 11:36 AM, Steve Dickson <[email protected]> =
Quoted 17 lines · wrote:
Quoted 17 lines
Quoted 17 lines
=20
Over the weekend I did some experimenting with
the remote call code in rpcbind. The code does=20 functionally work but is very antiquated when
it comes to the latest NFS versions.=20
=20
Since only UDP sockets are used to do remote calls using the documented interfacespmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no=20 longer supported.=20
=20
The undocumented interfacerpc_call()can be used to=20 call into NFS since the protocol can specified, which=20 also means thePMAPPROC_CALLITprotocol is not used. =20
It turns out privilege port are not needed to make remote calls, at least with my testing.
Quoted 8 lines
Quoted 4 lines
=20
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?Right...=20
Quoted 2 lines
=20
I claim that is true for all RPC listeners.It could be true..
"privileged port" always means a source port, never a listener. There is no extra privilege given to a listener port that is below 1024.
svc_tli_create is simply wrong to use bindresvport.
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
I'm thinking=20
the only reason privilege ports were being uses was=20 a side effect ofcreate_rmtcall_fd()calling=20svc_tli_create()with an unbound socket.=20
Privileged listener ports are being created becausesvc_tli_createis using bindresvport when the passed in socket is not already bound.Right... So handing
svc_tli_createa bound socket will cause the bindresvport not to happen.
True, and your patch corrects the behavior of rpcbind.
But I argue that is a workaround: svc_tli_create is still doing the wrong thing for any other RPC server that does not hand in a pre-bound socket. Fix it there and all RPC servers that use libtirpc are fixed.
Quoted 2 lines
Quoted 2 lines
svc_tli_createshould use bind instead, and it needs
to choose a port higher than 49151.Actual it does when at_bind=
structure is passed in.=20
Quoted 4 lines
But more to the point, I thought about changing=20
svc_tli_createbut that would effect all the callers of the routine which I didn't think was a good idea=20 for code that is basically not used.
I'm not sure what you mean by "code that is basically not used."
svc_tli_create is the bottom of the RPC stack. It is the libtirpc API that is used every time an RPC server starts a listener. mountd and statd call svc_tli_create directly for example, from support/nfs/svc_create.c.
Thus this is the right place to fix it for all RPC server applications.
Quoted 4 lines
Also, now that libtirpc is the only Linux RPC implementation (the RPC code has been removed from glibc) I'm a bit sensitive to changing functionality unless its a=20 clear bug or security issue.=20
This is a clear bug.
- The library should not be allowed to choose ports that interfere with well-known services.
- The library should choose service ports based on well- established standards, such as the IANA service names to port numbers standard.
Quoted 1 line
Quoted 1 line
=
https://www.iana.org/assignments/service-names-port-numbers/service-names-=
port-numbers.xhtml
Quoted 21 lines
Hmm... I have been conveniently ignoring Thorsten's blacklist patch. Maybe we should take another look at that.
=20Quoted 9 lines
=20
=20Quoted 7 lines
So the following patch simply binds the socket before calling
svc_tli_create()which means a non-privilege port will be reserved for remote calls.=20
=20
I'm thinking this is the simplest way to
not pollute the privilege port space.=20Quoted 9 lines
=20
This is going in the right direction, but the problem needs to be addressed insvc_tli_create, not in each application that callssvc_tli_create.
=20
This is the same issue that Guillem Jover was trying to address by making bindresvport skip well-known ports. =20
In other words: this code insrc/svc_generic.cis wrong:
Quoted 8 lines
It could be... but the API allows for the bindresvport (or any bind)=20=
to not happen... So changing how it is called I think is=20 appropriate... Plus its been working this way for a long to so=20 I'm very resistant to change functionality basically for no reason.=20 =20
But I do think we should look into bindresvport using a black list since it is already established in SuSE
IMO a bindresvport blacklist is absolutely the wrong approach. We have standards organizations that have explained exactly how this needs to work, and we want it to work without installing extra files or giving admins more knobs that they really don't need.
This is exactly the problem with distros applying patches without upstream review. SuSE fixed this and let their fix sit for years without any public bug report or review. IMO SuSE should be prepared to take this hit, it should not constrain upstream to choose a non-optimal long-term solution. I don't see any compelling reason in this particular case that we need to be constrained.
Fixing svc_tli_create to use ports higher than 49151 should be completely compatible with any reasonable blacklist, and it MUST be compatible with /etc/services, which is based on the IANA publication (no well-known fixed ports above 49151).
Quoted 14 lines
steved.
=20Quoted 12 lines
=20
218 /*
219 * If the fd is unbound, try to bind it.
220 */
221 if (madefd || !__rpc_sockisbound(fd)) {
222 if (bindaddr =3D=3D NULL) {223 if (bindresvport(fd, NULL) < 0) { ^^^^^^^^^^^^ =20 224 memset(&ss, 0, sizeof ss); 225 ss.ss_family =3D si.si_af; 226 if (bind(fd, (struct sockaddr =
*)(void *)&ss,
Quoted 3 lines
Quoted 3 lines
227 (socklen_t)si.si_alen) < 0) {
228 warnx(
229 "svc_tli_create: could not bind to =
anonymous port");
Quoted 7 lines
Quoted 7 lines
230 goto freedata;
231 }
232 }
233listen(fd, SOMAXCONN);
234 } else {
235 if (bind(fd,
236 (struct sockaddr =
*)bindaddr->addr.buf,
Quoted 3 lines
Quoted 3 lines
237 (socklen_t)si.si_alen) < 0) {
238 warnx(
239 "svc_tli_create: could not bind to requested =
address");
Quoted 13 lines
Quoted 13 lines
240 goto freedata;
241 }
242listen(fd, (int)bindaddr->qlen);
243 }
244=20
245 }
=20
=20Quoted 5 lines
Steve Dickson (1):
rmtcalls: Don't use privileged ports for remote calls. =20src/rpcb_svc_com.c| 19 ++++++++++++++++++-1 file changed, 18 insertions(+), 1 deletion(-)
Quoted 4 lines
Quoted 4 lines
=20
=20
--
Chuck Lever
--
Chuck Lever
Quoted 72 lines · Chuck Lever
Hi Steve-
Quoted 26 lines · Steve Dickson
Quoted 21 lines · Chuck Lever
Heya Steve-
Quoted 18 lines · Steve Dickson
Over the weekend I did some experimenting with the remote call code in rpcbind. The code does functionally work but is very antiquated when it comes to the latest NFS versions.
Since only UDP sockets are used to do remote calls using the documented interfaces
pmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no longer supported.The undocumented interface
rpc_call()can be used to call into NFS since the protocol can specified, which also means thePMAPPROC_CALLITprotocol is not used.It turns out privilege port are not needed to make remote calls, at least with my testing.
Quoted 7 lines
Quoted 3 lines
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?
Right...
Quoted 2 lines
I claim that is true for all RPC listeners.
It could be true..
"privileged port" always means a source port, never a listener. There is no extra privilege given to a listener port that is below 1024.
svc_tli_createis simply wrong to use bindresvport.Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
I'm thinking
the only reason privilege ports were being uses was a side effect ofcreate_rmtcall_fd()callingsvc_tli_create()with an unbound socket.Privileged listener ports are being created because
svc_tli_createis using bindresvport when the passed in socket is not already bound.Right... So handing
svc_tli_createa bound socket will cause the bindresvport not to happen.True, and your patch corrects the behavior of rpcbind.
But I argue that is a workaround:
svc_tli_createis still doing the wrong thing for any other RPC server that does not hand in a pre-bound socket. Fix it there and all RPC servers that use libtirpc are fixed.Quoted 6 lines
Quoted 2 lines
svc_tli_createshould use bind instead, and it needs
to choose a port higher than 49151.Actual it does when at_bindstructure is passed in.But more to the point, I thought about changing
svc_tli_createbut that would effect all the callers of the routine which I didn't think was a good idea for code that is basically not used.I'm not sure what you mean by "code that is basically not used."
Quoted 7 lines
svc_tli_createis the bottom of the RPC stack. It is the libtirpc API that is used every time an RPC server starts a listener. mountd and statd callsvc_tli_createdirectly for example, fromsupport/nfs/svc_create.c.Thus this is the right place to fix it for all RPC server applications.
Actually I believe those application get their ports from /etc/rpc via the getrpcbyname() and then hands svc_tli_create a bound socket which the reason bindresvport is not done.
Side Note: /etc/rpc will be staying in glibc since it is "backed by the NSS framework"
Quoted 8 lines
Quoted 6 lines
Also, now that libtirpc is the only Linux RPC implementation (the RPC code has been removed from glibc) I'm a bit sensitive to changing functionality unless its a clear bug or security issue.
This is a clear bug.
Lets do this... Please open up a upstream bz that justifies why the bindresvport was removed from svc_tli_create().
If we break some legacy app I would like something to point to explaining why the change was made
Quoted 53 lines
- The library should not be allowed to choose ports that interfere with well-known services.
- The library should choose service ports based on well- established standards, such as the IANA service names to port numbers standard.
Quoted 21 lines
Quoted 1 line
https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
Hmm... I have been conveniently ignoring Thorsten's blacklist patch. Maybe we should take another look at that.
Quoted 17 lines
Quoted 9 lines
So the following patch simply binds the socket before calling
svc_tli_create()which means a non-privilege port will be reserved for remote calls.I'm thinking this is the simplest way to
not pollute the privilege port space.This is going in the right direction, but the problem needs to be addressed in
svc_tli_create, not in each application that callssvc_tli_create.This is the same issue that Guillem Jover was trying to address by making bindresvport skip well-known ports.
Quoted 8 lines
Quoted 1 line
In other words: this code in
src/svc_generic.cis wrong:It could be... but the API allows for the bindresvport (or any bind) to not happen... So changing how it is called I think is appropriate... Plus its been working this way for a long to so I'm very resistant to change functionality basically for no reason.
But I do think we should look into bindresvport using a black list since it is already established in SuSE
IMO a bindresvport blacklist is absolutely the wrong approach. We have standards organizations that have explained exactly how this needs to work, and we want it to work without installing extra files or giving admins more knobs that they really don't need.
This is exactly the problem with distros applying patches without upstream review. SuSE fixed this and let their fix sit for years without any public bug report or review. IMO SuSE should be prepared to take this hit, it should not constrain upstream to choose a non-optimal long-term solution. I don't see any compelling reason in this particular case that we need to be constrained.
Quoted 5 lines
Fixing
svc_tli_createto use ports higher than 49151 should be completely compatible with any reasonable blacklist, and it MUST be compatible with/etc/services, which is based on the IANA publication (no well-known fixed ports above 49151).
Let me look into this...
steved.
Quoted 17 lines · Steve Dickson
=20
=20
=20Quoted 10 lines · Chuck Lever
Hi Steve-
=20Quoted 8 lines · Steve Dickson
=20
=20
=20Quoted 3 lines · Chuck Lever
Heya Steve-
=20Quoted 1 line
On Feb 5, 2018, at 11:36 AM, Steve Dickson <[email protected]> =
Quoted 52 lines · wrote:
Quoted 52 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
=20
Over the weekend I did some experimenting with
the remote call code in rpcbind. The code does=20 functionally work but is very antiquated when
it comes to the latest NFS versions.=20
=20
Since only UDP sockets are used to do remote calls using the documented interfacespmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no=20 longer supported.=20
=20
The undocumented interfacerpc_call()can be used to=20 call into NFS since the protocol can specified, which=20 also means thePMAPPROC_CALLITprotocol is not used. =20
It turns out privilege port are not needed to make remote calls, at least with my testing.Quoted 8 lines
Quoted 4 lines
=20
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?Right...=20
Quoted 2 lines
=20
I claim that is true for all RPC listeners.It could be true..
=20
"privileged port" always means a source port, never a listener. There is no extra privilege given to a listener port that is below 1024.
=20svc_tli_createis simply wrong to use bindresvport. =20
=20Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
I'm thinking=20
the only reason privilege ports were being uses was=20 a side effect ofcreate_rmtcall_fd()calling=20svc_tli_create()with an unbound socket.=20
Privileged listener ports are being created becausesvc_tli_createis using bindresvport when the passed in socket is not already bound.Right... So handing
svc_tli_createa bound socket will cause the bindresvport not to happen.=20
True, and your patch corrects the behavior of rpcbind. =20
But I argue that is a workaround:svc_tli_createis still doing the wrong thing for any other RPC server that does not hand in a pre-bound socket. Fix it there and all RPC servers that use libtirpc are fixed. =20
=20
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
svc_tli_createshould use bind instead, and it needs
to choose a port higher than 49151.Actual it does when at_bind=
structure is passed in.=20
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
But more to the point, I thought about changing=20
svc_tli_createbut that would effect all the callers of the routine which I didn't think was a good idea=20 for code that is basically not used.Quoted 11 lines
=20
I'm not sure what you mean by "code that is basically not used."
=20svc_tli_createis the bottom of the RPC stack. It is the libtirpc API that is used every time an RPC server starts a listener. mountd and statd callsvc_tli_createdirectly for example, fromsupport/nfs/svc_create.c. =20
Thus this is the right place to fix it for all RPC server applications.
Quoted 3 lines
Actually I believe those application get their ports from /etc/rpc=20 via the
getrpcbyname()and then handssvc_tli_createa bound socket which the reason bindresvport is not done.
/etc/rpc lists RPC program numbers, not ports.
mountd can and should use a dynamic port assignment, IMO. It doesn't have to use 20048.
Quoted 10 lines
Side Note:
/etc/rpcwill be staying in glibc since it is "backed by the NSS framework"
=20
=20Quoted 6 lines
=20
=20Quoted 4 lines
Also, now that libtirpc is the only Linux RPC implementation (the RPC code has been removed from glibc) I'm a bit sensitive to changing functionality unless its a=20 clear bug or security issue.=20
Quoted 7 lines
Quoted 2 lines
=20
This is a clear bug.Lets do this... Please open up a upstream bz that justifies why the bindresvport was removed from
svc_tli_create(). =20
If we break some legacy app I would like something to point to explaining why the change was made
That's fair. Also, my name will be on the bug and on the justification, so you can blame me when it goes all snafooey.
:-)
Quoted 9 lines
Quoted 9 lines
- The library should not be allowed to choose ports that interfere with well-known services.
=20
- The library should choose service ports based on well- established standards, such as the IANA service names to port numbers standard.
=20
=20Quoted 1 line
Quoted 1 line
=
https://www.iana.org/assignments/service-names-port-numbers/service-names-=
port-numbers.xhtml
Quoted 50 lines
Quoted 42 lines
Quoted 23 lines
Hmm... I have been conveniently ignoring Thorsten's blacklist patch. Maybe we should take another look at that.
=20Quoted 9 lines
=20
=20Quoted 7 lines
So the following patch simply binds the socket before calling
svc_tli_create()which means a non-privilege port will be reserved for remote calls.=20
=20
I'm thinking this is the simplest way to
not pollute the privilege port space.=20Quoted 9 lines
=20
This is going in the right direction, but the problem needs to be addressed insvc_tli_create, not in each application that callssvc_tli_create.
=20
This is the same issue that Guillem Jover was trying to address by making bindresvport skip well-known ports. =20
In other words: this code insrc/svc_generic.cis wrong:It could be... but the API allows for the bindresvport (or any bind)=20=
Quoted 7 lines
to not happen... So changing how it is called I think is=20 appropriate... Plus its been working this way for a long to so=20 I'm very resistant to change functionality basically for no reason.=20=
=20
But I do think we should look into bindresvport using a black list since it is already established in SuSE=20
IMO a bindresvport blacklist is absolutely the wrong approach. We have standards organizations that have explained exactly how this needs to work, and we want it to work without installing extra files or giving admins more knobs that they really don't need.
=20
This is exactly the problem with distros applying patches without upstream review. SuSE fixed this and let their fix sit for years without any public bug report or review. IMO SuSE should be prepared to take this hit, it should not constrain upstream to choose a non-optimal long-term solution. I don'tQuoted 8 lines
see any compelling reason in this particular case that we need to be constrained.
=20
Fixingsvc_tli_createto use ports higher than 49151 should be completely compatible with any reasonable blacklist, and it MUST be compatible with/etc/services, which is based on the IANA publication (no well-known fixed ports above 49151). =20
Quoted 5 lines
Let me look into this...=20
=20
steved.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Chuck Lever
Tom Talpey
reviewerQuoted 2 lines · Chuck Lever
mountd can and should use a dynamic port assignment, IMO. It doesn't have to use 20048.
Speaking of 20048, does anyone know why Nico made this assignment? Apart from making it well-known for firewalls, what system(s) actually required it? I don't recall it ever being discussed. Using it is certainly not required, since portmap resolves it.
https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt
++ mountd 20048 tcp NFS mount protocol [Nicolas_Williams] [Nicolas_Williams]
2010-08-09
++ mountd 20048 udp NFS mount protocol [Nicolas_Williams] [Nicolas_Williams]
2010-08-09Tom.
Quoted 7 lines · Tom Talpey
=20
Quoted 2 lines · Chuck Lever
mountd can and should use a dynamic port assignment, IMO. It doesn't have to use 20048.
Quoted 7 lines
=20
Speaking of 20048, does anyone know why Nico made this assignment? Apart from making it well-known for firewalls, what system(s) actually required it? I don't recall it ever being discussed. Using it is certainly not required, since portmap resolves it. =20
=
https://www.iana.org/assignments/service-names-port-numbers/service-names-=
port-numbers.txt
Quoted 2 lines
=20
++ mountd 20048 tcp NFS mount protocol =
[Nicolas_Williams] [Nicolas_Williams] =
2010-08-09
Quoted 1 line
++ mountd 20048 udp NFS mount protocol =
[Nicolas_Williams] [Nicolas_Williams] =
2010-08-09
Actually my first active interaction with the nfsv4 WG was at the IETF meeting in Montreal in late July of 2010. So I can't say that I have any memory of why this was done. It might be a question that can be answered by someone on [email protected].
--
Chuck Lever
Tom Talpey
reviewerQuoted 15 lines · Chuck Lever
Quoted 15 lines · Tom Talpey
Quoted 2 lines · Chuck Lever
mountd can and should use a dynamic port assignment, IMO. It doesn't have to use 20048.
Speaking of 20048, does anyone know why Nico made this assignment? Apart from making it well-known for firewalls, what system(s) actually required it? I don't recall it ever being discussed. Using it is certainly not required, since portmap resolves it.
https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt
Quoted 7 lines
Quoted 2 lines
++ mountd 20048 tcp NFS mount protocol [Nicolas_Williams] [Nicolas_Williams] 2010-08-09 ++ mountd 20048 udp NFS mount protocol [Nicolas_Williams] [Nicolas_Williams] 2010-08-09Actually my first active interaction with the nfsv4 WG was at the IETF meeting in Montreal in late July of 2010. So I can't say that I have any memory of why this was done. It might be a question that can be answered by someone on [email protected].
Sure, or Nico directly. What I was wondering is why nfs-utils seems to have implemented it? Surely there was a reason?
Tom.
Quoted 17 lines · Steve Dickson
=20
=20
=20Quoted 10 lines · Chuck Lever
Hi Steve-
=20Quoted 8 lines · Steve Dickson
=20
=20
=20Quoted 3 lines · Chuck Lever
Heya Steve-
=20Quoted 1 line
On Feb 5, 2018, at 11:36 AM, Steve Dickson <[email protected]> =
Quoted 52 lines · wrote:
Quoted 52 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
=20
Over the weekend I did some experimenting with
the remote call code in rpcbind. The code does=20 functionally work but is very antiquated when
it comes to the latest NFS versions.=20
=20
Since only UDP sockets are used to do remote calls using the documented interfacespmap_rmtcall()andcallrpc()calls to NFS will fail (actual times out) since UDP is no=20 longer supported.=20
=20
The undocumented interfacerpc_call()can be used to=20 call into NFS since the protocol can specified, which=20 also means thePMAPPROC_CALLITprotocol is not used. =20
It turns out privilege port are not needed to make remote calls, at least with my testing.Quoted 8 lines
Quoted 4 lines
=20
It's not quite clear what you are claiming here, but I'm guessing that what you demonstrated is that the CALLIT _listener_ does not have to be privileged?Right...=20
Quoted 2 lines
=20
I claim that is true for all RPC listeners.It could be true..
=20
"privileged port" always means a source port, never a listener. There is no extra privilege given to a listener port that is below 1024.
=20svc_tli_createis simply wrong to use bindresvport. =20
=20Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
I'm thinking=20
the only reason privilege ports were being uses was=20 a side effect ofcreate_rmtcall_fd()calling=20svc_tli_create()with an unbound socket.=20
Privileged listener ports are being created becausesvc_tli_createis using bindresvport when the passed in socket is not already bound.Right... So handing
svc_tli_createa bound socket will cause the bindresvport not to happen.=20
True, and your patch corrects the behavior of rpcbind. =20
But I argue that is a workaround:svc_tli_createis still doing the wrong thing for any other RPC server that does not hand in a pre-bound socket. Fix it there and all RPC servers that use libtirpc are fixed. =20
=20
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
svc_tli_createshould use bind instead, and it needs
to choose a port higher than 49151.Actual it does when at_bind=
structure is passed in.=20
Quoted 29 lines
Quoted 4 lines
Quoted 4 lines
But more to the point, I thought about changing=20
svc_tli_createbut that would effect all the callers of the routine which I didn't think was a good idea=20 for code that is basically not used.Quoted 11 lines
=20
I'm not sure what you mean by "code that is basically not used."
=20svc_tli_createis the bottom of the RPC stack. It is the libtirpc API that is used every time an RPC server starts a listener. mountd and statd callsvc_tli_createdirectly for example, fromsupport/nfs/svc_create.c. =20
Thus this is the right place to fix it for all RPC server applications.Actually I believe those application get their ports from /etc/rpc=20 via the
getrpcbyname()and then handssvc_tli_createa bound socket which the reason bindresvport is not done. =20
Side Note:/etc/rpcwill be staying in glibc since it is "backed by the NSS framework"
=20
=20Quoted 6 lines
=20
=20Quoted 4 lines
Also, now that libtirpc is the only Linux RPC implementation (the RPC code has been removed from glibc) I'm a bit sensitive to changing functionality unless its a=20 clear bug or security issue.=20
Quoted 7 lines
Quoted 2 lines
=20
This is a clear bug.Lets do this... Please open up a upstream bz that justifies why the bindresvport was removed from
svc_tli_create(). =20
If we break some legacy app I would like something to point to explaining why the change was made
I've opened a bug:
https://bugzilla.linux-nfs.org/show_bug.cgi?id=3D320
Quoted 9 lines
Quoted 9 lines
- The library should not be allowed to choose ports that interfere with well-known services.
=20
- The library should choose service ports based on well- established standards, such as the IANA service names to port numbers standard.
=20
=20Quoted 1 line
Quoted 1 line
=
https://www.iana.org/assignments/service-names-port-numbers/service-names-=
port-numbers.xhtml
Quoted 50 lines
Quoted 42 lines
Quoted 23 lines
Hmm... I have been conveniently ignoring Thorsten's blacklist patch. Maybe we should take another look at that.
=20Quoted 9 lines
=20
=20Quoted 7 lines
So the following patch simply binds the socket before calling
svc_tli_create()which means a non-privilege port will be reserved for remote calls.=20
=20
I'm thinking this is the simplest way to
not pollute the privilege port space.=20Quoted 9 lines
=20
This is going in the right direction, but the problem needs to be addressed insvc_tli_create, not in each application that callssvc_tli_create.
=20
This is the same issue that Guillem Jover was trying to address by making bindresvport skip well-known ports. =20
In other words: this code insrc/svc_generic.cis wrong:It could be... but the API allows for the bindresvport (or any bind)=20=
Quoted 7 lines
to not happen... So changing how it is called I think is=20 appropriate... Plus its been working this way for a long to so=20 I'm very resistant to change functionality basically for no reason.=20=
=20
But I do think we should look into bindresvport using a black list since it is already established in SuSE=20
IMO a bindresvport blacklist is absolutely the wrong approach. We have standards organizations that have explained exactly how this needs to work, and we want it to work without installing extra files or giving admins more knobs that they really don't need.
=20
This is exactly the problem with distros applying patches without upstream review. SuSE fixed this and let their fix sit for years without any public bug report or review. IMO SuSE should be prepared to take this hit, it should not constrain upstream to choose a non-optimal long-term solution. I don'tQuoted 8 lines
see any compelling reason in this particular case that we need to be constrained.
=20
Fixingsvc_tli_createto use ports higher than 49151 should be completely compatible with any reasonable blacklist, and it MUST be compatible with/etc/services, which is based on the IANA publication (no well-known fixed ports above 49151). =20
Quoted 5 lines
Let me look into this...=20
=20
steved.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Chuck Lever