[jira] [Updated] (NET-468) Request for native support for socks proxy routing with Commons net FTP
[ https://issues.apache.org/jira/browse/NET-468?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Matthew McGillis updated NET-468: - Attachment: imapproxy.java > Request for native support for socks proxy routing with Commons net FTP > --- > > Key: NET-468 > URL: https://issues.apache.org/jira/browse/NET-468 > Project: Commons Net > Issue Type: Improvement > Components: FTP >Affects Versions: 1.4, 2.0, 3.0.1, 3.1, 3.4 > Environment: We use commons net in out products for all > communication to an FTP server. OS : All. No other environment specifications. >Reporter: Ramya Rajendiran > Attachments: imapproxy.java, sockclient-proxy3.diff, > sockclient-proxy4.diff, sockclient-proxy5.diff, sockclient-proxy6.diff, > sockclient-proxy7.diff > > > Commons net currently does not natively support connection to an FTP server > via a socks proxy. The only way of achieving this would be to work at the > socket level as observed here > http://wiki.apache.org/commons/Net/FrequentlyAskedQuestions. (by setting JVM > properties socksProxyPort and socksProxyPortHost) > However, a major side effect of this all connections on this JVM will go > through the socks proxy since this setting is at the JVM level. This is > sometimes undesirable as the business requirements are such that only certain > applications on the JVM need to go through the socks proxy. There are no > existing workarounds to conditionally prevent other applications to not be > routed through the socks proxy. This makes our application which consumes the > commons net unusable for such businesses. > Providing native support for socks proxy with commons net for FTP, will go a > long way in supporting such common scenarios and business continuity. > Therefore raising this enhancement request. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NET-468) Request for native support for socks proxy routing with Commons net FTP
[ https://issues.apache.org/jira/browse/NET-468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16321820#comment-16321820 ] Matthew McGillis commented on NET-468: -- This is close but it does not resolve name lookups through the proxy so unless some how your local machine also knows the proper dns information through the proxy it does not work. My testing is with IMAPClient. See the attached imapproxy.java for my test code. If I use it with: {noformat} $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass connect error: java.net.UnknownHostException: imap.server.test.com: unknown error {noformat} If I use it with: {noformat} $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass * OK IMAP4rev1 proxy server ready IMAP: 10.250.3.127 143 LOGIN *** OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN completed AAAB LOGOUT * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection AAAB OK LOGOUT completed {noformat} > Request for native support for socks proxy routing with Commons net FTP > --- > > Key: NET-468 > URL: https://issues.apache.org/jira/browse/NET-468 > Project: Commons Net > Issue Type: Improvement > Components: FTP >Affects Versions: 1.4, 2.0, 3.0.1, 3.1, 3.4 > Environment: We use commons net in out products for all > communication to an FTP server. OS : All. No other environment specifications. >Reporter: Ramya Rajendiran > Attachments: imapproxy.java, sockclient-proxy3.diff, > sockclient-proxy4.diff, sockclient-proxy5.diff, sockclient-proxy6.diff, > sockclient-proxy7.diff > > > Commons net currently does not natively support connection to an FTP server > via a socks proxy. The only way of achieving this would be to work at the > socket level as observed here > http://wiki.apache.org/commons/Net/FrequentlyAskedQuestions. (by setting JVM > properties socksProxyPort and socksProxyPortHost) > However, a major side effect of this all connections on this JVM will go > through the socks proxy since this setting is at the JVM level. This is > sometimes undesirable as the business requirements are such that only certain > applications on the JVM need to go through the socks proxy. There are no > existing workarounds to conditionally prevent other applications to not be > routed through the socks proxy. This makes our application which consumes the > commons net unusable for such businesses. > Providing native support for socks proxy with commons net for FTP, will go a > long way in supporting such common scenarios and business continuity. > Therefore raising this enhancement request. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Created] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
Matthew McGillis created NET-650: Summary: IMAPClient over proxy doesn't properly resolve DNS Key: NET-650 URL: https://issues.apache.org/jira/browse/NET-650 Project: Commons Net Issue Type: Bug Components: IMAP Affects Versions: 3.6 Reporter: Matthew McGillis Attachments: imapproxy.java IMAPClient when configured to use a socks proxy is not able to resolve DNS names through the proxy. See attached sample code, if I use it with: {noformat} $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass connect error: java.net.UnknownHostException: imap.server.test.com: unknown error {noformat} vs if I use it with the appropriate IP: {noformat} $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass * OK IMAP4rev1 proxy server ready IMAP: 10.250.3.127 143 LOGIN *** OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN completed AAAB LOGOUT * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection AAAB OK LOGOUT completed {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16323469#comment-16323469 ] Matthew McGillis commented on NET-650: -- Well this is the details of the exception: {noformat} java.net.UnknownHostException: zimbra07.loadtest.synacor.com at java.net.InetAddress.getAllByName0(InetAddress.java:1280) at java.net.InetAddress.getAllByName(InetAddress.java:1192) at java.net.InetAddress.getAllByName(InetAddress.java:1126) at java.net.InetAddress.getByName(InetAddress.java:1076) at org.apache.commons.net.SocketClient.connect(SocketClient.java:202) at imapproxy.main(imapproxy.java:45) {noformat} So it looks like your connect code calls InetAddress directly to resolve the name which will happen on the server that code is run from. Which is not what we need. I have attached a new program that works at a socket level in both cases: {noformat} $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar socketproxy imap.server.test.com user1 userpass * OK IMAP4rev1 proxy server ready palladium:commons-net-3.6 matthew$ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar socketproxy 10.250.3.127 user1 userpass * OK IMAP4rev1 proxy server ready {noformat} Let me know if that doesn't help I'm not going to have time to work out a patch but hopefully the above should turn into a simple replacement in the appropriate place. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis > Attachments: imapproxy.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Matthew McGillis updated NET-650: - Attachment: socketproxy.java > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis > Attachments: imapproxy.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Comment Edited] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16323469#comment-16323469 ] Matthew McGillis edited comment on NET-650 at 1/12/18 2:53 AM: --- Well this is the details of the exception: {noformat} java.net.UnknownHostException: zimbra07.loadtest.synacor.com at java.net.InetAddress.getAllByName0(InetAddress.java:1280) at java.net.InetAddress.getAllByName(InetAddress.java:1192) at java.net.InetAddress.getAllByName(InetAddress.java:1126) at java.net.InetAddress.getByName(InetAddress.java:1076) at org.apache.commons.net.SocketClient.connect(SocketClient.java:202) at imapproxy.main(imapproxy.java:45) {noformat} So it looks like your connect code calls InetAddress directly to resolve the name which will happen on the server that code is run from. Which is not what we need. I have attached a new program that works at a socket level in both cases: {noformat} $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar socketproxy imap.server.test.com user1 userpass * OK IMAP4rev1 proxy server ready $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar socketproxy 10.250.3.127 user1 userpass * OK IMAP4rev1 proxy server ready {noformat} Let me know if that doesn't help I'm not going to have time to work out a patch but hopefully the above should turn into a simple replacement in the appropriate place. was (Author: msm): Well this is the details of the exception: {noformat} java.net.UnknownHostException: zimbra07.loadtest.synacor.com at java.net.InetAddress.getAllByName0(InetAddress.java:1280) at java.net.InetAddress.getAllByName(InetAddress.java:1192) at java.net.InetAddress.getAllByName(InetAddress.java:1126) at java.net.InetAddress.getByName(InetAddress.java:1076) at org.apache.commons.net.SocketClient.connect(SocketClient.java:202) at imapproxy.main(imapproxy.java:45) {noformat} So it looks like your connect code calls InetAddress directly to resolve the name which will happen on the server that code is run from. Which is not what we need. I have attached a new program that works at a socket level in both cases: {noformat} $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar socketproxy imap.server.test.com user1 userpass * OK IMAP4rev1 proxy server ready palladium:commons-net-3.6 matthew$ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar socketproxy 10.250.3.127 user1 userpass * OK IMAP4rev1 proxy server ready {noformat} Let me know if that doesn't help I'm not going to have time to work out a patch but hopefully the above should turn into a simple replacement in the appropriate place. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis > Attachments: imapproxy.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Comment Edited] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16323469#comment-16323469 ] Matthew McGillis edited comment on NET-650 at 1/12/18 3:08 AM: --- Well this is the details of the exception: {noformat} java.net.UnknownHostException: imap.server.test.com at java.net.InetAddress.getAllByName0(InetAddress.java:1280) at java.net.InetAddress.getAllByName(InetAddress.java:1192) at java.net.InetAddress.getAllByName(InetAddress.java:1126) at java.net.InetAddress.getByName(InetAddress.java:1076) at org.apache.commons.net.SocketClient.connect(SocketClient.java:202) at imapproxy.main(imapproxy.java:45) {noformat} So it looks like your connect code calls InetAddress directly to resolve the name which will happen on the server that code is run from. Which is not what we need. I have attached a new program that works at a socket level in both cases: {noformat} $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar socketproxy imap.server.test.com user1 userpass * OK IMAP4rev1 proxy server ready $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar socketproxy 10.250.3.127 user1 userpass * OK IMAP4rev1 proxy server ready {noformat} Let me know if that doesn't help I'm not going to have time to work out a patch but hopefully the above should turn into a simple replacement in the appropriate place. was (Author: msm): Well this is the details of the exception: {noformat} java.net.UnknownHostException: zimbra07.loadtest.synacor.com at java.net.InetAddress.getAllByName0(InetAddress.java:1280) at java.net.InetAddress.getAllByName(InetAddress.java:1192) at java.net.InetAddress.getAllByName(InetAddress.java:1126) at java.net.InetAddress.getByName(InetAddress.java:1076) at org.apache.commons.net.SocketClient.connect(SocketClient.java:202) at imapproxy.main(imapproxy.java:45) {noformat} So it looks like your connect code calls InetAddress directly to resolve the name which will happen on the server that code is run from. Which is not what we need. I have attached a new program that works at a socket level in both cases: {noformat} $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar socketproxy imap.server.test.com user1 userpass * OK IMAP4rev1 proxy server ready $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar socketproxy 10.250.3.127 user1 userpass * OK IMAP4rev1 proxy server ready {noformat} Let me know if that doesn't help I'm not going to have time to work out a patch but hopefully the above should turn into a simple replacement in the appropriate place. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis > Attachments: imapproxy.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341640#comment-16341640 ] Matthew McGillis commented on NET-650: -- See the API for the socket connect http://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/SocketClient.html#connect it doesn't support what you suggest. {code} $ javac -cp ./commons-net-3.6.jar imapproxy.java imapproxy.java:44: error: no suitable method found for connect(InetSocketAddress) ic.connect(rip); ^ method SocketClient.connect(InetAddress) is not applicable (argument mismatch; InetSocketAddress cannot be converted to InetAddress) method SocketClient.connect(String) is not applicable (argument mismatch; InetSocketAddress cannot be converted to String) Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output {code} Even if it did I would consider that a work around and not a fix for the underlying issue. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341706#comment-16341706 ] Matthew McGillis commented on NET-650: -- This would be an outline of a test case you might want to setup up or figure out how to build in to a regression test: 1. Consider two hosts A and B 2. Setup the host file on A so it only knows host B as say: test.domain.com 3. Setup the host file on B so it only knows it self as say: proxy.domain.com 4. Confirm ping proxy.domain.com from A fails on host lookup 5. From A ssh to B creating a socks proxy {code:java} $ ssh -D localhost:16000 test.domain.com {code} 6. now run the socketproxy.java on A {code:java} $ java -DsocksProxyHost=localhost -DsocksProxyPort=16000 socketproxy proxy.domain.com {code} As socketproxy is currently written you would need something listening on the imap port of host B so it returns something when connected to so you can see that the above works. But you can replace the port number in socketproxy to anything that will respond. In the above since ssh is on B to support the socks proxy you could use the ssh port which when you connect should return something like: $ nc localhost 22 SSH-2.0-OpenSSH_7.6 > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, imapproxy2.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341717#comment-16341717 ] Matthew McGillis commented on NET-650: -- This is what I get when using your imapproxy2 code with a hostname: connect error: java.lang.NullPointerException connect error: java.lang.NullPointerException I also get the same thing when I use an IP address. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, imapproxy2.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341732#comment-16341732 ] Matthew McGillis commented on NET-650: -- InetSocketAddress should work regardless of proxy or not. So you should be able to test that you have found a working InetSocketAddress solution simply by connecting to anything you would normally. {code} $ java -cp .:./commons-net-3.6.jar socketproximap.comcast.net * OK IMAP4 ready {code} Then once you are using InetSocketAddress locally fine it should continue to work for when -DsocksProxyHost and -DsocksProxyPort are specified. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, imapproxy2.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341732#comment-16341732 ] Matthew McGillis edited comment on NET-650 at 1/26/18 10:49 PM: InetSocketAddress should work regardless of proxy or not. So you should be able to test that you have found a working InetSocketAddress solution simply by connecting to anything you would normally. {code} $ java -cp .:./commons-net-3.6.jar socketproxy imap.comcast.net * OK IMAP4 ready {code} Then once you are using InetSocketAddress locally fine it should continue to work for when -DsocksProxyHost and -DsocksProxyPort are specified. was (Author: msm): InetSocketAddress should work regardless of proxy or not. So you should be able to test that you have found a working InetSocketAddress solution simply by connecting to anything you would normally. {code} $ java -cp .:./commons-net-3.6.jar socketproximap.comcast.net * OK IMAP4 ready {code} Then once you are using InetSocketAddress locally fine it should continue to work for when -DsocksProxyHost and -DsocksProxyPort are specified. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, imapproxy2.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341777#comment-16341777 ] Matthew McGillis commented on NET-650: -- > This brings up something else: it's possible that the hostname has different > values on the local and far side of the proxy, so I think any fix would need > to take that into account. Not sure what your thinking but if you have directed something to use a proxy then you want the remote mapping of the name and not the local one. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, imapproxy2.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341784#comment-16341784 ] Matthew McGillis commented on NET-650: -- I get this with those lines: {code} $ javac -cp .:./commons-net-3.6.jar imapproxy2.java imapproxy2.java:17: error: cannot find symbol _socket_.connect(endpoint, connectTimeout); // before this ^ symbol: variable endpoint location: class MyClient 1 error {code} > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, imapproxy2.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341803#comment-16341803 ] Matthew McGillis commented on NET-650: -- Your latest changes work as expected for both host name and IP of proxy. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, imapproxy2.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341812#comment-16341812 ] Matthew McGillis commented on NET-650: -- > There may be no remote mapping, so you might want to add your own local > definition. I would want to know that the remote does not know haw to resolve the name. > Also the code may not know that a proxy is being used. But I do and because I told it I wanted it to use the proxy. If I don't want to use the proxy I won't specify it. > As it stands, the constructor new InetSocketAddress(host, port) will use the > local definition if there is one. To force the use of the remote mapping, one would need to use InetSocketAddress. InetSocketAddress(host,port) Not following the above you sure you wrote it correctly. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, imapproxy2.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341812#comment-16341812 ] Matthew McGillis edited comment on NET-650 at 1/26/18 11:55 PM: > There may be no remote mapping, so you might want to add your own local > definition. I would want to know that the remote does not know how to resolve the name. > Also the code may not know that a proxy is being used. But I do and because I told it I wanted it to use the proxy. If I don't want to use the proxy I won't specify it. > As it stands, the constructor new InetSocketAddress(host, port) will use the > local definition if there is one. To force the use of the remote mapping, one would need to use InetSocketAddress. InetSocketAddress(host,port) Not following the above you sure you wrote it correctly. was (Author: msm): > There may be no remote mapping, so you might want to add your own local > definition. I would want to know that the remote does not know haw to resolve the name. > Also the code may not know that a proxy is being used. But I do and because I told it I wanted it to use the proxy. If I don't want to use the proxy I won't specify it. > As it stands, the constructor new InetSocketAddress(host, port) will use the > local definition if there is one. To force the use of the remote mapping, one would need to use InetSocketAddress. InetSocketAddress(host,port) Not following the above you sure you wrote it correctly. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, imapproxy2.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341812#comment-16341812 ] Matthew McGillis edited comment on NET-650 at 1/26/18 11:56 PM: > There may be no remote mapping, so you might want to add your own local > definition. I would want to know that the remote does not know how to resolve the name. > Also the code may not know that a proxy is being used. But I do because I told it I wanted it to use the proxy. If I don't want to use the proxy I won't specify it. > As it stands, the constructor new InetSocketAddress(host, port) will use the > local definition if there is one. To force the use of the remote mapping, one would need to use InetSocketAddress. InetSocketAddress(host,port) Not following the above you sure you wrote it correctly. was (Author: msm): > There may be no remote mapping, so you might want to add your own local > definition. I would want to know that the remote does not know how to resolve the name. > Also the code may not know that a proxy is being used. But I do and because I told it I wanted it to use the proxy. If I don't want to use the proxy I won't specify it. > As it stands, the constructor new InetSocketAddress(host, port) will use the > local definition if there is one. To force the use of the remote mapping, one would need to use InetSocketAddress. InetSocketAddress(host,port) Not following the above you sure you wrote it correctly. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, imapproxy2.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341839#comment-16341839 ] Matthew McGillis commented on NET-650: -- > If the remote does not have a mapping, you have to use/remember the IP > address. It would be nice to be able to define the IP as a local mapping. I'm not sure that gets very confusing in a number of contexts. I might like it in some cases but not sure I would want it on default. Have you actually tested that a name existing in both places but different ends up always using the local one? To my thinking I want the remote name mapping first. Maybe if it doesn't exist remotely then look locally. I haven't looked at the actual InetSocketAddress code but some code does now about the proxy and InetSocketAddress may also know this or it may not if you have looked at the code and nothing about the proxy is in it OK but the proxy as I have outlined it is easly knowable simply by checking the property setting. Also keep in mind where this ticket came from which was adding support for something in common-net to know about a proxy so you could specifically configure it in the code. I'm sort of wondering if that has been done consistently with property settings what happens if they overlap. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, imapproxy2.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341858#comment-16341858 ] Matthew McGillis commented on NET-650: -- > Yes, of course, but AFAICT that is buried deep (in the native code ?) All that happens on the command line is system properties are set. Any code can get a system property value. Agree this needs more work. I think if you substitute InetSocketAddress in the correct place all your existing regression tests will still pass. Plus it will now support the command line. How things behave in edge cases is worth testing but my guess is that InetSocketAddress probably does what I have suggested. Which is to use the remote name mapping. I think it would be a fairly unusual situation that a local DNS infrastructure knows about a proxy remote infrastructure. But I could see that as a nice configurable feature. This also leaves investigation/testing in how the previous ticket implementation of proxy support interacts with all of this. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, imapproxy2.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341887#comment-16341887 ] Matthew McGillis commented on NET-650: -- If InetSocketAddress acts as I have indicated then if someone wants to add the feature of using a local mapping over a remote mapping they can easily add it simply by passing the connect the locally mapped name. InetSocketAddress simply passes IP's through as does the proxy so its easy to do on top of a InetSocketAddress base. However without InetSocketAddress we have no way to get a remote name properly resolved. So I think this could be very close it would be interesting to see if just making this InetSocketAddress change in the Common-Net socket code passes all existing tests. If it does then it fixes this bug at no cost to any existing functionality. > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, imapproxy2.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NET-650) IMAPClient over proxy doesn't properly resolve DNS
[ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16343921#comment-16343921 ] Matthew McGillis commented on NET-650: -- The question I had is can we add something without impacting current behavior. Focus on the no proxy case, hostname defined or undefined locally. If we replace existing implementation and use ISA constructor. This is what the source code is for it. (It has other constructors but lets assume this common case only) {code} public More ...InetSocketAddress(String hostname, int port) { if (port < 0 || port > 0x) { throw new IllegalArgumentException("port out of range:" + port); } if (hostname == null) { throw new IllegalArgumentException("hostname can't be null"); } try { addr = InetAddress.getByName(hostname); } catch(UnknownHostException e) { this.hostname = hostname; addr = null; } this.port = port; } {code} Does all existing behavior work. My guess is yes. If you have the hostname you get the local IP and we have no proxy so the local IP works and gets you to desired destination. If you have no hostname then you get the expected and desired response of UnknownHostException this is not a problem in this case it is a informative response. If all other existing regression tests pass then the above is a simple fix that keeps all current functionality. However the above allows the proxy to now also work in this fashion 1. the host does not exist locally but does remotely (most common case I think) 2. the host does exist locally and works remotely (sort of unusual case I think) 3. the host does not exist locally or remotely (this you get an odd error for but an error is appropriate just might be nice to provide a better one) 4. the host does exist locally but does not work remotely (sort of unusual case I think expect you would get some sort of error that may or may not be obvious but an error is appropriate) 5. the host exists in both places but the local ip does not work on remote only the remote ip does (this case is broken in this initial implementation you think the remote name and ip are getting used but instead you are using a local ip remotely for the name you think would work) > IMAPClient over proxy doesn't properly resolve DNS > -- > > Key: NET-650 > URL: https://issues.apache.org/jira/browse/NET-650 > Project: Commons Net > Issue Type: Bug > Components: IMAP >Affects Versions: 3.6 >Reporter: Matthew McGillis >Priority: Major > Attachments: imapproxy.java, imapproxy2.java, socketproxy.java > > > IMAPClient when configured to use a socks proxy is not able to resolve DNS > names through the proxy. > See attached sample code, if I use it with: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass > connect error: java.net.UnknownHostException: imap.server.test.com: unknown > error > {noformat} > vs if I use it with the appropriate IP: > {noformat} > $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp > .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass > * OK IMAP4rev1 proxy server ready > IMAP: 10.250.3.127 143 > LOGIN *** > OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE > ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ > LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR > SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN > completed > AAAB LOGOUT > * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection > AAAB OK LOGOUT completed > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)