Native Messaging Problem between linux app and wine native app (piping linux app to wine app)

Questions about Wine on Linux
Locked
muhammedemintombak
Level 2
Level 2
Posts: 42
Joined: Tue Sep 22, 2020 6:52 am

Native Messaging Problem between linux app and wine native app (piping linux app to wine app)

Post by muhammedemintombak »

Hello Guys,
I am using Debian 10 Buster and wine 6.0 rc1.
My problem is native messaging between linux app to wine app.
The wine app is e-signature application (arksigner windows version).
This app have also linux version, but My company's firewall denies the app. So, the linux app does NOT working.
I have installed the wine app and windows versions of web browsers on wine 6.0 rc1, and I am using the wine application this way. But, it is the problem, because I have to install windows versions of web browsers on wine!

this wine app talks web browsers via a web extension that is for web browsers. The web extension sends native messages to the wine app via Native Messaging Hostmodule.
My problem is starting here.

I have installed the web extension to linux version of web browsers and written bash script to call the wine app and called the bash script in JSON file that is used by Native Messaging Host module. So I have been able to call the wine app with this way. BUT, when i call the wine app, the wine app closes immediately. So, the wine app can not receive any messages and closes.
I have looked logs of the wine app and seen that is "taken close signal and program closed". I have searched and NOT found anything.
I have found only that this is Piping problem between wine and linux, and Winelib is necessay for solution

How must I do? How can I solve this problem?
Could anyone help?
savelov
Level 2
Level 2
Posts: 46
Joined: Sun Jan 10, 2010 5:46 am

Re: Native Messaging Problem between linux app and wine native app (piping linux app to wine app)

Post by savelov »

Hi, it is not clear from your description how company firewall can deny linux app but allow windows app - firewall is operating in terms of network protocols, but these apps should behave similarly in terms of network traffic. Are you saying that your company disallows downloading linux version? then as I assume you have admin rights on your PC - you can download the app yourself and install it via different network connection.
I am trying to explain that using the linux browser / linux extension route is easier to debug/fix rather than trying to try the mix of windows browsers in wine with linux externsion app
muhammedemintombak
Level 2
Level 2
Posts: 42
Joined: Tue Sep 22, 2020 6:52 am

Re: Native Messaging Problem between linux app and wine native app (piping linux app to wine app)

Post by muhammedemintombak »

savelov wrote: Tue Jan 05, 2021 3:13 am Hi, it is not clear from your description how company firewall can deny linux app but allow windows app -
the linux application can not use native messaging. So, web extensions do NOT work with linux app. The linux app uses web sockets and socket1v2 and listens port 16357 to talk to server of linux app. Our company's firewall blocks everything. We have to use certificate and proxy server to connect internet. Our company's firewall blocks communication of linux app and its server.

As the windows app talks to web browser via web extension, firewall does not see and does not deny it.
my bash script is

Code: Select all

#!/bin/sh



set -e

EBYS_DIZINI="$HOME/.ebys32"
if [ -d "$EBYS_DIZINI" ]; then
    
    env WINEPREFIX="$EBYS_DIZINI" /opt/wine-mtombak/bin/wine c:\\ProgramData\\Ark\\ArkSigner\\ArkSignerBEs.exe

fi


echo "Muhammed Emin TOMBAK"
sleep 500
exit 0

# vim: ts=2 sw=2


I can call the windows app with this, But the app closes immediately. The app does NOT talk to web extension as i have written in my topic.

I have to use linux versions of browsers and their extensions, and the wine app due to blocking of our company's firewall.
the web extensions are the same on linux and windows versions of web browsers
savelov
Level 2
Level 2
Posts: 46
Joined: Sun Jan 10, 2010 5:46 am

Re: Native Messaging Problem between linux app and wine native app (piping linux app to wine app)

Post by savelov »

I doubt you can use wine app inside web extensions API, as it was designed to prevent external applications launch and use only html/javascript
muhammedemintombak
Level 2
Level 2
Posts: 42
Joined: Tue Sep 22, 2020 6:52 am

Re: Native Messaging Problem between linux app and wine native app (piping linux app to wine app)

Post by muhammedemintombak »

savelov wrote: Tue Jan 05, 2021 4:44 am I doubt you can use wine app inside web extensions API, as it was designed to prevent external applications launch and use only html/javascript
Web extensions use Native Messaging Host module. So, they need JSON file only. I have edited JSON file as that :

Code: Select all

{
   "name": "com.ark.pw.websigner",
   "description": "ARK Teknoloji | ArkSigner Firefox Extension",
   "path": "/home/HSSGM/mtombak/.mozilla/native-messaging-hosts/ArkSignerBEsCalistir",
   "type": "stdio",
   "allowed_extensions": [
     "[email protected]"
   ]
}
ArkSignerBEsCalistir is my bash script.

I put this json file on $HOME/.mozilla/native-messaging-hosts.
Web extension send message to bash script, but the script can not send anything to wine app.
How can I use web extensions API to call the wine app?
savelov
Level 2
Level 2
Posts: 46
Joined: Sun Jan 10, 2010 5:46 am

Re: Native Messaging Problem between linux app and wine native app (piping linux app to wine app)

Post by savelov »

but having looked at arksigner architecture, there is arksignerd daemon running locally, and web extension, assuming talking to it. Have you tried running native linux arksigner and checking arksignerd logs (apparently in /logs/arksigner-service.log) to check what is causing its inability to connect? it might be that arsignerd is not configured to use the proxy that your company is requiring, in that case it is required to pass it as a configuration settings (either via HTTP_PROXY environment variable or some other way).
muhammedemintombak
Level 2
Level 2
Posts: 42
Joined: Tue Sep 22, 2020 6:52 am

Re: Native Messaging Problem between linux app and wine native app (piping linux app to wine app)

Post by muhammedemintombak »

I have spoken with Arksigner Company. they told me that the linux app can not be configured for proxy. It connects internet directly. :(
I have also tried the app with proxychains and it is fail :(
I have looked the log file. that is:

2021-01-05 13:35:49,438 INFO [default] SmartCard : ----- Configuring supported smart cards ----
2021-01-05 13:35:49,438 INFO [default] JSONP Service: -----------------------------------------------------------------------------------------------------------------------------------
2021-01-05 13:35:49,438 INFO [default] JSONP Service: ArkSignerService Started Successfully
2021-01-05 13:35:49,438 INFO [default] JSONP Service: -----------------------------------------------------------------------------------------------------------------------------------
2021-01-05 13:40:08,495 INFO [default] SmartCard : ----- Configuring supported smart cards ----
2021-01-05 13:40:08,495 INFO [default] JSONP Service: -----------------------------------------------------------------------------------------------------------------------------------
2021-01-05 13:40:08,495 INFO [default] JSONP Service: ArkSignerService Started Successfully
2021-01-05 13:40:08,495 INFO [default] JSONP Service: -----------------------------------------------------------------------------------------------------------------------------------

this is arksigner-universal.log file
2021-01-05 13:35:49,435 INFO [default] Universal: ArkSignerService Started Successfully
2021-01-05 13:35:49,435 INFO [default] Universal: -----------------------------------------------------------------------------------------------------------------------------------
2021-01-05 13:35:49,446 INFO [default] Universal: The certificate is loaded: true
2021-01-05 13:35:49,447 INFO [default] Universal: The key is loaded: true
2021-01-05 13:35:49,447 INFO [default] Universal: The intermediate certificate is loaded: true
2021-01-05 13:35:49,447 INFO [default] Universal: PW Universal WebSigner App started on port 16356
2021-01-05 13:40:08,490 INFO [default] ArkSignerUniversal Main Starting ArkSignerConn.exe application
2021-01-05 13:40:08,491 INFO [default] ArkSignerUniversal Main ArkSigner Path: /usr/bin/arksigner
2021-01-05 13:40:08,491 INFO [default] SmartCard : ----- Configuring supported smart cards ----
2021-01-05 13:40:08,491 INFO [default] Universal: -----------------------------------------------------------------------------------------------------------------------------------
2021-01-05 13:40:08,491 INFO [default] Universal: ArkSignerService Started Successfully
2021-01-05 13:40:08,491 INFO [default] Universal: -----------------------------------------------------------------------------------------------------------------------------------
2021-01-05 13:40:08,503 INFO [default] Universal: The certificate is loaded: true
2021-01-05 13:40:08,503 INFO [default] Universal: The key is loaded: true
2021-01-05 13:40:08,503 INFO [default] Universal: The intermediate certificate is loaded: true
2021-01-05 13:40:08,503 INFO [default] Universal: PW Universal WebSigner App started on port 16356
The log files do not say anything :(

The app has located in /usr/bin/arksigner folder
it has two files only that are arksigner-service and arksigner-universal.
In this folder, there are not anything about web extensions. :(
savelov
Level 2
Level 2
Posts: 46
Joined: Sun Jan 10, 2010 5:46 am

Re: Native Messaging Problem between linux app and wine native app (piping linux app to wine app)

Post by savelov »

you might need to try transaprent proxy setup via NAT, similar to below documentation, however need to ensure that both http(80) and https(443) traffic is forwarded - acceptance criteria would be that web borwser works without its own proxy configuration.

https://tldp.org/HOWTO/TransparentProxy-6.html#ss6.1

I still think that linux driver should be much easier to configure (even with these proxy settings) rather than fighting with wine browser extensions.
savelov
Level 2
Level 2
Posts: 46
Joined: Sun Jan 10, 2010 5:46 am

Re: Native Messaging Problem between linux app and wine native app (piping linux app to wine app)

Post by savelov »

@muhammedemintombak you can contact me and I think I can help you sort it out
muhammedemintombak
Level 2
Level 2
Posts: 42
Joined: Tue Sep 22, 2020 6:52 am

Re: Native Messaging Problem between linux app and wine native app (piping linux app to wine app)

Post by muhammedemintombak »

I have added you on skype. thank you very much
savelov
Level 2
Level 2
Posts: 46
Joined: Sun Jan 10, 2010 5:46 am

Re: Native Messaging Problem between linux app and wine native app (piping linux app to wine app)

Post by savelov »

this is resolved by using native arksigner application and excluding address local.pwsigner.ark-teknoloji.com from going to proxy
muhammedemintombak
Level 2
Level 2
Posts: 42
Joined: Tue Sep 22, 2020 6:52 am

Re: Native Messaging Problem between linux app and wine native app (piping linux app to wine app)

Post by muhammedemintombak »

thank @savelov to his helps.
we use linux native application. we have added local broadcast address (local.pwsigner.ark-teknoloji.com) to hosts file and exclude this address in the cntlm proxy settings.
We have not used wine application.
@savelov has helped me very much. I thank him very much
Locked