DonHaul opened a new issue, #55885:
URL: https://github.com/apache/airflow/issues/55885

   ### Apache Airflow version
   
   3.0.6
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   When using the `FTPSHook` I get an error when trying to connect to it. (See 
example on next section)
   
   Error:
   
   ```
   Task failed with exception: source="task"
   SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate 
verify failed: self-signed certificate (_ssl.c:1016)
   File 
"/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/execution_time/task_runner.py",
 line 920 in run
   File 
"/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/execution_time/task_runner.py",
 line 1215 in _execute_task
   File 
"/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/bases/operator.py",
 line 397 in wrapper
   File 
"/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/bases/decorator.py",
 line 251 in execute
   File 
"/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/bases/operator.py",
 line 397 in wrapper
   File 
"/home/airflow/.local/lib/python3.11/site-packages/airflow/providers/standard/operators/python.py",
 line 216 in execute
   File 
"/home/airflow/.local/lib/python3.11/site-packages/airflow/providers/standard/operators/python.py",
 line 239 in execute_callable
   File 
"/home/airflow/.local/lib/python3.11/site-packages/airflow/sdk/execution_time/callback_runner.py",
 line 81 in run
   File "/opt/airflow/dags/literature/ieee_harvest.py", line 44 in ftp_1
   File 
"/home/airflow/.local/lib/python3.11/site-packages/airflow/providers/ftp/hooks/ftp.py",
 line 100 in list_directory
   File 
"/home/airflow/.local/lib/python3.11/site-packages/airflow/providers/ftp/hooks/ftp.py",
 line 300 in get_conn
   File "/usr/local/lib/python3.11/ftplib.py", line 740 in __init__
   File "/usr/local/lib/python3.11/ftplib.py", line 123 in __init__
   File "/usr/local/lib/python3.11/ftplib.py", line 745 in login
   File "/usr/local/lib/python3.11/ftplib.py", line 756 in auth
   File "/usr/local/lib/python3.11/ssl.py", line 517 in wrap_socket
   File "/usr/local/lib/python3.11/ssl.py", line 1104 in _create
   File "/usr/local/lib/python3.11/ssl.py", line 1382 in do_handshake
   ```
   
   This is caused due a `context` being passed to create a connection
   
https://github.com/apache/airflow/blob/3.0.6/providers/ftp/src/airflow/providers/ftp/hooks/ftp.py#L295
 for security reasons https://github.com/apache/airflow/pull/38266 .
   A solution would be to allow to customize this context to also allow for 
less secure FTPS connections
   
   
   ### What you think should happen instead?
   
   I should be able to pass my own custom `context` for less secure 
connections, I can and will implement my custom hook, but I wonder if this 
option should also be added to `FTPSHook`.
   
   ### How to reproduce
   
   Have the following task
   
   ```python
       @task
       def ftp_1():
           """
           Test task to get a list file from an FTPS server.
           """
           hook = FTPSHook(ftp_conn_id="ieee_ftp")
           remote_files = hook.list_directory("/")
           print(remote_files)
   ```
   
   ### Operating System
   
   macos w docker
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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: commits-unsubscr...@airflow.apache.org.apache.org

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

Reply via email to