platform/core/security/nether.git
3 years agoChange systemd-devel package name 01/252901/1 accepted/tizen_6.5_unified accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix accepted/tizen_8.0_unified accepted/tizen_unified tizen tizen_6.5 tizen_7.0 tizen_7.0_hotfix tizen_8.0 accepted/tizen/6.5/unified/20211028.120242 accepted/tizen/7.0/unified/20221110.062516 accepted/tizen/7.0/unified/hotfix/20221116.105618 accepted/tizen/8.0/unified/20231005.093650 accepted/tizen/unified/20210210.130306 submit/tizen/20210209.102453 submit/tizen_6.5/20211028.162401 tizen_6.5.m2_release tizen_7.0_m2_release tizen_8.0_m2_release
INSUN PYO [Wed, 3 Feb 2021 04:43:03 +0000 (13:43 +0900)]
Change systemd-devel package name

Change-Id: I89c19fdcf7d9f08f92a90149e4cba9d23d2684b8

3 years agoSwitch to GPLv2.0 45/238945/3 accepted/tizen_6.0_unified accepted/tizen_6.0_unified_hotfix tizen_6.0 tizen_6.0_hotfix accepted/tizen/6.0/unified/20201030.115211 accepted/tizen/6.0/unified/hotfix/20201103.003325 accepted/tizen/unified/20200731.145746 submit/tizen/20200730.115129 submit/tizen_6.0/20201029.205104 submit/tizen_6.0_hotfix/20201102.192504 submit/tizen_6.0_hotfix/20201103.114804 tizen_6.0.m2_release
Krzysztof Jackiewicz [Mon, 20 Jul 2020 16:16:54 +0000 (18:16 +0200)]
Switch to GPLv2.0

Change-Id: I103450eec4177ffc39b1239905bdb2aa0a792cef

4 years agoFixes for gcc 9 81/222481/1 accepted/tizen/unified/20200116.101952 submit/tizen/20200115.094013
Tomasz Swierczek [Wed, 15 Jan 2020 09:33:07 +0000 (10:33 +0100)]
Fixes for gcc 9

Change-Id: Ie4504973bd0057f7561053a8850059d6fcd99236

4 years agoChange the config value of the "PermissionsStartOnly=" ("true" -> "yes") 41/208541/1
INSUN PYO [Wed, 26 Jun 2019 00:49:21 +0000 (09:49 +0900)]
Change the config value of the "PermissionsStartOnly=" ("true" -> "yes")

Change-Id: I473f0e5ddd5ef07f21fdd8aec5b31071d1b6cb91

5 years agoMerge "Change Nether rule to use raw table for UDP packet." into tizen
Kim Kidong [Wed, 31 Oct 2018 01:07:55 +0000 (01:07 +0000)]
Merge "Change Nether rule to use raw table for UDP packet." into tizen

5 years agoAdd Apache 2.0 license header 98/186898/5
Pawel Kowalski [Thu, 16 Aug 2018 09:50:38 +0000 (11:50 +0200)]
Add Apache 2.0 license header

Change-Id: Iba56dc1b4da52decbcc468805c4ddfde64a4a62e

5 years agoFix code style 14/186914/4
Pawel Kowalski [Thu, 16 Aug 2018 11:22:39 +0000 (13:22 +0200)]
Fix code style

Change-Id: Ia9b1218ab6d0e82de0837c6789b9bcaf067c3f7f

5 years agoChange Nether rule to use raw table for UDP packet. 60/183260/2
jin-gyu.kim [Wed, 4 Jul 2018 02:50:05 +0000 (11:50 +0900)]
Change Nether rule to use raw table for UDP packet.

UDP packets are dropped unexpectedly if those are included into NFQUEUE
simultaneously. This seems to be bug in conntrack, can be avoided
if raw table is used. It requires the kernel support to enable
CONFIG_IP_NF_RAW and change priority in nf_ip_hook_priorities.

Change-Id: I8f3b3e1ecf69a44486757f27c61b34da02f4fb42

6 years agoRelease 0.0.2 24/141424/2 accepted/tizen_5.5_unified_mobile_hotfix tizen_5.5_mobile_hotfix accepted/tizen/4.0/unified/20170816.010656 accepted/tizen/4.0/unified/20170829.020137 accepted/tizen/5.0/unified/20181102.021142 accepted/tizen/5.5/unified/20191031.022353 accepted/tizen/5.5/unified/mobile/hotfix/20201027.090212 accepted/tizen/unified/20170802.151206 submit/tizen/20170731.124137 submit/tizen/20170801.075759 submit/tizen_4.0/20170811.094300 submit/tizen_4.0/20170828.100004 submit/tizen_4.0/20170828.110004 submit/tizen_5.0/20181101.000004 submit/tizen_5.5/20191031.000004 submit/tizen_5.5_mobile_hotfix/20201026.185104 tizen_4.0.IoT.p1_release tizen_4.0.IoT.p2_release tizen_4.0.m2_release tizen_5.5.m2_release
Piotr Sawicki [Mon, 31 Jul 2017 10:11:18 +0000 (12:11 +0200)]
Release 0.0.2

This relase adds the ability of managing UDP, UDPLite and local DNS traffic.
Restoring of netfilter configuration has been moved from Nether executable to
systemd startup scripts. Managing of capabilities has been moved to
the security-config service. Furthermore, a few bugs has been fixed - defects
detected by Svace and those found during development of new features.

Change-Id: I43148e148952e1c19f0b379a3d9bce7c6e472234

6 years agoRemove caps option in spec file. 31/138631/1
jin-gyu.kim [Thu, 13 Jul 2017 05:06:04 +0000 (14:06 +0900)]
Remove caps option in spec file.

All capabilities need to be managed by security-config service.
Therefore, remove %caps option in spec file.

Change-Id: Icb6f620e2ebed561323f1ec427e5843bb3d4b3e8

6 years agoAdd filtering of IGMP packets 72/129472/10
Piotr Sawicki [Tue, 16 May 2017 09:49:20 +0000 (11:49 +0200)]
Add filtering of IGMP packets

When a user application registers itself in a multicast group
(IP_ADD_MEMBERSHIP), the underlying kernel mechanism sends appropriate
IGMP packets out. These packets don't contain any information about
credentials, as they are not associated with any socket. This additional
netfilter rule causes this kind of packets to be accepted before they reach
the Nether service. Prior to this change, IGMP packets were accepted by
Nether's default back-end, so this change is only for optimization purposes.
It is worth to mention that an application is not able to send IGMP packets
on its own, because the CAP_NET_RAW capability is required to do that.

Change-Id: Id2b6756f0e5737bed606742d87c5d09f04b6866a

6 years agoLet Nether manage UDPLite traffic and local DNS queries 04/124104/8
Piotr Sawicki [Thu, 4 May 2017 08:54:58 +0000 (10:54 +0200)]
Let Nether manage UDPLite traffic and local DNS queries

A netfilter rule has been added to let Nether manage UDPLite traffic for
outgoing connections. There are some kernel configurations that don't have
NF_CT_PROTO_UDPLITE option turned on. For these kernel images, the rule that
uses the conntrack module do not catch packets of the UDPLite protocol.
Special rules have been introduced to inspect DNS queries sent by an app
to the Connman service (running on localhost). The Connman service, which
works as a DNS proxy, sends the queries out of the box on behalf
of the app.

Change-Id: Ib41e61d8367b8c78eb814b3e98396e6c1e5fa4b1

6 years agoMerge "Turn on NFQA_CFG_F_GSO option for NFQUEUE" into tizen
Zofia Abramowska [Wed, 31 May 2017 11:41:03 +0000 (11:41 +0000)]
Merge "Turn on NFQA_CFG_F_GSO option for NFQUEUE" into tizen

6 years agoFix issues detected by SVACE 97/129597/10
Piotr Sawicki [Wed, 17 May 2017 06:35:02 +0000 (08:35 +0200)]
Fix issues detected by SVACE

Change-Id: I290fd7453cc96326442e73a4250cd58650a10b85

6 years agoProperly handle Cynara errors 76/129476/14
Piotr Sawicki [Tue, 16 May 2017 11:58:34 +0000 (13:58 +0200)]
Properly handle Cynara errors

Added handling of all possible errors that may be returned by Cynara's async
API. From now, an unused entry in responseQueue is erased when the processing
of a packet is done. Moreover, packets with incomplete credentials are not
handled by Cynara's backend, they are passed to backup backends for further
processing. Fix a bug in cynaraErrorCodeToString().

Change-Id: Ia93c6912a4222aa0787b3d5f68149a4bc2a7ebc8

6 years agoFix handling of unknown netlink messages 75/129475/12
Piotr Sawicki [Tue, 16 May 2017 11:44:08 +0000 (13:44 +0200)]
Fix handling of unknown netlink messages

A severe netlink error should stop the service, but other kinds of errors,
like inability to parse a netlink message by libnetfilter_queue, should only
be registered in the system log. These errors may happen when Nether issues
a verdict to a nonexistent packet (in result the kernel replies with an
error message).

Change-Id: I69bb811d34a993c28a2cde0cb0e8290c25c895d3

6 years agoTurn on NFQA_CFG_F_GSO option for NFQUEUE 61/131661/3
Piotr Sawicki [Tue, 30 May 2017 08:59:20 +0000 (10:59 +0200)]
Turn on NFQA_CFG_F_GSO option for NFQUEUE

This patch is required to deal with fragmented IP packets. It has been
revealed that without this option Nether has IP fragments without valid
credentials (UID/GID, security context) delivered. These fragments are
passed to the backup back-end which accepts them.
In result some fragments reach a network interface, which is not
what we expect. Of course, a listener is not able to receive such
traffic because of lack of important fragments.

Change-Id: I7485cc97f298c0cc73e3c011421de445ef1aaa02

6 years agoPrevent from dereferencing nullptr returned by localtime() 78/130678/7
Piotr Sawicki [Tue, 23 May 2017 09:09:59 +0000 (11:09 +0200)]
Prevent from dereferencing nullptr returned by localtime()

Change-Id: I4245c0e856c06c7d5e9ad1902590f5196f0394e0

6 years agoMake main() return proper status code 74/129474/11
Piotr Sawicki [Tue, 16 May 2017 10:58:34 +0000 (12:58 +0200)]
Make main() return proper status code

Until now, in case of a netlink error, Nether's main() function returned 0.
In result, systemd was not informed about the necessity of restarting
the Nether service.

Change-Id: I82baa62425939bf6f27dc472f84a4775a3f5d23d

6 years agoInitialize uid and gid fields of NetherPacket 73/129473/11
Piotr Sawicki [Tue, 16 May 2017 10:38:34 +0000 (12:38 +0200)]
Initialize uid and gid fields of NetherPacket

Under some circumstances, Nether may receive netlink packets which
don't contain uid and gid fields (e.g. IGMP packets generated by
the kernel). Prior to this change, uid and gid fields were not
properly initialized because the nfq_get_uid() and nfq_get_gid()
functions don't modify their second argument in case of an absence
of the UID/GID fields in an input packet.

Change-Id: I712d44a4eccb3603fdf5d8279e7eb1f49e8f34a7

6 years agoMerge "Modify iptables policy for policing all protocols, not only TCP" into tizen
Piotr Sawicki [Fri, 26 May 2017 13:28:50 +0000 (13:28 +0000)]
Merge "Modify iptables policy for policing all protocols, not only TCP" into tizen

6 years agoMerge "Load iptables rules from systemd unit file, not from nether program" into...
Piotr Sawicki [Fri, 26 May 2017 13:28:08 +0000 (13:28 +0000)]
Merge "Load iptables rules from systemd unit file, not from nether program" into tizen

6 years agoMerge "service file: make symlink /usr/lib/systemd/system/multi-user.target.wants...
Rafal Krypa [Fri, 26 May 2017 12:11:35 +0000 (12:11 +0000)]
Merge "service file: make symlink /usr/lib/systemd/system/multi-user.target.wants/nether.service" into tizen

6 years agoLoad iptables rules from systemd unit file, not from nether program 63/104863/6
Rafal Krypa [Wed, 28 Dec 2016 10:42:29 +0000 (11:42 +0100)]
Load iptables rules from systemd unit file, not from nether program

Drop nether support for loading iptables rules. Such rules should ideally be
managed from a central place that implements multiple requirements, not only
nether. It is not right for nether to be the manager of iptables policy.

For now nether daemon will stop managing the rules, they will be loaded from
systemd unit files. It is already done for ip6tables rules, as nether never
handled ip6tables for IPv6, only iptables for IPv4.

Change-Id: Icb0cf1f42b54e0859c182a6a4baac42e85294388

6 years agoSet Restart option as Always 73/130773/2
jin-gyu.kim [Wed, 24 May 2017 02:17:58 +0000 (11:17 +0900)]
Set Restart option as Always

Nether should be always running as it is the security module.
Even it is killed with the unexpected reason, it needs to be running again.

Change-Id: I10f515278b5862c7d3a43f5f2b7c741b06ca492b

6 years agoRemove nether.service file, it is autogenerated during build 62/104862/5
Rafal Krypa [Wed, 14 Dec 2016 12:00:34 +0000 (13:00 +0100)]
Remove nether.service file, it is autogenerated during build

The nether.service file is generated from nether.service.in. No need to keep the
generated version in the repository.

Change-Id: Id160521703b38d7e38cf1dda2a8d2b318d0edd2b

6 years agoconf: remove packet counters from iptables rules 61/104861/4
Rafal Krypa [Wed, 14 Dec 2016 11:44:01 +0000 (12:44 +0100)]
conf: remove packet counters from iptables rules

The packet counters were dumped from PC of developer who initially generated
the rules file. They are meaningless and confusing.

Change-Id: I184ae88999a937280bf11d5846fa3b0c0212c3e6

6 years agoMerge "Prevents against unterminated user chains in iptables policy" into tizen
Rafal Krypa [Fri, 26 May 2017 11:59:58 +0000 (11:59 +0000)]
Merge "Prevents against unterminated user chains in iptables policy" into tizen

7 years agoExclude loopback interface for setting secmark to 'System' 56/127056/1 accepted/tizen_3.0_common accepted/tizen_3.0_ivi accepted/tizen/3.0/common/20170508.153032 accepted/tizen/3.0/ivi/20170508.050341 accepted/tizen/3.0/mobile/20170508.050314 accepted/tizen/3.0/tv/20170508.050327 accepted/tizen/3.0/wearable/20170508.050336 accepted/tizen/unified/20170426.200024 submit/tizen/20170426.070401 submit/tizen_3.0-common/20170508.080135 submit/tizen_3.0-common/20170508.081301 submit/tizen_3.0-common/20170508.091535 submit/tizen_3.0/20170426.070355 submit/tizen_3.0_common/20170508.091735 tizen_4.0.m1_release
jin-gyu.kim [Wed, 26 Apr 2017 04:47:03 +0000 (13:47 +0900)]
Exclude loopback interface for setting secmark to 'System'

We gave secmark as 'System' as default.
Due to this, inter processes can send and receive with loopback
interface, without checking smack rules.
Therefore, we need to take loopback interface as the exception.

Change-Id: Ic7990521eba75e5204dd915f733eda3460501e3c

7 years agoservice file: make symlink /usr/lib/systemd/system/multi-user.target.wants/nether... 98/125998/2
INSUN PYO [Wed, 19 Apr 2017 18:28:40 +0000 (03:28 +0900)]
service file: make symlink /usr/lib/systemd/system/multi-user.target.wants/nether.service

Before : /usr/lib/systemd/system/multi-user.target.wants/nether.service is legacy file.
After : /usr/lib/systemd/system/multi-user.target.wants/nether.service indicates ../nether.service

Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: Ib216dddb187238a27c70ef205f8ebfc8bfe75a50

7 years agoUse %license macro to copy license file. 05/121805/1 accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable accepted/tizen/3.0/common/20170331.152248 accepted/tizen/3.0/ivi/20170331.044908 accepted/tizen/3.0/mobile/20170331.044456 accepted/tizen/3.0/tv/20170331.044628 accepted/tizen/3.0/wearable/20170331.044757 accepted/tizen/common/20170331.152645 accepted/tizen/ivi/20170330.224841 accepted/tizen/mobile/20170330.224721 accepted/tizen/tv/20170330.224758 accepted/tizen/unified/20170330.224857 accepted/tizen/wearable/20170330.224821 submit/tizen/20170330.102312 submit/tizen_3.0/20170330.102413
jin-gyu.kim [Wed, 29 Mar 2017 05:26:46 +0000 (14:26 +0900)]
Use %license macro to copy license file.

Change-Id: Ie00627d233f48b0098a05d0080eac878b22a8f86

7 years agoModify iptables policy for policing all protocols, not only TCP 77/116777/3
Rafal Krypa [Tue, 28 Feb 2017 07:51:27 +0000 (08:51 +0100)]
Modify iptables policy for policing all protocols, not only TCP

A new rule passing packets for nether inspection is replacing the old one
that worked only for TCP.
The new rule makes a policy check for a first packet in each network flow, as
seen by the conntrack module. This is done by matching all packets that have
ctstate=NEW (the packet has started a new connection) but not checking those
that have ctstatus=CONFIRMED (connection is confirmed: originating packet has
left box). This rule causes to nether check for each first packet on the flow,
the minimum required for determining whether the connection should be allowed.

For TCP connections, this should work exactly as the old rule. For connection-
less protocols it will check the first packet of the network flow.

Change-Id: Iccbe8febd1568a615d8169123d7f45b4e998a47d

7 years agoPrevents against unterminated user chains in iptables policy 62/118562/2
Anish Singhania [Thu, 9 Mar 2017 14:02:41 +0000 (19:32 +0530)]
Prevents against unterminated user chains in iptables policy

[Model] SM-Z400F
[BinType] AP
[Customer] Open

[Issue#]
[Request] PM
[Occurrence Version]

[Problem] Kernel panic occurs on enabling nether flags
[Cause & Measure] Add unconditional return rules to two use defined chains created
[Checking Method]

[Team] Security
[Developer] Anish Singhania
[Solution company] Samsung
[Change Type] Market Issue

Change-Id: I8a5cbacc2418d5268599ebbcc581cfe7227d88d1
Signed-off-by: Anish Singhania <a.singhania@samsung.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
7 years agoAdd missing initialization in constructor. 27/113627/4 accepted/tizen/3.0/common/20170216.151308 accepted/tizen/3.0/ivi/20170216.022610 accepted/tizen/3.0/mobile/20170216.022411 accepted/tizen/3.0/tv/20170216.022533 accepted/tizen/3.0/wearable/20170216.022555 accepted/tizen/common/20170215.170821 accepted/tizen/ivi/20170215.085643 accepted/tizen/mobile/20170215.085525 accepted/tizen/tv/20170215.085555 accepted/tizen/unified/20170309.033539 accepted/tizen/wearable/20170215.085618 submit/tizen/20170215.023110 submit/tizen_3.0/20170215.023044 submit/tizen_unified/20170308.100409
jin-gyu.kim [Wed, 8 Feb 2017 08:06:28 +0000 (17:06 +0900)]
Add missing initialization in constructor.

All member variables need to be set as the default value for the safe use.
Therefore, initialize 'processedPacket' in constructor as nullptr.

Change-Id: Ifa4c4695e764b29b0f070e7b745333da655f4c41

7 years agoAdd parentheses to remove build warning. 44/106844/1 accepted/tizen/3.0/common/20170118.130741 accepted/tizen/3.0/ivi/20170118.042548 accepted/tizen/3.0/mobile/20170118.042501 accepted/tizen/3.0/tv/20170118.042522 accepted/tizen/3.0/wearable/20170118.042533 accepted/tizen/common/20170120.125242 accepted/tizen/ivi/20170116.085929 accepted/tizen/mobile/20170116.085838 accepted/tizen/tv/20170116.085851 accepted/tizen/wearable/20170116.085914 submit/tizen/20170116.034909 submit/tizen_3.0/20170115.225845 submit/tizen_common/20170120.070309
jin-gyu.kim [Fri, 23 Dec 2016 07:56:52 +0000 (16:56 +0900)]
Add parentheses to remove build warning.

Change-Id: I1c9b30c3d46864a7464f840f56fc4e13ac62f574

7 years agoSet all packet's secmark to 'System' label on input iptables 26/101426/1 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv accepted/tizen_3.0.m2_wearable tizen_3.0.m2 accepted/tizen/3.0.m2/mobile/20170104.141804 accepted/tizen/3.0.m2/tv/20170104.142137 accepted/tizen/3.0.m2/wearable/20170104.142431 accepted/tizen/3.0/common/20161205.092154 accepted/tizen/3.0/ivi/20161205.065828 accepted/tizen/3.0/mobile/20161205.065747 accepted/tizen/3.0/tv/20161205.065808 accepted/tizen/3.0/wearable/20161205.065822 accepted/tizen/ivi/20161205.233725 accepted/tizen/mobile/20161205.233633 accepted/tizen/tv/20161205.233650 accepted/tizen/wearable/20161205.233709 submit/tizen/20161205.090948 submit/tizen_3.0.m2/20170104.093751 submit/tizen_3.0/20161205.010713
jooseong lee [Thu, 1 Dec 2016 06:30:27 +0000 (15:30 +0900)]
Set all packet's secmark to 'System' label on input iptables

It is hard to change packet's secmark in specific IP scope
to avoid Smack denial. Nether provides access control for
input and output packet better than IP management.

Change-Id: I7a6da0d53c313a7987217d62fefb16ef2f0b8a0f
Signed-off-by: jooseong lee <jooseong.lee@samsung.com>
7 years agoUpdate nether.rules for multicast IP 96/100096/2
jooseong lee [Fri, 25 Nov 2016 06:30:07 +0000 (15:30 +0900)]
Update nether.rules for multicast IP

Loopback communication should be allowed only for multicast address range.
In case, iptable will set packet's secmark to 'System' label to avoid
Smack deny issue.

Current -r option is for ipv4. ip6table will be updated on ExecStartPost.

* IPv4
 - '224.0.1.187', IPv4 multicast address for "All CoAP Nodes"
* IPv6
 - 'ff02::', IPv6 multicast address for "All CoAP Nodes", link-local scope
 - 'fe80::ae5a:14ff:fe0e:b2c0', This is only for iotcon provisioning, but
   should be removed.

Change-Id: Ic57d2205f8bb20ece23de4fe48db9d2cbad43ea8
Signed-off-by: jooseong lee <jooseong.lee@samsung.com>
7 years agoRevert "Disable nether.service temporarily" 95/100095/2
jooseong lee [Fri, 25 Nov 2016 06:29:45 +0000 (15:29 +0900)]
Revert "Disable nether.service temporarily"

This reverts commit 66b8b92ac00109fbf1cb7e9f03b0ce3d8bcd545b.

Change-Id: Iec896baed3f01e462f32027f3ecb1bf2b208bc85
Signed-off-by: jooseong lee <jooseong.lee@samsung.com>
7 years agoDisable nether.service temporarily 36/92836/1 accepted/tizen/3.0/common/20161114.110014 accepted/tizen/3.0/ivi/20161028.134047 accepted/tizen/3.0/mobile/20161028.133203 accepted/tizen/3.0/tv/20161028.133514 accepted/tizen/3.0/wearable/20161028.133803 accepted/tizen/common/20161019.145648 accepted/tizen/ivi/20161019.142009 accepted/tizen/mobile/20161019.141946 accepted/tizen/tv/20161019.141951 accepted/tizen/wearable/20161019.141955 submit/tizen/20161019.043044 submit/tizen_3.0/20161028.062323 submit/tizen_3.0/20161028.082423 submit/tizen_3.0_common/20161104.104000
jooseong lee [Wed, 19 Oct 2016 04:16:07 +0000 (13:16 +0900)]
Disable nether.service temporarily

When enabling CONFIG_SECURITY_SMACK_NETFILTER in Linux kernel,
we have unexpected behavior of Smack. Disable nether.service until
we find the proper solution.

Change-Id: I8d6a85962b5fcbacc57344d3f5453f98de018725
Signed-off-by: jooseong lee <jooseong.lee@samsung.com>
7 years agoCheck if policy backend descriptor is set 64/81464/3
Zbigniew Jasinski [Tue, 26 Jul 2016 10:00:37 +0000 (12:00 +0200)]
Check if policy backend descriptor is set

We need to check if policy backend descriptor is set before we even
check if it's ready for reading/writing.

Change-Id: I35d414ff8723089ecb552d944382c808d618d215
Signed-off-by: Zbigniew Jasinski <z.jasinski@samsung.com>
7 years agoFix for GCC 4.7 not supporting thread_local C++11 feature
Rafal Krypa [Wed, 13 Jul 2016 14:20:16 +0000 (16:20 +0200)]
Fix for GCC 4.7 not supporting thread_local C++11 feature

It must be at least GCC 4.8 to use C++11 thread_local specifier.
Bump GCC version for C++11 workarounds to 4.8.

Change-Id: I1f96d307aec12aae87bc0749ab2c5d1acb60e765

7 years agoFix compilation with GCC 4.7
Rafal Krypa [Wed, 13 Jul 2016 14:19:00 +0000 (16:19 +0200)]
Fix compilation with GCC 4.7

GCC 4.7 has some weird behaviour expecting some destructors to be declared
explicitly with "noexcept(true)":

  In file included from /data/src/security/nether/src/nether_Manager.cpp:25:0:
  /data/src/security/nether/src/../include/nether_Manager.h:37:3: error: looser throw specifier for â€˜virtual NetherManager::~NetherManager()’
  In file included from /data/src/security/nether/src/../include/nether_Manager.h:28:0,
                   from /data/src/security/nether/src/nether_Manager.cpp:25:
  /data/src/security/nether/src/../include/nether_Types.h:200:11: error:   overriding â€˜virtual NetherVerdictListener::~NetherVerdictListener() noexcept (true)’

Change-Id: I2b12d7b6255d4057a3b9f198c1ca2c5c9d477ea1

7 years agoFix compilation with clang
Rafal Krypa [Wed, 13 Jul 2016 14:09:11 +0000 (16:09 +0200)]
Fix compilation with clang

Clang doesn't like mixing "enum" with "enum class":

  error: enumeration previously declared as scoped

Stripping the "enum" keyword from NetherProtocolType.

Change-Id: Id62ef3514c90b2c7f26053558485ccb7f5a8af58

7 years agoSet SmackProcessLabel to System 18/80818/2 accepted/tizen/3.0/ivi/20161011.055421 accepted/tizen/3.0/mobile/20161015.034007 accepted/tizen/3.0/tv/20161016.005452 accepted/tizen/3.0/wearable/20161015.083714 accepted/tizen/common/20160721.175942 accepted/tizen/ivi/20160721.090816 accepted/tizen/mobile/20160721.090546 accepted/tizen/tv/20160721.091344 accepted/tizen/wearable/20160721.091115 submit/tizen/20160721.003054 submit/tizen_3.0_ivi/20161010.000005 submit/tizen_3.0_mobile/20161015.000005 submit/tizen_3.0_tv/20161015.000004 submit/tizen_3.0_wearable/20161015.000004
Yunjin Lee [Wed, 20 Jul 2016 10:28:42 +0000 (19:28 +0900)]
Set SmackProcessLabel to System

Change-Id: I31cceb7f0051b6f8f5c64c3b697962e9330cda90
Signed-off-by: Yunjin Lee <yunjin-.lee@samsung.com>
7 years agoSet capabilities for nether process and binary. 75/79675/3
Zbigniew Jasinski [Tue, 12 Jul 2016 09:07:25 +0000 (11:07 +0200)]
Set capabilities for nether process and binary.

Nether running as non-privileged user needs CAP_NET_ADMIN for netfilter
to work. Additionally it needs CAP_NET_RAW to restore firewall with
iptables.

Change-Id: Ieb358e8837769ffe2039c608be2361e2feec8a1c
Signed-off-by: Zbigniew Jasinski <z.jasinski@samsung.com>
7 years agoRemove brackets in service file. 03/78803/1 accepted/tizen/common/20160707.171646 accepted/tizen/ivi/20160707.043345 accepted/tizen/mobile/20160707.043404 accepted/tizen/tv/20160707.043250 accepted/tizen/wearable/20160707.043343 submit/tizen/20160707.022820
jin-gyu.kim [Thu, 7 Jul 2016 02:23:39 +0000 (11:23 +0900)]
Remove brackets in service file.

Change-Id: I9a27c41a23fdb2d3bd8bb6a2a9377d25029b0a49

7 years agochange nether service to non-root service and drop capability. 60/77460/1 accepted/tizen/ivi/20160706.132707 accepted/tizen/mobile/20160706.131438 accepted/tizen/tv/20160706.131517 accepted/tizen/wearable/20160706.131606 submit/tizen/20160706.073439
keeho.yang [Thu, 30 Jun 2016 01:48:36 +0000 (10:48 +0900)]
change nether service to non-root service and drop capability.

Change-Id: I95aea0e4d64f1155f66d826fe8a9125fcae88c88

7 years agoRevert "Disable nether.service temporarily for high memory usage" 93/74993/1 accepted/tizen/common/20160620.163042 accepted/tizen/ivi/20160617.083037 accepted/tizen/mobile/20160617.082853 accepted/tizen/tv/20160617.082824 accepted/tizen/wearable/20160617.082844 submit/tizen/20160616.085821
Tomasz Swierczek [Thu, 16 Jun 2016 08:25:14 +0000 (10:25 +0200)]
Revert "Disable nether.service temporarily for high memory usage"

This reverts commit 66efb1d04bd6168ccc6b7466643d33fdd7a68efb.

Change-Id: I5fc6143c020ae58db2012d4f00f711bf60c68333

7 years agoFix high CPU load on nether startup 27/74727/1 accepted/tizen/common/20160616.151910 submit/tizen/20160616.061238
Zbigniew Jasinski [Wed, 15 Jun 2016 09:40:07 +0000 (11:40 +0200)]
Fix high CPU load on nether startup

During startup nether tries to connect to Cynara backend.
In backend class constructor, Cynara file descriptor is set
to 0, which is valid, but not proper Cynara descriptor.

Change-Id: I4938a3074e1f1cf034a13f98768af89d0c20ebb3
Signed-off-by: Zbigniew Jasinski <z.jasinski@samsung.com>
7 years agoDisable nether.service temporarily for high memory usage 80/73880/1 accepted/tizen/common/20160610.182426 accepted/tizen/ivi/20160610.114619 accepted/tizen/mobile/20160610.114517 accepted/tizen/tv/20160610.114537 accepted/tizen/wearable/20160610.114600 submit/tizen/20160610.023316
jooseong lee [Fri, 10 Jun 2016 02:10:42 +0000 (11:10 +0900)]
Disable nether.service temporarily for high memory usage

USER PID PPID RSS  SIZE VSZ  %MEM %CPU TIME    COMMAND
root 356 1    1364 332  4148 0.1  99.5 0:23:05 nether

Change-Id: I3ffdb7c32327846bcb27de15275954a4db41283e
Signed-off-by: jooseong lee <jooseong.lee@samsung.com>
7 years agoMerge "Apply ASLR" into tizen accepted/tizen/common/20160609.154902 accepted/tizen/ivi/20160609.090843 accepted/tizen/mobile/20160609.090811 accepted/tizen/tv/20160609.090830 accepted/tizen/wearable/20160609.090841 submit/tizen/20160608.112218
Zbigniew Jasinski [Mon, 6 Jun 2016 10:51:44 +0000 (03:51 -0700)]
Merge "Apply ASLR" into tizen

7 years agoAdd missing 'break' in switch / case 92/71592/1 accepted/tizen/common/20160527.153759 accepted/tizen/ivi/20160528.111203 accepted/tizen/mobile/20160528.111149 accepted/tizen/tv/20160528.111201 accepted/tizen/wearable/20160528.111152 submit/tizen/20160527.090619 submit/tizen/20160528.093549
jin-gyu.kim [Thu, 26 May 2016 05:26:03 +0000 (14:26 +0900)]
Add missing 'break' in switch / case

Change-Id: I797936bb2546afda2f6633b4f0c02861fe69c0a1

7 years agoApply ASLR 65/70665/1
Yunjin Lee [Fri, 20 May 2016 05:28:29 +0000 (14:28 +0900)]
Apply ASLR

Change-Id: Id2c349fd38fff6af5c14b2a69688908316f83cbb
Signed-off-by: Yunjin Lee <yunjin-.lee@samsung.com>
8 years agoMinor fixes 10/65110/1 accepted/tizen/common/20160408.184826 accepted/tizen/ivi/20160408.004343 accepted/tizen/mobile/20160408.004416 accepted/tizen/tv/20160408.004349 accepted/tizen/wearable/20160408.004412 submit/tizen/20160407.135155 submit/tizen/20160527.090025
Zbigniew Jasinski [Thu, 7 Apr 2016 08:51:48 +0000 (10:51 +0200)]
Minor fixes

Change-Id: Ic66c9fe1c750bd1ef73abb782efdd9595d1b02b8

8 years ago- added a disable_cipso script 34/64234/3
r.kubiak [Wed, 30 Mar 2016 14:50:10 +0000 (16:50 +0200)]
- added a disable_cipso script
- modified README.md for github (synced with wiki.tizen.org)

Change-Id: Ia2ee53fbb216f869ed91f46aecb0cac941c2ad6a
Signed-off-by: Zbigniew Jasinski <z.jasinski@samsung.com>
8 years agonether internal logic follow up 74/63574/6
r.kubiak [Thu, 24 Mar 2016 13:37:14 +0000 (14:37 +0100)]
nether internal logic follow up

- mark is always int32_t and -1 means that
  no packet marking is done, and the packet
  should go through normal iptables rules

- when not copying packet, address and port
  are zeroed to indicate this in logs

- the builtin privilege for cynara is used
  unless specified in the policy file or
  on the command line NETHER_CYNARA_INTERNET_PRIVILEGE

- new command line parameters for cynara
  backend are "policy" - defines the path
  of the policy file  and "privname" - defines
  the default privilege to use when doing
  cynara checks

Change-Id: I1b4a91685af7f27fff162317a63e15a2d1b7319c
Signed-off-by: Zbigniew Jasinski <z.jasinski@samsung.com>
8 years agoFirst draft of simple nether logic. 73/63573/2
r.kubiak [Wed, 23 Mar 2016 16:58:56 +0000 (17:58 +0100)]
First draft of simple nether logic.

This allows to specify exclusion rules in the
cynara backend, so that certain privileges
can be marked with different packet marks
and thanks to iptables those packets can
hit other chains (not the default ones)
so they can pass through or get redirected
if needed.

Change-Id: I61092196c727bddf975d404171468a251db55ea4
Signed-off-by: Zbigniew Jasinski <z.jasinski@samsung.com>
8 years agoMerge branch 'tizen' of ssh://review.tizen.org:29418/platform/core/security/nether... accepted/tizen/common/20160315.222152 accepted/tizen/ivi/20160313.114808 accepted/tizen/mobile/20160311.143423 accepted/tizen/tv/20160313.113829 accepted/tizen/wearable/20160313.114234 submit/tizen/20160311.103935 submit/tizen_common/20160311.103923
r.kubiak [Fri, 11 Mar 2016 10:38:37 +0000 (11:38 +0100)]
Merge branch 'tizen' of ssh://review.tizen.org:29418/platform/core/security/nether into tizen

8 years agoMerge "Add compiler warning flags and fix compile warning" into tizen
Roman Kubiak [Fri, 11 Mar 2016 10:19:53 +0000 (02:19 -0800)]
Merge "Add compiler warning flags and fix compile warning" into tizen

8 years agoAdd compiler warning flags and fix compile warning 52/61752/3
seong.chung [Thu, 10 Mar 2016 09:01:07 +0000 (18:01 +0900)]
Add compiler warning flags and fix compile warning

[Problem]
In case of adding compiler warning, there is one build error in class NetherCynaraBackend

The order of member variable between cynaraConfig and cynaraResult in class declaration is different from order of enumeration in constructor

* class declaration
class NetherCynaraBackend : public NetherPolicyBackend
{
   ....
   private:
   ....

          cynara_async_configuration *cynaraConfig;
          std::vector<u_int32_t> responseQueue;
          int cynaraResult;
}

* constructor
NetherCynaraBackend::NetherCynaraBackend(const NetherConfig &netherConfig)
             : NetherPolicyBackend(netherConfig), currentCynaraDescriptor(0),
             cynaraLastResult(CYNARA_API_UNKNOWN_ERROR), CynaraConfig(nullptr)

[Fix]
Change order between cynaraResult and cynaraConfig of class declaration

Change-Id: Ia03b10a33ee6b025ee28d76b82035e8f9cfb68d1
Signed-off-by: seong.chung <seong.chung@samsung.com>
8 years agocmake fix, added CXX flags from rpmbuild to be included
r.kubiak [Fri, 4 Mar 2016 15:11:12 +0000 (16:11 +0100)]
cmake fix, added CXX flags from rpmbuild to be included
in the actual build (otherwise they were ignored)

8 years agoMove iptables-restore after full init 92/60292/1
r.kubiak [Wed, 24 Feb 2016 17:53:46 +0000 (18:53 +0100)]
Move iptables-restore after full init

This patch moves the loading of iptables rules
after all subsystems have been initialized. In
case any of the subsystems fails,  nether will
not leave any rules behind.

Change-Id: I86b63848d7864a684f2ed5d3f10c9e4419712617

8 years agoTemporary fix for images without proper nether patches. 90/60290/1 accepted/tizen/common/20160225.160641 accepted/tizen/ivi/20160225.082022 accepted/tizen/mobile/20160225.081929 accepted/tizen/tv/20160225.081947 accepted/tizen/wearable/20160225.082000 submit/tizen/20160224.165550 submit/tizen/20160224.170026 submit/tizen_common/20160224.170035
r.kubiak [Wed, 24 Feb 2016 16:51:11 +0000 (17:51 +0100)]
Temporary fix for images without proper nether patches.

If the nether patches are not in the kernel, the rule
that was commented out, will stop all outgoing network traffic.
This should not be the case thanks to the queue-bypass
parameter to iptables, but it seems to fail anyway.

Since the kernel patches are not yet merged, nether is
useless anyway. This will fix any issues until this changes.

Change-Id: Ic6c6876a62588f76d0f7e4105d2866320474149f

8 years agoFixed the -d option. 98/58098/1
r.kubiak [Wed, 27 Jan 2016 11:44:39 +0000 (12:44 +0100)]
Fixed the -d option.

Change-Id: I82c08e1558bf23fb7c446f0eddd8540692a8d51e

8 years agoBump release version 97/58097/1
r.kubiak [Wed, 27 Jan 2016 11:36:06 +0000 (12:36 +0100)]
Bump release version

Change-Id: I07b1c7ec8f0cc4c78c20fbaf3a3d5031d682ec17

8 years agoThis patch disables the "-d" option for systemd, nether 94/52594/1 accepted/tizen/ivi/20160218.023857 accepted/tizen/mobile/20160125.011644 accepted/tizen/tv/20160125.011651 accepted/tizen/wearable/20160125.011655 submit/tizen/20160122.121634 submit/tizen_common/20160122.121757 submit/tizen_common/20160218.142243 submit/tizen_ivi/20160217.000000 submit/tizen_ivi/20160217.000003
r.kubiak [Tue, 24 Nov 2015 13:28:58 +0000 (14:28 +0100)]
This patch disables the "-d" option for systemd, nether
does not fork into background and systemd is keeping
nether alive.

Change-Id: I1674e27919694773814104c0f0045a7ee3d21694

8 years agoAdded apache LICENSE file 73/52173/1 accepted/tizen/mobile/20151119.232410 accepted/tizen/tv/20151119.232431 accepted/tizen/wearable/20151119.232437 submit/tizen/20151119.145050 submit/tizen_common/20151123.122441
r.kubiak [Thu, 19 Nov 2015 12:48:26 +0000 (13:48 +0100)]
Added apache LICENSE file

Change-Id: If9ab9b33a53e93121cfbbe227d2f9b77845a69da

8 years agoFix potential failures with inheritance 59/52059/2
Aleksander Zdyb [Wed, 18 Nov 2015 14:34:32 +0000 (15:34 +0100)]
Fix potential failures with inheritance

Classes being inherited should generally have virtual destructors.
There was no problem at the moment, but it will help preventing failures
in the future.

Change-Id: I5ddd7c6bf5f8bd4751082244bc3730bc3d78691c

8 years agoAdded performance test scripts and programs 19/49219/1 submit/tizen/20151110.144250
r.kubiak [Thu, 8 Oct 2015 14:22:55 +0000 (16:22 +0200)]
Added performance test scripts and programs

Change-Id: Iaf497786d993e98e6020290e0c5cb33af1461e23

8 years agoAdded a cynara backend option (passed as a primary backend 18/49218/1
r.kubiak [Thu, 8 Oct 2015 13:32:24 +0000 (15:32 +0200)]
Added a cynara backend option (passed as a primary backend
option -P) cache-size, to control the client side of cynara
caache (default is 1000). This size is in cynara objects
not kilo-mega/bytes.

Change-Id: Ia02053990d01d37a00f8d78ab743d60a7a0e758b

8 years agoAdded loopback rules, so that the REJECT target 17/49217/1
r.kubiak [Wed, 7 Oct 2015 15:40:26 +0000 (17:40 +0200)]
Added loopback rules, so that the REJECT target
can transmit ICMP packets to the process.

Change-Id: Idb5494f72e380164ab1473d18ef1f41a83e03ebe

8 years agoCynaara backend init, needs to return a valid 16/49216/1
r.kubiak [Wed, 7 Oct 2015 15:39:19 +0000 (17:39 +0200)]
Cynaara backend init, needs to return a valid
descriptor otherwise an error will be reported.

Change-Id: I3ea749bd39b7a61cb05d00a8d2cb63c51336cebb

8 years agoAdded a relaxed mode. 48/46448/2
RomanKubiak [Thu, 20 Aug 2015 11:31:02 +0000 (13:31 +0200)]
Added a relaxed mode.

This allows to run nether in a permissive/relaxed
mode where all DENY requestes are actualy allowed
but logged via AUDIT.

Change-Id: I0f67f061b2697a80d610d1988b706bd92de05944

8 years agoFixed cynara socket initialization. 72/46072/1
RomanKubiak [Thu, 13 Aug 2015 14:26:05 +0000 (16:26 +0200)]
Fixed cynara socket initialization.

Change-Id: I38fe7751f087a719657e9d6a6da58cea3bf4a9d4

8 years agoAdded optional interface information (output interface only) 52/46052/1
RomanKubiak [Thu, 13 Aug 2015 11:06:23 +0000 (13:06 +0200)]
Added optional interface information (output interface only)

Small fix for daemon mode.

Change-Id: I8fa3974ad54f5fd4b403672ba3a4abe3c8e7c568

8 years agoFix for bad policy install path 51/46051/1
RomanKubiak [Mon, 10 Aug 2015 15:23:43 +0000 (17:23 +0200)]
Fix for bad policy install path

Change-Id: I90e8e565d8f9efd46c34833a74cf59012163d6b0

8 years agoPacket copying is now optional. 12/45312/2
RomanKubiak [Tue, 4 Aug 2015 12:39:48 +0000 (14:39 +0200)]
Packet copying is now optional.

We need to copy packets to userspace to get
TCP/IP information (address, port, protocol)

This has been made optional now.

Change-Id: Ic753a8ecacdf460b2587f65457a80e1da9bb21a6

8 years agoAdded a fix for malformed policy files. 97/45297/1
RomanKubiak [Tue, 4 Aug 2015 12:24:51 +0000 (14:24 +0200)]
Added a fix for malformed policy files.

Change-Id: Ia362e8003df4eb3af0ccb2d47482d58d1b3edee9

8 years agoFixed a compilation error when cynara is not available. 93/45293/1
RomanKubiak [Tue, 4 Aug 2015 12:04:53 +0000 (14:04 +0200)]
Fixed a compilation error when cynara is not available.

Change-Id: Ifa595f3cc1ef31d758cb40f468a46e1a36f8abd7

8 years agoModified sources to eliminate pedantic warnings 08/45208/1
RomanKubiak [Mon, 3 Aug 2015 13:19:40 +0000 (15:19 +0200)]
Modified sources to eliminate pedantic warnings
from gcc.

- split function declaration and implementation
- delt with unsigned/signed comparison in Cynara
  backend

Change-Id: I1b77af78292915efa9e850d32445c97d5893c513

8 years agoFixed EOLs/TABs/spaces 75/44675/3
RomanKubiak [Fri, 24 Jul 2015 13:14:34 +0000 (15:14 +0200)]
Fixed EOLs/TABs/spaces
Included fixes and changes from change I16970c3dedd9071c970523a478fbf35e009d13ef
as commented by Jan Olszak and Rafal Krypa

refer to https://review.tizen.org/gerrit/#/c/44086/ for details

Removed const qualifiers on method return types.
Removed unused parameters from method definitions.

Change-Id: Ic03f4b35cdb476005749d2c93a413a83c09490fd

8 years agoSwitched all enums to "enum class : uint8_t" types 99/44599/2
RomanKubiak [Thu, 23 Jul 2015 12:31:43 +0000 (14:31 +0200)]
Switched all enums to "enum class : uint8_t" types

Change-Id: I0c24cb67e2cb362a2c1970edca6f1947e05b806a

8 years agorunAsDaemon function to work in the background 00/44500/3
RomanKubiak [Wed, 22 Jul 2015 15:14:38 +0000 (17:14 +0200)]
runAsDaemon function to work in the background
a fix for iptables rules to only catch the first
"new" packet not ALL

Change-Id: Ib5f2359a7a74da97a9b48d808005a5fe166975bb

8 years agoAdded audit support 93/44293/2
RomanKubiak [Mon, 20 Jul 2015 14:11:10 +0000 (16:11 +0200)]
Added audit support
Updated cmake to include certain constants
Made boost optional not required
Fixed spec
Added iptables-restore support

Change-Id: I3b965023bd5c5a07612f80fa2e040454e7db42a2

8 years agoAdded the README.md file for github 90/44090/4
RomanKubiak [Thu, 16 Jul 2015 14:57:24 +0000 (16:57 +0200)]
Added the README.md file for github
Added license info to files
Using unique_ptr<> in manager
Broke up the process() method in manager

Change-Id: I980d281d7decae6d1e23b9f5937117449ac627e3

8 years agoAdded nether helper scripts and a simple example policy 89/44089/1
RomanKubiak [Thu, 16 Jul 2015 14:57:12 +0000 (16:57 +0200)]
Added nether helper scripts and a simple example policy
for the file backend.

Change-Id: Ife2f173d9964cb9f65a9c88d8779872020ab6e46

8 years agoIncluded vasum logger class. 88/44088/1
RomanKubiak [Thu, 16 Jul 2015 14:56:05 +0000 (16:56 +0200)]
Included vasum logger class.
Some modifications
- added an option to disable colours in stderr logger
- added a syslog backend if journal is not available
- added a file backend

Change-Id: Id6ed1c56f871be8970879277b331b26d0e3969f3

8 years agoBuild subsystem for nether (cmake, codeblocks, spec) 87/44087/1
RomanKubiak [Thu, 16 Jul 2015 14:55:05 +0000 (16:55 +0200)]
Build subsystem for nether (cmake, codeblocks, spec)

Change-Id: I35e39dc7e34087126b0a8aa2999cd0f7eb733fe3

8 years agoInitial source code for nether 0.0.1 (source code only) 86/44086/1
RomanKubiak [Thu, 16 Jul 2015 14:54:22 +0000 (16:54 +0200)]
Initial source code for nether 0.0.1 (source code only)

Change-Id: I16970c3dedd9071c970523a478fbf35e009d13ef

8 years agoInitial empty repository master
KyungMi Lee [Thu, 16 Jul 2015 07:46:44 +0000 (00:46 -0700)]
Initial empty repository