Centos 7 - Proxy authentication without saving password

Asked

Viewed 254 times

0

Is there any way to configure the proxy in the "/etc/yum.conf" file without leaving the password saved in this file? Something like, pass the password by parameter?

Today the password is written in the file as follows:

# HABILITAR PROXY CENTOS 7:
# The proxy server - proxy server:port number
proxy=http://10.10.10.10:3128
# The account details for yum connections
proxy_username=dominio\usuario
proxy_password=123456

The idea is that the password is not saved, thus avoiding a possible security breach in case of use.

Thank you.

  • How do you run this proxy? via terminal?

  • So, to use the machine in the network I save this information in the file "/etc/yum.conf"...

  • But who pays this info?

1 answer

1

Consider simply setting permissions for yum.conf as 0600 and always execute the yum as root. So only those who know the root password can read the proxy password in the configuration.

That being said, in shell script you can ask the password for the user and run the yum in a context that contains that environment variable. Thus, confidential information remains in memory only during the execution of the process:

#!/bin/bash
# yum.pedesenha.sh
read -sp 'Informe o endereço do proxy: ' endereco;
read -sp 'Informe o usuário do proxy: ' usuario;
read -sp 'Informe a senha do proxy: ' senha;
proxy=$endereco proxy_username=$usuario proxy_password=$senha yum "$@";

Run passing parameters as a yum common:

$ ./yum.pedesenha.sh check-update

Of course, maybe you just don’t like the idea of leaving the password in the configuration file, but leaving address and user is easy for you. Simply remove the lines from read and assignments for the environment variables in the last row for the parameters that continue to be defined in yum.conf.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.