StrongSwan配置多个子网

ipsec.conf方式

conn myikesettings
    keyexchange=ikev1
    left=10.0.0.1
    right=10.0.0.2
    leftcert=mycert.pem
    rightcert=othercert.oem
    ike=aesgcm16-prfsha256-modp3072!
    esp=aesgcm16-modp3072!
    auto=add
 
conn sa_1
    leftsubnet=192.168.1.0/24
    rightsubnet=192.168.51.0/24
    also=myikesettings
 
conn sa_2
    leftsubnet=192.168.2.0/24
    rightsubnet=192.168.52.0/24
    also=myikesettings
1
2
3
4
ipsec restart
ipsec reload
ipsec up sa_1
ipsec up sa_2

swanctl方式

connections {
	host-host {
		...
		children {
			host-host1 {
				local_ts=10.1.0.0/24
				remote_ts=10.2.0.0/24
				...
			}
			host-host2 {
				local_ts=10.1.0.0/24
				remote_ts=10.2.0.0/24
				...
			}
		}
	}
}
1
2
3
4
charon &
swanctl --load-all --clear
swanctl --initiate --child host-host1
swanctl --initiate --child host-host2

refer to:
https://wiki.strongswan.org/projects/strongswan/wiki/FAQ#Multiple-subnets-per-SA

mount squashfs: Operation not permitted

Need recompile Linux kernel with squashfs support.

1
2
3
4
CONFIG_SQUASHFS
Location:
	-> File systems
		-> Miscellaneous filesystems (MISC_FILESYSTEMS [=y])

Or use user space cmd

1
squashfuse ./sysrcd.dat sysrcd_dir

SecureFX连接失败

连接linux主机A失败,返回

i Available Remote Kex Methods = curve25519-sha256,curve25519-sha256@libssh.org,...
i Selected Kex Method =

连接linux主机B成功,返回

i Available Remote Kex Methods = curve25519-sha256@libssh.org,ecdh-sha2-nistp256,...
i Selected Kex Method = diffie-hellman-group14-sha1

原因是主机A中的OpenSSH升级了,可用以下命令确认

1
ssh -V

解决办法为,在/etc/ssh/sshd_config文件尾部加入

1
2
3
#Ciphers aes128-cbc
#MACs hmac-md5,hmac-sha1
KexAlgorithms diffie-hellman-group14-sha1

重启sshd

1
service sshd restart

refer to:
https://blog.csdn.net/lk_db/article/details/50964912

验证IPSec抗重放攻击

linux内核xfrm参数replay-window用于设定抗重放攻击效果。

replay-window为0表示不启用抗重放攻击,大于0时表示当前esp/ah包活动序列窗口大小,序号太旧的包因赶不上活动窗口而被丢弃或回复失败包。

在基于
StrongSwan PSK RSA
连通的环境下。

在C机器中编辑/etc/strongswan.d/charon.conf,更改replay-window值。
重启strongswan并启动连接后,可能通过命令

1
ip xfrm state

查看strongswan有没有将参数值设定到内核中。

在B机器中

1
apt install tcpreplay

在B机器中启动两个wireshark进程,分别抓包vmnet2和vmnet3。

当B和C中的strongswan都启动并连通后,在A中ping D的ip。

此时在B中抓vmnet3上的esp包,抓了几个后,点击对应wireshark窗口菜单

1
File/Export Specified Packet

将这些esp包保存为文件

1
/tmp/esp-b2c.pcapng

在A中停止ping D的ip。

在B的bash中执行

1
tcpreplay -i enp2s6 /tmp/esp-b2c.pcapng

其中enp2s6是网卡vmnet3对应的识别名。

可以看到,
当C中的replay-window参数设为0时,B中的vmnet2上会抓到模拟重放的icmp ping包,并且方向是10.2.0.10至10.1.0.10。
当C中的replay-window参数不为0时,B中的vmnet2上抓不到模拟重放的icmp ping包。
一旦重启B或C中的strongswan,使用旧的esp-b2c.pcapng文件重放时,不管C中的replay-window取何值,B中的vmnet2上都不会出现模拟重放包。

Strongswan中验证NATT

在基于
StrongSwan PSK RSA
连通的环境下。

四台虚拟机ABCD,三段Host Only虚拟网络vmnet2、vmnet3、vmnet4,DHCP都禁掉。

1
2
3
4
5
6
7
8
9
10
A
vmnet2: 10.1.0.10/24 gw 10.1.0.2
B
vmnet2: 10.1.0.2/24
vmnet3: 192.168.0.12/24  <--这里变了
C
vmnet3: 192.168.0.3/24
vmnet4: 10.2.0.2/24
D
vmnet4: 10.2.0.10/24 gw 10.2.0.2

在B的bash中执行

1
2
iptables -t nat -A POSTROUTING -s 192.168.0.12 -j SNAT --to-source 192.168.0.2
iptables -t nat -A PREROUTING -d 192.168.0.2 -j DNAT --to-destination 192.168.0.12

在B中用ifconfig命令查看vmnet3的hwaddr,比如为00:0c:29:5a:fc:8e。
在C的bash中执行

1
arp -s 192.168.0.2 00:0c:29:5a:fc:8e

修改B的ipsec.conf中指定conn下的left为192.168.0.12。
而仍将C的ipsec.conf中指定conn下的right设为192.168.0.2。

之后再重启BC中的strongswan并连接会看到第5条ISAKMP消息开始端口都走4500了。

医学英语备忘录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
当前面的元音是非重读元音时,f,θ和x进一步变化成b,d和g。
Verner's Law says that voiceless fricatives, when immediately following an unstressed syllable in the same word, underwent voicing.
centum -> hundred
PIE upo -> over
PIE apo -> off
 
中元音2个: / ә / / ә: / 
后元音6个: / u / / u: / / ɔ / / ɔ: / / Λ / / a: /
前元音4个: / i: / / i / / e / / æ /
 
i-umlaut(i-mutation), a-mutation, u-mutation
 
唇	b p m f
齿	d t n l
硬腭	dʒ s tʃ
软腭	g k h
 
Green's Low
b -> p -> f
d -> t -> th
g -> k -> h
 
a - e - i - o - u
t - d - s 前齿音
b - p - m - f - v - d 前唇音
u - v - w
g - k/c - h 喉音
l - m - n - r 鼻音 侧音
s - c - z
 
r - s - t
 
b - d
m - w
y - g
y - j
g - w
 
ad-vjpm
a*-bcfglnqrst
a-sp,sc,st
 
sub-btnm
su*-cfgpc
 
ab: abs,aps,as,au,a
con: cog,col,com,cor,co
in: im,il,ir,ig
en: em
syn: sym,sy
ob: oc,of,op,o
trans: tran,tra
dis: dif,dir,di
ex: ef,e,ec,es
 
drag=trac(t)
break=frac(t)
make=fact
miss=mit
pend=pens
grad=gress 走
hundred=centi
hand=chir
hard=crac
carve=gram,graph
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
malleolus: 踝
tibia: 胫骨
tuberosity: 粗隆
fibula: 腓骨
phlegm: 粘液
bile: 胆汁
chole: 胆汁
etymology: 词源
 
adenosine: 腺苷
adenine: 维生素B4、腺嘌呤
purine: 嘌呤
guanine: 鸟嘌呤
pyrimidine: 嘧啶
cytosine: 胞嘧啶
thymine: 胸腺嘧啶
uracil: 尿嘧啶
glycoside: 糖苷
ribose: 核糖
glucose: 葡萄糖
choline: 胆碱
Cholesterol: 胆固醇
fructose: 果糖
peptide: 肽
acyl: 酰
ester: 酯
lipid: 脂
aldose: 醛糖
steroid: 类固醇
histone: 组蛋白
 
halide: 卤
fluoride: 氟
chloride: 氯
bromide: 溴
iodide: 碘
alkane: 烷
alkene: 烯
alkyne: 炔
alcohol: 醇
aldehyde: 醛
acetal: 缩醛
ketone: 酮
ketal: 缩酮
amine: 胺
imine: 亚胺
aminal: 缩醛胺
ether: 醚
oxime: 肟,亚硝基化合物
aldoxime: 硝酮
hydrazone: 腙
azine: 嗪
pyridine: 吡啶
cyanohydrin: 羟腈
nitrile: 腈
hydrazide: 酰肼
amidine: 脒
urea: 脲
enol: 烯醇
mercaptan: 硫醇
sulfone: 砜
alkyl halide: 卤代烷
epoxide: 环氧化物
lactone: 内酯
aryl group: 芳基
phenyl group: 苯基
Phenol: 苯酚
naphthalene: 萘
benzyl group: 苄基
ketyl radical: 羰自由基
dextro isomer: 右旋异构体
laevo isomer: 左旋异构体
chiral: 手性

refer to:
本源英语
钱博士英语
安森垚(yáo)、李浩
American Heritage Dictionary
http://www.chem.ucla.edu/~harding/IGOC/IGOC.html
https://wenku.baidu.com/view/04cad1c84b7302768e9951e79b89680202d86b53.html
https://www.chemicalbook.com/CASDetailList_8400.htm
https://weibo.com/ttarticle/p/show?id=2309634676610120089888
https://easyenglishnotes.com/verners-law-and-grimms-law/
https://zhuanlan.zhihu.com/p/387221511
https://china.guidechem.com/
https://zhuanlan.zhihu.com/p/403476453