Last active
August 19, 2023 11:09
-
-
Save kris-anderson/6255c1fcad8ec853e1dbd44e3c029957 to your computer and use it in GitHub Desktop.
pfSense NUT Package Fix Through Ansible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - name: get sha256sum of /usr/local/libexec/nut/usbhid-ups | |
| stat: | |
| path: /usr/local/libexec/nut/usbhid-ups | |
| checksum_algorithm: sha256 | |
| get_checksum: yes | |
| register: nut_orig | |
| - name: backup original /usr/local/libexec/nut/usbhid-ups | |
| copy: | |
| remote_src: true | |
| src: /usr/local/libexec/nut/usbhid-ups | |
| dest: /usr/local/libexec/nut/usbhid-ups.orig | |
| owner: root | |
| group: wheel | |
| mode: "0755" | |
| remote_user: root | |
| when: nut_orig.stat.checksum == "c90a4d8e39fa89f5eb62680b904845a690ee7dbaec9b105d610a3ef0fcd641d2" | |
| - name: download patched usbhid-ups | |
| get_url: | |
| url: https://forum.netgate.com/assets/uploads/files/1678659799995-usbhid-ups.gz | |
| dest: /tmp/usbhid-ups.gz | |
| owner: root | |
| group: wheel | |
| mode: "0755" | |
| remote_user: root | |
| - name: extract /tmp/usbhid-ups.gz | |
| command: gunzip -f /tmp/usbhid-ups.gz | |
| remote_user: root | |
| - name: get sha256sum of /tmp/usbhid-ups | |
| stat: | |
| path: /tmp/usbhid-ups | |
| checksum_algorithm: sha256 | |
| get_checksum: yes | |
| register: nut_new | |
| - name: copy /tmp/usbhid-ups to /usr/local/libexec/nut/usbhid-ups | |
| copy: | |
| remote_src: true | |
| src: /tmp/usbhid-ups | |
| dest: /usr/local/libexec/nut/usbhid-ups | |
| owner: root | |
| group: wheel | |
| mode: "0755" | |
| remote_user: root | |
| when: | |
| nut_new.stat.checksum == "999a2653559dbc50ecc8ba592a67587b1e307a1495f6e8ebbd3d8e90e3967133" and | |
| nut_orig.stat.checksum == "c90a4d8e39fa89f5eb62680b904845a690ee7dbaec9b105d610a3ef0fcd641d2" | |
| - name: remove /tmp/usbhid-ups.gz | |
| file: | |
| path: /tmp/usbhid-ups.gz | |
| state: absent | |
| remote_user: root | |
| - name: remove /tmp/usbhid-ups | |
| file: | |
| path: /tmp/usbhid-ups | |
| state: absent | |
| remote_user: root |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since version 23.01 of pfSense plus, some users like myself started getting spammed by disconnect messages from the pfSense NUT package.
@dennypageon Netgate's forum provided a development build of theusbhid-upspackage which addresses this issue for me and many others. You can see the original source of this fix here:https://forum.netgate.com/topic/102959/nut-package/1105?_=1685261003329
I originally fixed this manually on pfSense Plus 23.01. But after upgrading to pfSense Plus 23.05, the issue returned, and I had to track down the fix again. So I don't have to do this again, I decided to put this in Ansible so the fix will be in code and I don't need to remember in the future.
Make sure you add
user=rootto your ups.conf in the pfSense GUI for the NUT package.I have tested this on:
My UPS is a Trip Lite SMART1500LCD