Landscape 16.06 security_update_db.sh Erro

1

Eu sei que as tarefas cron não funcionam por meio do proxy, mas quando tento executar manualmente o security_update_db.sh por meio do comando descrito aqui link

sudo -u landscape bash -x /opt/canonical/landscape/scripts/update_security_db.sh

O arquivo é baixado, mas eu recebo um erro quando o script move a parte de download.

+ output='  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
100 11.1M  100 11.1M    0     0   355k      0  0:00:32  0:00:32 --:--:--  315k'
+ '[' 0 -ne 0 ']'
+ mv -f /var/lib/landscape/usndb.pickle.bz2-new /var/lib/landscape/usndb.pickle.bz2
+ cd /opt/canonical/landscape
+ set -o pipefail
+ bzcat /var/lib/landscape/usndb.pickle.bz2
+ ./process-usns /dev/stdin
+ pipe_to_syslog update-security-db
+ tag=update-security-db
++ get_logger_arguments
++ echo /dev/log
++ grep -q :
++ '[' -n /dev/log ']'
++ '[' /dev/log '!=' /dev/log ']'
++ echo ''
+ args=
+ logger -s -p user.error -t update-security-db
<11>Feb  3 22:11:31 update-security-db: Traceback (most recent call last):
<11>Feb  3 22:11:31 update-security-db:   File "./process-usns", line 7, in <module>
<11>Feb  3 22:11:31 update-security-db:     canonical.landscape.scripts.usn.run()
<11>Feb  3 22:11:31 update-security-db:   File "/opt/canonical/landscape/canonical/landscape/scripts/batch.py", line 66, in __call__
<11>Feb  3 22:11:31 update-security-db:     code = self.run()
<11>Feb  3 22:11:31 update-security-db:   File "/opt/canonical/landscape/canonical/landscape/scripts/usn.py", line 40, in run
<11>Feb  3 22:11:31 update-security-db:     changeset = update_from_usn_tool_db(db)
<11>Feb  3 22:11:31 update-security-db:   File "/opt/canonical/landscape/canonical/landscape/model/package/usn.py", line 195, in update_from_usn_tool_db
<11>Feb  3 22:11:31 update-security-db:     added=added_package_usns_map, removed=removed_package_usns_map)
<11>Feb  3 22:11:31 update-security-db:   File "/opt/canonical/landscape/canonical/landscape/model/package/client.py", line 38, in query
<11>Feb  3 22:11:31 update-security-db:     return self._query(method, params)
<11>Feb  3 22:11:31 update-security-db:   File "/opt/canonical/landscape/canonical/landscape/model/package/client.py", line 60, in _query
<11>Feb  3 22:11:31 update-security-db:     raise PackageSearchRequestError(loads(error.body)["Error"])
<11>Feb  3 22:11:31 update-security-db:   File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
<11>Feb  3 22:11:31 update-security-db:     return _default_decoder.decode(s)
<11>Feb  3 22:11:31 update-security-db:   File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
<11>Feb  3 22:11:31 update-security-db:     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
<11>Feb  3 22:11:31 update-security-db:   File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
<11>Feb  3 22:11:31 update-security-db:     raise ValueError("No JSON object could be decoded")
<11>Feb  3 22:11:31 update-security-db: ValueError: No JSON object could be decoded
+ '[' 1 -ne 0 ']'
+ alert_admin update_security_db.sh
+ echo 'Error running /opt/canonical/landscape/scripts/update_security_db.sh: 0'
Error running /opt/canonical/landscape/scripts/update_security_db.sh: 0
+ echo 'Check out the syslog output for script update_security_db.sh.'
Check out the syslog output for script update_security_db.sh.
+ exit 1
+ release_lock update_security_db.sh
+ get_distributed_lock update_security_db.sh --release
+ local command=/opt/canonical/landscape/get-distributed-lock
+ /opt/canonical/landscape/get-distributed-lock update_security_db.sh --release
+ rm -f /var/lock/update_security.lock

A saída de /var/log/landscape-server/security_update_db.log apenas repete isso várias vezes:

Feb  3 16:11:38 update-security-db ERR  Traceback (most recent call last):
Feb  3 16:11:38 update-security-db ERR    File "./process-usns", line 7, in <module>
Feb  3 16:11:38 update-security-db ERR      canonical.landscape.scripts.usn.run()
Feb  3 16:11:38 update-security-db ERR    File "/opt/canonical/landscape/canonical/landscape/scripts/batch.py", line 66, in __call__
Feb  3 16:11:38 update-security-db ERR      code = self.run()
Feb  3 16:11:38 update-security-db ERR    File "/opt/canonical/landscape/canonical/landscape/scripts/usn.py", line 40, in run
Feb  3 16:11:38 update-security-db ERR      changeset = update_from_usn_tool_db(db)
Feb  3 16:11:38 update-security-db ERR    File "/opt/canonical/landscape/canonical/landscape/model/package/usn.py", line 195, in update_from_usn_tool_db
Feb  3 16:11:38 update-security-db ERR      added=added_package_usns_map, removed=removed_package_usns_map)
Feb  3 16:11:38 update-security-db ERR    File "/opt/canonical/landscape/canonical/landscape/model/package/client.py", line 38, in query
Feb  3 16:11:38 update-security-db ERR      return self._query(method, params)
Feb  3 16:11:38 update-security-db ERR    File "/opt/canonical/landscape/canonical/landscape/model/package/client.py", line 60, in _query
Feb  3 16:11:38 update-security-db ERR      raise PackageSearchRequestError(loads(error.body)["Error"])
Feb  3 16:11:38 update-security-db ERR    File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
Feb  3 16:11:38 update-security-db ERR      return _default_decoder.decode(s)
Feb  3 16:11:38 update-security-db ERR    File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
Feb  3 16:11:38 update-security-db ERR      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
Feb  3 16:11:38 update-security-db ERR    File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
Feb  3 16:11:38 update-security-db ERR      raise ValueError("No JSON object could be decoded")
Feb  3 16:11:38 update-security-db ERR  ValueError: No JSON object could be decoded

Eu tenho uma configuração de proxy e configuro variáveis de ambiente com informações de proxy adicionadas ao / etc / environment para /etc/apt/apt.conf em / etc / wgetrc, assim como ~ / curlrc

Isso permitiu que eu realmente baixasse o link , mas quando ele tenta analisar isso é onde parece falhar. Alguém capaz de superar esse problema?

    
por Chris C 03.02.2017 / 23:26

2 respostas

1

Eu encontrei uma solução para isso. Depois que os scripts fizerem o download do https://usn.ubuntu.com/usn-db/database.pickle.bz2 via proxy, o script estará conectando ao webservice no localhost HTTP: POST http://localhost:9099/UpdateUsns HTTP/1.1

Este falha no proxy, pois o servidor proxy não tem acesso à sua interface localhost. A solução foi desativar o proxy apenas para esta chamada. ou seja,

Editar

/opt/canonical/landscape/canonical/landscape/model/package/client.py

e altere a linha 56

response = self.fetch(url, post=True, data=data, total_timeout=60")

para

response = self.fetch(url, post=True, data=data, total_timeout=60, proxy="")

felicidades / Thor

    
por Thor Olason 23.10.2017 / 09:03
0

Como uma solução alternativa sem alterar a fonte LDS, defina (ou acrescente) localhost à variável NO_PROXY em /etc/environment :

HTTP_PROXY="..."
HTTPS_PROXY="..."
NO_PROXY="localhost"

Todas as três variáveis serão originadas e exportadas por /opt/canonical/landscape/scripts/landscape-env.py , às quais o script update_security_db.sh (e todos os outros scripts de tarefa cron) se referem.

(testado em Landscape Dedicated Server 18.03.)

    
por 05.12.2018 / 13:24