Skip to contentSkip to conversation

contrib: ntp interface runs both ntpd and ntpdate

PATCH New Guido Trentalancia 2 participants 4 messages Apr 14, 2018 – Apr 16, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 contrib: ntp interface runs both ntpd and ntpdate

The ntp_run() interface is modified so that it also allows to run ntpdate and not just ntpd.

The comment in the ntpdate is changed to reflect the fact that ntpdate is a client and not a server.

---
 policy/modules/contrib/ntp.if |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
policy/modules/contrib/ntp.if +4 -3
diff -pru a/policy/modules/contrib/ntp.if b/policy/modules/contrib/ntp.if
@@ -55,8 +55,8 @@ interface(`ntp_domtrans',`
 
 ########################################
 ## <summary>
-##	Execute ntp in the ntp domain, and
-##	allow the specified role the ntp domain.
+##	Execute ntp or ntpdate in the ntp domain,
+##	and allow the specified role the ntp domain.
 ## </summary>
 ## <param name="domain">
 ##	<summary>
@@ -76,12 +76,13 @@ interface(`ntp_run',`
 	')
 
 	ntp_domtrans($1)
+	ntp_domtrans_ntpdate($1)
 	roleattribute $2 ntpd_roles;
 ')
 
 ########################################
 ## <summary>
-##	Execute ntpdate server in the ntpd domain.
+##	Execute ntpdate client in the ntpd domain.
 ## </summary>
 ## <param name="domain">
 ##	<summary>
#1 lore raw

PATCH 2/2 contrib: ntp interface runs both ntpd and ntpdate

Quoted 26 lines · Guido Trentalancia via refpolicy

The ntp_run() interface is modified so that it also allows to run ntpdate and not just ntpd.

The comment in the ntpdate is changed to reflect the fact that ntpdate is a client and not a server.

---
  policy/modules/contrib/ntp.if |    7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)

diff -pru a/policy/modules/contrib/ntp.if b/policy/modules/contrib/ntp.if

policy/modules/contrib/ntp.if +2 -2
@@ -55,8 +55,8 @@ interface(`ntp_domtrans',`
 
  ########################################
  ## <summary>
-##	Execute ntp in the ntp domain, and
-##	allow the specified role the ntp domain.
+##	Execute ntp or ntpdate in the ntp domain,
+##	and allow the specified role the ntp domain.
  ## </summary>
  ## <param name="domain">
  ##	<summary>

policy/modules/contrib/ntp.if interface(`ntp_run',` · line 82

Quoted 7 lines
policy/modules/contrib/ntp.if +1 -0
@@ -76,12 +76,13 @@ interface(`ntp_run',`
  	')
 
  	ntp_domtrans($1)
+	ntp_domtrans_ntpdate($1)
  	roleattribute $2 ntpd_roles;
  ')
 

This definitely needs to be in a separate interface, ntp_run_ntpdate().

Signature · 1 line
Chris PeBenito
#2 lore raw

PATCH 2/2 contrib: ntp interface runs both ntpd and ntpdate

That's fine to me, I was undecided...

Regards,

Guido

Quoted 39 lines · Chris PeBenito
Quoted 6 lines · Guido Trentalancia via refpolicy

The ntp_run() interface is modified so that it also allows to run ntpdate and not just ntpd.

The comment in the ntpdate is changed to reflect the fact that ntpdate is a client and not a server.

Quoted 6 lines
---
  policy/modules/contrib/ntp.if |    7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)

diff -pru a/policy/modules/contrib/ntp.if

b/policy/modules/contrib/ntp.if

Quoted 1 line

--- a/policy/modules/contrib/ntp.if 2017-09-29 19:01:55.171455647

+0200

Quoted 1 line

+++ b/policy/modules/contrib/ntp.if 2018-04-14 18:14:18.537666188

+0200

Quoted 12 lines
policy/modules/contrib/ntp.if +2 -2
@@ -55,8 +55,8 @@ interface(`ntp_domtrans',`
 
  ########################################
  ## <summary>
-##	Execute ntp in the ntp domain, and
-##	allow the specified role the ntp domain.
+##	Execute ntp or ntpdate in the ntp domain,
+##	and allow the specified role the ntp domain.
  ## </summary>
  ## <param name="domain">
  ##	<summary>

policy/modules/contrib/ntp.if interface(`ntp_run',` · line 82

Quoted 7 lines
policy/modules/contrib/ntp.if +1 -0
@@ -76,12 +76,13 @@ interface(`ntp_run',`
  	')
 
  	ntp_domtrans($1)
+	ntp_domtrans_ntpdate($1)
  	roleattribute $2 ntpd_roles;
  ')
 

This definitely needs to be in a separate interface, ntp_run_ntpdate().

#3 lore raw

PATCH v2 2/2 contrib: ntp interface runs both ntpd and ntpdate

In reply to Chris PeBenito

A new ntp_run_ntpdate() interface is added so that it is possible to run ntpdate with a domain transition and not just ntpd.

The comment in the ntpdate is changed to reflect the fact that ntpdate is a client and not a server.

---
 policy/modules/contrib/ntp.if |   28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
policy/modules/contrib/ntp.if +27 -1
@@ -81,7 +81,7 @@ interface(`ntp_run',`
 
 ########################################
 ## <summary>
-##	Execute ntpdate server in the ntpd domain.
+##	Execute ntpdate client in the ntpd domain.
 ## </summary>
 ## <param name="domain">
 ##	<summary>
@@ -99,6 +99,32 @@ interface(`ntp_domtrans_ntpdate',`
 ')
 
 ########################################
+## <summary>
+##	Execute ntpdate in the ntp domain, and
+##	allow the specified role the ntp domain.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed to transition.
+##	</summary>
+## </param>
+## <param name="role">
+##	<summary>
+##	Role allowed access.
+##	</summary>
+## </param>
+## <rolecap/>
+#
+interface(`ntp_run_ntpdate',`
+	gen_require(`
+		attribute_role ntpd_roles;
+	')
+
+	ntp_domtrans_ntpdate($1)
+	roleattribute $2 ntpd_roles;
+')
+
+########################################
 ## <summary>
 ##	Execute ntpd init scripts in
 ##	the init script domain.