NHAS / wag

Simple Wireguard 2FA
BSD 3-Clause "New" or "Revised" License
499 stars 27 forks source link

Expose port range #66

Closed marulitua closed 10 months ago

marulitua commented 11 months ago

Thank you for your amazing work.

I need to expose a port range 10000-20000. But currently we don't support range. So what I do instead, is created 10001 entries

    "DatabaseLocation": "devices.db",
    "ExposePorts": [
        "10000/udp",
        "10001/udp",
        .
        .
        .
        "19997/udp",
        "19998/udp",
        "19999/udp",
        "20000/udp"
    ],
    "ExternalAddress": "xxx.xxx.xxx.xxx",
    "HelpMail": "support@mailcom",
    "Lockout": 5,

But turn out with all these entries, WAG need a long time to set up iptables.

root@ubuntu-jammy:/home/vagrant# time systemctl restart wag

real    3m0.423s
user    0m0.000s
sys     0m0.005s

I think it would be great if we support range instead of have a lot of entries. Is that possible to have this feature ? IMHO Iptables itself accept port range.

image

NHAS commented 11 months ago

Hi.

Wag currently does support ranges for ports. And it doesn't use iptables to do the allowing.

NHAS commented 11 months ago

An example from the readme: 192.168.1.1 22-1024/tcp 23-53/any: Format

marulitua commented 11 months ago

The thing is I want to expose ports on the VPN server to the client. So, I don't need to set ExposePorts port if I add Policies rules ?

NHAS commented 11 months ago

Oh yes you're right and I totally skim read this. Sorry!

I will add this as a feature but will be out for a bit an unable to make changes.

emaruli commented 11 months ago

As this feature is good for new newcomer, let me try to contribute to this uber cool piece of software

NHAS commented 11 months ago

That's so awesome! Thanks!

Can I suggest forking from the unstable branch when you make your changes?

marulitua commented 11 months ago

I see, will do