Karaf
  1. Karaf
  2. KARAF-132

The user name for the main console session is always "karaf"

    Details

    • Type: Bug Bug
    • Status: In Progress
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2.4
    • Fix Version/s: 4.0.0, 3.0.2
    • Component/s: karaf-shell
    • Labels:
      None

      Description

      See org.apache.karaf.shell.console.jline.ConsoleFactory#start

                  CommandSession session = console.getSession();
                  session.put("USER", "karaf");
                  session.put("APPLICATION", System.getProperty("karaf.name", "root"));
                  session.put("LINES", Integer.toString(terminal.getTerminalHeight()));
                  session.put("COLUMNS", Integer.toString(terminal.getTerminalWidth()));
                  session.put(".jline.terminal", terminal);
                  new Thread(console, "Karaf Shell Console Thread").start();
      
      1. patchfile.txt
        0.9 kB
        Tracy Snell

        Activity

        Hide
        Tracy Snell added a comment -

        Just needs to change that line to get the username right?

        
                    session.put("USER", System.getProperty("user.name"));
        
        Show
        Tracy Snell added a comment - Just needs to change that line to get the username right? session.put( "USER" , System .getProperty( "user.name" ));
        Hide
        Łukasz Dywicki added a comment -

        Committed r1053665.

        Show
        Łukasz Dywicki added a comment - Committed r1053665.
        Hide
        Guillaume Nodet added a comment -

        Not sure what real value the current fix brings.
        The idea was more to be able to have the default user configurable in a way that would allow connect to other karaf instances (like child instances managed by the admin shell) by having a way to specify the default user, not really by using the system user name.

        Show
        Guillaume Nodet added a comment - Not sure what real value the current fix brings. The idea was more to be able to have the default user configurable in a way that would allow connect to other karaf instances (like child instances managed by the admin shell) by having a way to specify the default user, not really by using the system user name.
        Hide
        Andreas Pieber added a comment -

        This is connected to KARAF-348, isn't it?

        Show
        Andreas Pieber added a comment - This is connected to KARAF-348 , isn't it?
        Hide
        Guillaume Nodet added a comment -

        No, KARAF-348 is about the instance name. This one is about the user name.
        The default prompt is "karaf@root" where "karaf" is the user name and "root" is the instance name.
        The attached patch changes the user name from "karaf" to the system user name (your OS user name).
        Using this value is just as arbitrary as using karaf.

        My idea was more to be able to change the default user name, but it is also slightly related to KARAF-356, but more importantly to KARAF-32.
        It would make sense to use the current system user name if we could reuse the running SSH agent to do/forward the authentication.

        Show
        Guillaume Nodet added a comment - No, KARAF-348 is about the instance name. This one is about the user name. The default prompt is "karaf@root" where "karaf" is the user name and "root" is the instance name. The attached patch changes the user name from "karaf" to the system user name (your OS user name). Using this value is just as arbitrary as using karaf. My idea was more to be able to change the default user name, but it is also slightly related to KARAF-356 , but more importantly to KARAF-32 . It would make sense to use the current system user name if we could reuse the running SSH agent to do/forward the authentication.
        Hide
        Jean-Baptiste Onofré added a comment -

        We should detect the first valid user from the security framework (as the user may use the users.properties, but also a LDAP or JDBC backend), and populate the session/branding with this user, and eventually fallback to Karaf.

        Show
        Jean-Baptiste Onofré added a comment - We should detect the first valid user from the security framework (as the user may use the users.properties, but also a LDAP or JDBC backend), and populate the session/branding with this user, and eventually fallback to Karaf.

          People

          • Assignee:
            Jean-Baptiste Onofré
            Reporter:
            Guillaume Nodet
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development