Este conteúdo não está disponível no idioma selecionado.
Chapter 13. Changing proxy settings
RHUI can use a proxy server to sync Red Hat content through. If no proxy server is specified while installing RHUI, none is used. Otherwise, this proxy server is used with all RHUI repositories that you add. This chapter describes how the proxy server configuration can be changed.
13.1. Configuring a new proxy server or unconfiguring an existing proxy server Copiar o linkLink copiado para a área de transferência!
Follow these steps if you wish to:
- start using a proxy server in a RHUI environment that was installed with no proxy server configuration
- edit the current proxy server configuration, for example, if the server hostname has changed
- stop using the proxy server that a RHUI environment was installed with
Procedure
There are two ways to configure (or unconfigure) proxy server settings.
First option: Rerun the installer to update the global RHUI tools configuration and answers file:
rhui-installer --rerun --proxy-protocol <PROTOCOL> \ --proxy-hostname <HOSTNAME> \ --proxy-port <PORT> \ --proxy-username <USERNAME> \ --proxy-password <PASSWORD>rhui-installer --rerun --proxy-protocol <PROTOCOL> \ --proxy-hostname <HOSTNAME> \ --proxy-port <PORT> \ --proxy-username <USERNAME> \ --proxy-password <PASSWORD>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Second option: Create (or edit) the local overrides file,
/root/.rhui/rhui-tools-custom.conf, so that it contains:Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThis option was introduced in RHUI 4.11.
In either case, the parameters are as follows:
PROTOCOLis eitherhttporhttpsif configuring the proxy server; if unconfiguring it:-
if rerunning the installer, do not use the
--proxy-protocolargument - if using the local file, leave the value empty
-
if rerunning the installer, do not use the
HOSTNAMEis the new proxy server hostname; if clearing the configuration:-
if rerunning the installer, use an empty string in double quotes (
"") - if using the local file, leave the value empty
-
if rerunning the installer, use an empty string in double quotes (
PORTis the TCP port where the proxy server is listening, typically3128; if clearing the configuration:-
if rerunning the installer, do not use the
--proxy-portargument - if using the local file, leave the value empty
-
if rerunning the installer, do not use the
USERNAMEis an optional parameter. Only use it if the proxy server requires credentials. If it does not or you are clearing the configuration:-
if rerunning the installer, use
"" -
if using the local file, leave the value empty or do not use the
proxy_user:option at all
-
if rerunning the installer, use
PASSWORDditto.Examples:
Start using a proxy server, and this server requires no credentials.
With the installer:
rhui-installer --rerun --proxy-protocol http --proxy-hostname squid.example.com --proxy-port 3128
rhui-installer --rerun --proxy-protocol http --proxy-hostname squid.example.com --proxy-port 3128Copy to Clipboard Copied! Toggle word wrap Toggle overflow With the local file:
[proxy] proxy_host: squid.example.com proxy_protocol: http proxy_port: 3128
[proxy] proxy_host: squid.example.com proxy_protocol: http proxy_port: 3128Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Change the proxy server hostname, everything else remains the same.
With the installer:
rhui-installer --rerun --proxy-hostname newsquid.example.com
rhui-installer --rerun --proxy-hostname newsquid.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow With the local file:
[proxy] proxy_host: newsquid.example.com
[proxy] proxy_host: newsquid.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Stop using the proxy server.
With the installer:
rhui-installer --rerun --proxy-hostname ""
rhui-installer --rerun --proxy-hostname ""Copy to Clipboard Copied! Toggle word wrap Toggle overflow With the local file:
[proxy] proxy_protocol: proxy_host: proxy_port:
[proxy] proxy_protocol: proxy_host: proxy_port:Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantThis new configuration will only affect Red Hat repositories added after the configuration is updated. To apply this new configuration to existing repositories, it is necessary to remove, add, and re-synchronize the repositories.
This will cause an outage that will last from the moment you remove them until you re-sync them. However, already synchronized packages will not have to be re-downloaded from the Red Hat CDN. RHUI will mainly have to parse all the repodata files and determine which package belongs where. This can take up to several hours.
Although there are technical means outside of
rhui-managerwhereby the proxy fields can be modified for the existing repositories—or rather, for the so-called remotes—using such means is unsupported.
Make sure you have a list (or lists) of your repositories so that you can add them again. If you do not have such a list, you can use
rhui-managerto generate a file with all your currently added Red Hat repositories.To generate a list of Red Hat repositories, first create a raw list with one ID per line:
rhui-manager --noninteractive repo list --redhat_only --ids_only > /root/rawlist
rhui-manager --noninteractive repo list --redhat_only --ids_only > /root/rawlistCopy to Clipboard Copied! Toggle word wrap Toggle overflow Then create a YAML file with repositories. Start by creating a stub:
echo -e "name: all Red Hat repositories\nrepo_ids:" > /root/repo_list.yml
echo -e "name: all Red Hat repositories\nrepo_ids:" > /root/repo_list.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Next, append the repositories from the raw list as YAML list items:
sed "s/^/ - /" /root/rawlist >> /root/repo_list.yml
sed "s/^/ - /" /root/rawlist >> /root/repo_list.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Delete all Red Hat repositories from your RHUI:
Use the text user interface, or delete them one by one on the command line. For the latter, you can use the raw list created earlier:
while read repo; do rhui-manager --noninteractive repo delete --repo_id $repo; done < /root/rawlist
while read repo; do rhui-manager --noninteractive repo delete --repo_id $repo; done < /root/rawlistCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteRepositories are deleted in asynchronous background tasks: queued and executed by available Pulp workers. It may take tens of minutes, or hours, to actually delete all the repositories. Be patient.
When the repositories have been deleted, re-add them. They will be added with the new proxy settings (or with no proxy URL) this time. It is also necessary to re-synchronize the repositories. You can add and re-synchronize them in one step on the command line:
rhui-manager --noninteractive repo add_by_file --file /root/repo_list.yml --sync_now
rhui-manager --noninteractive repo add_by_file --file /root/repo_list.yml --sync_nowCopy to Clipboard Copied! Toggle word wrap Toggle overflow Alternatively, use your own methods to synchronize the repositories, for example, in a specific order. Lastly, you can also simply wait for the synchronization to start automatically: in six hours, or in any other time defined as
repo_sync_frequencyin/etc/rhui/rhui-tools.conf.ImportantIn any case, the repositories will not be available in the meantime.
Verification
The rhui-manager tool does not display information about the proxy server that is used with a repository. However, you can use the pulpcore-manager tool as outlined below:
env PULP_SETTINGS=/etc/pulp/settings.py /usr/bin/pulpcore-manager shell << EOM from pulpcore.app.models import Remote rem = Remote.objects.get(name="rhel-8-for-x86_64-baseos-rhui-rpms-8") print(rem.proxy_url) EOM
env PULP_SETTINGS=/etc/pulp/settings.py /usr/bin/pulpcore-manager shell << EOM
from pulpcore.app.models import Remote
rem = Remote.objects.get(name="rhel-8-for-x86_64-baseos-rhui-rpms-8")
print(rem.proxy_url)
EOM
The output should look like this for a configured proxy server:
http://squid.example.com:3128
http://squid.example.com:3128
or None if no proxy server is configured with the specified repository.