Outils pour utilisateurs

Outils du site


blog

Pb Apache ProxyPass 502 503 mod_proxy 100-continue

Voir :

curl -m5 -X PUT --write-out "http_code=%{http_code}" --data @submit.xml http://127.0.0.1/CTRL/submit?EBu
curl -m5 -X PUT --write-out "http_code=%{http_code}" --data @submit.xml http://127.0.0.1:8080/I/submit?EBu

Solution

Solution 1

RequestHeader unset Expect early

/etc/httpd/conf/httpd.conf

LoadModule headers_module modules/mod_headers.so
 
<IfModule mod_headers.c>
RequestHeader unset Expect early
</IfModule>
Solution 2
<IfVersion >= 2.4.41>
    Proxy100Continue off
</IfVersion>
2025/03/24 15:06

Pb Ansible Python3 replace regexp err cannot use a string pattern on a bytes-like object

Source : https://github.com/ansible/ansible/pull/18822/commits/d3e372fc378ec69f30c25918892cd536a9c24748

Debian Jessie - Ansible jessie-backports

- name: vim no mouse
  replace:
    dest: /usr/share/vim/vim80/defaults.vim
    regexp: '^\s+set mouse=a'
    replace: '"  set mouse=a'

Erreur

TASK [standard : vim no mouse] ***************************************************                                                           
fatal: [plop]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Shared connection to 192.168.134.163 closed.\r\n", "module_stdout": "\r\nTraceback (most recent call last):\r\n  File \"/tmp/ansible_mx2mi0o7/ansible_module_re
place.py\", line 180, in <module>\r\n    main()\r\n  File \"/tmp/ansible_mx2mi0o7/ansible_module_replace.py\", line 153, in main\r\n    result = re.subn(mre, params['replace'], contents, 0)\r\n  File \"/usr/lib/python3.5/re.py\", line 193
, in subn\r\n    return _compile(pattern, flags).subn(repl, string, count)\r\nTypeError: cannot use a string pattern on a bytes-like object\r\n", "msg": "MODULE FAILURE"}
        to retry, use: --limit @/home/jibe/ansible/play-ghost-debian9-std-dev.retry
$ ansible --version
ansible 2.2.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

~/.ansible/hosts

[all:vars]
ansible_python_interpreter=/usr/bin/env python3
 
[plop]
plop
 
[plop:vars]
ansible_python_interpreter=/usr/bin/python3

Solution :

ansible-python3-replace.patch

+++ /usr/lib/python2.7/dist-packages/ansible/modules/core/files/replace.py      2017-10-31 11:49:52.296243787 +0100
@@ -149,8 +149,8 @@
             'before': contents,
         }
 
-    mre = re.compile(params['regexp'], re.MULTILINE)
-    result = re.subn(mre, params['replace'], contents, 0)
+    mre = re.compile(to_bytes(params['regexp']), re.MULTILINE)
+    result = re.subn(mre, to_bytes(params['replace']), contents, 0)
 
     if result[1] > 0 and contents != result[0]:
         msg = '%s replacements made' % result[1]
@@ -175,6 +175,7 @@
 
 # this is magic, see lib/ansible/module_common.py
 from ansible.module_utils.basic import *
+from ansible.module_utils._text import to_bytes
 
 if __name__ == '__main__':
     main()
cd /
patch -p0 < ~/ansible-python3-replace.patch
2025/03/24 15:06

Pb Ansible - sftp transfer mechanism failed

Warn - sftp transfer mechanism failed
Connexion distante
$ ansible -m ping -i inv.lst -u root srv1
[WARNING]: sftp transfer mechanism failed on [srv1]. Use ANSIBLE_DEBUG=1 to see detailed information
srv1 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
$ sftp root@srv1
subsystem request failed on channel 0
Connection closed
Sur la cible
# tail -f /var/log/messages>
Aug  7 10:25:19 srv1 sshd[30049]: Accepted publickey for root from 192.168.1.22 port 45878 ssh2
Aug  7 10:25:19 srv1 sshd[30051]: subsystem request for sftp
Aug  7 10:25:19 srv1 sshd[30051]: error: subsystem: cannot stat /usr/sbin/sftp-server: No such file or directory
Aug  7 10:25:19 srv1 sshd[30051]: subsystem request for sftp failed, subsystem not found
# grep sftp /etc/ssh/sshd_config
Subsystem       sftp    /usr/libexec/openssh/sftp-server
Solution

Sur la cible

ln -s /usr/libexec/openssh/sftp-server /usr/sbin/sftp-server

Ou

/etc/ssh/sshd_config

#Subsystem sftp /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp
systemctl restart sshd

Ou

alias ansible_host=192.168.1.102 ansible_ssh_transfer_method=scp

Ou

ansible.cfg

[ssh_connection]
# Control the mechanism for transferring files (old)
#   * smart = try sftp and then try scp [default]
#   * True = use scp only
#   * False = use sftp only
#scp_if_ssh = smart
 
# Control the mechanism for transferring files (new)
# If set, this will override the scp_if_ssh option
#   * sftp  = use sftp to transfer files
#   * scp   = use scp to transfer files
#   * piped = use 'dd' over SSH to transfer files
#   * smart = try sftp, scp, and piped, in that order [default]
#transfer_method = smart
2025/03/24 15:06

Pb ansible - failure when attempting to use callback plugin - ascii codec can t decode byte in position ordinal not in range

ansible-playbook install-plop.yml

Erreur

TASK [plop : configuration php-fpm plop] *********************************
 [WARNING]: Failure when attempting to use callback plugin (<ansible.plugins.callback.default.CallbackModule object at 0x7f9681409b10>): 'ascii' codec can't decode byte 0xc3 in position
755: ordinal not in range(128)

Solution : sed_suppression_caracteres_non_ascii

Un caractère spécial c'est glissé. On peut les enlever avec Perl

perl -lpe 's/[[:^print:]]+//g' roles/plop/templates/php-plop.conf.j2 > roles/plop/templates/php-plop1.conf.j2

Comparons les deux fichiers avec diff ou vimdiff, le pb venait des accents dans les commanditaires

< # Doit tre accessible en criture par l'utilisateur PHP-FPM (dfinie dans ce fichier "user = ")
---
> # Doit être accessible en écriture par l'utilisateur PHP-FPM (définie dans ce fichier "user = ")
2025/03/24 15:06

Pb accents extraire un zip qui contient des fichiers non utf-8

Voir : pb_unrar_accents

Source : https://suumitsu.eu/links/?3hr51Q

Extraire un ZIP qui contient des fichiers non UTF-8 Procéder ainsi dans un terminal:

export LANG=ja_JP
7z x fichier.zip

Ouvrir un nouveau terminal (ou restaurer $LANG), et puis:

convmv --nosmart --notest -r -f shift-jis -t utf8 .

(dans mon cas, le contenu du ZIP étant codé en SHIFT_JIS, d'après la détection d'un fichier texte inclus grâce à uchardet)

2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki