Files
2024-11-04 18:48:51 +00:00

270 lines
14 KiB
HTML

<!DOCTYPE html>
<html lang="en" data-content_root="../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Autoproxy &#8212; Documentation for Clear Linux* project</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../_static/bizstyle.css?v=5283bb3d" />
<link rel="stylesheet" type="text/css" href="../../_static/copybutton.css?v=76b2166b" />
<script src="../../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../../_static/doctools.js?v=9bcbadda"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../../_static/copybutton.js?v=a56c686a"></script>
<script src="../../_static/bizstyle.js"></script>
<link rel="canonical" href="https://clearlinux.github.io/clear-linux-documentation/guides/clear/autoproxy.html" />
<link rel="icon" href="../../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../../about.html" />
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="autospec" href="autospec.html" />
<link rel="prev" title="Guides" href="../index.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<!--[if lt IE 9]>
<script src="_static/css3-mediaqueries.js"></script>
<![endif]-->
</head><body>
<div class="related" role="navigation" aria-label="Related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="autospec.html" title="autospec"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="../index.html" title="Guides"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../../index.html">Documentation for Clear Linux* project</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../index.html" accesskey="U">Guides</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Autoproxy</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="autoproxy">
<span id="id1"></span><h1>Autoproxy<a class="headerlink" href="#autoproxy" title="Link to this heading"></a></h1>
<p>Autoproxy is provided to enable Clear Linux* OS to work smoothly behind a
corporate proxy.</p>
<nav class="contents local" id="contents">
<ul class="simple">
<li><p><a class="reference internal" href="#description" id="id3">Description</a></p></li>
<li><p><a class="reference internal" href="#how-it-works" id="id4">How it works</a></p></li>
<li><p><a class="reference internal" href="#troubleshooting" id="id5">Troubleshooting</a></p></li>
</ul>
</nav>
<section id="description">
<h2><a class="toc-backref" href="#id3" role="doc-backlink">Description</a><a class="headerlink" href="#description" title="Link to this heading"></a></h2>
<p>Autoproxy tries to detect a Proxy Auto-Config (PAC) script and use it to
automatically resolve the proxy needed for a given connection. With
Autoproxy, you can use Clear Linux OS inside any proxy environment without having to
manually configure the proxies.</p>
<p>Corporate and private networks can be very complex, needing to restrict and
control network connections for security reasons. The typical side effects
are limited or blocked connectivity, and require manual configuration of
proxies to perform the most mundane tasks, such as cloning a repo or checking
for updates. With Clear Linux OS, all of the work is done behind the scenes to
effortlessly use your network and have connections “just work”.</p>
<p>This feature removes severe complications with network connectivity due to
proxy issues. You can automate tasks, such as unit testing, without worrying
about the proxy not being set, and you can remove unset proxies from the
equation when dealing with network unavailability across systems.</p>
</section>
<section id="how-it-works">
<h2><a class="toc-backref" href="#id4" role="doc-backlink">How it works</a><a class="headerlink" href="#how-it-works" title="Link to this heading"></a></h2>
<p>We designed Autoproxy around tools provided by most Linux*
distributions with a few minor additions and modifications. We leveraged the
DHCP and network information obtained from systemd and created a
PAC-discovery daemon. The daemon uses the information to resolve a URL for a
PAC file. The daemon then passes the URL into PACrunner*. PACrunner
downloads the PAC file and uses the newly implemented Duktape* engine to
parse it.</p>
<figure class="align-default" id="id2">
<a class="reference internal image-reference" href="../../_images/autoproxy_0.png"><img alt="../../_images/autoproxy_0.png" src="../../_images/autoproxy_0.png" style="width: 400px;" />
</a>
<figcaption>
<p><span class="caption-text">Figure 1: Autoproxy Flow</span><a class="headerlink" href="#id2" title="Link to this image"></a></p>
</figcaption>
</figure>
<p>From that point on, any cURL* or network requests query PACrunner for the
correct proxy to use. We modified the cURL library to communicate with
PACrunner over DBus. However, cURL will ignore PACrunner and run normally if
no PAC file is loaded or if you manually set any proxies. Thus, your
environment settings are respected and no time is wasted trying to resolve a
proxy. All these steps happen in the background with no user interaction.</p>
</section>
<section id="troubleshooting">
<h2><a class="toc-backref" href="#id5" role="doc-backlink">Troubleshooting</a><a class="headerlink" href="#troubleshooting" title="Link to this heading"></a></h2>
<p>Autoproxy allows Clear Linux OS to operate seamlessly behind a proxy
because <a class="reference internal" href="swupd.html#swupd-guide"><span class="std std-ref">swupd</span></a> and other Clear Linux OS tools are implemented on
top of libcurl. Tools that do not use libcurl, like git, must
be configured independently.</p>
<p>If you are familiar with PAC files and WPAD, you can use
<strong class="command">pacdiscovery</strong> and <strong class="command">FindProxyForURL</strong> to
troubleshoot problems with autoproxy.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Learn more about WPAD, PAC files, and PAC functions at <a class="reference external" href="http://findproxyforurl.com/">findproxyforurl</a>.</p>
</div>
<p>Run <strong class="command">pacdiscovery</strong> with no arguments to indicate <br><br></p>
<ol class="arabic">
<li><p>if there is a problem resolving the <strong class="command">WPAD</strong> host name resolution:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>pacdiscovery
</pre></div>
</div>
<p>Sample output:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">failed getaddrinfo: No address associated with hostname</span>
<span class="go">Unable to find wpad host</span>
</pre></div>
</div>
</li>
<li><p>or if the <strong class="command">pacrunner</strong> service is disabled (masked).</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>pacdiscovery
</pre></div>
</div>
<p>Sample output:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">PAC url: http://autoproxy.your.domain.com/wpad.dat</span>
<span class="go">Failed to create proxy config: Unit pacrunner.service is masked.</span>
</pre></div>
</div>
</li>
</ol>
<p>Unmask the <strong class="command">pacrunner</strong> service by running:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>systemctl<span class="w"> </span>unmask<span class="w"> </span>pacrunner.service
</pre></div>
</div>
<p>Use <strong class="command">FindProxyForURL</strong> with <strong class="command">busctl</strong> to indicate <br><br></p>
<ol class="arabic">
<li><p>the URL and port of the proxy server when an external URL and host are
provided as arguments:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>busctl<span class="w"> </span>call<span class="w"> </span>org.pacrunner<span class="w"> </span>/org/pacrunner/client<span class="w"> </span>org.pacrunner.Client<span class="w"> </span>FindProxyForURL<span class="w"> </span>ss<span class="w"> </span><span class="s2">&quot;http://www.google.com&quot;</span><span class="w"> </span><span class="s2">&quot;google.com&quot;</span>
</pre></div>
</div>
<p>Sample output showing proxy was found:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">s &quot;PROXY proxy.your.domain.com:&lt;port&gt;&quot;</span>
</pre></div>
</div>
</li>
<li><p>if the <strong class="command">pacrunner.service</strong> is masked:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>busctl<span class="w"> </span>call<span class="w"> </span>org.pacrunner<span class="w"> </span>/org/pacrunner/client<span class="w"> </span>org.pacrunner.Client<span class="w"> </span>FindProxyForURL<span class="w"> </span>ss<span class="w"> </span><span class="s2">&quot;http://www.google.com&quot;</span><span class="w"> </span><span class="s2">&quot;google.com&quot;</span>
</pre></div>
</div>
<p>Sample output:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">Unit pacrunner.service is masked.</span>
<span class="go">dig wpad, dig wpad.&lt;domain&gt;</span>
</pre></div>
</div>
</li>
<li><p>if a proxy server is not available, or if <strong class="command">pacrunner</strong> is running
without a PAC file:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>busctl<span class="w"> </span>call<span class="w"> </span>org.pacrunner<span class="w"> </span>/org/pacrunner/client<span class="w"> </span>org.pacrunner.Client<span class="w"> </span>FindProxyForURL<span class="w"> </span>ss<span class="w"> </span><span class="s2">&quot;http://www.google.com&quot;</span><span class="w"> </span><span class="s2">&quot;google.com&quot;</span>
</pre></div>
</div>
<p>Sample output, indicating connection made directly, without proxy:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">s &quot;DIRECT&quot;</span>
</pre></div>
</div>
</li>
</ol>
<p>Once <strong class="command">pacdiscovery</strong> is able to look up <strong class="command">WPAD</strong>, restart the
<strong class="command">pacrunner</strong> service:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>systemctl<span class="w"> </span>stop<span class="w"> </span>pacrunner
sudo<span class="w"> </span>systemctl<span class="w"> </span>restart<span class="w"> </span>pacdiscovery
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>A “domain” or “search” entry in <code class="file docutils literal notranslate"><span class="pre">/etc/resolv.conf</span></code> is required
for short name lookups to resolve. The <code class="file docutils literal notranslate"><span class="pre">resolv.conf</span></code> man page has
additional details.</p>
</div>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/clearlinux.png" alt="Logo of Clear Linux* Project Docs"/>
</a></p>
<div>
<h3><a href="../../index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Autoproxy</a><ul>
<li><a class="reference internal" href="#description">Description</a></li>
<li><a class="reference internal" href="#how-it-works">How it works</a></li>
<li><a class="reference internal" href="#troubleshooting">Troubleshooting</a></li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="../index.html"
title="previous chapter">Guides</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="autospec.html"
title="next chapter">autospec</a></p>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../_sources/guides/clear/autoproxy.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="Related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="autospec.html" title="autospec"
>next</a> |</li>
<li class="right" >
<a href="../index.html" title="Guides"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../../index.html">Documentation for Clear Linux* project</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../index.html" >Guides</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Autoproxy</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2022 Intel Corporation. All Rights Reserved..
Last updated on Nov 04, 2024.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.1.3.
</div>
</body>
</html>