Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Wednesday, May 26, 2010

NTLM authentication is no longer supported by Spring Security 3.0.x

I am exploring the way to automatically authenticated on Windows platforms on Spring Security. The older way of doing this is by using the NTLM_FILTER which works with Spring Security 2.0.x.

I just realised that the NTLM filter is no longer supported in Spring Security 3.0.x. The preferred way to do authentication is using the Kerberos.

http://blog.springsource.com/2009/09/28/spring-security-kerberos/

I have stumbled upon this Kerberos authentication has since my freshmen year at university back in 1995. It should then be  I remember when using the yellow page tools on SunOS in SPARCstation  boxes; the ypbind, yppasswd, etc (renamed NIS) are Kerberos based. It's been around for years, yet I haven't had much experience in setting the configuration on the server from scratch.

Now that I have to explore this, it's time to go in depth with this Kerberos stuffs.

The Windows NT which formerly has its own authentication system, that time, began to adopting standards such as LDAP, Kerberos, etc. NTLM -- which stands for NT LAN Manager, hum, sounds very very oldies kind of stuff -- has been superseded by Kerberos based authentication. Windows 2000 started providing Kerberos authentication as an alternative. Of course since the introduction of Kerberos based system, the transition has been slow, suggesting the new user to use Kerberos by default, and only supporting NTLM when they need backward compatibility with old systems (such as Windows 98). Nevertheless there are some people is still using the NTLM on their legacy systems.

The Spring Security team has deprecated the NTLM integration and move to Kerberos based authentication (for Windows systems) instead.

Monday, March 29, 2010

Hudson Shows "No buffer space available (maximum connections reached?): JVM_Bind"

These few days we kept bumping into this "No buffer space available" issue with Hudson CI. Initially I thought it was because of we updated Hudson to the latest version and there was a kind of bug in that latest version. I reverted to the latest stable supported version in the Hudson CI website (http://hudson-ci.org). The problem didn't appear for a while, only to reappear again after a while!

Here is the capture in my browser:

I purposely put the same message as in the captured image so that search engine will be able to find when people search using the error message.

java.net.SocketException: No buffer space available (maximum connections reached?): JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.(Unknown Source)
at hudson.TcpSlaveAgentListener.(TcpSlaveAgentListener.java:91)
at hudson.model.Hudson.(Hudson.java:598)
at hudson.WebAppMain$2.run(WebAppMain.java:224)

I initially tried to find any solutions to this issue using  Google search without much luck. There are few reference on this kind of error but it happened long time ago and seemed to be unrelated to the problem we encountered.

Initially I was thinking of the user limits on Windows, something like ulimit in UNIX/Linux systems.

After 2 cups of coffee, there come the enlightenment.

It's hard to believe that this problem was caused by this (http://support.microsoft.com/kb/196271). The Hudson CI application is currently running on Windows Server 2003 box. This version of Windows Server has something called  "maximum ephemeral port number".

Quoting from this Wikipedia entry:

"Ephemeral port is a transport protocol port for Internet Protocol (IP) communications allocated automatically from a predefined range by the TCP/IP Stack Software. It is typically used by the TCP, UDP or SCTP as port for the client end of a client-server communication when the application doesn't bind the socket to a specific port number, or by a server application to free up service's well known listening port and establish a service connection to the client host. The allocations are temporary and only valid for the duration of the connection. After completion of the communication session the ports become available for reuse, although most implementations simply increment the last used port number until the ephemeral port range is exhausted."

According to the Microsoft support website:

Windows Vista and Windows Server 2008 use the IANA suggested ephemeral ports range while the Windows Server 2003 is still using port range of 1250 to 5000.

Ephemeral ports are short-lived port, chosen ad-hoc to serve. In most implementations, they usually only add the port numbers by one until get exhausted on port numbers.

May be this is just my silly thought of me, but it seems like they implemented like this pseudo-code:

[sourcecode lang="python"]
next_port_num = 1250

def get_next_ephemeral_port_num():
result = next_port_num
next_port_num = next_port_num + 1
if next_port_num > 5000:
raise ValueError('no buffer space available')
return result
[/sourcecode]

I wasn't really sure that it is the cause of the problem, but I guess no kangaroo being harmed in the making of the game, so I tried it anyway.

The remedy was simply, run the Registry Editor in the Administrator privilege, open  the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters and create new DWORD entry, "MaxUserPort", fill with 65534.

The result, after 2 days monitoring, Hudson is still running well.

NOTE:
  • It seems that the problem happens to this specific version of Windows (Windows Server 2003)
  • I haven't been able to reproduce this problem on another platforms

Thursday, July 17, 2008

Apache Tomcat 6.0 Cannot Undeploy Correctly

This 3 months I have been using Tomcat 6.0 for deployment, and one thing that I don't like is that the application server needs to be restarted most of the time when deploying. I remember that this is not the case with my previous development. I thought it was because the Tomcat 6.0. Later I found out that the problem is with the struts-core-1.3.9.jar library.

Several attempts have been made to use the antiJARLocking and antiResourceLocking features of Tomcat. All ends up in futility.

The struts-core-1.3.9.jar (as well as version 1.3.5, 1.3.8) as setup by maven 2 dependency, depends on the Apache commons-digester-1.8.jar. This version (1.8) of the commons-digester library has this bug specific to Windows environment.

There are some workarounds that is possible:

  • Upgrade to higher version of Struts (in the case of my current work, we are moving to struts2 which known not to have this problem)

  • Override the maven 2 dependency, and inject a new dependency to higher version of commons-digester library


First option is obvious, the next will be a bit tricky.
I will show you how to do it later...

Saturday, August 18, 2007

No TELNET Client in Vista!?

Changing job always needs adjustments.
One of the most annoying thing is that you have to backup all your data, return your notebook to the office, and move the data to your new notebook. I moved to my personal notebook, cos starting from now I will be working on office's PC.
For me, I had an additional tasks, as I have to buy a new notebook. Making backup of all your data you have accumulated for more,than 1 year itself quite a tricky stuff. I have settled on the XP Professional, have a virtualized OpenSolaris 11 (Nevada) and CentOS 5, WebLogic 8.1 and WebLogic 9.2 installations along with the domains, and tons of codes personal stuffs to move.
My choice eventually fell on dual core Turion64 based Fujitsu lifebook. Large clear screen, economic, no camera, but I like it. Fujitsu also invented smart battery management and shock prevention software for hard drives.
One of the thing, is that latest computers only offer Vista. Mine is bundled with Vista Home Premium. It is much like changing platform from Linux to OpenSolaris. Lots of homeworks to do before you could run it so well.
Last week when I tried to work on with Tomcat, but my browser don't show anything. I need to check whether Tomcat service is available on the default port 8080. Then suddenly I found out that THERE IS NO TELNET CLIENT in Windows Vista! I checked the PATH variable, seems to be okay.
Then I googled around, and found out that TELNET client is disabled by default on Windows Vista!
You need to set it up like this, go to Control Panel:
Control Panel > Programs and Features > Turn Windows features on or off > Telnet client
Turn it on.
Amazingly, it took more than 10 minutes just to enable TELNET client! I got no idea why it took so long to enable such a simple trivial client application.
Later on I found out the reason why Tomcat not yet listening to port 8080. Vista blocked the port and asking for permission to listen to that port. This happens only the first time you run your Tomcat instance. If you enable client access feature, you need to reply to this kind of quite-annoying-prompts. Anyway I must be getting used to it.
Voila, Tomcat works again.