~vcs-imports/ipfire/ipfire-2.x

« back to all changes in this revision

Viewing changes to src/patches/strongswan-ipfire.patch

  • Committer: Peter Müller
  • Date: 2022-04-23 14:27:56 UTC
  • mto: This revision was merged to the branch mainline in revision 9750.
  • Revision ID: git-v1:7a981d94cb2c3e48ecaf07c506c8353a2c839d79
SSH: do not send spoofable TCP keep alive messages

By default, both SSH server and client rely on TCP-based keep alive
messages to detect broken sessions, which can be spoofed rather easily
in order to keep a broken session opened (and vice versa).

Since we rely on SSH-based keep alive messages, which are not vulnerable
to this kind of tampering, there is no need to double-check connections
via TCP keep alive as well.

This patch thereof disables using TCP keep alive for both SSH client and
server scenario. For usability reasons, a timeout of 5 minutes (10
seconds * 30 keep alive messages = 300 seconds) will be used for both
client and server configuration, as 60 seconds were found to be too
short for unstable connectivity scenarios.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
commit b439f74361d393bcb85109b6c41a905cf613a296
2
 
Author: Peter Müller <peter.mueller@ipfire.org>
3
 
Date:   Wed May 18 17:46:57 2022 +0000
 
1
commit 654e2b7688c5fbd4e1fc46648bc1864301fb6027
 
2
Author: Michael Tremer <michael.tremer@ipfire.org>
 
3
Date:   Mon Mar 21 19:49:02 2022 +0000
4
4
 
5
5
    IPFire modifications to _updown script
6
6
    
7
 
    Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
 
7
    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8
8
 
9
9
diff --git a/src/_updown/_updown.in b/src/_updown/_updown.in
10
 
index 34eaf68c7..9ed387a0a 100644
 
10
index 34eaf68c7..514ecb578 100644
11
11
--- a/src/_updown/_updown.in
12
12
+++ b/src/_updown/_updown.in
13
13
@@ -242,10 +242,10 @@ up-host:iptables)
98
98
              -s $PLUTO_PEER -d $PLUTO_ME $IPSEC_POLICY_IN -j ACCEPT
99
99
        fi
100
100
        #
101
 
@@ -342,47 +324,37 @@ up-client:iptables)
 
101
@@ -342,10 +324,10 @@ up-client:iptables)
102
102
          if [ "$PLUTO_PEER_CLIENT" = "$PLUTO_PEER/32" ]
103
103
          then
104
104
            logger -t $TAG -p $FAC_PRIO \
110
110
+             "client+ $PLUTO_PEER_ID $PLUTO_PEER_CLIENT == $PLUTO_PEER -- $PLUTO_ME == $PLUTO_MY_CLIENT"
111
111
          fi
112
112
        fi
113
 
+
114
 
+       # Open Firewall for IPinIP + AH + ESP Traffic
115
 
+       iptables --wait -I IPSECINPUT 1 -i $PLUTO_INTERFACE -p IPIP \
116
 
+               -s $PLUTO_PEER $S_PEER_PORT \
117
 
+               -d $PLUTO_ME $D_MY_PORT -j ACCEPT
118
 
+       iptables --wait -I IPSECINPUT 1 -i $PLUTO_INTERFACE -p AH \
119
 
+               -s $PLUTO_PEER $S_PEER_PORT \
120
 
+               -d $PLUTO_ME $D_MY_PORT -j ACCEPT
121
 
+       iptables --wait -I IPSECINPUT 1 -i $PLUTO_INTERFACE -p ESP \
122
 
+               -s $PLUTO_PEER $S_PEER_PORT \
123
 
+               -d $PLUTO_ME $D_MY_PORT -j ACCEPT
124
 
+
125
113
        ;;
126
 
 down-client:iptables)
 
114
@@ -353,36 +335,14 @@ down-client:iptables)
127
115
        # connection to client subnet, with (left/right)firewall=yes, going down
128
116
        # This is used only by the default updown script, not by your custom
129
117
        # ones, so do not mess with it; see CAUTION comment up at top.
161
149
              -s $PLUTO_PEER -d $PLUTO_ME $IPSEC_POLICY_IN -j ACCEPT
162
150
        fi
163
151
        #
164
 
@@ -392,12 +364,24 @@ down-client:iptables)
 
152
@@ -392,10 +352,10 @@ down-client:iptables)
165
153
          if [ "$PLUTO_PEER_CLIENT" = "$PLUTO_PEER/32" ]
166
154
          then
167
155
            logger -t $TAG -p $FAC_PRIO -- \
173
161
+             "client- $PLUTO_PEER_ID $PLUTO_PEER_CLIENT == $PLUTO_PEER -- $PLUTO_ME == $PLUTO_MY_CLIENT"
174
162
          fi
175
163
        fi
176
 
+
177
 
+       # Close Firewall for IPinIP + AH + ESP Traffic
178
 
+       iptables --wait -D IPSECINPUT -i $PLUTO_INTERFACE -p IPIP \
179
 
+               -s $PLUTO_PEER $S_PEER_PORT \
180
 
+               -d $PLUTO_ME $D_MY_PORT -j ACCEPT
181
 
+       iptables --wait -D IPSECINPUT -i $PLUTO_INTERFACE -p AH \
182
 
+               -s $PLUTO_PEER $S_PEER_PORT \
183
 
+               -d $PLUTO_ME $D_MY_PORT -j ACCEPT
184
 
+       iptables --wait -D IPSECINPUT -i $PLUTO_INTERFACE -p ESP \
185
 
+               -s $PLUTO_PEER $S_PEER_PORT \
186
 
+               -d $PLUTO_ME $D_MY_PORT -j ACCEPT
187
 
+
188
164
        ;;
189
 
 #
190
 
 # IPv6
191
 
@@ -422,10 +406,10 @@ up-host-v6:iptables)
 
165
@@ -422,10 +382,10 @@ up-host-v6:iptables)
192
166
        # connection to me, with (left/right)firewall=yes, coming up
193
167
        # This is used only by the default updown script, not by your custom
194
168
        # ones, so do not mess with it; see CAUTION comment up at top.
201
175
            -s $PLUTO_ME $S_MY_PORT $IPSEC_POLICY_OUT \
202
176
            -d $PLUTO_PEER_CLIENT $D_PEER_PORT -j ACCEPT
203
177
        #
204
 
@@ -454,10 +438,10 @@ down-host-v6:iptables)
 
178
@@ -454,10 +414,10 @@ down-host-v6:iptables)
205
179
        # connection to me, with (left/right)firewall=yes, going down
206
180
        # This is used only by the default updown script, not by your custom
207
181
        # ones, so do not mess with it; see CAUTION comment up at top.
214
188
            -s $PLUTO_ME $S_MY_PORT $IPSEC_POLICY_OUT \
215
189
            -d $PLUTO_PEER_CLIENT $D_PEER_PORT -j ACCEPT
216
190
        #
217
 
@@ -487,10 +471,10 @@ up-client-v6:iptables)
 
191
@@ -487,10 +447,10 @@ up-client-v6:iptables)
218
192
        # ones, so do not mess with it; see CAUTION comment up at top.
219
193
        if [ "$PLUTO_PEER_CLIENT" != "$PLUTO_MY_SOURCEIP/128" ]
220
194
        then
227
201
              -s $PLUTO_PEER_CLIENT $S_PEER_PORT \
228
202
              -d $PLUTO_MY_CLIENT $D_MY_PORT $IPSEC_POLICY_IN -j ACCEPT
229
203
        fi
230
 
@@ -499,10 +483,10 @@ up-client-v6:iptables)
 
204
@@ -499,10 +459,10 @@ up-client-v6:iptables)
231
205
        # or sometimes host access via the internal IP is needed
232
206
        if [ -n "$PLUTO_MY_SOURCEIP" -o -n "$PLUTO_HOST_ACCESS" ]
233
207
        then
240
214
              -s $PLUTO_MY_CLIENT $S_MY_PORT \
241
215
              -d $PLUTO_PEER_CLIENT $D_PEER_PORT $IPSEC_POLICY_OUT -j ACCEPT
242
216
        fi
243
 
@@ -535,11 +519,11 @@ down-client-v6:iptables)
 
217
@@ -535,11 +495,11 @@ down-client-v6:iptables)
244
218
        # ones, so do not mess with it; see CAUTION comment up at top.
245
219
        if [ "$PLUTO_PEER_CLIENT" != "$PLUTO_MY_SOURCEIP/128" ]
246
220
        then
254
228
              -s $PLUTO_PEER_CLIENT $S_PEER_PORT \
255
229
              -d $PLUTO_MY_CLIENT $D_MY_PORT \
256
230
                 $IPSEC_POLICY_IN -j ACCEPT
257
 
@@ -549,11 +533,11 @@ down-client-v6:iptables)
 
231
@@ -549,11 +509,11 @@ down-client-v6:iptables)
258
232
        # or sometimes host access via the internal IP is needed
259
233
        if [ -n "$PLUTO_MY_SOURCEIP" -o -n "$PLUTO_HOST_ACCESS" ]
260
234
        then