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

Open ports? #1

Closed
mcfrojd opened this issue Nov 27, 2022 · 7 comments
Closed

Open ports? #1

mcfrojd opened this issue Nov 27, 2022 · 7 comments
Labels
question Further information is requested

Comments

@mcfrojd
Copy link

mcfrojd commented Nov 27, 2022

Hi im trying out this script after hearing about it from Techno Tim youtube channel.
After running the script everything seems to work fine, i can access the 3 webpages with information.

But when trying to connect with Windows NUT Client or when trying to add the server into Home-Assistant i dont seem to be able to connect.

All devices is on the same network, and if i run the windows tool "Advanced Port Scanner" it says only port 22 & 80 is open.

I installed the script on a Raspberry Pi 3b+ with a PoE hat, running Pi OS Lite (64-bit)

The UPS is an "APC Back-UPS 850 BE850G2-GR UPS" in my livingroom.

I have another "APC Back UPS Pro - BR900MI - UPS 900VA" in my serverrack that is connected to my Synology NAS (that have an internal NUT server) and this one is working in Home-Assistant, and i can see that the port 3493 is open on my NAs when i port scan.

Output from the pi:

sudo netstat -lptu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:ssh             0.0.0.0:*               LISTEN      517/sshd: /usr/sbin
tcp        0      0 localhost:nut           0.0.0.0:*               LISTEN      6201/upsd
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      517/sshd: /usr/sbin
tcp6       0      0 localhost:nut           [::]:*                  LISTEN      6201/upsd
tcp6       0      0 [::]:http               [::]:*                  LISTEN      6229/apache2
udp        0      0 0.0.0.0:bootpc          0.0.0.0:*                           604/dhcpcd
udp        0      0 0.0.0.0:56464           0.0.0.0:*                           332/avahi-daemon: r
udp        0      0 0.0.0.0:snmp            0.0.0.0:*                           9571/snmpd
udp        0      0 0.0.0.0:mdns            0.0.0.0:*                           332/avahi-daemon: r
udp6       0      0 [::]:50963              [::]:*                              332/avahi-daemon: r
udp6       0      0 [::]:mdns               [::]:*                              332/avahi-daemon: r
@mcfrojd
Copy link
Author

mcfrojd commented Nov 27, 2022

Tried to install it on Ubuntu Server 22.10 (32-bit) instead of Pi OS Lite (64-bit), but i still can not add it to home-assistant.

Another question, is it possible to make the script install the new version 2.8.0 instead of the 2.7.4 that seems to be the latest one when "apt install nut"

@dzomaya
Copy link
Owner

dzomaya commented Nov 27, 2022

Hey @mcfrojd

But when trying to connect with Windows NUT Client or when trying to add the server into Home-Assistant i dont seem to be able to connect.

I haven't tested this, but my hunch is you'll be able to get it working by adding a LISTEN directive with the appropriate address and port to the /etc/upsd.conf.
The default config here gets the web server and SNMP going — which use port 80 and 161 (the snmp in your netstat output) — but doesn't modify the default LISTEN settings for upsd. The default upsd port is 3493 and the default behavior is to listen on localhost (which is happening based on your netstat showing localhost:nut).

Example LISTEN directives below:

LISTEN 127.0.0.1 3493 # localhost IPv4
LISTEN 192.0.2.11 3493 # Another IPv4 address

After you make config changes you can reload upsd like this

upsd -c reload

If you're able to test it out and it works, let me know!

Another question, is it possible to make the script install the new version 2.8.0 instead of the 2.7.4 that seems to be the latest one when "apt install nut"

Good question! We could add something that installs from source code. I've kinda debated whether or not it makes sense to depend on the package managers or to go out and get specific versions of NUT and build from source. I expect that most of the popular OS repos will have 2.8.0 "soon" and the problem will solve itself, but I don't have a good feel for exactly how long "soon" is.

@dzomaya dzomaya added the question Further information is requested label Nov 27, 2022
@mcfrojd
Copy link
Author

mcfrojd commented Nov 28, 2022

Hello.

I added the lines:

LISTEN 127.0.0.1 3493
LISTEN 192.168.111.90 3493
LISTEN 192.168.111.25 3493

to the file /etc/nut/upsd.conf

Now the windows nut client gives these log lines:

[Id 5: 2022-11-28 17:01:49] Connection to Nut Host 192.168.111.205:3493 Failed: Value can not be null. Parametername: value
[Id 3: 2022-11-28 17:01:49] Disconnected from Nut Host
[Id 2: 2022-11-28 17:01:49] Connection to Nut Host 192.168.111.205:3493 Established

So at least it was able to connect a short while.

Home-Assistant can't connect still.

@dzomaya
Copy link
Owner

dzomaya commented Nov 28, 2022

@mcfrojd
Is the IP address of the PI 192.168.111.205?
If so, use that in the LISTEN directive

@mcfrojd
Copy link
Author

mcfrojd commented Nov 28, 2022

Ah.. My mistake.
When i chaged the ip to 205 Home-Assistant was able to connect.
Thanks for your help.
Maybe you find time and a way to upgrade to latest version in the future.

@dzomaya
Copy link
Owner

dzomaya commented Nov 28, 2022

Cool, thanks @mcfrojd!
I'll close this question and create a feature request for 2.8.0.
If you have other questions, just reply back. Thanks for using the project!

@dzomaya
Copy link
Owner

dzomaya commented Nov 28, 2022

Created #3 and closing this one.

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

No branches or pull requests

2 participants