Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HP ilo3 generates the jnlp file on the fly through javascript - this may not be supported #25

Open
kostecky opened this issue Mar 4, 2024 · 7 comments

Comments

@kostecky
Copy link

kostecky commented Mar 4, 2024

I'm not sure if you've come across this before but in the HP ilo3 IPMI, these jnlp files are dynamically generated from javascript and then the browser saves the file. It's not a static download. This looks as though it might work if I just get this last part working! I managed to figure out the remaining options to set.

Is there any workaround for this? I have the format of the file where you just need to replace the variables that are ${} or $

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="$ILO_ADDRESS" href="">
<information>
    <title>Integrated Remote Console</title>
    <vendor>HPE</vendor>
    <offline-allowed></offline-allowed>
</information>
<security>
    <all-permissions></all-permissions>
</security>
<resources>
    <j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se"></j2se>
    <jar href="${ILO_ADDRESS}${ILO_JAR}" main="false" />
</resources>
<property name="deployment.trace.level property" value="basic"></property>
<applet-desc main-class="com.hp.ilo2.intgapp.intgapp" name="iLOJIRC" documentbase="${ILO_ADDRESS}html/java_irc.html" width="1" height="1">
    <param name="RCINFO1" value="$ILO_SESSKEY"/>
    <param name="RCINFOLANG" value="en"/>
    <param name="INFO0" value="7AC3BDEBC9AC64E85734454B53BB73CE"/>
    <param name="INFO1" value="17988"/>
    <param name="INFO2" value="composite"/>
</applet-desc>
 <update check="background"></update>
</jnlp>
@Jeff-liaojinfu
Copy link

Jeff-liaojinfu commented Mar 4, 2024 via email

@kostecky
Copy link
Author

kostecky commented Mar 4, 2024

Thank you!

@kostecky
Copy link
Author

kostecky commented Mar 4, 2024

Maybe something like this for the docker py script, - although it would add HP specific ilo code in this and the python libraries would have to be modified to pass these options. I'll await your response! Have a good day.

def get_java_viewer(
    hostname,
    skip_login,
    user,
    password,
    download_location,
    login_endpoint,
    download_endpoint,
    ssl_verify,
    user_attribute_name,
    password_attribute_name,
    extra_form_fields=None,
    format_jnlp=False,
    use_json=False,
    session_cookie_key=None,
    session_only=False,
    generate_jnlp=False,  # New parameter to control JNLP generation
    ilo_jar="html/intgapp3_231.jar",  # Default value for iLO jar file
):
    # Your existing function code up until the JNLP handling part

    if generate_jnlp:
        # Generate JNLP content using provided details
        jnlp_template = f"""<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="{hostname}" href="">
    <information>
        <title>Integrated Remote Console</title>
        <vendor>HPE</vendor>
        <offline-allowed></offline-allowed>
    </information>
    <security>
        <all-permissions></all-permissions>
    </security>
    <resources>
        <j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se"></j2se>
        <jar href="{hostname}/{ilo_jar}" main="false" />
    </resources>
    <applet-desc main-class="com.hp.ilo2.intgapp.intgapp" name="iLOJIRC" documentbase="{hostname}/html/java_irc.html" width="1" height="1">
        <param name="RCINFO1" value="{session_cookie_key}"/>
        <param name="RCINFOLANG" value="en"/>
    </applet-desc>
    <update check="background"></update>
</jnlp>"""
        # Write the JNLP content to a file
        with open(download_location, "w") as f:
            f.write(jnlp_template)
        logging.info("Generated JNLP file.")
    else:
        # Your existing code for downloading the JNLP file

    # Any additional function code

@IngoMeyer441
Copy link
Member

We had a similar issue before: #22
IMHO, this could only be solved in a general way if nojava-ipmi-kvm would include a JavaScript engine, but this is probably a bit over the top. But if you know the template which is used for the jnlp generation, this should work. To keep it general, it would probably be better to reference the template in the nojava-ipmi-kvm configuration file. This way, users could use different templates without changing the source code.

@kostecky
Copy link
Author

kostecky commented Mar 4, 2024

OK, I managed to get this working! However, once I VNC in, the java applet runs, downloads jar, good stdout, but the window that should display the console is just white. It does have the proper header as I"m used to, but no video =(

Any ideas? The dreaded xprop error =(

java.security.AccessControlException: access denied ("java.io.FilePermission" "/usr/bin/xprop" "execute")

2024-03-04 18:11:49,575 DEBG 'javaws' stdout output:
No video. image_source = java.awt.image.MemoryImageSource@4d08b705
2024-03-04 18:11:49,575 DEBG 'javaws' stdout output:


2024-03-04 18:11:59,258 DEBG 'javaws' stdout output:
Moving Power to ON state
2024-03-04 18:11:59,270 DEBG 'javaws' stdout output:

@IngoMeyer441
Copy link
Member

Do you usually use Oracle Java or the OpenJDK? Some KVM consoles do not work without Oracle Java 😢

@kostecky
Copy link
Author

kostecky commented Mar 4, 2024

That was it. I had to use 8u211!!!

Thank you so much. Now I have to document all my changes and keep this forever ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants