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

softethervpn: added new package 4.21-9613 #3498

Merged
merged 1 commit into from Dec 7, 2016
Merged

Conversation

fededim
Copy link
Contributor

@fededim fededim commented Nov 9, 2016

Compile tested: ar71xx, ramips
Run tested: ramips

Signed-Off-by: Federico Di Marco fededim@gmail.com

@build000
Copy link

build000 commented Nov 9, 2016

@fededim
I waited for this for a long time - thank you very much for a great idea - now the question of whether it will work well on LEDE and are not required any additional changes in other segments LEDE (eq. for all supported to LEDE device architecture ?, for natively settings firewall ?, etc).

eq. architecture:
https://github.com/el1n/OpenWRT-package-softether/blob/master/softethervpn/Makefile:

(...)
ifeq ($(ARCH),mips)
    SE4WRT_OPTIONS := -minterlink-mips16
endif
ifeq ($(ARCH),mipsel)
    SE4WRT_OPTIONS := -minterlink-mips16
endif
(...)

not working eq. to ppc*(eq. https://github.com/lede-project/source/tree/master/target/linux/apm821xx ) ?
💃

@fededim
Copy link
Contributor Author

fededim commented Nov 10, 2016

Sorry I did not fully understand what you wrote (eq. architecture means ?!?). I tested it on OpenWRT, not LEDE sources so apm821xx is not present (https://github.com/openwrt/openwrt/tree/master/target/linux). What error it gives on apm821xx on LEDE ?
As it regards the -minterlink-mips16 compilation flag I forgot it but in my ramips test the package works flawlessly, in any case if you tell me it's needed I will add it (even though it will be set for all mips or mipsel based architectures).

p.s. what does the salsa dancer stand for ?

$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnclient/vpnclient $(1)/usr/bin/softethervpn
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnbridge/vpnbridge $(1)/usr/bin/softethervpn
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpncmd/vpncmd $(1)/usr/bin/softethervpn
$(INSTALL_DATA) files/dummy $(1)/usr/bin/softethervpn/vpn_server.config
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably go into /etc/softether/ or similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above comment

$(MAKE) \
$(TARGET_CONFIGURE_OPTS) \
CCFLAGS="$(SSL3_SUPP) -I$(STAGING_DIR)/usr/include $(ICONV_CFLAGS)" \
LDFLAGS="-L$(STAGING_DIR)/usr/lib $(ICONV_LDFLAGS) -liconv" \
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Please disregard the -liconv comment, that part is fine.

/usr/bin/softethervpn/vpn_server.config
/usr/bin/softethervpn/vpn_client.config
/usr/bin/softethervpn/vpn_bridge.config
/usr/bin/softethervpn/lang.config
Copy link
Contributor

Choose a reason for hiding this comment

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

These should go all into /etc/softether/

Copy link
Contributor Author

@fededim fededim Nov 10, 2016

Choose a reason for hiding this comment

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

Well it's not possible, softether looks for them in the executable directory see https://www.softether.org/4-docs/1-manual/3._SoftEther_VPN_Server_Manual/3.3_VPN_Server_Administration#3.3.7_Configuration_File:

"The Configuration file is created under the file name "vpn_server.config" which is located in the same directory as that containing the VPN Server processes' executable files.".

It uses also the same folder for creating backups, storing certificates, logs etc. Here follows a list of all the files contained my /usr/bin/softethervpn folder

root@nowhere:~# ls -la /usr/bin/softethervpn/
drwxr-xr-x 10 root root 4096 Nov 10 10:35 .
drwxr-xr-x 3 root root 4096 Nov 9 21:09 ..
-rw------- 1 root root 0 Nov 10 01:40 .VPN-D2081D3F75
-rw------- 1 root root 11 Nov 10 01:40 .ctl_D09E56EF60C570C7E5 54DF6A41A2091A
-rw------- 1 root root 5 Nov 10 01:40 .pid_D09E56EF60C570C7E5 54DF6A41A2091A
drwx------ 2 root root 4096 Nov 9 18:03 backup.vpn_bridge.confi g
drwx------ 2 root root 4096 Nov 9 18:04 backup.vpn_client.confi g
drwxr-xr-x 2 root root 4096 Nov 10 10:00 backup.vpn_server.confi g
drwx------ 2 root root 4096 Nov 6 22:29 chain_certs
drwx------ 2 root root 4096 Nov 9 18:03 client_log
-rwxr-xr-x 1 root root 1295369 Oct 29 00:29 hamcore.se2
-rw------- 1 root root 867 Nov 6 22:14 lang.config
drwx------ 3 root root 4096 Nov 6 23:14 packet_log
drwx------ 5 root root 4096 Nov 7 01:45 security_log
drwx------ 2 root root 4096 Nov 10 00:11 server_log
-rw-r--r-- 1 root root 11957 Nov 9 18:07 vpn_bridge.config
-rw------- 1 root root 1227 Nov 9 18:08 vpn_client.config
-rw-r--r-- 1 root root 13621 Nov 10 10:35 vpn_server.config
-rwxr-xr-x 1 root root 1656440 Oct 29 00:29 vpnbridge
-rwxr-xr-x 1 root root 1656440 Oct 29 00:29 vpnclient
-rwxr-xr-x 1 root root 1656440 Oct 29 00:29 vpncmd
-rwxr-xr-x 1 root root 1656440 Oct 29 00:29 vpnserver

That's why I made a subfolder in /usr/bin. And patching softether C code is not so straightforward and not so maintenable.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, well in this case I propose the libexec approach.

@@ -0,0 +1,113 @@
#
# Copyright (C) 2008-2016 OpenWrt.org
Copy link
Contributor

Choose a reason for hiding this comment

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

Use your own copyright here or none at all

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well in all makefiles I have always used the same copyright (obviously it's for the Makefile not for the program) and there is the same heading in every other makefile. Why do I have to remove it ?

Copy link
Contributor

@jow- jow- Nov 10, 2016

Choose a reason for hiding this comment

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

The rationale is that you cannot disclaim your own copyright and since you (at least I assume so) have no formal, legal contract with OpenWrt to develop this makefile you cannot assign your natural copyright to the OpenWrt entity.

Copy link
Contributor Author

@fededim fededim Nov 10, 2016

Choose a reason for hiding this comment

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

Far from looking for any contract with Openwrt, I am just one contributor of the Openwrt packages project. All previous packages I added (since 2014) had ALWAYS that copyright and moreover it seems to be present in EVERY makefile of the Github repository (I do not think that every contributor here has a contract with OpenWRT). This makefile has been done by my person, taking the work done by el1n and improving it as stated in the commit message; I have also inserted a reference to el1n in the same Makefile under the copyright (# Based on the initial porting done by el1n) and before doing this package I have asked obviously to el1n the permission to borrow his work after I understood he was not interested in merging his job into OpenWRT repository. I am not a "thief" if this is what you are meaning and anyone can verify this by comparing my makefile and the one done by el1n (https://github.com/el1n/OpenWRT-package-softether/blob/master/softethervpn/Makefile), there a lot of changes. I just want to bring another useful package to the repository since nobody was willing to do this. I do not understand why you are coming out with this absurd rationale, but if you do not want this package to be merged for any reasons fine, but please simply tell.

Copy link
Contributor

Choose a reason for hiding this comment

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

Easy :) I'm not having a bad day and no objections to merging due to the above notice. The copyright issue just has been raised a while back and I am trying to make people aware of the fact that the copyright statement as-is is simply invalid and most people simply cargo-cult it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I'm not sure what kind of absurd rationale you mean, neither was I accusing you of stealing nor did I doubt the origin of your work - I was merely just asking you to put # Copyright (C) 2016 Federico Di Marco <fededim@gmail.com>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simply because I do not want to be first, I can amend it later.

endef

define Package/softethervpn/install
$(INSTALL_DIR) $(1)/usr/bin/softethervpn
Copy link
Contributor

Choose a reason for hiding this comment

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

Subdirectories in /usr/bin/ are highly unusual - if the files within that directory or not meant to be directly executable then maybe use /usr/libexec/ instead and symlink the actual commands direclty into /usr/bin/, e.g. /usr/bin/vpnserver -> /usr/libexec/softethervpn/vpnserver

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I didn't know

@@ -0,0 +1,2 @@
103-noeucjp.patch
105-nosslv3.patch
Copy link
Contributor

@jow- jow- Nov 10, 2016

Choose a reason for hiding this comment

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

Please drop this file - it is created on demand with make package/softethervpn/{clean,prepare} QUILT=1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

@fededim
Copy link
Contributor Author

fededim commented Nov 10, 2016

What about minterlink-mips16, is it needed ? I have just read https://gcc.gnu.org/ml/gcc-patches/2007-09/msg01419.html, but it is not so much clear to me. Since softether is all written in C I don't think it is needed at all (I mean if a particular target requires that compilation flag, it should already be set in the global CCFLAGS).

@jow-
Copy link
Contributor

jow- commented Nov 10, 2016

I'd say remove the -minterlink-mips16 handling entirely and just set PKG_USE_MIPS16:=0 instead.

@fededim
Copy link
Contributor Author

fededim commented Nov 10, 2016

not working eq. to ppc*(eq. https://github.com/lede-project/source/tree/master/target/linux/apm821xx ) ?

And what about the LEDE issue you were mentioning ?

@fededim
Copy link
Contributor Author

fededim commented Nov 10, 2016

Done, I left -minterlink-mips16 and I had to remove the /usr/bin/ links otherwise the executable won't run (see Makefile). I am still waiting for some information about the lede issues.

$(INSTALL_DIR) $(1)/usr/bin

# we can't use links because each command tries to load hamcore.se2 from the directory of the linked command (/usr/bin) and not from
# /usr/libexec/softether hence they all fail to start
Copy link
Contributor

Choose a reason for hiding this comment

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

Create an /usr/libexec/softethervpn/launcher.sh with mode 0755 and the following contents:

#!/bin/sh
exec "/usr/libexec/softethervpn/${0##*/}" "$@"

Then symlink that to /usr/bin/vpn{server,bridge,client,cmd}.

Copy link
Contributor

Choose a reason for hiding this comment

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

If that still does not work, try this instead of the exec line:

#!/bin/sh
cd /usr/libexec/softethervpn
"./${0##*/}" "$@"

Copy link
Contributor Author

@fededim fededim Nov 10, 2016

Choose a reason for hiding this comment

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

Ok, thanks for the idea, but is it really necessary ? There are the standard /etc/init.d/ scripts (used also by luci frontend) and moreover there aren't any other parameters for each command, except start/stop. So nobody should be using the /usr/bin symlinks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok - well I just assumed that at least vpncmd is a user utility but fine with me, you can leave out the symlinking then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:) Well I missed that because I configured everything through the client application, I'll make the symlink only for it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, first version works fine.

- based on the work done by el1n with his authorization (https://github.com/el1n/OpenWRT-package-softether)
- updated softethervpn to latest version
- introduced necessary patches for lede compatibility (nossl3)

Signed-Off-by: Federico Di Marco <fededim@gmail.com>
@nicolov
Copy link

nicolov commented Nov 22, 2016

Hi, thanks for doing this. I believe you could use Host/Prepare and Host/Compile to build HamCoreBuilder, instead of cleaning the tree mid-build. You can have a look at the Makefile I'd forked here

@fededim
Copy link
Contributor Author

fededim commented Nov 23, 2016

I did not know about Host/Compile and Host/Prepare, well I can do this on the next release of softether.

@fededim
Copy link
Contributor Author

fededim commented Dec 7, 2016

I have other changes to push to another package I manage, I would be grateful if you could merge this pr otherwise I think that also the new commit for the other package will be merged by this PR. As I told I will update Host/Compile Host/Prepare later.

@nicolov
Copy link

nicolov commented Dec 7, 2016 via email

@jow- jow- merged commit b7c332f into openwrt:master Dec 7, 2016
@fededim
Copy link
Contributor Author

fededim commented Dec 7, 2016

Ok did a new branch

fededim added a commit to fededim/packages that referenced this pull request Dec 31, 2016
- bugfix openwrt#3498

Signed-Off-by: Federico Di Marco <fededim@gmail.com>
fededim added a commit to fededim/packages that referenced this pull request Dec 31, 2016
- bugfix openwrt#3498

Signed-Off-by: Federico Di Marco <fededim@gmail.com>
fededim added a commit to fededim/packages that referenced this pull request Dec 31, 2016
- bugfix openwrt#3498

Signed-Off-by: Federico Di Marco <fededim@gmail.com>
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

Successfully merging this pull request may close these issues.

None yet

4 participants