users@glassfish.java.net

Re: Glassfish v3, port 80, & Authbind

From: <glassfish_at_javadesktop.org>
Date: Wed, 12 Nov 2008 06:14:53 PST

According to this post:

http://sourceforge.net/mailarchive/forum.php?thread_name=46de940e0712050824r26de48emea490d6cf5eabc49%40mail.gmail.com&forum_name=privbind-devel

The JRE binary directly calls there kernel and therefore the bind(2) call interception used by authbind/privbind does not work. On my Ubuntu 8.10 64 bit I was unable to get neither Sun JDK 1.5 nor 1.6 working. With GCJ it did work. To test and reproduce:

import java.io.IOException;
import java.net.ServerSocket;

public class Bind {
    public static void main(String[] args) throws IOException {
        new ServerSocket(80).accept();
    }
}

Then do as root this:

privbind -u kurt /usr/lib/jvm/java-6-sun-1.6.0.10/bin/java -cp build/classes/ Bind
Exception in thread "main" java.net.BindException: Permission denied
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
        at java.net.ServerSocket.bind(ServerSocket.java:319)
        at java.net.ServerSocket.<init>(ServerSocket.java:185)
        at java.net.ServerSocket.<init>(ServerSocket.java:97)
        at Bind.main(Bind.java:12)
[Message sent by forum member 'kurti' (kurti)]

http://forums.java.net/jive/thread.jspa?messageID=316280