Response from bluetooth OBEX connect request is HTTP Not Acceptable - bluetooth

I'm using nObex on Windows to create a Obex connection to an android phone over bluetooth. As library I'm using nObex https://github.com/nccgroup/nOBEX
AF_BLUETOOTH is under windows not available, whereas I'm using pybluez to create the connection.
Authentication works fine, on the phone I have to accept that I get access to the file system. When I'm trying to create the OBEX connection:
b'\x80\x00\x0e\x10\x00\xff\xffF\x00\x071106'
|opcode for connect = 0x80| length = 0x000e|obex version = 0x10 = 16| flags = 0x00| max obex message length = 0xffff| length header = 0x0007| profile = 1106
I'm getting the following response:
b'\xc6\x00\x0c\x10\x00\xff\xfe\xcb\x00\x00\x00\x01'
\xc6 = 198 is the flag for "HTTP Not Acceptable"
Does anybody understands, why I'm not able to get a connection?

For MAP and FTP Profiles the target ID must be added. I used for this the UUID which is wrong.
The target ID for the Message Access service (MAS) can be found in the MAP document (https://www.academia.edu/32372957/MESSAGE_ACCESS_PROFILE) on page 64

Related

How to control UserID in pymqi?

Got a trouble:
IBM MQ Server v9.1.0.0
pymqi==1.11.1
When trying connect to server got an error:
pymqi.MQMIError: MQI Error. Comp: 2, Reason 2035: FAILED: MQRC_NOT_AUTHORIZED
When I check traffic in Wireshark i got that:
And in server log this:
07/31/2020 10:08:02 AM - Process(27333.5) User(mqm) Program(amqrmppa)
Host(host) Installation(Installation1)
VRMF(9.1.0.0) QMgr(queue_manager)
Time(2020-07-31T07:08:02.253Z)
ArithInsert1(2) ArithInsert2(2035)
CommentInsert1(haha)
AMQ9557E: Queue Manager User ID initialization failed for 'haha'.
EXPLANATION:
The call to initialize the User ID 'haha' failed with CompCode 2 and Reason
2035. If an MQCSP block was used, the User ID in the MQCSP block was ''.
ACTION:
Correct the error and try again.
My code sample:
import pymqi
host = "host"
port = 1416
conn_info = f"{host}({port})"
channel = "channel"
queue_manager = "queue_manager"
def main():
manager = pymqi.connect(queue_manager=queue_manager, channel=channel, conn_info=conn_info)
if __name__ == '__main__':
main()
I tried to execute the code from other devices and there, accordingly, the account under which I ran was taken as the UserID.
After that I asked our support to deal with the problem, after which I was able to connect with an account haha, but the solution with the creation of a list of allowed users does not suit me. Is there any way to control the UserID that is sent by pymqi?
UPD 04.08.2020
The support team said that the user phoenix was created on the IBM MQ server with the password 123456789, tried to send an MQSCP:
manager = pymqi.connect(queue_manager=queue_manager, channel=channel,
conn_info=conn_info, user="phoenix", password="123456789")
And got similar error MQRC_NOT_AUTHORIZED and server log contains error as above with username of machine where code launches (not phoenix).

Azure Point to Site VPN with Basic SKU not working on Windows 10 (ErrorCode = 720 ErrorSource = RAS)

I am trying to connect to Azure vNET Gateway and I am not having success. It ends with ErrorCode = 720 ErrorSource = RAS. Anyone experienced this issue before for the following scenario?
Azure vNET Gateway configured with Basic SKU.
VpnStrategy is SSTP for Windows 10
Authentication: Client certificate (self signed)
Both the root and client certificates are in current user personal store. They are resolved ok.
Root cert is stored in trusted root path of current user
Root cert is saved in Azure vpn gateway user configuration without line breaks
Don't wish to create other SKU to save $$ on poc
Deleted all the WAN Miniport adapters and rebooted the machine with no success. They get recreated automatically
I can't share certificates (root or client) in this forum since I am revealing the vpn gateway endpoint in the logs (for security reason)
Event logs from local machine in the order of execution:
CoId={3285D778-432A-4746-B74C-8B95FECEB53E}: The user SYSTEM has started dialing a Connection Manager connection using a per-user connection profile named az-aks-vnet-v2. The connection settings are:
Dial-in User = P2SDemoClientCert
VpnStrategy = SSTP
DataEncryption = Require
PrerequisiteEntry =
AutoLogon = No
UseRasCredentials = Yes
Authentication Type = EAP <Microsoft: Smart Card or other certificate>
Ipv4DefaultGateway = No
Ipv4AddressAssignment = By Server
Ipv4DNSServerAssignment = By Server
Ipv6DefaultGateway = Yes
Ipv6AddressAssignment = By Server
Ipv6DNSServerAssignment = By Server
IpDnsFlags =
IpNBTEnabled = Yes
UseFlags = Private Connection
ConnectOnWinlogon = No.
CoId={3285D778-432A-4746-B74C-8B95FECEB53E}: The user SYSTEM is trying to establish a link to the Remote Access Server for the connection named az-aks-vnet-v2 using the following device:
Server address/Phone Number = azuregateway-b80c0077-e69d-4f0c-8f50-baa0c7a6e23e-0fe0aceeddbb.vpn.azure.com
Device = WAN Miniport (SSTP)
Port = VPN1-1
MediaType = VPN.
CoId={3285D778-432A-4746-B74C-8B95FECEB53E}: The user SYSTEM has successfully established a link to the Remote Access Server using the following device:
Server address/Phone Number = azuregateway-b80c0077-e69d-4f0c-8f50-baa0c7a6e23e-0fe0aceeddbb.vpn.azure.com
Device = WAN Miniport (SSTP)
Port = VPN1-1
MediaType = VPN.
CoId={3285D778-432A-4746-B74C-8B95FECEB53E}: The link to the Remote Access Server has been established by user SYSTEM.
CoId={3285D778-432A-4746-B74C-8B95FECEB53E}: The user SYSTEM dialed a connection named az-aks-vnet-v2 which has failed. The error code returned on failure is 720.
VPN logs:
******************************************************************
Operating System : Windows NT 10.0
Dialer Version : 7.2.18362.1
Connection Name : az-aks-vnet-v2
All Users/Single User : Single User
Start Date/Time : 6/22/2020, 10:31:31
******************************************************************
Module Name, Time, Log ID, Log Item Name, Other Info
For Connection Type, 0=dial-up, 1=VPN, 2=VPN over dial-up
******************************************************************
[cmdial32] 10:31:31 03 Pre-Init Event CallingProcess = C:\WINDOWS\system32\rasautou.exe
[cmdial32] 10:31:40 04 Pre-Connect Event ConnectionType = 1
[cmdial32] 10:31:40 06 Pre-Tunnel Event UserName = P2SDemoClientCert Domain = DUNSetting = b80c0077-e69d-4f0c-8f50-baa0c7a6e23e Tunnel DeviceName = TunnelAddress = azuregateway-b80c0077-e69d-4f0c-8f50-baa0c7a6e23e-0fe0aceeddbb.vpn.azure.com
[cmdial32] 10:31:42 21 On-Error Event ErrorCode = 720 ErrorSource = RAS
Thanks in advance for the help.
The problem is resolved, I just needed a break from computer and take a long evening walk! This is what I did to fix the problem-
Open Device Manager
Go to Network Adapters
Uninstall all the adapters name starts with "WAN Miniport". Repeat the step for every “WAN Miniport driver” installed
I didn't reboot the machine.
Right click “Network adapters” and select “Scan for hardware changes”
All of the WAN Miniport adapters will reappear immediately
I was able to connect to the VPN Gateway after the above steps and connect to VM with private ip.
Thanks to svenvdveen for the solution with the exception of no reboot. I followed the same instruction (twice) before and I rebooted the machine but didn't have luck!
I ran into a similar issue with Azure Basic Gateway.
For anyone reading this, I suggest you start by simply uninstalling the Wan Miniport (Ikev2). Then try to connect to your VPN again. It worked in my case :).
(Windows 11)

Connection configuration loops - Prosys OPC UA Client

I'm using sample codes from documentation and I'm trying to connect to server using Prosys OPC UA Client. I have tried opcua-commander and integration objects opc ua client and it looks like server works just fine.
Here's what is happening:
After entering endpointUrl, client adds to url -- urn:NodeOPCUA-Server-default.
Client asks to specify security settings.
Client asks to choose server - only 1 option and it's urn:NodeOPCUA-Server-default.
And it goes back to step 2 and 3 over and over.
If I just minimize prosys client without closing configuration after some time I get this info in terminal:
Server: closing SESSION new ProsysOpcUaClient Session15 because of timeout = 300000 has expired without a keep alive
\x1B[46mchannel = \x1B[49m ::ffff:10.10.13.2 port = 51824
I have tried this project and it works -> node-opcua-htmlpanel. What's missing in sample code then?
After opening debugger I have noticed that each Time I select security settings and hit OK, server_publish_engine reports:
server_publish_engine:179 Cencelling pending PublishRequest with statusCode BadSecureChannelClosed (0x80860000) length = 0
This is due to a specific interoperability issue that was introduced in node-opcua#0.2.2. this will be fixed in next version of node-opcua. The resolution can be tracked here https://github.com/node-opcua/node-opcua/issues/464
The issue has been handled at the Prosys OPC Forum:
The error happens because the server sends different
EndpointDescriptions in GetEndpointsResponse and
CreateSessionResponse.
In GetEndpoints, the returned EndpointDescriptions contain
TransportProfileUri=http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary.
In CreateSessionResponse, the corresponding TransportProfileUri is
empty.
In principle, the server application is not working according to
specification. The part 4 of the OPC UA specification states that “The
Server shall return a set of EndpointDescriptions available for the
serverUri specified in the request. … The Client shall verify this
list with the list from a DiscoveryEndpoint if it used a
DiscoveryEndpoint to fetch the EndpointDescriptions. It is recommended
that Servers only include the server.applicationUri, endpointUrl,
securityMode, securityPolicyUri, userIdentityTokens,
transportProfileUri and securityLevel with all other parameters set to
null. Only the recommended parameters shall be verified by the
client.”

Trouble connecting NodeMCU to Microsoft Azure IoT Hub

I am trying to connect my ESP8266, running the latest NodeMCU build, to a Microsoft Azure IoT Hub via MQTT Protocol.
It appears that this is possible, as it is shown here...
http://thinglabs.io/workshop/esp8266/sending-d2c-messages/
I am using the correct syntax as far as I can see from the MS Azure help...
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-mqtt-support
Unlike the example in ThingLabs, which creates a SAS token using NodeMCU, I have followed the MS document and generated a SAS token using the Device Explorer, for testing purposes.
My LUA code is as follows...
-- Create variables
DEVICE = "testdevice"
IOTHUB = "mynewiothub.azure-devices.net"
PORT = 8883
USER = IOTHUB.."/"..DEVICE.."/api-version=2016-11-14"
PASS = "SharedAccessSignature sr=mynewiothub.azure-devices.net%2Fdevices%2Ftestdevice&sig=Roa5P8BPiGj...v2Vu%2Bm1j9sas%3D&se=1485704099"
-- Create an MQTT Client
azure = mqtt.Client(DEVICE, 60, USER, PASS)
-- Connect to IoTHub via MQTT
azure:connect(IOTHUB, PORT, 1, 0,
-- Callback for a successful connection
function(client)
print("Connected")
end,
-- Error callback, if connection fails
function(client, reason)
print("Error Connecting: "..reason)
end
)
The response is always Error Connecting: -5 which translates to "There is no broker listening at the specified IP Address and Port".
I suspected that NodeMCU was struggling with the SSL (port 8883) connection. So I ensured that I was able to make HTTPS connections (after verifying the SSL root certificate) with the following code, this worked but did not help.
http.get("https://example.com/info", nil,
function (code, resp)
print(code, resp)
end)
I cannot seem to get this to work! #Marcel Stör - any thoughts?
Many thanks in advance.
I had the same error Error Connecting: -5 , I have set the time on the ESP and it fix this error.
You will find some information about sntp on http://thinglabs.io/workshop/esp8266/sending-d2c-messages/ (as you mention it).

WinCE: 10053 error during connect

I wrote a Bluetooth client program for a wince 4.2 device. The device discovery works fine. However, when I attempt to connect to a PC, the connect function immediately returns with error code 10053. The connection request was being processed by the PC with a prompt to enter the authentication code but the wince device doesn’t seem to wait.
What could be causing this issue? I am using the following steps (removed error handling for simplicity):
WSAStartup(..)…////was successful.
SOCKET m_Socket =Socket (AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM); //was successful.
SOCKADDR_BTH sClinet;
memset (&sClinet, 0, sizeof(sClinet));
sClinet.addressFamily = AF_BTH;
sClinet.btAddr = btd.btaddr; ; //BT_ADDR of the PC obtained via Device Discovery..
sClinet.port = BT_PORT_ANY; //I did try 0, did not help!
sClinet.serviceClassId = RFCOMM_PROTOCOL_UUID;
int nConErr = connect (m_Socket, (SOCKADDR *)&sClinet, sizeof(sClinet));
nConErr returns 10053 immediately. It doesn’t even wait, even though the PC recognized the connection and prompted a message to enter the PIN for authentication.
From what you are describing it looks like it is a pairing/authentication problem. You should consider in using also setsockopt function: http://msdn.microsoft.com/en-us/library/ms863347.aspx
You should try to use SO_BTH_AUTHENTICATE option which according to MSDN:
On connected socket, triggers authentication. On not connected socket, forces authentication on connection. For incoming connection this means that connection is rejected if authentication cannot be performed.
So before calling connect function you should set options to your socket.

Resources