RemoteCertificateNameMismatch when auth using SslStream on linux - linux

I've come across some strange behaviour of dotnet SslStream, when running my dotnet-core app on linux environment.
here is the code:
TcpClient cl = new TcpClient();
cl.Connect("52.209.63.190", 443);
var ssl = new SslStream(cl.GetStream());
ssl.AuthenticateAsClient("api.bitfinex.com");
Auth result is success, when running on windows.
But same code ends with auth error (RemoteCertificateNameMismatch), when linux.
dotnet --info:
.NET Command Line Tools (2.1.4)
Product Information:
Version: 2.1.4
Commit SHA-1 hash: 5e8add2190
Runtime Environment:
OS Name: fedora
OS Version: 27
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/2.1.4/
Microsoft .NET Core Shared Framework Host
Version : 2.0.5
Build : 17373eb129b3b05aa18ece963f8795d65ef8ea54
Why code behaviour is so different on linux?
How can I handle it and pass ssl auth?
Thank you in advance

So, you can connect to that host with
TcpClient cl = new TcpClient();
cl.Connect("api.bitfinex.com", 443);
var ssl = new SslStream(cl.GetStream());
ssl.AuthenticateAsClient("api.bitfinex.com");
I don't know how you got the IP address of api.bitfinex.com, but it's under cloudflare, and may be you don't need to connect bitfinex with his real IP address.
But if it is required to connect that special IP address, you can override verification callback before you do any connection
System.Net.ServicePointManager.ServerCertificateValidationCallback =
(sender, certificate, chain, errors) => true;

Looks like the answer is simple: too old dotnet version.
2.0 seems to have some ssl issues, which were fixed since 2.1
When I installed the newest one (2.1.3), my app still didn't work, decause I had to uninstall prev version (2.0.5) manually to be able to use 2.1.3
Now the app ends with the same result on both windows and linux environments.
Many thanks to M. Hovhannisyan. I've started trying different linux versions, and figured out what I did wrong

Related

Stack fails to download any ghc

I am renting a Ubuntu server. I want to execute a build on it, but Stack is failing to download the GHC. I could not found any solution on the internet. I also tried to downgrade Stack, but that fails when trying to download GHC. Can you help me? Do you have a solution or workaround for that?
stack install
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Preparing to download ghc-8.10.3 ...
Download expectation failure: HttpExceptionRequest Request {
host = "downloads.haskell.org"
port = 443
secure = True
requestHeaders = [("User-Agent","The Haskell Stack")]
path = "/~ghc/8.10.3/ghc-8.10.3-x86_64-deb9-linux.tar.xz"
queryString = ""
method = "GET"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutDefault
requestVersion = HTTP/1.1
}
ConnectionTimeout
Thank you for your time.
I suspect that this is an issue with the firewall settings on the rented Ubuntu server. The industry standard is to have these very tight by default when first created. It is very likely that Stack does not have permission to create the connection it needs to download GHC. To get a more detailed answer, it would help to know more about the Ubuntu server you are renting. You also might see if you can connect to https://downloads.haskell.org with something like wget or curl.

PlatformNotSupportedException error when starting Azure Storage Emulator [duplicate]

WCF : PlatformNotSupportedException when running Server Projects it doesn't work for me...
Console.WriteLine(System.Net.HttpListener.IsSupported); // false
Code:
HttpListener h = new HttpListener();
Error:
System.PlatformNotSupportedException: Operation is not supported on this platform
In System.Net.HttpListener..ctor()
I recently reinstalled Windows 10 1703,i don't know why it happened.
but i can use it on Windows 10 1511
http://www.mycsharp.de/wbb2/thread.php?threadid=92534
It helped me!
because my HTTP start option is 4.
i fixed it.
sc config http start=demand
sc start http

RMySQL connection with --secure_auth=false

I need to get data from an old MySQL server and I'm getting the following error when trying to connect to it with RMySQL or DBI packages:
Error in .local(drv, ...) :
Failed to connect to database: Error: Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)
On terminal, I must use the '--secure_auth=false' option to be able to connect to that MySQL server, but I'cant handle how to use it with RMySQL and DBI packages.
Reading these packages docs, I've found the default.file arg to use in cdbConnect() functions. So I've created a '.my.cnf' file with 'secure_auth=false' direction (following MySQL documentation). But with this conf file the dbConnect() function crashed.
With RJDBC package, I can connect to that server, even without any extra option to set secure_auth. But I would like to use RMySQL to do that, since I am already using it to many other connections in the same script and also because RMySQL is more updated than RJDBC.
My sessionInfo():
R version 3.3.1 (2016-06-21)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RJDBC_0.2-5 rJava_0.9-8 DT_0.1 reshape2_1.4.1 RAdwords_0.1.9
[6] RGA_0.4.2 highcharter_0.3.0 ggplot2_2.1.0 lubridate_1.5.6 dplyr_0.4.3
[11] gpbR_1.0 RMySQL_0.10.9 DBI_0.4-1

how to configure component pubsub to tigase server in ubuntu machine(localhost)?

I have installed tigase server in my linux machine.
After successfully installed tigase i found following in etc/init.properties.
--user-db = mysql
--admins = admin#username
--user-db-uri = jdbc:mysql://localhost/tigasedb?user=tigase&password=tigase12
config-type = --gen-config-def
--virt-hosts = username
--debug = server
Now, I want to install pubsub component with already installed server.
You need to reinstall with advance configuration options instead of basic installation.
You will get options for which component you need to configure with server.

Running protractor tests on IE 11

OK, so I have been searching a lot to get proper solution to the blocker I am facing right now. Let me give you a background of what I have done so far :
I want to run protractor tests (located on Linux machine) on IE 11 of Windows Server 2012 R2 (IP : 10.81.73.248). My protractorTest.conf.js has below :
exports.config = {
seleniumAddress: 'http://10.81.73.248:4444/wd/hub',
baseURL: 'http://10.81.78.137:80000/',
capabilities: {
browserName: 'internet explorer',
platform: 'ANY',
version: '11'
},
On my Windows Server 2012 R2 machine, I've downloaded IEDriverServer_Win32_2.47.0 and placed it under C:\Windows\System32, environment variable PATH has been updated with above location. Protected mode settings are same for all zones. Windows machine also has selenium-server-standalone-2.48.2.jar placed under C:\Users\Selenium.
On Windows machine, I am starting selenium server using below command :
java -jar selenium-server-standalone-2.48.2.jar -port 4444 -Dwebdriver.ie.driver="C:\Windows\System32\IEDriverServer_Win32_2.47.0\IEDriverServer.exe" , which starts selenium server fine.
With above settings, I run protractor tests from my Linux machine using grunt protractor_test, which launches IE browser on Windows machine, shows localhost:dynamic port and a message as : This is the initial page of webdriver server and within 2 seconds, closes the browser.
The exception I get on selenium server terminal is as below :
Session ID is null. Using WebDriver after calling quit() ?
This is where I am stuck at. I looked at various posts which describes similar issue (?) as mine along with the potential solution, but I am unable to resolve my issue here.
Is there anything I might be doing wrong to setup the connections ? or am I missing some steps to get me through ?
I would really appreciate if you guide me in resolving this long time pending blocker.
I think you are trying to run using old selenium version.It should be 2.53.x something.
Few basics things to check first regarding IE execution:
1).IE Setting for protractor(Selenium)
http://elgalu.github.io/2014/run-protractor-against-internet-explorer-vm/
2).Take IE driver of 32 bit(don't take 64 it has known slowness issues) and manually copy on the following path:
Root Folder\node_modules\protractor\node_modules\webdriver-manager\selenium\IEDriverServer_Win32_2.53.1
3). IE Driver can be downloaded from following path:
http://selenium-release.storage.googleapis.com/index.html?path=2.53/
**OR**
Please upgrade your protractor version to latest like 4.0.11 by changing the version in package.json file and do from command prompt(inside project root directory):
npm update
and then give update your selenium driver with following command from command prompt
webdriver-manager update --ie
it will update the selenium version of IE driver to latest and then try running your tests again.

Resources