Search code examples
bashopensslwget

wget Unable to establish SSL connection on bash script install


I'm trying to install a github file through bash following these instructions

https://github.com/allenai/s2orc-doc2json

bash scripts/setup_grobid.sh

but I'm getting the following error

bash scripts/setup_grobid.sh
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = c:/progra~1/wget/etc/wgetrc
--2022-07-21 20:55:25--  https://github.com/kermitt2/grobid/archive/0.6.1.zip
Resolving github.com... 140.82.121.4
Connecting to github.com|140.82.121.4|:443... connected.
OpenSSL: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
Unable to establish SSL connection.
unzip:  cannot find or open 0.6.1.zip, 0.6.1.zip.zip or 0.6.1.zip.ZIP.
rm: cannot remove '0.6.1.zip': No such file or directory
scripts/setup_grobid.sh: line 11: cd: /c/Users/User/grobid-0.6.1: No such file or directory
scripts/setup_grobid.sh: line 12: ./gradlew: No such file or directory
cp: cannot stat '/c/Users/User/git/s2orc-pdf2json/pdf2json/grobid/config.yaml': No such file or directory
cp: cannot stat '/c/Users/User/git/s2orc-pdf2json/pdf2json/grobid/grobid.properties': No such file or directory
scripts/setup_grobid.sh: line 22: ./gradlew: No such file or directory

This is the setup_grobid.sh after running it through ShellCheck.net

#!/usr/bin/env bash

# put in your pdf2json directory here
export PDF2JSON_HOME=$HOME/Desktop/s2orc-doc2json-main

# Download Grobid
cd "$HOME" || exit
wget https://github.com/kermitt2/grobid/archive/0.6.1.zip
unzip 0.6.1.zip
rm 0.6.1.zip
cd "$HOME"/Desktop/s2orc-doc2json-main/grobid-0.6.1 || exit
./gradlew clean install

## Grobid configurations
# increase max.connections to slightly more than number of processes
# decrease logging level
# this isn't necessary but is nice to have if you are processing lots of files
cp "$PDF2JSON_HOME"/pdf2json/grobid/config.yaml "$HOME"/grobid-0.6.1/grobid-service/config/config.yaml
cp "$PDF2JSON_HOME"/pdf2json/grobid/grobid.properties "$HOME"/grobid-0.6.1/grobid-home/config/grobid.properties

## Start Grobid
./gradlew run

I even tried to --no-check-certificate but still got the same error.

edit: I'm using Wget 1.11.4 / OpenSSL 1.1.1q 5 Jul 2022


Solution

  • Telling by

    OpenSSL: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
    

    this might be caused by github droping support for ancient TLS version protocols https://github.blog/2018-02-01-crypto-removal-notice/ and a fairly outdated wget+openssl installation.

    Try forcing a specific modern TLS protocol and see how it goes

    wget --secure-protocol=TLSv1_2 https://github.com/kermitt2/grobid/archive/0.6.1.zip 
    

    or try to upgrade your installation


    As a rule of thumb, start your scripts with

    set -ex
    

    So that they

    1. stop if any instruction fails
    2. echo the instruction that is being executed