ipsec: add missing permissions for pluto
PATCH 1/1 ipsec: add missing permissions for pluto
When using libreswan, pluto needs permissions for building the Security Association Database and for setting contexts on IPSec policy and SAs.
--- policy/modules/system/ipsec.te | 6 ++++++ 1 file changed, 6 insertions(+)
policy/modules/system/ipsec.te +6 -0
@@ -212,6 +212,12 @@ domtrans_pattern(ipsec_mgmt_t, ipsec_exec_t, ipsec_t) read_files_pattern(ipsec_mgmt_t, ipsec_t, ipsec_t) read_lnk_files_pattern(ipsec_mgmt_t, ipsec_t, ipsec_t) +# allow pluto to build Security Association Database +ipsec_setcontext_default_spd(ipsec_t) + +# allow pluto to set contexts on ipsec policy and SAs +domain_ipsec_setcontext_all_domains(ipsec_t) + allow ipsec_mgmt_t ipsec_conf_file_t:file read_file_perms; manage_files_pattern(ipsec_mgmt_t, ipsec_key_file_t, ipsec_key_file_t)
Signature · 1 line
2.18.0
PATCH 1/1 ipsec: add missing permissions for pluto
Quoted 4 lines · Yuli Khodorkovskiy via refpolicy
When using libreswan, pluto needs permissions for building the Security Association Database and for setting contexts on IPSec policy and SAs.
I am fine with this, just wanted to share some considerations inline below.
Quoted 10 lines
Signed-off-by Yuli Khodorkovskiy <[email protected]>--- policy/modules/system/ipsec.te | 6 ++++++ 1 file changed, 6 insertions(+)policy/modules/system/ipsec.te +0
-0
policy/modules/system/ipsec.te domtrans_pattern(ipsec_mgmt_t, ipsec_exec_t, ipsec_t) · line 216
Quoted 5 lines
policy/modules/system/ipsec.te +2
-0@@ -212,6 +212,12 @@ domtrans_pattern(ipsec_mgmt_t, ipsec_exec_t, ipsec_t) read_files_pattern(ipsec_mgmt_t, ipsec_t, ipsec_t) read_lnk_files_pattern(ipsec_mgmt_t, ipsec_t, ipsec_t) +# allow pluto to build Security Association Database +ipsec_setcontext_default_spd(ipsec_t)
I would probably consider instead: corenet_setcontext_all_spds(ipsec_t)
That will make it easier to declare new spds and then associate them. You dont have to worry then about whether ipsec_t can setcontext
If its an ipsec spd then pluto can setcontext automatically
policy/modules/system/ipsec.te domtrans_pattern(ipsec_mgmt_t, ipsec_exec_t, ipsec_t) · line 219
Quoted 3 lines
policy/modules/system/ipsec.te +3
-0+ +# allow pluto to set contexts on ipsec policy and SAs +domain_ipsec_setcontext_all_domains(ipsec_t)
This in practice could probably be limited to domains with network access. (which are nss clients as well)
Quoted 11 lines
policy/modules/system/ipsec.te +1
-0+ allow ipsec_mgmt_t ipsec_conf_file_t:file read_file_perms; manage_files_pattern(ipsec_mgmt_t, ipsec_key_file_t, ipsec_key_file_t)Signature · 6 lines
2.18.0 _______________________________________________ refpolicy mailing list refpolicy at oss.tresys.com http://oss.tresys.com/mailman/listinfo/refpolicy
Signature · 10 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Dominick Grift -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 659 bytes Desc: not available Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20180725/49714916/attachment.bin
PATCH 1/1 ipsec: add missing permissions for pluto
Quoted 25 lines · Dominick Grift
Quoted 4 lines · Yuli Khodorkovskiy via refpolicy
When using libreswan, pluto needs permissions for building the Security Association Database and for setting contexts on IPSec policy and SAs.
I am fine with this, just wanted to share some considerations inline below.
Quoted 13 lines
Signed-off-by Yuli Khodorkovskiy <[email protected]>---
policy/modules/system/ipsec.te | 6 ++++++1 file changed, 6 insertions(+)policy/modules/system/ipsec.te +0
-0@@ -212,6 +212,12 @@ domtrans_pattern(ipsec_mgmt_t, ipsec_exec_t, ipsec_t) read_files_pattern(ipsec_mgmt_t, ipsec_t, ipsec_t) read_lnk_files_pattern(ipsec_mgmt_t, ipsec_t, ipsec_t)
Quoted 8 lines
policy/modules/system/ipsec.te domtrans_pattern(ipsec_mgmt_t, ipsec_exec_t, ipsec_t) · line 216
Quoted 2 lines
policy/modules/system/ipsec.te +2
-0+# allow pluto to build Security Association Database +ipsec_setcontext_default_spd(ipsec_t)I would probably consider instead:
corenet_setcontext_all_spds(ipsec_t)That will make it easier to declare new spds and then associate them. You dont have to worry then about whether
ipsec_tcan setcontextIf its an ipsec spd then pluto can setcontext automatically
I like this better. I?ll send a second version.
Quoted 6 lines
policy/modules/system/ipsec.te domtrans_pattern(ipsec_mgmt_t, ipsec_exec_t, ipsec_t) · line 219
Quoted 4 lines
policy/modules/system/ipsec.te +3
-0+ +# allow pluto to set contexts on ipsec policy and SAs +domain_ipsec_setcontext_all_domains(ipsec_t)This in practice could probably be limited to domains with network access. (which are nss clients as well)
I can?t find a network domain attribute nor an interface setcontext on network domain associations.
Quoted 17 lines
Quoted 12 lines
policy/modules/system/ipsec.te +1
-0+ allow ipsec_mgmt_t ipsec_conf_file_t:file read_file_perms; manage_files_pattern(ipsec_mgmt_t, ipsec_key_file_t, ipsec_key_file_t)Signature · 6 lines
2.18.0 _______________________________________________ refpolicy mailing list refpolicy at oss.tresys.com http://oss.tresys.com/mailman/listinfo/refpolicySignature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Dominick Grift
PATCH 1/1 ipsec: add missing permissions for pluto
Quoted 37 lines · Yuli Khodorkovskiy
Quoted 25 lines · Dominick Grift
Quoted 4 lines · Yuli Khodorkovskiy via refpolicy
When using libreswan, pluto needs permissions for building the Security Association Database and for setting contexts on IPSec policy and SAs.
I am fine with this, just wanted to share some considerations inline below.
Quoted 13 lines
Signed-off-by Yuli Khodorkovskiy <[email protected]>---
policy/modules/system/ipsec.te | 6 ++++++1 file changed, 6 insertions(+)policy/modules/system/ipsec.te +0
-0@@ -212,6 +212,12 @@ domtrans_pattern(ipsec_mgmt_t, ipsec_exec_t, ipsec_t) read_files_pattern(ipsec_mgmt_t, ipsec_t, ipsec_t) read_lnk_files_pattern(ipsec_mgmt_t, ipsec_t, ipsec_t)Quoted 8 lines
policy/modules/system/ipsec.te domtrans_pattern(ipsec_mgmt_t, ipsec_exec_t, ipsec_t) · line 216
Quoted 2 lines
policy/modules/system/ipsec.te +2
-0+# allow pluto to build Security Association Database +ipsec_setcontext_default_spd(ipsec_t)I would probably consider instead:
corenet_setcontext_all_spds(ipsec_t)That will make it easier to declare new spds and then associate them. You dont have to worry then about whether
ipsec_tcan setcontextIf its an ipsec spd then pluto can setcontext automatically
I like this better. I?ll send a second version.
Quoted 1 line
Quoted 7 lines
Quoted 5 lines
policy/modules/system/ipsec.te domtrans_pattern(ipsec_mgmt_t, ipsec_exec_t, ipsec_t) · line 219
Quoted 3 lines
policy/modules/system/ipsec.te +3
-0+ +# allow pluto to set contexts on ipsec policy and SAs +domain_ipsec_setcontext_all_domains(ipsec_t)This in practice could probably be limited to domains with network access. (which are nss clients as well)
I can?t find a network domain attribute nor an interface setcontext on network domain associations.
Yes you would have to create one yourself. Not sure its worth the trouble. Probably safer and cleaner to stick with what you have.
For example:
interface auth_setcontext_nsswitch_domains(`,'
allow $1 nsswitch_domain:association setcontext;
')
The assumption here is that nsswitch_domain assoc. types are domains with network access.
The problem is that in reference policy this is not necessarily so. But even then, this would probably narrow things down at least a little.
Regardless. I wouldnt blame you for keeping what you have instead.
Quoted 19 lines
Quoted 18 lines
Quoted 13 lines
policy/modules/system/ipsec.te +1
-0+ allow ipsec_mgmt_t ipsec_conf_file_t:file read_file_perms; manage_files_pattern(ipsec_mgmt_t, ipsec_key_file_t, ipsec_key_file_t)Signature · 6 lines
2.18.0 _______________________________________________ refpolicy mailing list refpolicy at oss.tresys.com http://oss.tresys.com/mailman/listinfo/refpolicySignature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Dominick Grift
Signature · 10 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Dominick Grift -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 659 bytes Desc: not available Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20180726/aae88b27/attachment.bin
PATCH 1/1 ipsec: add missing permissions for pluto
Quoted 9 lines · Dominick Grift
Quoted 8 lines · Yuli Khodorkovskiy
Quoted 8 lines · Dominick Grift
Quoted 3 lines · Yuli Khodorkovskiy via refpolicy
When using libreswan, pluto needs permissions for building the Security Association Database and for setting contexts on IPSec policy and SAs.
A few more considerations:
1. I believe labeled-ipsec isnt supported for IKEv2 yet.
2. I believe the network_peer_controls polcap (which is enabled by default) "interferes" with some of the ipsec access vectors (there seems to be some overlap wrt send recv). You might want to consider disabling that polcap if youre just using labeled-ipsec (although not strictly needed).
Quoted 75 lines
Quoted 29 lines
Quoted 17 lines
Quoted 1 line
I am fine with this, just wanted to share some considerations inline below.
Quoted 13 lines
Signed-off-by Yuli Khodorkovskiy <[email protected]>---
policy/modules/system/ipsec.te | 6 ++++++1 file changed, 6 insertions(+)policy/modules/system/ipsec.te +0
-0@@ -212,6 +212,12 @@ domtrans_pattern(ipsec_mgmt_t, ipsec_exec_t, ipsec_t) read_files_pattern(ipsec_mgmt_t, ipsec_t, ipsec_t) read_lnk_files_pattern(ipsec_mgmt_t, ipsec_t, ipsec_t)Quoted 8 lines
policy/modules/system/ipsec.te domtrans_pattern(ipsec_mgmt_t, ipsec_exec_t, ipsec_t) · line 216
Quoted 2 lines
policy/modules/system/ipsec.te +2
-0+# allow pluto to build Security Association Database +ipsec_setcontext_default_spd(ipsec_t)I would probably consider instead:
corenet_setcontext_all_spds(ipsec_t)That will make it easier to declare new spds and then associate them. You dont have to worry then about whether
ipsec_tcan setcontextIf its an ipsec spd then pluto can setcontext automatically
I like this better. I?ll send a second version.
Quoted 1 line
Quoted 7 lines
Quoted 5 lines
policy/modules/system/ipsec.te domtrans_pattern(ipsec_mgmt_t, ipsec_exec_t, ipsec_t) · line 219
Quoted 3 lines
policy/modules/system/ipsec.te +3
-0+ +# allow pluto to set contexts on ipsec policy and SAs +domain_ipsec_setcontext_all_domains(ipsec_t)This in practice could probably be limited to domains with network access. (which are nss clients as well)
I can?t find a network domain attribute nor an interface setcontext on network domain associations.
Yes you would have to create one yourself. Not sure its worth the trouble. Probably safer and cleaner to stick with what you have.
For example:
interface auth_setcontext_nsswitch_domains(`,'
allow $1 nsswitch_domain:association setcontext;')
The assumption here is that
nsswitch_domainassoc. types are domains with network access.The problem is that in reference policy this is not necessarily so. But even then, this would probably narrow things down at least a little.
Regardless. I wouldnt blame you for keeping what you have instead.
Quoted 19 lines
Quoted 18 lines
Quoted 13 lines
policy/modules/system/ipsec.te +1
-0+ allow ipsec_mgmt_t ipsec_conf_file_t:file read_file_perms; manage_files_pattern(ipsec_mgmt_t, ipsec_key_file_t, ipsec_key_file_t)Signature · 6 lines
2.18.0 _______________________________________________ refpolicy mailing list refpolicy at oss.tresys.com http://oss.tresys.com/mailman/listinfo/refpolicySignature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Dominick GriftSignature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Dominick Grift
Signature · 10 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Dominick Grift -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 659 bytes Desc: not available Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20180726/876ae318/attachment.bin