Search code examples
aclhsqldb

HSQLDB server ACL takes no effect


I am trying to use HSQLDB in server mode, but cannot get the ACL to work.

I started a server (creating a fresh database) with this command line:

java -cp $CLASSPATH:/usr/share/java/hsqldb.jar org.hsqldb.server.Server --database.0 file:~/workspaces/foo/db/fooserver --dbname.0 fooserver

I can connect to it with HSQL Database Manager and issue a SHUTDOWN.

Next, I created an ACL file in ~/workspaces/foo/db/fooserver.acl with the following content:

deny 127.0.0.1

I sucessfully tested it with java -cp $CLASSPATH:/usr/share/java/hsqldb.jar org.hsqldb.server.ServerAcl ~/workspaces/foo/db/fooserver.acl, and it tells me 127.0.0.1 is denied access.

Now I created ~/workspaces/foo/db/server.properties (as there was no server.properties file yet) with the following content:

server.acl=traffserver.acl

However, when I now launch the server, I can still connect to the database.

HSQLDB version is 2.4.1, as shipped with Ubuntu 18.04.

Other things I have tried:

  • This mailing list post suggests using server.acl_filepath instead of server.acl. Behavior is still the same.
  • I have tried adding either property to fooserver.properties. Still no effect, and the property gets deleted when I stop the server.

What am I missing?


Solution

  • First of all, if you use a server.properties file which is not located in the directory where you execute the java command, you should include the path to that properties file.

    In the same scenario, in the server.properties file, you need to use the same path as you successfully tested. So it should be:

    server.acl=~/workspaces/foo/db/fooserver.acl
    

    It would be easier to specify the properties and acl files if you issue the java command from the directory that contains both files. In that case you can use a short filename instead of the full path.

    See the Guide http://hsqldb.org/doc/2.0/guide/listeners-chapt.html