Server alive

This commit is contained in:
Oystein Kristoffer Tveit 2022-11-07 15:49:46 +01:00
parent 69ee6ca858
commit 45fd9e59d5
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
6 changed files with 189 additions and 41 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
result

49
README.md Normal file
View File

@ -0,0 +1,49 @@
# Save my Dell Poweredge r710
So my r710 is dead (some disks failed or whatever).
But do you know what's even more dead?
Java Web Applets.
And idrac6 just so happens to use that in order to launch your shell...
Luckily, nixpkgs is a god damn time machine.
It can let you travel all the way back to 2015 and use the old technology stack that allows you to speak to the idrac.
## Steps
### 1. Log into idrac
idrac6 still uses TLS 1.0, which isn't really supported anymore.
I also could not find the option to allow older TLS versions in chrome, so I had to use firefox to access the idrac webpage.
- open `about:config` in the url bar
- search for the setting named `security.tls.version.min`
- set it to `1`
## 2. Download the virtual console file
Once you are there, you can click the launch button on the left side inside the "Virtual Console Preview" pane, which should download some sort of `viewer.jnlp` file (might be named slightly differently).
You must replace that file with this repos `viewer.jnlp`, because it contains a new `user`/`password` setting that lets you connect properly.
## 3. Adjust settings in flake.nix
Go into `flake.nix` and scroll down to `packages.${system}.adjustedViewer`. Here, you will find some settings that will be overwritten in `viewer.jnlp` when running the program.
## 3.5 ssh into a machine that can access your idrac
The reason i even needed to use the idrac in the first place, was that i was physically not in the same location as the machine.
Luckily, I had remembered to set up a separate raspberry pi with an ssh server, just in case something like this happened.
That way, I could forward the ports I needed to access the idrac.
SSH into your machine with access to the idrac, and port forward both the https port and the `kmport`/`vport`.
```console
ssh <pi-hostname> -p <pi-port> -L 8000:<idrac-hostname>:443 -L 5900:<idrac-hostname>:5900
```
## 4. nix run
Use the default app.
This should firstly create a modified version of `viewer.jnlp` with your updated settings from step 3.
Then it will spin up the old version of `icedtea-web` that lets you access your idrac.

23
adjust-viewer.nix Normal file
View File

@ -0,0 +1,23 @@
{
pkgs,
xmlstarlet ? pkgs.xmlstarlet,
# Usually forwarded through ssh
ip ? "localhost",
https-port ? 8000,
kmport ? 5900,
vport ? 5900,
original-viewer-path ? ./viewer.jnlp
}:
pkgs.runCommand "viewer.jnlp" {} ''
cp ${original-viewer-path} viewer.jnlp
sed -i 's|https://localhost:443|https://${ip}:${toString https-port}|g' viewer.jnlp
${xmlstarlet}/bin/xmlstarlet ed --inplace -u "/information/application-desc/ip" -v ${ip} viewer.jnlp
${xmlstarlet}/bin/xmlstarlet ed --inplace -u "/information/application-desc/kmport" -v ${toString kmport} viewer.jnlp
${xmlstarlet}/bin/xmlstarlet ed --inplace -u "/information/application-desc/vport" -v ${toString vport} viewer.jnlp
install -Dm644 -t $out viewer.jnlp
''

39
flake.lock Normal file
View File

@ -0,0 +1,39 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1667653703,
"narHash": "sha256-Xow4vx52/g5zkhlgZnMEm/TEXsj+13jTPCc2jIhW1xU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f09ad462c5a121d0239fde645aacb2221553a217",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-22.05",
"type": "indirect"
}
},
"old-nixpkgs": {
"flake": false,
"locked": {
"narHash": "sha256-6ex8oAb2JsE9w7CjjJlBaFzxNY6aG50/FfqrIYaMdt0=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/dd7e6bd97fc26b72fb6ac9e9d6f9750980fd3f56.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/dd7e6bd97fc26b72fb6ac9e9d6f9750980fd3f56.tar.gz"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"old-nixpkgs": "old-nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@ -1,26 +1,62 @@
{ {
# 1.5.2 - 2015-04-13 description = "java web applet resurrection";
# inputs.nixpkgs.url = "https://github.com/NixOS/nixpkgs/archive/df31a338dcfbbc1561905eb02224912c82a92fc7.tar.gz";
# 1.6 - 2015-08-31 inputs = {
# inputs.nixpkgs.url = "https://github.com/NixOS/nixpkgs/archive/00abee22bee06fdb57ee67cc514ab387deb186c9.tar.gz"; nixpkgs.url = "nixpkgs/nixos-22.05";
old-nixpkgs = {
flake = false;
# 1.6.1 - 2016-02-08 # See https://lazamar.co.uk/nix-versions/?channel=nixpkgs-unstable&package=icedtea-web
inputs.nixpkgs.url = "https://github.com/NixOS/nixpkgs/archive/dd7e6bd97fc26b72fb6ac9e9d6f9750980fd3f56.tar.gz";
# 1.6.2 - 2018-03-12
# inputs.nixpkgs.url = "https://github.com/NixOS/nixpkgs/archive/2c9d2d65266c2c3aca1e4c80215de8bee5295b04.tar.gz";
# 1.7.1 - 2019-06-24
# inputs.nixpkgs.url = "https://github.com/NixOS/nixpkgs/archive/4599f2bb9a5a6b1482e72521ead95cb24e0aa819.tar.gz";
outputs = { self, nixpkgs }: let # 1.5.2 - 2015-04-13
# url = "https://github.com/NixOS/nixpkgs/archive/df31a338dcfbbc1561905eb02224912c82a92fc7.tar.gz";
# 1.6 - 2015-08-31
# url = "https://github.com/NixOS/nixpkgs/archive/00abee22bee06fdb57ee67cc514ab387deb186c9.tar.gz";
# 1.6.1 - 2016-02-08
url = "https://github.com/NixOS/nixpkgs/archive/dd7e6bd97fc26b72fb6ac9e9d6f9750980fd3f56.tar.gz";
# 1.6.2 - 2018-03-12
# url = "https://github.com/NixOS/nixpkgs/archive/2c9d2d65266c2c3aca1e4c80215de8bee5295b04.tar.gz";
# 1.7.1 - 2019-06-24
# url = "https://github.com/NixOS/nixpkgs/archive/4599f2bb9a5a6b1482e72521ead95cb24e0aa819.tar.gz";
};
};
outputs = { self, nixpkgs, old-nixpkgs }: let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = import nixpkgs { inherit system; };
old-pkgs = import old-nixpkgs { inherit system; };
in { in {
packages.${system} = rec { apps.${system} = {
icedtea-web = pkgs.icedtea8_web; default = self.apps.${system}.javaws-adjusted-viewer;
default = icedtea-web; javaws = {
type = "app";
program = "${self.packages.${system}.icedtea-web}/bin/javaws";
};
javaws-adjusted-viewer = {
type = "app";
program = let
inherit (self.packages.${system}) icedtea-web adjusted-viewer;
executable = pkgs.writeShellScriptBin "javaws-adjusted-viewer"''
${icedtea-web}/bin/javaws --verbose ${adjusted-viewer}/viewer.jnlp
'';
in "${executable}/bin/javaws-adjusted-viewer";
};
};
packages.${system} = {
icedtea-web = old-pkgs.icedtea8_web;
adjusted-viewer = pkgs.callPackage ./adjust-viewer.nix {
ip = "localhost";
https-port = 8000;
kmport = 5900;
vport = 5900;
original-viewer-path = ./viewer.jnlp;
};
}; };
devShells.${system}.default = pkgs.mkShell { devShells.${system}.default = pkgs.mkShell {

View File

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<jnlp codebase="https://localhost:4443" spec="1.0+"> <jnlp codebase="https://localhost:443" spec="1.0+">
<information> <information>
<title>iDRAC6 Virtual Console Client</title> <title>iDRAC6 Virtual Console Client</title>
<vendor>Dell Inc.</vendor> <vendor>Dell Inc.</vendor>
<icon href="https://localhost:4443/images/logo.gif" kind="splash"/> <icon href="https://localhost:443/images/logo.gif" kind="splash"/>
<shortcut online="true"/> <shortcut online="true"/>
</information> </information>
<application-desc main-class="com.avocent.idrac.kvm.Main"> <application-desc main-class="com.avocent.idrac.kvm.Main">
<argument>ip=localhost</argument> <argument>ip=localhost</argument>
<argument>vmprivilege=true</argument> <argument>vmprivilege=true</argument>
<argument>helpurl=https://localhost:4443/help/contents.html</argument> <argument>helpurl=https://localhost:443/help/contents.html</argument>
<argument>title=idrac-73W805J%2C+PowerEdge+R710%2C+User%3Aroot</argument> <argument>title=idrac-73W805J%2C+PowerEdge+R710%2C+User%3Aroot</argument>
<argument>user=1804289383</argument> <argument>user=596516649</argument>
<argument>passwd=846930886</argument> <argument>passwd=1189641421</argument>
<argument>kmport=5900</argument> <argument>kmport=5900</argument>
<argument>vport=5900</argument> <argument>vport=5900</argument>
<argument>apcp=1</argument> <argument>apcp=1</argument>
@ -23,42 +23,42 @@
</security> </security>
<resources> <resources>
<j2se version="1.6+"/> <j2se version="1.6+"/>
<jar href="https://localhost:4443/software/avctKVM.jar" download="eager" main="true" /> <jar href="https://localhost:443/software/avctKVM.jar" download="eager" main="true" />
</resources> </resources>
<resources os="Windows" arch="x86"> <resources os="Windows" arch="x86">
<nativelib href="https://localhost:4443/software/avctKVMIOWin32.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctKVMIOWin32.jar" download="eager"/>
<nativelib href="https://localhost:4443/software/avctVMWin32.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctVMWin32.jar" download="eager"/>
</resources> </resources>
<resources os="Windows" arch="amd64"> <resources os="Windows" arch="amd64">
<nativelib href="https://localhost:4443/software/avctKVMIOWin64.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctKVMIOWin64.jar" download="eager"/>
<nativelib href="https://localhost:4443/software/avctVMWin64.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctVMWin64.jar" download="eager"/>
</resources> </resources>
<resources os="Windows" arch="x86_64"> <resources os="Windows" arch="x86_64">
<nativelib href="https://localhost:4443/software/avctKVMIOWin64.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctKVMIOWin64.jar" download="eager"/>
<nativelib href="https://localhost:4443/software/avctVMWin64.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctVMWin64.jar" download="eager"/>
</resources> </resources>
<resources os="Linux" arch="x86"> <resources os="Linux" arch="x86">
<nativelib href="https://localhost:4443/software/avctKVMIOLinux32.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctKVMIOLinux32.jar" download="eager"/>
<nativelib href="https://localhost:4443/software/avctVMLinux32.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctVMLinux32.jar" download="eager"/>
</resources> </resources>
<resources os="Linux" arch="i386"> <resources os="Linux" arch="i386">
<nativelib href="https://localhost:4443/software/avctKVMIOLinux32.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctKVMIOLinux32.jar" download="eager"/>
<nativelib href="https://localhost:4443/software/avctVMLinux32.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctVMLinux32.jar" download="eager"/>
</resources> </resources>
<resources os="Linux" arch="i586"> <resources os="Linux" arch="i586">
<nativelib href="https://localhost:4443/software/avctKVMIOLinux32.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctKVMIOLinux32.jar" download="eager"/>
<nativelib href="https://localhost:4443/software/avctVMLinux32.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctVMLinux32.jar" download="eager"/>
</resources> </resources>
<resources os="Linux" arch="i686"> <resources os="Linux" arch="i686">
<nativelib href="https://localhost:4443/software/avctKVMIOLinux32.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctKVMIOLinux32.jar" download="eager"/>
<nativelib href="https://localhost:4443/software/avctVMLinux32.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctVMLinux32.jar" download="eager"/>
</resources> </resources>
<resources os="Linux" arch="amd64"> <resources os="Linux" arch="amd64">
<nativelib href="https://localhost:4443/software/avctKVMIOLinux64.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctKVMIOLinux64.jar" download="eager"/>
<nativelib href="https://localhost:4443/software/avctVMLinux64.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctVMLinux64.jar" download="eager"/>
</resources> </resources>
<resources os="Linux" arch="x86_64"> <resources os="Linux" arch="x86_64">
<nativelib href="https://localhost:4443/software/avctKVMIOLinux64.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctKVMIOLinux64.jar" download="eager"/>
<nativelib href="https://localhost:4443/software/avctVMLinux64.jar" download="eager"/> <nativelib href="https://localhost:443/software/avctVMLinux64.jar" download="eager"/>
</resources> </resources>
</jnlp> </jnlp>