common: Use local socket address when checking for localhost
common: Use local socket address when checking for localhost

When we check for a local connection (and don't require TLS
redirection) check that the local socket address is in the
localhost netblock.

Previously we used the remote address, but machines are
technically free to choose a non local address as the
source address.

The local networks (like 127.0.0.0/8) are explicitly
not routable off machine. Therefore this does not present a
security issue.

This manifested itself in a failure of the
/web-server/no-redirect-localhost test.

Closes #2752
Reviewed-by: Marius Vollmer <bb11c6e942c5cc765df5f04da146b3198127a7a3@redhat.com>

larsu/cockpit,vanloswang/cockpit,larskarlitski/cockpit,stefwalter/cockpit,harishanand95/cockpit,haiyangd/cockpit_view,moolitayer/cockpit,cockpituous/cockpit,matobet/cockpit,dperpeet/cockpit,martinpitt/cockpit,jscotka/cockpit,Scribery/cockpit,larskarlitski/cockpit,sgallagher/cockpit,moraleslazaro/cockpit,xhad/cockpit,michalskrivanek/cockpit,jscotka/cockpit,vanloswang/cockpit,haiyangd/cockpit_view,denysvitali/cockpit,SotolitoLabs/cockpit,michalskrivanek/cockpit,petervo/cockpit,dperpeet/cockpit,xhad/cockpit,deryni/cockpit,mvollmer/cockpit,moraleslazaro/cockpit,stefwalter/cockpit,larskarlitski/cockpit,denysvitali/cockpit,FireDrunk/cockpit,michalskrivanek/cockpit,sgallagher/cockpit,moraleslazaro/cockpit,mvollmer/cockpit,FireDrunk/cockpit,moraleslazaro/cockpit,larskarlitski/cockpit,SotolitoLabs/cockpit,martinpitt/cockpit,stefwalter/cockpit,moolitayer/cockpit,larsu/cockpit,denysvitali/cockpit,deryni/cockpit,Scribery/cockpit,vanloswang/cockpit,mareklibra/cockpit,harishanand95/cockpit,Scribery/cockpit,cockpit-project/cockpit,garrett/cockpit,stefwalter/cockpit,SotolitoLabs/cockpit,arilivigni/cockpit,mareklibra/cockpit,larsu/cockpit,denysvitali/cockpit,garrett/cockpit,larskarlitski/cockpit,haiyangd/cockpit_view,xhad/cockpit,SotolitoLabs/cockpit,jscotka/cockpit,petervo/cockpit,sgallagher/cockpit,harishanand95/cockpit,andreasn/cockpit,dperpeet/cockpit,sgallagher/cockpit,deryni/cockpit,matobet/cockpit,sgallagher/cockpit,deryni/cockpit,petervo/cockpit,dperpeet/cockpit,SotolitoLabs/cockpit,xhad/cockpit,harishanand95/cockpit,stefwalter/cockpit,mareklibra/cockpit,harishanand95/cockpit,andreasn/cockpit,haiyangd/cockpit_view,moolitayer/cockpit,garrett/cockpit,zigitax/cockpit,mareklibra/cockpit,deryni/cockpit,xhad/cockpit,larsu/cockpit,arilivigni/cockpit,arilivigni/cockpit,vanloswang/cockpit,martinpitt/cockpit,SotolitoLabs/cockpit,vanloswang/cockpit,cockpituous/cockpit,mareklibra/cockpit,arilivigni/cockpit,sgallagher/cockpit,stefwalter/cockpit,arilivigni/cockpit,larskarlitski/cockpit,arilivigni/cockpit,martinpitt/cockpit,harishanand95/cockpit,mvollmer/cockpit,michalskrivanek/cockpit,matobet/cockpit,zigitax/cockpit,garrett/cockpit,jscotka/cockpit,harishanand95/cockpit,Scribery/cockpit,cockpituous/cockpit,mareklibra/cockpit,dperpeet/cockpit,zigitax/cockpit,cockpit-project/cockpit,petervo/cockpit,cockpituous/cockpit,matobet/cockpit,mareklibra/cockpit,andreasn/cockpit,FireDrunk/cockpit,andreasn/cockpit,arilivigni/cockpit,larskarlitski/cockpit,Scribery/cockpit,cockpituous/cockpit,mvollmer/cockpit,moraleslazaro/cockpit,deryni/cockpit,matobet/cockpit,Scribery/cockpit,denysvitali/cockpit,stefwalter/cockpit,michalskrivanek/cockpit,michalskrivanek/cockpit,jscotka/cockpit,moolitayer/cockpit,petervo/cockpit,martinpitt/cockpit,cockpit-project/cockpit,FireDrunk/cockpit,FireDrunk/cockpit,haiyangd/cockpit_view,matobet/cockpit,zigitax/cockpit,zigitax/cockpit,andreasn/cockpit,andreasn/cockpit,garrett/cockpit,moolitayer/cockpit,petervo/cockpit,dperpeet/cockpit,vanloswang/cockpit,xhad/cockpit,mvollmer/cockpit,cockpit-project/cockpit,petervo/cockpit,sgallagher/cockpit,Scribery/cockpit,cockpit-project/cockpit,xhad/cockpit,dperpeet/cockpit,moraleslazaro/cockpit,larsu/cockpit,moraleslazaro/cockpit,SotolitoLabs/cockpit,jscotka/cockpit,michalskrivanek/cockpit,andreasn/cockpit,larsu/cockpit,cockpituous/cockpit,vanloswang/cockpit,deryni/cockpit