Bug 1169 - Enhancement request to support subnet configurations for Host configuration directive
Summary: Enhancement request to support subnet configurations for Host configuration d...
Status: NEW
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 4.2p1
Hardware: Other All
: P2 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
: 2645 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-03-03 15:20 AEDT by senthilkumar
Modified: 2016-12-01 18:36 AEDT (History)
4 users (show)

See Also:


Attachments
ssh config for local subnets (198 bytes, text/plain)
2014-02-20 03:00 AEDT, Marc Zonzon
no flags Details
python script to test local ip (999 bytes, text/plain)
2014-02-20 03:03 AEDT, Marc Zonzon
no flags Details
debug data with the proposed config (482 bytes, text/plain)
2014-02-20 03:07 AEDT, Marc Zonzon
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description senthilkumar 2006-03-03 15:20:52 AEDT
Currently, the Host configuration directive in ssh_config restricts only to hosts following the keyword "HOST". It supports wildcard patterns '*' and '?'. 

This is an enhancement request to make it support for subnets as well.
Comment 1 Damien Miller 2010-04-09 15:02:32 AEST
I'd like to see this but it is tricky.

The problem with allowing IP address matching in ssh_config is that we don't know the address that we will be connecting to when we parse the file unless the user has happened to directly specify an IP address instead of a domain name. We need to pass through the config file prior to address resolution because a Hostname directive may remap the actual target that we are connecting to.

A solution to this is to make a second pass through the config file once we have resolved the address. Unfortunately, this is complex - a hostname might resolve to multiple addresses, each of which might set different, even contradictory, options. Worse, we can't just save and restore client options easily since there is a fair bit of linked state so we would need to solve this first.
Comment 2 Damien Miller 2010-08-27 10:44:47 AEST
This might well turn out to be too confusing to deploy, but I'll try to take a look at it this release.
Comment 3 Damien Miller 2011-09-06 10:34:08 AEST
Retarget unresolved bugs/features to 6.0 release
Comment 4 Damien Miller 2011-09-06 10:36:23 AEST
Retarget unresolved bugs/features to 6.0 release
Comment 5 Damien Miller 2011-09-06 10:38:57 AEST
Retarget unresolved bugs/features to 6.0 release

(try again - bugzilla's "change several" isn't)
Comment 6 Damien Miller 2012-02-24 10:34:16 AEDT
Retarget from 6.0 to 6.1
Comment 7 Damien Miller 2012-02-24 10:37:54 AEDT
Retarget 6.0 => 6.1
Comment 8 Damien Miller 2012-09-07 11:37:38 AEST
Retarget uncompleted bugs from 6.1 => 6.2
Comment 9 Damien Miller 2012-09-07 11:40:04 AEST
Retarget bugs from 6.1 => 6.2
Comment 10 Iain Morgan 2013-02-15 10:30:50 AEDT
Perhaps this could be simplified by adding a new keyword, such as
Address, that would function similarly to the Host keyword, except that
it would match against the IP address of the remote host.

To avoid having to parse the configuration twice, we could stipulate
that the first Address section triggers an address lookup and that
subsequent HostName options would have no effect on the address that ssh
would connect to. We could also recommend that all Host sections occur
before any Address sections. However, there could still be issues if an
Address section appears in the user's configuration file and there is a
relevant Host section in the system-wide file.

This approach has the advantage that existing configurations would be
unaffected; even those that have explicit IP addresses on Host lines.
Comment 11 Damien Miller 2013-03-08 10:23:12 AEDT
retarget to openssh-6.3
Comment 12 Damien Miller 2013-07-25 12:17:12 AEST
Retarget to openssh-6.4
Comment 13 Damien Miller 2013-07-25 12:20:01 AEST
Retarget 6.3 -> 6.4
Comment 14 Damien Miller 2013-09-19 10:55:25 AEST
This won't be in the 6.4 release. I'd like to implement this one day, but it is a lot of very fiddly work to get right.
Comment 15 Marc Zonzon 2014-02-20 03:00:52 AEDT
Created attachment 2409 [details]
ssh config for local subnets
Comment 16 Marc Zonzon 2014-02-20 03:03:17 AEDT
Created attachment 2410 [details]
python script to test local ip
Comment 17 Marc Zonzon 2014-02-20 03:07:12 AEDT
Created attachment 2411 [details]
debug data with the proposed config
Comment 18 Marc Zonzon 2014-02-20 03:11:16 AEDT
To have a subnet matching would be great, but we can from 6.4 use the match directive, look at the attachments for an exemple to change the ciphers for a quicker and less secure cipher when on a local subnet.
Comment 19 Damien Miller 2016-12-01 18:36:02 AEDT
*** Bug 2645 has been marked as a duplicate of this bug. ***