Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 693026 - sys-apps/portage: make emerge --sync rsync DNS lookup compatible with proxychains
Summary: sys-apps/portage: make emerge --sync rsync DNS lookup compatible with proxych...
Status: IN_PROGRESS
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 240187 691278
  Show dependency tree
 
Reported: 2019-08-28 17:36 UTC by Zac Medico
Modified: 2019-08-31 06:24 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zac Medico gentoo-dev 2019-08-28 17:36:30 UTC
For compatibility with proxychains, emerge --sync rsync DNS lookup must occur in the rsync process, since proxychains allocates a process-local surrogate IP. This patch solves the problem:

> diff --git a/lib/portage/sync/modules/rsync/rsync.py b/lib/portage/sync/modules/rsync/rsync.py
> index e6f2688f8..5de2b5369 100644
> --- a/lib/portage/sync/modules/rsync/rsync.py
> +++ b/lib/portage/sync/modules/rsync/rsync.py
> @@ -283,6 +283,12 @@ class RsyncSync(NewBase):
>                                 # With some configurations we need to use the plain hostname
>                                 # rather than try to resolve the ip addresses (bug #340817).
>                                 uris.append(syncuri)
> +                       elif len(uris) == 1:
> +                               # Use the original hostname if it resolves to a single IP,
> +                               # since DNS lookup must occur in the rsync process for
> +                               # compatibility with things like proxychains that allocate
> +                               # a surrogate IP.
> +                               uris = [syncuri]
>  
>                         # reverse, for use with pop()
>                         uris.reverse()
Comment 1 Zac Medico gentoo-dev 2019-08-28 17:41:02 UTC
Example sync failure looks like this, since proxychains allocates a surrogate IP 224.0.0.1 that is valid in the python process and invalid in the child rsync process:

> >>> Syncing repository 'gentoo' into '/var/db/repos/gentoo'...
> >>> Starting rsync with rsync://224.0.0.1/gentoo-portage...
> >>> Checking server timestamp ...
> [proxychains] DLL init: proxychains-ng 4.12
> [proxychains] Strict chain  ...  127.0.0.1:1080  ...  �:873 <--socket error or timeout!
> rsync: failed to connect to 224.0.0.1 (224.0.0.1): Connection refused (111)
> rsync error: error in socket IO (code 10) at clientserver.c(127) [Receiver=3.1.3]
> >>> Retrying...
> !!! Exhausted addresses for rsync.gentoo.org
Comment 3 Larry the Git Cow gentoo-dev 2019-08-30 17:38:19 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=7ea06e6d87cd1394fe06c77ed5abad7f4497158d

commit 7ea06e6d87cd1394fe06c77ed5abad7f4497158d
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2019-08-28 17:42:51 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-08-30 17:07:16 +0000

    rsync: proxychains compatibility (bug 693026)
    
    Use the original hostname if it resolves to a single IP, since DNS
    lookup must occur in the rsync process for compatibility with things
    like proxychains that allocate a surrogate IP which is only valid
    within the current process.
    
    Bug: https://bugs.gentoo.org/693026
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/sync/modules/rsync/rsync.py | 7 +++++++
 1 file changed, 7 insertions(+)
Comment 4 Larry the Git Cow gentoo-dev 2019-08-31 06:21:48 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05d4de36535c74df5e27784886a7de8d0d8afddb

commit 05d4de36535c74df5e27784886a7de8d0d8afddb
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2019-08-31 06:13:47 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-08-31 06:21:36 +0000

    sys-apps/portage: Bump to version 2.3.74
    
     #587930 glsa-check: add exit code for affected GLSAs
     #688902 Add FEATURES=pkgdir-index-trusted
     #690758 Use RTNETLINK to configure the loopback interface
     #692872 glsa-check: forward port --quiet option from gentoolkit
     #693026 rsync: proxychains compatibility
     #693088 glsa-check: forward port remaining changes from gentoolkit
     #693096 emerge: deprecate --changelog option
    
    Bug: https://bugs.gentoo.org/691278
    Bug: https://bugs.gentoo.org/587930
    Bug: https://bugs.gentoo.org/688902
    Bug: https://bugs.gentoo.org/690758
    Bug: https://bugs.gentoo.org/692872
    Bug: https://bugs.gentoo.org/693026
    Bug: https://bugs.gentoo.org/693088
    Bug: https://bugs.gentoo.org/693096
    Package-Manager: Portage-2.3.74, Repoman-2.3.17
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-2.3.74.ebuild | 261 +++++++++++++++++++++++++++++++++
 2 files changed, 262 insertions(+)