MuleSoft: Develop a Project From Behind the Firewall

DZone 's Guide to

MuleSoft: Develop a Project From Behind the Firewall

Sometimes your org's firewall can cause issues when you're trying to test or deploy an Internet connected application. This article shows how to use Mule to try to get around that.

· Integration Zone ·
Free Resource

Max prepared a demo for presales. He wanted to show that his company offered the recent technology trend, Internet of Things (IoT). Hence, he focused on the promise of enabling many applications to communicate with others over the internet. After spending a whole night, finally he finished the project. Then he went to sleep and hoped tomorrow the prospective client will be impressed.

Just a few minutes before the scheduled release, his project couldn't completely run. Errors about the internet connection. The connection request was rejected by the Firewall. He was frustrated, because everything was OK last night when he tested at home.

Max’s story might have happened to you in real life, and it happened to my team. Most developers do not realize how they connect to the internet, whether direct connection or through a firewall. It might be caused by the network infrastructure already prepared by IT support, or the development environment set by a senior or previous employee. Consequently, when facing this kind of issue, they will try to debug, review, and retest the project code. Obviously, it will not solve the issue.

This experience usually occurs in a company using a firewall. In particular, a company with an ISA firewall which requires NTLM authentication, a Microsoft security protocol that handles the user authentication service. Along with this, some applications written in Java (e.g., Anypoint Studio on the top of Eclipse, and Maven) do not support NTLM authentication natively.

To solve this issue, we need a mediator as an authentication proxy. It stands between the application and the corporate proxy, adding NTLM authentication on-the-fly1. This mediator is CNTLM, an NTLM authenticating HTTP proxy. Since all network connectivity issues will be handled by this mediator, the application, through Eclipse or Maven, only needs to be configured to connect via CNTLM.

How to Install CNTLM?2

  1. Install the latest version of CNTLM from http://cntlm.sourceforge.net.
  2. Edit the cntlm.ini
  3. This file is located in [installation folder].
  4. Add/replace the following lines:
  5. Username      company_username
    Domain           company
    Password       company_password
  6. The method above exposes our company password in the file cntlm.ini. If this makes you uncomfortable, then we can do this instead: Instead of adding 3 lines including the password, just enter 2 lines such as:
  7. Username      company_username
    Domain           company
  8. Save it.
  9. Since we did not enter the password, then we need to create hashed password. To do this, open Command Prompt and open the [installation folder].
  10. Execute the following command: cntlm –H
  11. cntlm -H

  12. Type the password and press enter.
  13. enter password

  14. Copy and paste the 3 lines into cntlm.ini
  15. PassLM          0995AB853CB1FA544AE7935149206237
    PassNT          0DC7087DD2312E5C97C8A83DA3FE88F3
    PassNTLMv2   A675EECD6EA3712844495A04472CF948    # Only for user 'company_username', domain 'company'
  16. Then add the proxy URL.
  17. Please contact IT support for the URL.
  18. Or open Forefront TMG Client >> Settings. Then copy the value from: Forefront TMG Selection.
  19. We can put more than one proxy URL.
  20. Finally, restart CNTLM by typing the following command in the Command Prompt.

    Or we can choose another alternative (and preferably if we are using Win7) to start and stop CNTLM service from Service Admin panel:

    C:\Program Files (x86)\Cntlm> net stop cntlm
    C:\Program Files (x86)\Cntlm> net start cntlm

    cntlm service

Configure Anypoint Studio

Once CNTLM is running, then we need to configure Anypoint Studio and Maven. These applications will connect to the network via CNTLM. Hence, open Anypoint Studio and then:

  1. Select Window menu >> Preferences.
  2. Type network, in the search field.
  3. Select Network Connections from the tree on the left side, then a new section will be displayed on the right side.
  4. Select Active Provider = Manual.
  5. Double click on of Proxy Entries, e.g.: HTTP, and complete the following configurations:
    • Host = localhost
    • Port = 3128 (CNTLM listens this port by default)
    • User = [company domain]\[username]
    • Password = [password]
  6. Click OK to save the configuration.
  7. cntlm mule

    For development in different network, then just change the Active Provider option in Anypoint Studio as required:

    • Direct: connect to the network without the use of proxy server
    • Manual: connect using the settings defined in Anypoint Studio
    • Native: connect using the settings defined in the OS.

Configure Maven

Assuming we have installed Maven by extracting the binary zip file from http://maven.apache.org/download.cgi to a certain [installation folder]. And also have set the following configurations:

  1. Add M2_HOME environment variable
  2. M2_HOME=C:\Program Files\Apache\Maven
  3. To modify the PATH environment variable, append the following:
  4. Then we have to add another configuration to connect to the network via CNTLM. Add the following in settings.xml inside the <proxies> … </proxies> segment. The settings.xml file is located in Maven [installation folder]/conf folder.
  5. After finishing those configurations, we can start/continue developing Mule Projects from behind the Firewall. Because the Microsoft’s related authentication which is not supported by Java-based applications, now already handled by CNTLM. So, welcome to the IoT world!


  1. CNTLM Authentication Proxy, http://cntlm.sourceforge.net
  2. Gama Ogi Prayogo for his guidance via internal company blog: How to install CNTLM
mulesoft ,mulesoft studio

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}