From 1ff772122e7ef1d88fcbf41044882a49611e1d48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= <cedric.dsm@tiolive.com>
Date: Wed, 12 Oct 2011 19:27:26 +0200
Subject: [PATCH] Add draft of IP binding, add TODOs

---
 slapos/recipe/cubrid/__init__.py                    | 7 +++++++
 slapos/recipe/cubrid/template/access_file.txt.in    | 5 +++++
 slapos/recipe/cubrid/template/cubrid_broker.conf.in | 5 ++++-
 slapos/recipe/cubrid/template/iplist.txt.in         | 1 +
 4 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 slapos/recipe/cubrid/template/access_file.txt.in
 create mode 100644 slapos/recipe/cubrid/template/iplist.txt.in

diff --git a/slapos/recipe/cubrid/__init__.py b/slapos/recipe/cubrid/__init__.py
index bb64b5f86..554a525f0 100644
--- a/slapos/recipe/cubrid/__init__.py
+++ b/slapos/recipe/cubrid/__init__.py
@@ -79,6 +79,10 @@ class Recipe(BaseSlapRecipe):
       manager_port=1523, database='cubrid_slapos_db'):
     # XXX-Cedric : use work from Antoine to have backuped + generic cubrid
     # XXX-Cedric : Check that running this recipe does not erase database
+    # XXX-Cedric : Check manager status
+    # XXX-Cedric : Check master status
+    # XXX-Cedric : restrict everything by user/password
+    # XXX-Cedric : IPv6?
     config_dict = {}
     config_dict.update(self.options)
     config_dict.update(self.parameter_dict)
@@ -115,6 +119,9 @@ class Recipe(BaseSlapRecipe):
     self._createSimlink(cubrid_broker_configuration_path,
         os.path.join(cubrid_conf_directory, 'cubrid_broker.conf'))
 
+    # XXX-Cedric : Finish IP binding http://www.cubrid.org/manual/840/en/Broker%20Server%20Access%20Limitation
+    #              Add access_file.txt.in, iplist.txt.in
+
     # Files needed to fill database for demo
     demodb_schema_template_path = self.getTemplateFilename('demodb_schema')
     self._writeFile(os.path.join(cubrid_home_path, 'demodb_schema'),
diff --git a/slapos/recipe/cubrid/template/access_file.txt.in b/slapos/recipe/cubrid/template/access_file.txt.in
new file mode 100644
index 000000000..69a00bf30
--- /dev/null
+++ b/slapos/recipe/cubrid/template/access_file.txt.in
@@ -0,0 +1,5 @@
+[%%QUERY_EDITOR]
+*:*:iplist.txt
+ 
+[%%BROKER1]
+*:*:iplist.txt
\ No newline at end of file
diff --git a/slapos/recipe/cubrid/template/cubrid_broker.conf.in b/slapos/recipe/cubrid/template/cubrid_broker.conf.in
index 73ffab4b2..99c2e6971 100644
--- a/slapos/recipe/cubrid/template/cubrid_broker.conf.in
+++ b/slapos/recipe/cubrid/template/cubrid_broker.conf.in
@@ -14,6 +14,8 @@ SQL_LOG                 =ON
 TIME_TO_KILL            =120
 SESSION_TIMEOUT         =300
 KEEP_CONNECTION         =AUTO
+ACCESS_ CONTROL         =ON
+ACCESS_CONTROL_FILE     =%(cubrid_home)s/access_file.txt
 
 [%%BROKER1]
 SERVICE                 =ON
@@ -27,4 +29,5 @@ SQL_LOG                 =ON
 TIME_TO_KILL            =120
 SESSION_TIMEOUT         =300
 KEEP_CONNECTION         =AUTO
-
+ACCESS_ CONTROL         =ON
+ACCESS_CONTROL_FILE     =%(cubrid_home)s/access_file.txt
diff --git a/slapos/recipe/cubrid/template/iplist.txt.in b/slapos/recipe/cubrid/template/iplist.txt.in
new file mode 100644
index 000000000..ecac9b6ce
--- /dev/null
+++ b/slapos/recipe/cubrid/template/iplist.txt.in
@@ -0,0 +1 @@
+%(private_ip)s
\ No newline at end of file
-- 
2.30.9