Undefined reference for TLSv1_1_client_method though 'nm' says otherwise - c

In my SSL client code, on trying to compile I get an undefined reference error on using TLSv1_1_client_method(). If I don't have the TLS method, the linking is fine. On running ldd on the binary I see:
%ldd client_sim_ssl
libssl.so.10 => /usr/lib64/libssl.so.10
libcrypto.so.10 => /usr/lib64/libcrypto.so.10
Now, if I check nm for /usr/lib64/libssl.so.10 :
%nm /usr/lib64/libssl.so.10 | grep TLSv1_1_client_method
0000000000030d30 T TLSv1_1_client_method
OpenSSL version installed : OpenSSL 1.0.1g 7 Apr 2014
Why the undefined reference error when the library it links to has the definition? What is the missing piece?
EDIT 1:
I had logged off the system I was working on. In my experiment in upgrading the version - openSSL 1.0.1g, I think, I have messed with libraries. SSH connection is having problems. :-(
ssh root#10.200.2.197
ssh_exchange_identification: Connection closed by remote host
May be my original problem is also related to this?
I will update the post shortly on more details as I fix SSH connection issue.
EDIT 2:
My system is RHEL 6.1. For SSH issue had to re install OpenSSL rpm from CD for there was version mismatch error from ssh. With this OpenSSL reinstallation, libraries have been set right in /usr/lib/ and /usr/lib64/. Now I don't get to see TLSv1_1_client_method() with nm.
I must have put in libraries from 1.0.1g into /usr/lib64/' and thus resulted innm` showing TLS method. And while compiling it was using other versions? Not sure.

Related

snmpd not found issue?

I've installed the net-snmp package (version 5.8) by downloading the tar.gz file and compiling the files inside on a RHEL server (version 6.9).
I can see that the package is installed when I type snmpd --version but whenever I try to use service snmpd restart it says snmpd: unrecognized service.
I did all the setups and the snmpd.conf file was created (but not at /etc/snmp/ for some reason initially, so I copied the file there) but it seems like snmpd isn't being recognized at all.
I even tried snmpd restart but nothing happens and it seems like the SNMP connection still isn't there either.
Is there a way to fix this issue? Thanks!

How do I install RODBC so that is uses unixODBC?

After installing and configuring FreeTDS and unixODBC and confirming they are working correctly, I am trying to configure RODBC. However, I am getting the following results when attempting to view the ODBC data sources in the R console.
> odbcDataSources()
named character(0)
If I attempt to use the FreeTDS driver I get the following results.
>odbcDriverConnect("driver={FreeTDS};server=xx.xx.xx.xx;port=1433;database=XXXX_Analysis;trusted_connection=true;UID=********;PWD=********") :
[RODBC] ERROR: state IM003, code 0, message [iODBC][Driver Manager]Specified driver could not be loaded
Based on the error, it looks like RODBC is trying to use iODBC instead of unixODBC. I am not sure how to configure RODBC to use unixODBC.
The proper way to do this is to specify the odbc manager to the package's configure script, like this
install.packages("RODBC",
type = "source",
INSTALL_opts="--configure-args='--with-odbc-manager=odbc'"
)
--with-odbc-manager=odbc indicates you want to use unixODBC
--with-odbc-manager=iodbc indicates you want to use iODBC
I also had this issue after configuring unixODBC on Mac OS 10.13.3 High Sierra. I tried configuring my .Renviron to set an R-specific environment variable for ODBCINI, but RODBC still wouldn't list my data source names (DSNs). Additionally, I couldn't get it to find the driver specified in ODBCinst.ini or even get a connection string working with RODBC::ODBCDriverConnect(), despite being able to connect with isql.
What ended up working was simply:
remove.packages('RODBC')
install.packages('RODBC', type="source")
It seems if you install RODBC from source on mac, it picks up on the odbc.ini file and odbcinst.ini file correctly.
Thanks to this post's subtle comment for unlocking the key:
http://eriqande.github.io/2014/12/19/setting-up-rodbc.html
Turns out the default RODBC package install won't work with unixODBC. Here is a process for recompiling and installing RODBC.
Remove current generic RODBC package via the R console.
>remove.packages("RODBC")
Removing package from ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library’
(as ‘lib’ is unspecified)
Download the source for RODBC.
https://cran.r-project.org/src/contrib/RODBC_1.3-15.tar.gz
Set the environment variable DYLD_LIBRARY_PATH to the location where your unixODBC library is located. I used homebrew to install unixODBC so my my library is located in /usr/local/lib.
export DYLD_LIBRARY_PATH=/usr/local/lib
Now reinstall RODB so it picks up the new library location.
R CMD INSTALL /Users/xxxxxx/Downloads/RODBC_1.3-15.tar.gz
There is quite a bit of output but look towards the end and you should see something like this.
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o RODBC.so RODBC.o -lodbc -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.4/Resources/library/RODBC/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (RODBC)
Notice the -L/usr/local/lib indicating the library location was picked up.
Now you should be able to see your ODBC connections provided by unixODBC. Back in the restarted R console you can type the following to verify RODBC is using unixODBC.
> library("RODBC")
> odbcDataSources()
MYMSSQL1 MYMSSQL XXXXXXXXX_C_DB XXXXXXXX-SQL1
"FreeTDS" "FreeTDS" "FreeTDS" "FreeTDS"
Thanks to hiltmon for helping put me on the right track.

MacPorts failed install port

I have trouble installing PHP, MySQL and Apache2 using MacPorts. Currently my OS is Mavericks and i'm downloading the official binary package for mavericks (also tried compile from source and running selfupdate) but I got this error message:
---> Building readline
Error: org.macports.build for port readline returned: command execution failed
Error: Failed to install readline
Please see the log file for port readline for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_readline/readline/main.log
Error: The following dependencies were not installed: apache2 apr-util mysql5 readline tcp_wrappers sqlite3 libedit pcre bzip2 autoconf213 gawk xz m4 gsed libtool libxml2 mhash pkgconfig
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
Error: Processing of port php5 failed
How can I solve this?
Thanks
Can you please check the error message block within the log file:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_readline/readline/main.log
Also make sure xcode command line tools are installed.
FYI: I faced similar error in Mavericks. My case was:
opt is a different partition which is mounted in /Volumes/opt
/opt is a symbolic link to /Volumes/opt.
It has been solved after editing /opt/local/etc/macports/macports.conf by replacing /opt with /Volumes/opt. Note sure this can help your case.

Open ssl unkown protocol

I wrote a code that worked for me great, I don't remember modifying it..
I compiled it today and tried to run it, but I got this error:
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
I also tried to connect to the host name with the openssl client, but I've got and error says: Linked closed ping timeout..
I also tried to Install openssl again, and even install an older version but it didn't work..
Any solutions?
I also tried to connect to the host name with the openssl client, but I've got and error says: Linked closed..
It sounds like the remote host is not available. If you can't connect to the remote host using command line tools, then there's nothing you can do with your code to make it work. Verify that the remote host is responding correctly first.

libcurl gnutls_handshake() failed: A TLS warning alert has been received

I am essentially trying to do the following:
http://curl.haxx.se/libcurl/c/https.html
I have my apache server set up with mod_ssl and a server cert. I added the line:
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
and also tried:
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
but I keep getting the error: gnutls_handshake() failed: A TLS warning alert has been received.
Does anyone know who to fix this or get around it?
Realizing that the question is fairly old and one answer was already accepted, here is an alternative answer that worked perfectly for me and may be useful for folks coming here from search:
Replace libcurl-gnutls with libcurl-openssl alternative.
I noticed that the certificate error was only generated with programs using libcurl and not with browsers so I assumed that something about GNUTLS was at fault here and not the certificates.
Here is what worked for me (Ubuntu 12.04 LTS):
$ sudo apt-get remove libcurl4-gnutls-dev
$ sudo apt-get install libcurl4-openssl-dev
All programs that were relying on libcurl started working fine immediately after I replaced the libraries (I also recompiled the programs just in case).
Note: this solution will only help you if you get a warning with GNUTLS but not with, say, browsers. That is, I am assuming the certificate chain is actually set up correctly.
I attempted the above solution and that did not work for me. In python, I tried the following option which effectively forces SSLv3 and disables TLS.
c.setopt(pycurl.SSLVERSION, pycurl.SSLVERSION_SSLv3)
in PHP it should be able to be accomplished by setting the CURLOPT_SSLVERSION option to 3.
That "usual" warning you get means there is no well-known organization (certificate authority) willing to vouch for its authenticity. That is what the "usual" warning means and that is what the TLS warning is telling you.
Try to set CURLOPT_SSL_VERIFYHOST to 0 or install a proper certificate.

Resources