Using the pkg set-publisher Command to Set a Proxy

The --proxy option of the pkg set-publisher command sets a persistent proxy URI for the specified publisher origin and mirror URIs. The proxy value is stored as part of the publisher configuration. Storing the proxy value as part of the publisher configuration automatically updates the system repository that is used by child images. Storing the proxy value as part of the publisher configuration also means you could use different proxies for different publishers.

In the following example, the value of proxyURI is the following, where protocol is http or https and :port is optional:

protocol://host-name[:port]

The --proxy option cannot be used to set an authenticated proxy. The following form for the value of proxyURI is not supported:

protocol://user:password@host
$ pkg publisher
PUBLISHER                   TYPE     STATUS P LOCATION
solaris                     origin   online F file:///var/share/pkgrepos/solaris/
$ pkg publisher -F tsv
PUBLISHER STICKY SYSPUB ENABLED TYPE   STATUS URI                                 PROXY
solaris   true   false  true    origin online file:///var/share/pkgrepos/solaris/ -
$ pkg set-publisher -g http://pkg.oracle.com/solaris/release/ --proxy proxyURI solaris
$ pkg publisher solaris
      Publisher: solaris
          Alias:
     Origin URI: file:///var/share/pkgrepos/solaris/
        SSL Key: None
       SSL Cert: None
     Origin URI: http://pkg.oracle.com/solaris/release/
          Proxy: proxyURI
        SSL Key: None
       SSL Cert: None
    Client UUID: e15e3228-eada-11df-80ab-8023183d954b
Catalog Updated: July 11, 2013 11:32:46 PM
        Enabled: Yes
     Properties:
                 proxied-urls = []
$ pkg publisher
PUBLISHER                   TYPE    STATUS P LOCATION
solaris                     origin  online F file:///var/share/pkgrepos/solaris/
solaris                     origin  online T http://pkg.oracle.com/solaris/release/
$ pkg publisher -F tsv
PUBLISHER STICKY SYSPUB ENABLED TYPE   STATUS URI                                 PROXY
solaris   true   false  true    origin online file:///var/share/pkgrepos/solaris/ -
solaris   true   false  true    origin online http://pkg.oracle.com/solaris/release/ proxyURI

If this image has non-global zones, the system repository is automatically updated with this proxy information; you do not need to set properties in the system-repository service. If you examine the publisher proxy in the non-global zone, you do not see the same proxy URI that you see in the global zone. In the global zone, the system repository uses the proxy URI. In the non-global zone, the system repository acts as a proxy itself, enabling the non-global zone to communicate with the system repository in the global zone. Relationship Between Global and Non-Global Zones shows an example of what the system repository publisher looks like in the non-global zone.