Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTF8 Encoding issues when importing certs #160

Open
jabbott-hbk opened this issue Mar 28, 2023 · 5 comments
Open

UTF8 Encoding issues when importing certs #160

jabbott-hbk opened this issue Mar 28, 2023 · 5 comments

Comments

@jabbott-hbk
Copy link

Describe the bug

When running 'icingacli x509 import' I repeatedly get an errors like:

ERROR: PDOException in /usr/share/icinga-php/ipl/vendor/ipl/sql/src/Connection.php:402 with message: SQLSTATE[22021]: Character not in repertoire: 7 ERROR: invalid byte sequence for encoding "UTF8": 0x9c

The specific invalid byte changes depending on which certificate file I provide, but the error is the same.

I have confirmed that the files I am providing to the command are valid .pem formatted certificates. When I run 'file -bi' I see that the files have charset=us-ascii. This should be a subset of UTF8, so there shouldn't be any invalid bytes in the files.

I double checked the cert files using /%d in vi to search for the dec code corresponding to the invalid byte sequence returned in the error message (for 0x9c it would be /%d156), and vi does not identify any occurrences of that byte in the file.

I have also confirmed that the Postgres DB backing the x509 module has the appropriate encoding of en_US.UTF-8.

To Reproduce

  1. Move a valid, .pem encoded certificate chain into /tmp
  2. Run command sudo icingacli x509 import --file /tmp/<cert_file_name>

Expected behavior

Icingacli command should add the certificate to the Postgres DB.

Your Environment

Icinga Web 2 version: 2.11.3
ipl version: 0.10.1
thirdparty version: 0.11.0
x509 version: 1.1.2
x509 db backend: Postgres 12.9
PHP version: 7.3.11
Web browser used: N/A. Commands executed through ssh connection to Icinga master
Icinga 2 version used (icinga2 --version): r2.13.6-1
Server operating system and version: CentOS 7

@yhabteab
Copy link
Member

Hello @JA-HBK, thanks for reporting, though PostgreSQL support works only with the master branch. Therefore you have to either use the master or switch to mysql.

@jabbott-hbk
Copy link
Author

Hi @yhabteab Thanks for getting back to me. Swapping to the master branch did get me around that error

@jabbott-hbk
Copy link
Author

Hello @yhabteab

This issue has come up again. I'm using version 1.2.1 of the x509 module, which seems like it ought to support PostgreSQL, based on the release notes.

Symptoms are the same as they were previously, and I haven't changed anything else in my icinga environment.

Any further recommendations?

@yhabteab
Copy link
Member

Symptoms are the same as they were previously, and I haven't changed anything else in my icinga environment.

Hii, please share the error message?

@jabbott-hbk
Copy link
Author

scan-error

This is the result of running a 'scan' command on a job with only the host/ip for this one certificate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants