Diagnosing MSMQ Access Errors with NServiceBus - msmq

Does anyone know of a decent way of diagnosing MSMQ access errors. I'm using NServiceBus in a web application. There is a service running that actually creates the private queues, and the web application sends messages to that queue.
The web site uses anonymous access, and the application pool runs using the Network Service account. When my application tries to send a message to the queue (using NServiceBus), I get MSMQ access denied errors. I have tried all combinations of full control with ANONYMOUS LOGON, Everyone, etc, and still no luck. I have tried deleting the queues and letting NServiceBus recreate them, and still no luck.
When I set the IIS App Pool to run using a local administrator account, then it all works fine. How can I work out exactly what permissions I need to apply? Using the accounts/permissions that are added by default clearly isn't working.

You need to set up the queue permissions so that "everyone" can send to any queue.

Related

Sophos UTM VPN not accessible

I used the Sophos UTM 9.510 ha_standalone Cloudformation template (https://github.com/sophos-iaas/aws-cf-templates/blob/master/utm/9.510/standalone.template) and used defaults when possible. I did not use an existing ElasticIP, so it created it's own at (scrubbed) 50.12.12.123.
I gave a hostname at (for example) vpn.example.com and after creation, I created an A record for vpn.example.com to point to 50.12.12.123.
I don't have a license and just pay hourly for the AMI.
I understand that I should be able to hit https://vpn.example.com:4444 or https://50.12.12.123:4444 to see the admin panel. However, it times out and doesn't load anything.
When I deployed the stack, I got an email at the admin email I provided and it said REST daemon not running - restarted. I assume it restarted fine, since I have received no new emails, and the EC2 instance is running.
Has anyone else experienced this? Is there a step I'm missing? Aside from creating the Route53 record, I thought the Cloudformation Template should just work right out of the box.
The default security groups blocked traffic. I modified one of them to accept all traffic and the dashboard became accessible. I will now refine access further.

Connecting to remote MSMQ

I'm writing my first application using MSMQ and everything works well with local queues on my development machine. I cannot seem to connect to a remote queue when I tested it.
I have 10 Windows 10 Pro installation (not domain joined, but I have also tried this on two domain joined machines), both with MSMQ installed. I have disabled the firewall on both machines, unchecked the 'Disable un-authenticated RPC calls" on both machines. Changed the permissions on the queue to full control for everyone and anonymous.
I'm using .NET and the system.messaging namespace. When I call the messagequeue constructor, I can see that most of the properties are in a exception state.
VB code New MessageQueue("FormatName:Direct=TCP:x.x.x.x\private$\test")
I found an article detailing a registry entry NewRemoteReadServerAllowNoneSecurityClient I thought might work but got the same result. I'm sure this is some sort of security issue but I have no idea what I'm doing wrong.
Anyone have any ideas? Seems like this should be much easier than I am experiencing.

Find out which program reads from a given MSMQ queue

I have a queue that should only be read by a specific program. However, I have discovered that some other program is "stealing" messages from that queue. Is there a way to determine which program does that? I couldn't come up with anything.
For a given service account, set read-message and peek-message permissions on the queue, and then ensure that only the consumer runs under that service account.
UPDATE
On Windows server 2008 or Windows 7 or higher, MSMQ has a dedicated system event log which records everything the MSMQ subsystem does. It may be possible to see what user account is accessing the queue via this.

How to reset MSMQ permissions after changing domains

What considerations should be addressed when moving a Microsoft 2003 server with MSMQ installed to another domain?
We assigned permissions to the queue for a user account from the new domain. We still get an error "Access to Message Queing system is denied."
There are no other servers in the new domain running MSMQ. Is there an Active Directory object that gets created when MSMQ is installed on a member server?
The issue has been resolved. The problem was with a private queue created by our application. That explains why we didn't see any AD object created. Using domain admin credentials, we tried to modify the permissions on the private queue using the MMC snapin. We got an error and could not make the required change because the domain admin was not on the ACL for that queue. We found a work around to the problem. We created a new temporary private queue and assigned full control to the user account we need for our application. We located the newly created private queue configuration file in the \system32\msmq\storage\lqs directory. We opened the file and copied the entire security line. Then we opened the configuration file for the private queue we are trying to fix and pasted the security line over the same line in that file. We saved the configuration file. We restarted the MSMQ service and then started our application service. The application could now function properly. Thanks everyone for your help!
If the domain is in a different forest and you wish to make use of public queues, etc. then you will need to reinstall MSMQ so that all the MSMQ objects are created in AD.
What exact operation generates "Access to Message Queing system is denied."?
If you don't have any messages or journal history that you need to save, I would suggest uninstalling and reinstalling MSMQ.
Have you logged into the server directly using the account that is trying to send the message? This is necessary to establish a message queuing certificate, a little understood and poorly documented area of MSMQ.
We also found another easier way to reset the permissions on the private queue. Instead of modifying the private queue configuration file, we took ownership of the private queue as the domain admin, assigned full permissions to the user account needed for our application, and transfered ownership to the same user. This restored the private queue to the state it was in prior to the server move.

MSMQ - Create and Send Message

I have a public queue created in a remote machine. I am able to access the queue, create a message and send it from my workstation. However, when I access the remote machine that hosts the message queue, I do not see any messages. Any ideas on what I am missing? Is there anything that need to be configured to receive messages?
You should check the security settings on the remote queue - the default setting for any account is "allow sending only".
I got it to work by removing MessageQueueTransactionType.Single from MessageQueue.Send(message,MessageQueueTransactionType.Single) method.
It Seems like there was a mismatch between the Transaction types. I am still not familiar how the transaction types work.