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

Feature Request: Port forwarding #44

Open
lucasff opened this issue May 12, 2020 · 12 comments
Open

Feature Request: Port forwarding #44

lucasff opened this issue May 12, 2020 · 12 comments

Comments

@lucasff
Copy link

lucasff commented May 12, 2020

Hello!

I'd like to have support for the following use case. I'm willing to pay a beer casket (maybe with Durstexpress.de)

I'd like to be able to take down all port forwarding assigned to any device with a specific port, such as 80. Then I'd like to enable one device to port forward.
In this case, does the TR-069 Fritz protocol or any of it's extensions allow a single host in the network to manage port forwarding for other hosts?

I'd like to use Home Assistant and detect if a host is online to turn on port-forwarding and then if it's offline disable the port-forwarding.

@rikroe
Copy link

rikroe commented May 27, 2020

I'd love to see this as well. However, given this AVM documentation (1.14) it will not be possible via TR-069:

Port mapping entries are only allowed for hosts inside of LAN. Furthermore hosts can only
add port mapping entries for themselves and not for other hosts in the LAN.

When testing it out, it also only works the machine that I'm connecting from.

What might be possible could be using the web UI API, i.e. calling http://fritz.box/data.lua with the correct parameters. However this does not fit into this library which is purely TR-069 and not HTTP and could be very vulnerable to breaking changes.

@kbr
Copy link
Owner

kbr commented May 29, 2020

A remote http-based access is possible by using the official AVM AHA-HTTP-Interface, but that's just a wrapper for a TR-064 api-subset for home automation.

Controlling the box by the web UI is very fragile, can break on FritzOS updates and may even be model-specific. So I strongly discourage to try it this way.

@bcutter
Copy link

bcutter commented Dec 1, 2020

Hi, has anyone achieved this meanwhile?

I have a very important use case I want to address with this feature (automate Let's Encrypt certificate renewal progress by only enabling port forward rule for few minutes) and it would be totally fine for being able doing this only by the machine affected by the port forwarding.

Interesting: the Home Assistant fork (ha-fritzbox-tools) has implemented this already. How to do it in fritzconnection?

@kbr
Copy link
Owner

kbr commented Dec 1, 2020

ha-fritzbox-tools is based on fritzconnection, using the Layer3Forwarding service for this task.

@bcutter
Copy link

bcutter commented Dec 2, 2020

ha-fritzbox-tools is based on fritzconnection, using the Layer3Forwarding service for this task.

Uff. For me as a non-developer it´s quite hard to estimate if it´s possible to use the same methode like the ha-fritzbox-tools in my scenario (simple script: enable port forwarding / renew certificate / disable port forwarding).

I tested fritzconnection and there are plenty of commands but obviously no "fritzports" or similar. How are chances there will in near future?

@bcutter
Copy link

bcutter commented Dec 30, 2021

Just a little reminder bump here. One year of silence has ended now -.-

@serv-inc
Copy link

serv-inc commented Jan 3, 2024

Are you still interested @bcutter ? #206 is very similar, and might be applied for your case as well.

@serv-inc
Copy link

serv-inc commented Jan 3, 2024

Controlling the box by the web UI is very fragile, can break on FritzOS updates and may even be model-specific. So I strongly discourage to try it this way.

@kbr : What would you recommend if there is no official api ?

@bcutter
Copy link

bcutter commented Jan 3, 2024

Are you still interested @bcutter ? #206 is very similar, and might be applied for your case as well.

Interested yes. Able to use this in a Debian based shell script... not into that right now. I think I'd need a "ready to use" snippet as I'm still not a developer.

@kbr
Copy link
Owner

kbr commented Jan 3, 2024

@kbr : What would you recommend if there is no official api ?

Ask for one or hack at your own risk. If AVM changes internals this attempt may fail. Feel free to use the library to get an sid for that. It is officially published by AVM how to get one.

@bcutter
Copy link

bcutter commented Jan 3, 2024

Well, how did the Home Assistant AVM integration folks implement this? The integration is already capable of enabling/disabling port forwarding: https://www.home-assistant.io/integrations/fritz/#port-forward

With the limitation "only by the host affected by the port forwarding". That's why I was really hoping (I still do) this will be easily implemented natively, out of the box, plug'n'play - no dirty hacks.

@kbr
Copy link
Owner

kbr commented Jan 3, 2024

I don't know how it is implemented in Home-Assistant, but it is open source and inspectable.

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

5 participants