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

openssl command requires winpty on windows for OTA example (GIT8266O-556) #979

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ruthgrace
Copy link

@ruthgrace ruthgrace commented Sep 27, 2020

On Windows, running these commands with mingw as per https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/windows-setup.html , the openssl command must be run with winpty, or else it hangs. This is because openssl requires input from terminal.
See https://stackoverflow.com/questions/9450120/openssl-hangs-and-does-not-exit/45732888 and https://www.esp32.com/viewtopic.php?t=9521 .

When generating the ssl certificate and key, this command hangs:

ruthg@WINDOWS-T98KIEE MINGW32 ~/esp/ota/server
$ openssl req -x509 -newkey rsa:2048 -keyout ca_key.pem -out ca_cert.pem -days 365
Generating a RSA private key
...................................................+++++
..................................+++++

This command works:

ruthg@WINDOWS-T98KIEE MINGW32 ~/esp/ota/server
$ winpty openssl req -x509 -newkey rsa:2048 -keyout ca_key.pem -out ca_cert.pem -days 365
Generating a RSA private key
........................+++++
..........................................+++++
writing new private key to 'ca_key.pem'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:California
Locality Name (eg, city) []:San-Francisco
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:ruth
Email Address []:[email protected]
ruthg@WINDOWS-T98KIEE MINGW32 ~/esp/ota/server
$

When running the server, this command hangs:

ruthg@WINDOWS-T98KIEE MINGW32 ~/esp/ota/server
$ openssl s_server -WWW -key ca_key.pem -cert ca_cert.pem -port 8070

This command works:

ruthg@WINDOWS-T98KIEE MINGW32 ~/esp/ota/server
$ winpty openssl s_server -WWW -key ca_key.pem -cert ca_cert.pem -port 8070
Enter pass phrase for ca_key.pem:
Using default temp DH parameters
ACCEPT

On Window, running these commands with mingw as per https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/windows-setup.html , the `openssl` command must be run with `winpty`, or else it hangs. This is because openssl requires input from terminal.
See https://stackoverflow.com/questions/9450120/openssl-hangs-and-does-not-exit/45732888 and https://www.esp32.com/viewtopic.php?t=9521 .
@ruthgrace ruthgrace changed the title openssl command requires winpty on windows openssl command requires winpty on windows for OTA example Sep 27, 2020
@github-actions github-actions bot changed the title openssl command requires winpty on windows for OTA example openssl command requires winpty on windows for OTA example (GIT8266O-556) Sep 27, 2020
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Successfully merging this pull request may close these issues.

2 participants