You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "thinkORo (via GitHub)" <gi...@apache.org> on 2024/03/22 18:15:36 UTC

[I] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

thinkORo opened a new issue, #40754:
URL: https://github.com/apache/arrow/issues/40754

   ### Describe the usage question you have. Please include as many useful details as  possible.
   
   
   I would like to read a CSV file from my TLS-secured object storage (minio).
   
   Here is my code and configuration:
   
   ```
   from pyarrow import fs, csv, parquet
   minio = fs.S3FileSystem(
       endpoint_override="https://localhost:port",
       access_key="user1234",
       secret_key="password1234",
   )
   
   dataCSV = minio.open_input_file("bucket/filename.csv")
   ```
   I get the following error message:
   
   ```
   OSError: When reading information for key 'filename.csv' in bucket 'bucket': AWS Error NETWORK_CONNECTION during HeadObject operation: curlCode: 60, SSL peer certificate or SSH remote key was not OK
   ```
   If I use the same credentials to read the data with duckDB, it works perfectly.
   
   What am I doing wrong?
   
   ### Component(s)
   
   Python


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2019463586

   Please keep this issue open. The next step is opening a PR that improves `S3Options`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou closed issue #40754: [Python] Cannot read data if endpoint is s3 on a "secure" Minio server
URL: https://github.com/apache/arrow/issues/40754


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2019282780

   Thanks.
   
   It seems that we need to add TLS related options to https://github.com/apache/arrow/blob/e3b0bd1feb63d59cd6fb553af976449397b8348e/cpp/src/arrow/filesystem/s3fs.h#L102 and use it for internal AWS SDK for C++.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "cceyda (via GitHub)" <gi...@apache.org>.
cceyda commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2670583950

   If using jupyter notebook you gotta add `SSL_CERT_FILE` env variable in your `kernelspec.json` (found by `jupyter kernelspec list`) formatted like 
   ```
   "env": {
     "SSL_CERT_FILE":"/myenv_location/lib/python3.11/site-packages/certifi/cacert.pem"
    }
   ```
   find the CERT_FILE by doing `python -m certifi`.
   If you don't have it installed do`pip install certifi` first


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "thinkORo (via GitHub)" <gi...@apache.org>.
thinkORo commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2017552083

   Sure. Here is a list of parameters that unfortunately did not work
   
   ```
   import os
   os.environ['TLS_SKIP_VERIFY']="TRUE"
   os.environ['TLS_VERIFY']="FALSE"
   os.environ['VERIFY_CLIENT']="FALSE"
   os.environ['VERIFY']="FALSE"
   os.environ['CURLOPT_SSL_VERIFYHOST']="FALSE"
   os.environ['CURLOPT_SSL_VERIFYPEER']="FALSE"
   
   os.environ['REQUESTS_CA_BUNDLE']='path_to_my.pem'
   os.environ['AWS_CA_BUNDLE']='path_to_my.pem'
   os.environ['CURL_CA_BUNDLE']='path_to_my.pem'
   os.environ['ARROW_SSL_CERT_FILE']='path_to_my.crt'
   os.environ['SSL_CERT_FILE']='path_to_my.crt'
   ```
   
   From my perspective the problem is that the S3FileSystem implementation of pyarrow.fs has a different "signature" as s3fs. In s3fs.S3FileSystem I can define client_kwargs to provide a specific certificate. In pyarrow's implementation I couldn't find a respective way.
   
   But: My initial problem was related to pyiceberg (which is based on pyarrow). And there I got a hint to check the ssl verification parameter by
   
   ```
   import ssl
   paths = ssl.get_default_verify_paths()
   print(paths)
   ```
   I'm running Python in a virtual environment. Here the "openssl_cafile" from ssl points to a cert.pem in the virtual environment (./envs/name_of_my_venv/ssl/cert.pem) which I have to adjust (add the content of my CA's pem).
   
   And with that adjustment I got it to work. More or less :-) But at least without the initial mentioned certificate problem.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "bw513 (via GitHub)" <gi...@apache.org>.
bw513 commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2743497127

   I've raised a PR to expose the certificate path from S3Options as suggested by @kou .


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "sadum-vunet (via GitHub)" <gi...@apache.org>.
sadum-vunet commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2173794490

   is there a workaround for this?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2016955432

   > I tried all parameter I found on the internet to disable certificate validation or to povide a valid certificate to S3FileSystem directly.
   
   Could you share what you did?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2360291426

   `SSL_CERT_FILE` has worked for a long time, but you probably need to set it from the parent process (it may be too late to set it in Python).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "thinkORo (via GitHub)" <gi...@apache.org>.
thinkORo commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2360221506

   Great to hear that SSL_CERT_FILE is now working. I‘ll give them a try.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-3004003464

   Issue resolved by pull request 45881
   https://github.com/apache/arrow/pull/45881


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2358672097

   For now you can set the `SSL_CERT_FILE` environment variable from the parent process. For example:
   ```console
   $ SSL_CERT_FILE=/tmp/cafile.pem python -c "import ssl; print(ssl.get_default_verify_paths())"
   DefaultVerifyPaths(cafile='/tmp/cafile.pem', capath='/home/antoine/mambaforge/envs/pyarrow/ssl/certs', openssl_cafile_env='SSL_CERT_FILE', openssl_cafile='/home/antoine/mambaforge/envs/pyarrow/ssl/cert.pem', openssl_capath_env='SSL_CERT_DIR', openssl_capath='/home/antoine/mambaforge/envs/pyarrow/ssl/certs')
   ```
   
   In the future it would be better to expose the facility directly in PyArrow. It's already partly there, but adding API functions would be nice:
   https://github.com/apache/arrow/blob/1c1f7f359d61b59e446b0a47e0279728551ed89f/python/pyarrow/_fs.pyx#L36-L45
   
   cc @jorisvandenbossche @danepitkin 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "thinkORo (via GitHub)" <gi...@apache.org>.
thinkORo commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2019444452

   Thank's for double-checking. Should I close this issue now or what's the best next step?
   Thank you for your support. For you for developing/supporting such a great framework.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2024035555

   #37001 may be related.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2358675575

   Also, as @kou stated, we could make the TLS CA paths configurable in `S3Options`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "thinkORo (via GitHub)" <gi...@apache.org>.
thinkORo commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2360447359

   Ah, I see. Than we should find another way. To have this information outside the code (and configuration) isn’t that good. You mentioned some additional parameters in S3Options? Would be fine for me.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Cannot read data if endpoint is s3 on a "secure" Minio server [arrow]

Posted by "thinkORo (via GitHub)" <gi...@apache.org>.
thinkORo commented on issue #40754:
URL: https://github.com/apache/arrow/issues/40754#issuecomment-2016452202

   I tried all parameter I found on the internet so disable certificate validation or to povide a valid certificate to S3FileSystem directly. No success.
   
   Please, does have anyone any idea?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org