Class RogueJMX

  • All Implemented Interfaces:
    Remote, RMIServer

    public class RogueJMX
    extends Object
    implements RMIServer
    The RogueJMX class implements a rogue JMX server that displays used credentials from incoming JMX connections. The incoming connections can optionally be forwarded to a real JMX server which makes the rogue JMX server invisible for a client and does not interrupt any services.
    Author:
    Tobias Neitzel (@qtc_de)
    • Constructor Detail

      • RogueJMX

        public RogueJMX​(String address,
                        int port,
                        String objIDString)
        Constructor requires the address where the rogue JMX server is bound and the listening port.
        Parameters:
        address - Address where the rogue JMX should be bound
        port - Port where the rogue JMX should listen
        objIDString - the ObjID to use
    • Method Detail

      • export

        public Remote export()
                      throws RemoteException
        Export the rogue JMX server. This makes the server available via TCP on the address and port that were specified during creation of the server. A serialization filter that only accepts the String class is used during the export. This is the same filtering that is applied for the default JMX server and incoming credentials are expected to be an array of String (String[]). When using the server for other JMX implementations, you may need to modify the filter. It is important to notice that serialization filters were backported to Java8 and earlier in an incompatible way compared to Java9+ projects. Whereas in Java9+ the ObjectInputFilter class is located within the java.io package, Java8 and earlier contains it within the sun.misc package. This makes it basically impossible to write cross compatible code without using reflection. Therefore, the RMGUtils class is used for creating and injecting the serialization filter.
        Returns:
        Remote bound RogueJMX server
        Throws:
        RemoteException - internal error
      • forwardTo

        public void forwardTo​(RemoteObjectClient client)
        Register a forward target in form of a RemoteObjectClient.
        Parameters:
        client - RemoteObjectClient that points to a remote JMX service
      • newClient

        public RMIConnection newClient​(Object credentials)
                                throws IOException
        Incoming JMX connection that may contains credentials. Attempts to parse the credential object and display user credentials. Optionally forwards the connection to a remote JMX service (if specified). If no forward target was specified, raise a SecurityException (failed login from the client perspective).
        Specified by:
        newClient in interface RMIServer
        Throws:
        IOException