Commit graph

49 commits

Author SHA1 Message Date
Greg T. Wallace
b7026ff906 v0.5.2 2024-06-19 19:57:56 -04:00
Greg T. Wallace
703c26bd27 apcssh: add shell cmd timeout
It was possible for scanner.Scan() to block indefinitely if the UPS never returned the expected prompt regex pattern. This could occur with a UPS using a prompt format I'm not aware of, or if the UPS responds in a non-standard way.

This change ensures that Scan() is aborted after a fixed amount of blocking time and the shell cmd function accordingly returns an error.

Some error messages, comments, and var names are also updated for clarity.
2024-06-19 19:56:17 -04:00
Greg T. Wallace
841a459dca apcssh: minor log and logic clarity 2024-06-19 19:56:16 -04:00
Greg T. Wallace
f1dd079632 v0.5.1 2024-06-18 21:38:00 -04:00
Greg T. Wallace
208827f636 ssh: fix shell regex
* from ssh videos I found on youtube, the @ symbol might not be present in prompt, so make it optional
* fix typo of 0-0 instead of 0-9 (all numbers are possible in the prompt)
2024-06-18 21:30:40 -04:00
Greg T. Wallace
7bf70c4d71 ssh: switch string comps to EqualFold func 2024-06-18 21:30:39 -04:00
Greg T. Wallace
c669621bd3 install: add ssh connect log message 2024-06-18 21:30:38 -04:00
Greg T. Wallace
579419ae31 cmd: remove cmd done log msgs
remove these unncessary log messages because it says done before any returned error (which could imply it didn't error)
2024-06-06 22:52:54 -04:00
Greg T. Wallace
12c613f3b4 apcssh: remove logging
For sanity and consistency, centralize logging in the app with the app's loggers.
2024-06-06 22:52:54 -04:00
Greg T. Wallace
ce9958e422 create: always produce both p15 files 2024-06-06 22:52:54 -04:00
Greg T. Wallace
dda11df624 install: add support for native ssl command
The code should auto-select the native ssl method if the ssl command is available on the UPS.

If this fails, install will drop back to the original install method used by this tool (which works on NMC2).
2024-06-06 22:52:54 -04:00
Greg T. Wallace
06c9263bc4 ssh: breakout ups ssh to its own package
This was done for clearer separation of function. A subsequent update will (hopefully) make the SSL command more robust so it works for both NMC2 and NMC3.

The method for sending shell commands was also updated to use an interactive shell instead. This allows capturing responses of the commands which will be needed to deduce if devices are NMC2 or NMC3.
2024-06-06 22:52:54 -04:00
Greg T. Wallace
41efc56c62 ssh: clarify log error msg 2024-06-06 22:52:54 -04:00
Greg T. Wallace
7a415f5c85 v0.5.0-preview1 2024-06-06 22:52:46 -04:00
Greg T. Wallace
7dcf0f10b9 create: fix header debug file 2024-06-04 19:00:56 -04:00
Greg T. Wallace
b44b49cd19 create: add additional flag to signal creation of additional key.p15 2024-06-04 18:59:36 -04:00
Greg T. Wallace
f0253ccaf2 create: set file permissiosns to owner only 2024-06-04 18:59:36 -04:00
Greg T. Wallace
da84a7b085 debug: add base64 encoded debug files
When troubleshooting it is helpful to put the generated files into an asn1 decoder. The files can be copy/pasted easily in b64 format.

This change creates b64 files when the debug flag is set to make this process easier.
2024-06-04 18:59:36 -04:00
Greg T. Wallace
01be6ca577 add p15 key output file
The NMC Security Wizard can also produce .p15 files that contain just a private key. Add this ability to this tool.

When the `create` function is used, both files will be outputted.
2024-06-04 18:59:36 -04:00
Greg T. Wallace
ad3ee0d7f5 v0.4.2 2024-03-29 17:17:47 -04:00
k725
0476db7c35
fix usage message 2024-03-29 23:47:37 +09:00
Greg T. Wallace
15c6c6488e minor envelope reorg 2024-03-17 13:45:55 -04:00
Greg T. Wallace
49e30898c1 v0.4.1 2024-03-06 17:19:27 -05:00
Greg T. Wallace
dd246b9f14 v0.4.0 2024-02-05 18:29:06 -05:00
Greg T. Wallace
2b46f33af8 add optional webui restart 2024-02-05 18:25:55 -05:00
Greg T. Wallace
29cd44077b v0.3.3 2024-02-04 17:11:15 -05:00
Greg T. Wallace
598c4ba9f7 install: add insecure cipher options for older devices/firmwares
Requires explicit choice via flag

fixes: https://github.com/gregtwallace/apc-p15-tool/issues/1
2024-02-04 17:09:23 -05:00
Greg T. Wallace
357503382b remove empty file 2024-02-04 14:26:08 -05:00
Greg T. Wallace
7249c73214 v0.3.2 2024-02-04 11:05:04 -05:00
Greg T. Wallace
b633a357c7 add rsa 1024 support (not recommended though) 2024-02-04 10:59:58 -05:00
Greg T. Wallace
b878deaf2d add kex diffie-hellman-group-exchange-sha256 2024-02-04 10:18:21 -05:00
Greg T. Wallace
53a3bc5bd7 v0.3.1 2024-02-03 14:09:34 -05:00
Greg T. Wallace
15d8996b48 fix: only debug logging when specified 2024-02-03 14:05:21 -05:00
Greg T. Wallace
6d9878558b v0.3.0 2024-02-03 12:47:21 -05:00
Greg T. Wallace
201aedce1c simplify logging 2024-02-03 11:38:31 -05:00
Greg T. Wallace
50cc78a77e move env var prefix to config 2024-02-03 10:34:42 -05:00
Greg T. Wallace
ea3de54208 v0.2.0 2024-02-02 18:35:57 -05:00
Greg T. Wallace
b4dfb22028 scp: switch to quiet 2024-02-02 18:35:23 -05:00
Greg T. Wallace
27b7288e07 create/install: add support for key pem in args 2024-02-02 18:35:22 -05:00
Greg T. Wallace
d6bb512b3e add install only version 2024-02-02 18:35:21 -05:00
Greg T. Wallace
a089d12c87 add install function
install pem files directly to an apc ups
2024-02-02 18:35:21 -05:00
Greg T. Wallace
4c154b2f27 fix flag description 2024-02-02 18:35:21 -05:00
Greg T. Wallace
d94a10b949 cleanup extra args logging / logic 2024-02-02 18:35:20 -05:00
Greg T. Wallace
3b611b06e4 app: minor reorg
* add version number
* add more logging
* add command/subcommand
2024-01-28 11:16:26 -05:00
Greg T. Wallace
fc75922d18 write the functioning p15 file 2024-01-27 11:35:36 -05:00
Greg T. Wallace
dd6c6bd442 header: fix (needed proper type conversion) 2024-01-27 11:35:36 -05:00
Greg T. Wallace
a626d84fdb cert: finish p15 creation 2024-01-27 11:35:36 -05:00
Greg T. Wallace
1f6dad4907 key: finish key encoding and start cert 2024-01-27 11:35:35 -05:00
Greg T. Wallace
e2e4f2037c app: restructure and start building p15 output 2024-01-25 20:16:37 -05:00