Skip to content

wg-autoconf: add WireGuard Auto-Configuration tool#28459

Draft
alexandrglm wants to merge 1 commit intoopenwrt:masterfrom
alexandrglm:add/wg-autoconf
Draft

wg-autoconf: add WireGuard Auto-Configuration tool#28459
alexandrglm wants to merge 1 commit intoopenwrt:masterfrom
alexandrglm:add/wg-autoconf

Conversation

@alexandrglm
Copy link

Adds wg-autoconf package for OpenWrt

@alexandrglm alexandrglm requested a review from feckert January 30, 2026 19:49
@alexandrglm alexandrglm force-pushed the add/wg-autoconf branch 2 times, most recently from d25975b to 2b157e3 Compare January 30, 2026 20:25
@GeorgeSapkin
Copy link
Member

You need to squash your commits.

@alexandrglm
Copy link
Author

You need to squash your commits.

Fixed

@GeorgeSapkin
Copy link
Member

OK, but you still need to follow the commit format guidelines. There is no message or sign-off now.

@alexandrglm alexandrglm force-pushed the add/wg-autoconf branch 3 times, most recently from f6a854f to 50151b6 Compare January 31, 2026 04:24
@alexandrglm
Copy link
Author

OK, but you still need to follow the commit format guidelines. There is no message or sign-off now.

Ok, had to make my email public. No other way to --amend + push correctly.
All good?

@GeorgeSapkin
Copy link
Member

Also please describe the changes in the commit message, that is why this package is useful for. And you don't need the net/ prefix. wg-autoconf: is enough.

@alexandrglm alexandrglm force-pushed the add/wg-autoconf branch 3 times, most recently from f7a86c6 to 074dd6c Compare January 31, 2026 04:55
@alexandrglm
Copy link
Author

Also please describe the changes in the commit message, that is why this package is useful for. And you don't need the net/ prefix. wg-autoconf: is enough.

Ok, sir, all set, 75 chars/line, 50 char subject. Good to go?

@feckert feckert changed the title net/wg-autoconf: add WireGuard Auto-Configuration tool wg-autoconf: add WireGuard Auto-Configuration tool Jan 31, 2026
@alexandrglm alexandrglm marked this pull request as draft February 1, 2026 20:53
CLI tool for handling (multiple) WireGuard setups, with
batch configs, policy-based routing, and cleanup operations.
Easy and safe WireGuard-VPN tunneling manager for OpenWrt.
DOC: https://github.com/alexandrglm/openwrt_wg-autoconf

Signed-off-by: Alexander Gomez <[email protected]>
@alexandrglm alexandrglm marked this pull request as ready for review February 1, 2026 21:08
@alexandrglm
Copy link
Author

Made several update:

  • Fixed lifecycle hooks properly in the Makefile, updated to release version 1.0.0-r6, and amended the commit with proper formatting/sign-off

Ready for review!

Copy link
Member

@feckert feckert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must admit, I'm not entirely convinced why we need all the preinst, postinst and prerm scripts!

Comment on lines +3 to +6
# WireGuard Auto-Configuration tool for OpenWrt v1.0.0-r6
# Maintainer: Alexander Gomez <[email protected]>
# Repository: https://github.com/alexandrglm/openwrt_wg-autoconf
#
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this lines these lines are not needed.

PKG_VERSION:=1.0.0
PKG_RELEASE:=6
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION)-r$(PKG_RELEASE)-source.tar.gz
PKG_SOURCE_URL:=https://github.com/alexandrglm/openwrt_wg-autoconf/releases/download/1.0.0-r6/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally, an upstream project has versioning scheme <x.x.x>.
The value r6 refers to the change that OpenWrt is making and is therefore the PKG_RELEASE.
Therefore, the URL is normally structured as follows:
PKG_SOURCE_URL:=https://github.com/alexandrglm/openwrt_wg-autoconf/releases/download/$(PKG_VERSION)/

Can you adjust that in your Upstream repository?


define Package/wg-autoconf/preinst
#!/bin/sh
/usr/libexec/wg-autoconf/scripts/wg-autoconf_preinst.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that this will not work as expected. The script call is not available because it is a preinst call! The referenced script is currently not installed in /usr/libexec/wg-autoconf/scripts/.

@alexandrglm alexandrglm marked this pull request as draft February 3, 2026 13:33
@alexandrglm
Copy link
Author

alexandrglm commented Feb 3, 2026

I must admit, I'm not entirely convinced why we need all the preinst, postinst and prerm scripts!

Testing various scenarios:

  • Improper uninstalls
  • Upgrading with active WireGuard connection
  • Tampered bins
  • Reboots without proper WireGuard removal-cleanups

... I've endeavoured to ensure users don't end up in a "disaster" which requires a hard reset.

The processes verify:

  1. Binary existence
  2. Active WireGuard connections made up using the bin
  3. Remanants of "garbage" (firewall configs, dnsmasq settings, iproute2 tables)

Then, executes their actions:

  1. Using the proper cleanup methods included in the bin
    Else, if the binary doesn't exist or is broken/tampered:
  2. Making manual cleanup operations.

This, much to my regret, which would simplify my work by making "an easy code" but could nuke any router, must be repeated at different points outside the binary (such as in each existing lifecycle method ...), in an almost "surgical" manner, to ensure all cases are covered.

Please remove this lines these lines are not needed.
Got it.

Normally, an upstream project has versioning scheme <x.x.x>. The value r6 refers to the change that OpenWrt is making and is therefore the PKG_RELEASE. Therefore, the URL is normally structured as follows: PKG_SOURCE_URL:=https://github.com/alexandrglm/openwrt_wg-autoconf/releases/download/$(PKG_VERSION)/

Can you adjust that in your Upstream repository?

Got it.
Reason: I maintain a history of source versions in the repository where changes have occurred, which is why the release increments vary.

I suspect that this will not work as expected. The script call is not available because it is a preinst call! The referenced script is currently not installed in /usr/libexec/wg-autoconf/scripts/.

Indeed, using Alpine SDK (abuild), the pre-install method doesn't execute the referenced script because—during pre-installation—the script doesn't exist in /usr/libexec/wg-autoconf/scripts/.

In that case, the method includes the cleanup instructions directly within the pre_inst script itself, as I've explained before, even though the recommendations to avoid maintenance and scalability issues were to move that logic out of the lifecycle method in the Makefile.

Do I understand the need for these methods (not in my app but in general) ?
What do these methods exist for if they aren’t used?

Furthermore, since my sources aren't compiled from, e.g. C, but rather a shell scripts bin, I admittedly don't fully understand what a Makefile requires or how APK lifecycle methods function....though I've grasped APKBUILD usage well enough.

I see now the necessity for revisiting certain points across different APK lifecycle phases (including pre_upgrade, post_upgrade, which don't exist in a Makefile; hence the pre-existence hook in preinst).


In summary, a review of certain lifecycle phases that are not yet fully understood is planned.

I plan to implement a function that:

  1. Verifies states such as Is_Installed, Is_Active, Is_RouteTable, etc., states, from an external file.

  2. Automatically performs the necessary cleanup operations on each binary execution, without giving users the option to decide.

Is this preferable to what many OpenWrt projects do (configure, reconfigure, and obliterate configurations, forcing users into hard resets)? Hardly ideal.

Once everything is updated, I will remove this from draft status for review.

Thank you for your time, @feckert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants