blob: 354ace21a624f95bb0b63cf8edd6cfad191d4273 [file] [log] [blame]
developer82183d82023-10-13 12:08:31 +08001--- a/feeds/packages/net/strongswan/Makefile
2+++ b/feeds/packages/net/strongswan/Makefile
developer7b963b72023-11-15 14:13:49 +08003@@ -259,6 +259,7 @@ $(call Package/strongswan/Default)
4 TITLE+= (default)
5 DEPENDS:= strongswan \
6 +strongswan-charon \
7+ +strongswan-ipsec \
8 +strongswan-mod-aes \
9 +strongswan-mod-attr \
10 +strongswan-mod-connmark \
11@@ -536,25 +537,8 @@ define Package/strongswan-ipsec/conffile
12 endef
13
14 define Package/strongswan-ipsec/install
15- $(INSTALL_DIR) $(1)/etc/ $(1)/usr/sbin
16- $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/ipsec.conf $(1)/etc/
17- echo -e "\ninclude /var/ipsec/ipsec.conf" >> $(1)/etc/ipsec.conf
18- $(INSTALL_CONF) ./files/ipsec.secrets $(1)/etc/
19- echo -e "\ninclude /var/ipsec/ipsec.secrets" >> $(1)/etc/ipsec.secrets
20- $(INSTALL_CONF) ./files/ipsec.user $(1)/etc/
21- $(INSTALL_DIR) $(1)/etc/init.d
22- $(INSTALL_BIN) ./files/ipsec.init $(1)/etc/init.d/ipsec
23- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ipsec $(1)/usr/sbin/
24-endef
25-
26-define Package/strongswan-ipsec/postinst
27-#!/bin/sh
28-
29-[ -z "$${IPKG_INSTROOT}" ] || exit 0
30-
31-opkg list-changed-conffiles | grep -qx /etc/ipsec.conf || {
32- rm -f /etc/ipsec.conf-opkg
33-}
developer82183d82023-10-13 12:08:31 +080034+ $(INSTALL_DIR) $(1)/etc/config
35+ $(INSTALL_DATA) ./files/ipsec.conf $(1)/etc/config/ipsec
developer82183d82023-10-13 12:08:31 +080036 endef
37
developer7b963b72023-11-15 14:13:49 +080038 define Package/strongswan-libnttfft/install
developer82183d82023-10-13 12:08:31 +080039--- /dev/null
40+++ b/feeds/packages/net/strongswan/files/ipsec.conf
41@@ -0,0 +1,28 @@
42+config 'ipsec'
43+
44+config 'remote' 'TEST'
developer7b963b72023-11-15 14:13:49 +080045+ option 'enabled' '0'
developer82183d82023-10-13 12:08:31 +080046+ option 'gateway' '10.10.20.253'
47+ option 'authentication_method' 'psk'
48+ option 'pre_shared_key' '123456789'
49+ list 'crypto_proposal' 'phase_1_settings'
50+ list 'tunnel' 'TUNNEL'
51+
52+config 'crypto_proposal' 'phase_1_settings'
53+ option 'encryption_algorithm' 'aes128'
54+ option 'hash_algorithm' 'sha1'
55+ option 'dh_group' 'modp768'
56+
57+config 'tunnel' 'TUNNEL'
58+ option 'mode' 'add'
59+ option 'local_subnet' '192.168.1.0/24'
60+ option 'remote_subnet' '192.168.2.0/24'
61+ option 'crypto_proposal' 'phase_2_settings'
62+ option 'keyexchange' 'ikev2'
63+ option 'ikelifetime' '10800'
64+ option 'lifetime' '3600'
65+
66+config 'crypto_proposal' 'phase_2_settings'
67+ option 'encryption_algorithm' 'aes128'
68+ option 'hash_algorithm' 'sha1'
69+ option 'dh_group' 'modp768'
70--- a/feeds/packages/net/strongswan/files/swanctl.init
71+++ b/feeds/packages/net/strongswan/files/swanctl.init
72@@ -241,6 +241,7 @@ config_child() {
73 local if_id
74 local rekeytime
75 local rekeybytes
76+ local replay_window
77 local lifebytes
78 local rekeypackets
79 local lifepackets
80@@ -258,6 +259,7 @@ config_child() {
81 config_get interface "$conf" interface ""
82 config_get hw_offload "$conf" hw_offload ""
83 config_get priority "$conf" priority ""
84+ config_get replay_window "$conf" replay_window 32
85 config_get rekeybytes "$conf" rekeybytes ""
86 config_get lifebytes "$conf" lifebytes ""
87 config_get rekeypackets "$conf" rekeypackets ""
88@@ -323,7 +325,7 @@ config_child() {
89 esac
90
91 case "$hw_offload" in
92- yes|no|auto|"")
93+ yes|no|auto|crypto|packet|"")
94 ;;
95 *)
96 fatal "hw_offload value $hw_offload invalid"
97@@ -339,6 +341,7 @@ config_child() {
98 [ -n "$remote_subnet" ] && swanctl_xappend4 "remote_ts = $remote_subnet"
99
100 [ -n "$hw_offload" ] && swanctl_xappend4 "hw_offload = $hw_offload"
101+ [ -n "$replay_window" ] && swanctl_xappend4 "replay_window = $replay_window"
102 [ $ipcomp -eq 1 ] && swanctl_xappend4 "ipcomp = 1"
103 [ -n "$interface" ] && swanctl_xappend4 "interface = $interface"
104 [ -n "$priority" ] && swanctl_xappend4 "priority = $priority"