tiny_tds icon indicating copy to clipboard operation
tiny_tds copied to clipboard

openssl vs. gnutls

Open bf4 opened this issue 5 months ago • 6 comments

I'm on the Heroku-22 stack and had been using the buildpack https://github.com/rails-sqlserver/heroku-buildpack-freetds.git#v1.1.5

After removing the buildpack to rely on the vendored freetds present in tiny_tds 3.2.0, some, but not all, of our database connections began to fail at login.

After comparing the outputs of tsql -C prior to removing the buildpack and bundle exec tsql-ttds -C afterwards, I noticed

- OpenSSL: yes
- GnuTLS: no
+ OpenSSL: no
+ GnuTLS: yes
+ MARS: yes

which led me to believe that, at least on Heroku-22, for some connections, GnuTLS works and OpenSSL doesn't.

I'm not sure why the tradeoff is for changing the build args so for now I'm just reporting this for discussion.

This is against tiny_tds v3.2.0 on Ruby 3.3.4

Related https://github.com/rails-sqlserver/heroku-buildpack-freetds/pull/20 On topic https://github.com/rails-sqlserver/tiny_tds/pull/521#issuecomment-1374044452

#### Buildpack
# FREETDS_VERSION=1.4.26
# https://github.com/rails-sqlserver/heroku-buildpack-freetds.git#v1.1.5
tsql -C
Compile-time settings (established with the "configure" script)
                            Version: freetds v1.4.26
             freetds.conf directory: /tmp/build_home/freetds/etc
     MS db-lib source compatibility: no
        Sybase binary compatibility: no
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 7.3
                              iODBC: no
                           unixodbc: no
              SSPI "trusted" logins: no
                           Kerberos: no
                            OpenSSL: no
                             GnuTLS: yes
                               MARS: yes
#### Vendored
# FREETDS_VERSION=1.4.26
bundle exec tsql-ttds -C
[TinyTds][v3.2.0][tsql]: /app/vendor/bundle/ruby/3.3.0/gems/tiny_tds-3.2.0-x86_64-linux-gnu/ports/x86_64-linux-gnu/bin/tsql
Compile-time settings (established with the "configure" script)
                            Version: freetds v1.4.26
             freetds.conf directory: /home/runner/work/tiny_tds/tiny_tds/ports/x86_64-linux-gnu/etc
     MS db-lib source compatibility: no
        Sybase binary compatibility: no
                      Thread safety: yes
                      iconv library: yes
                        TDS version: auto
                              iODBC: no
                           unixodbc: no
              SSPI "trusted" logins: no
                           Kerberos: no
                            OpenSSL: yes
                             GnuTLS: no
Example of connection failing at password auth
TDSVER="${TSQL_TDSVER}" bundle exec tsql-ttds -H "${test_ip}" -p "${test_port}" -U "$TSQL_USERNAME"

[TinyTds][v3.2.0][tsql]: /app/vendor/bundle/ruby/3.3.0/gems/tiny_tds-3.2.0-x86_64-linux-gnu/ports/x86_64-linux-gnu/bin/tsql
Password:

locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20017 (severity 9):
	Unexpected EOF from the server
Error 20002 (severity 9):
	Adaptive Server connection failed
Error 20002 (severity 9):
	Adaptive Server connection failed

bf4 avatar Jul 09 '25 03:07 bf4