Adding a new feature that makes process jailing rules more fine-grained - we can...
authorrtrimana <rtrimana@uci.edu>
Fri, 1 Dec 2017 22:26:24 +0000 (14:26 -0800)
committerrtrimana <rtrimana@uci.edu>
Fri, 1 Dec 2017 22:26:24 +0000 (14:26 -0800)
39 files changed:
benchmarks/Java/HomeSecurityController/HomeSecurityController.config
benchmarks/Java/HomeSecurityController/Makefile
benchmarks/Java/IrrigationController/IrrigationController.config
benchmarks/Java/IrrigationController/IrrigationController.tomoyo [new file with mode: 0644]
benchmarks/Java/IrrigationController/Makefile
benchmarks/Java/Lifxtest/Lifxtest.config
benchmarks/Java/SmartLightsController/Makefile
benchmarks/Java/SmartLightsController/SmartLightsController.config
benchmarks/Java/SmartLightsController/SmartLightsController.tomoyo [new file with mode: 0644]
benchmarks/Java/SpeakerController/Makefile
benchmarks/Java/SpeakerController/SpeakerController.config
benchmarks/Java/SpeakerController/SpeakerController.tomoyo [new file with mode: 0644]
benchmarks/drivers/Java/AmcrestCamera/AmcrestCamera.config
benchmarks/drivers/Java/AmcrestCamera/AmcrestCamera.tomoyo [new file with mode: 0644]
benchmarks/drivers/Java/AudioRoom/AudioRoom.config
benchmarks/drivers/Java/BlossomSprinkler/BlossomSprinkler.config
benchmarks/drivers/Java/DlinkAlarm/DlinkAlarm.config
benchmarks/drivers/Java/DoorlockActuator/DoorlockActuator.config
benchmarks/drivers/Java/DoorlockSensor/DoorlockSensor.config
benchmarks/drivers/Java/EspAlarm/EspAlarm.config
benchmarks/drivers/Java/EspSprinkler/EspSprinkler.config
benchmarks/drivers/Java/GPSPhoneGateway/GPSPhoneGateway.config
benchmarks/drivers/Java/GreenLawn/GreenLawn.config
benchmarks/drivers/Java/HomeRoom/HomeRoom.config
benchmarks/drivers/Java/IHome/IHome.config
benchmarks/drivers/Java/LabRoom/LabRoom.config
benchmarks/drivers/Java/LifxLightBulb/LifxLightBulb.config
benchmarks/drivers/Java/Makefile
benchmarks/drivers/Java/MotionSensor/MotionSensor.config
benchmarks/drivers/Java/MultipurposeSensor/MultipurposeSensor.config
benchmarks/drivers/Java/SpruceSensor/SpruceSensor.config
benchmarks/drivers/Java/WaterLeakSensor/WaterLeakSensor.config
benchmarks/drivers/Java/WeatherPhoneGateway/WeatherPhoneGateway.config
iotjava/iotruntime/master/IoTMaster.java
iotjava/iotruntime/master/ProcessJailConfig.java
localconfig/mysql/cameras.config
localconfig/mysql/iotcloudServer.config
localconfig/mysql/lawnSprinklerRelation.config
localconfig/mysql/lifx_light_bulb.config

index 7e9a569..9d3aee2 100644 (file)
@@ -22,12 +22,14 @@ PHONY += homesecurity
 homesecurity:
        $(JAVAC) $(JFLAGS) *.java
        cp HomeSecurityController.config $(BIN_DIR)/HomeSecurityController
+       cp HomeSecurityController.tomoyo $(BIN_DIR)/HomeSecurityController
        cd $(BIN_DIR)/HomeSecurityController; $(JAR) $(JARFLAGS) HomeSecurityController.jar ../HomeSecurityController/HomeSecurityController*.class ../HomeSecurityController/*.class ../iotcode/interfaces/SmartthingsSensor*.class ../iotcode/interfaces/SmartthingsActuator*.class ../iotcode/interfaces/Camera*.class ../iotcode/interfaces/Alarm*.class ../iotcode/interfaces/Room*.class  ../iotcode/interfaces/ZoneState*.class ../iotcode/interfaces/Resolution*.class
 
 PHONY += check-homesecurity
 check-homesecurity:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) *.java
        cp HomeSecurityController.config $(BIN_DIR)/HomeSecurityController
+       cp HomeSecurityController.tomoyo $(BIN_DIR)/HomeSecurityController
        cd $(BIN_DIR)/HomeSecurityController; $(JAR) $(JARFLAGS) HomeSecurityController.jar ../HomeSecurityController/HomeSecurityController*.class ../HomeSecurityController/*.class ../iotcode/interfaces/SmartthingsSensor*.class ../iotcode/interfaces/SmartthingsActuator*.class ../iotcode/interfaces/Camera*.class ../iotcode/interfaces/Alarm*.class ../iotcode/interfaces/Room*.class  ../iotcode/interfaces/ZoneState*.class ../iotcode/interfaces/Resolution*.class
 
 .PHONY: $(PHONY)
diff --git a/benchmarks/Java/IrrigationController/IrrigationController.tomoyo b/benchmarks/Java/IrrigationController/IrrigationController.tomoyo
new file mode 100644 (file)
index 0000000..637ecf7
--- /dev/null
@@ -0,0 +1,3 @@
+file read /home/iotuser/iot2/iotjava/iotruntime/resources/\*.csv
+file read /home/iotuser/iot2/iotjava/iotruntime/help_files/\*
+
index e8d863b..fa69d0d 100644 (file)
@@ -23,6 +23,7 @@ irrigation:
        $(JAVAC) $(JFLAGS) *.java
        cd  $(BIN_DIR)/IrrigationController; $(JAR) $(JARFLAGS) IrrigationController.jar ../IrrigationController/*.class ../iotcode/interfaces/*.class
        cp IrrigationController.config $(BIN_DIR)/IrrigationController
+       cp IrrigationController.tomoyo $(BIN_DIR)/IrrigationController
        cp -rf ./resources ./help_files $(BIN_DIR)/IrrigationController
        cd  $(BIN_DIR)/IrrigationController; zip -r IrrigationController.zip ./resources ./help_files
 
@@ -31,6 +32,7 @@ check-irrigation:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) *.java
        cd  $(BIN_DIR)/IrrigationController; $(JAR) $(JARFLAGS) IrrigationController.jar ../IrrigationController/*.class ../iotcode/interfaces/*.class
        cp IrrigationController.config $(BIN_DIR)/IrrigationController
+       cp IrrigationController.tomoyo $(BIN_DIR)/IrrigationController
        cp -rf ./resources ./help_files $(BIN_DIR)/IrrigationController
        cd  $(BIN_DIR)/IrrigationController; zip -r IrrigationController.zip ./resources ./help_files
 
index c7823d5..d1320f7 100644 (file)
@@ -8,3 +8,6 @@ FIELD_TYPE_0=IoTSet
 
 # Language
 LANGUAGE=Java
+
+# Tomoyo
+ADDITIONAL_MAC_POLICY=No
index 25baf35..e4dd350 100644 (file)
@@ -22,12 +22,14 @@ PHONY += smartlights
 smartlights:
        $(JAVAC) $(JFLAGS) *.java
        cp SmartLightsController.config $(BIN_DIR)/SmartLightsController
+       cp SmartLightsController.tomoyo $(BIN_DIR)/SmartLightsController
        cd $(BIN_DIR)/SmartLightsController; $(JAR) $(JARFLAGS) SmartLightsController.jar ../SmartLightsController/SmartLightsController*.class ../SmartLightsController/ColorTemperature*.class ../SmartLightsController/MotionDetection*.class ../SmartLightsController/*.class ../iotcode/interfaces/Camera*.class ../iotcode/interfaces/Room*.class ../iotcode/interfaces/LightBulb*.class ../iotcode/interfaces/Resolution*.class
 
 PHONY += check-smartlights
 check-smartlights:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) *.java
        cp SmartLightsController.config $(BIN_DIR)/SmartLightsController
+       cp SmartLightsController.tomoyo $(BIN_DIR)/SmartLightsController
        cd $(BIN_DIR)/SmartLightsController; $(JAR) $(JARFLAGS) SmartLightsController.jar ../SmartLightsController/SmartLightsController*.class ../SmartLightsController/ColorTemperature*.class ../SmartLightsController/MotionDetection*.class ../SmartLightsController/*.class ../iotcode/interfaces/Camera*.class ../iotcode/interfaces/Room*.class ../iotcode/interfaces/LightBulb*.class ../iotcode/interfaces/Resolution*.class
 
 .PHONY: $(PHONY)
diff --git a/benchmarks/Java/SmartLightsController/SmartLightsController.tomoyo b/benchmarks/Java/SmartLightsController/SmartLightsController.tomoyo
new file mode 100644 (file)
index 0000000..974b883
--- /dev/null
@@ -0,0 +1,3 @@
+file create /tmp/imageio\*.tmp 0600
+file read/write/unlink /tmp/imageio\*.tmp
+
index 90dc1a7..8903728 100644 (file)
@@ -25,6 +25,7 @@ speaker:
        $(JAVAC) $(JFLAGS) *.java
        cd  $(BIN_DIR)/SpeakerController; $(JAR) $(JARFLAGS) SpeakerController.jar ../SpeakerController/*.class ../iotcode/interfaces/*.class
        cp SpeakerController.config $(BIN_DIR)/SpeakerController
+       cp SpeakerController.tomoyo $(BIN_DIR)/SpeakerController
        zip -r SpeakerController.zip ./music
        mv SpeakerController.zip $(BIN_DIR)/SpeakerController
 
@@ -33,6 +34,7 @@ check-speaker:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) *.java
        cd  $(BIN_DIR)/SpeakerController; $(JAR) $(JARFLAGS) SpeakerController.jar ../SpeakerController/*.class ../iotcode/interfaces/*.class
        cp SpeakerController.config $(BIN_DIR)/SpeakerController
+       cp SpeakerController.tomoyo $(BIN_DIR)/SpeakerController
        zip -r SpeakerController.zip ./music
        mv SpeakerController.zip $(BIN_DIR)/SpeakerController
 
diff --git a/benchmarks/Java/SpeakerController/SpeakerController.tomoyo b/benchmarks/Java/SpeakerController/SpeakerController.tomoyo
new file mode 100644 (file)
index 0000000..22d7dd8
--- /dev/null
@@ -0,0 +1 @@
+file read /home/iotuser/iot2/iotjava/iotruntime/music/\*.mp3
diff --git a/benchmarks/drivers/Java/AmcrestCamera/AmcrestCamera.tomoyo b/benchmarks/drivers/Java/AmcrestCamera/AmcrestCamera.tomoyo
new file mode 100644 (file)
index 0000000..7d1b011
--- /dev/null
@@ -0,0 +1,2 @@
+file create /tmp/imageio\*.tmp 0600
+file read/write/unlink /tmp/imageio\*.tmp
index 30be632..ec9c5d4 100644 (file)
@@ -5,3 +5,6 @@ INTERFACE_STUB_CLASS=RoomSmart
 
 # Language
 LANGUAGE=Java
+
+# Tomoyo
+ADDITIONAL_MAC_POLICY=No
index a4f10a8..b6460ee 100644 (file)
@@ -5,3 +5,6 @@ INTERFACE_STUB_CLASS=AlarmSmart
 
 # Language
 LANGUAGE=Java
+
+# Tomoyo
+ADDITIONAL_MAC_POLICY=No
index a4f10a8..b6460ee 100644 (file)
@@ -5,3 +5,6 @@ INTERFACE_STUB_CLASS=AlarmSmart
 
 # Language
 LANGUAGE=Java
+
+# Tomoyo
+ADDITIONAL_MAC_POLICY=No
index 1fe5d04..e6d46ef 100644 (file)
@@ -5,3 +5,6 @@ INTERFACE_STUB_CLASS=SprinklerSmart
 
 # Language
 LANGUAGE=Java
+
+# Tomoyo
+ADDITIONAL_MAC_POLICY=No
index 1f025f1..c6f0120 100644 (file)
@@ -5,3 +5,6 @@ INTERFACE_STUB_CLASS=LawnSmart
 
 # Language
 LANGUAGE=Java
+
+# Tomoyo
+ADDITIONAL_MAC_POLICY=No
index 30be632..ec9c5d4 100644 (file)
@@ -5,3 +5,6 @@ INTERFACE_STUB_CLASS=RoomSmart
 
 # Language
 LANGUAGE=Java
+
+# Tomoyo
+ADDITIONAL_MAC_POLICY=No
index 5d7772c..34c5400 100644 (file)
@@ -5,3 +5,6 @@ INTERFACE_STUB_CLASS=SpeakerSmart
 
 # Language
 LANGUAGE=Java
+
+# Tomoyo
+ADDITIONAL_MAC_POLICY=No
index 30be632..ec9c5d4 100644 (file)
@@ -5,3 +5,6 @@ INTERFACE_STUB_CLASS=RoomSmart
 
 # Language
 LANGUAGE=Java
+
+# Tomoyo
+ADDITIONAL_MAC_POLICY=No
index e178dd8..cf40798 100644 (file)
@@ -9,3 +9,6 @@ LANGUAGE=Java
 # Language (fine-grained flags)
 #LANGUAGE_LifxLightBulbLB1=Java
 #LANGUAGE_LifxLightBulbLB2=Java
+
+# Tomoyo
+ADDITIONAL_MAC_POLICY=No
index 3d45da4..b144b73 100644 (file)
@@ -25,42 +25,49 @@ PHONY += light
 light:
        $(JAVAC) $(JFLAGS) LifxLightBulb/*.java
        cp LifxLightBulb/LifxLightBulb.config $(BIN_DIR)/iotcode/LifxLightBulb
+       cp LifxLightBulb/LifxLightBulb.tomoyo $(BIN_DIR)/iotcode/LifxLightBulb
        cd $(BIN_DIR)/iotcode/LifxLightBulb; $(JAR) $(JARFLAGS) LifxLightBulb.jar ../../iotcode/LifxLightBulb/*.class ../../iotcode/interfaces/LightBulb*.class
 
 PHONY += camera
 camera:
        $(JAVAC) $(JFLAGS) AmcrestCamera/*.java
        cp AmcrestCamera/AmcrestCamera.config $(BIN_DIR)/iotcode/AmcrestCamera
+       cp AmcrestCamera/AmcrestCamera.tomoyo $(BIN_DIR)/iotcode/AmcrestCamera
        cd $(BIN_DIR)/iotcode/AmcrestCamera; $(JAR) $(JARFLAGS) AmcrestCamera.jar ../../iotcode/AmcrestCamera/*.class ../../iotcode/interfaces/Camera*.class ../../iotcode/interfaces/Resolution*.class
 
 PHONY += labroom
 labroom:
        $(JAVAC) $(JFLAGS) LabRoom/*.java
        cp LabRoom/LabRoom.config $(BIN_DIR)/iotcode/LabRoom
+       cp LabRoom/LabRoom.tomoyo $(BIN_DIR)/iotcode/LabRoom
        cd $(BIN_DIR)/iotcode/LabRoom; $(JAR) $(JARFLAGS) LabRoom.jar ../../iotcode/LabRoom/*.class ../../iotcode/interfaces/Room*.class
 
 PHONY += greenlawn
 greenlawn:
        $(JAVAC) $(JFLAGS) GreenLawn/*.java
        cp GreenLawn/GreenLawn.config $(BIN_DIR)/iotcode/GreenLawn
+       cp GreenLawn/GreenLawn.tomoyo $(BIN_DIR)/iotcode/GreenLawn
        cd $(BIN_DIR)/iotcode/GreenLawn; $(JAR) $(JARFLAGS) GreenLawn.jar ../../iotcode/GreenLawn/*.class ../../iotcode/interfaces/Lawn*.class
 
 PHONY += sprinkler
 sprinkler:
        $(JAVAC) $(JFLAGS) EspSprinkler/*.java
        cp EspSprinkler/EspSprinkler.config $(BIN_DIR)/iotcode/EspSprinkler
+       cp EspSprinkler/EspSprinkler.tomoyo $(BIN_DIR)/iotcode/EspSprinkler
        cd $(BIN_DIR)/iotcode/EspSprinkler; $(JAR) $(JARFLAGS) EspSprinkler.jar ../../iotcode/EspSprinkler/*.class ../../iotcode/interfaces/Sprinkler*.class ../../iotcode/interfaces/ZoneState*.class
        
 PHONY += blossomsprinkler
 blossomsprinkler:
        $(JAVAC) $(JFLAGS) BlossomSprinkler/*.java
        cp BlossomSprinkler/BlossomSprinkler.config $(BIN_DIR)/iotcode/BlossomSprinkler
+       cp BlossomSprinkler/BlossomSprinkler.tomoyo $(BIN_DIR)/iotcode/BlossomSprinkler
        cd $(BIN_DIR)/iotcode/BlossomSprinkler; $(JAR) $(JARFLAGS) BlossomSprinkler.jar ../../iotcode/BlossomSprinkler/*.class ../../iotcode/interfaces/Sprinkler*.class ../../iotcode/interfaces/ZoneState*.class
 
 PHONY += moisture
 moisture:
        $(JAVAC) $(JFLAGS) SpruceSensor/*.java
        cp SpruceSensor/SpruceSensor.config $(BIN_DIR)/iotcode/SpruceSensor
+       cp SpruceSensor/SpruceSensor.tomoyo $(BIN_DIR)/iotcode/SpruceSensor
        #cd $(BIN_DIR)/iotcode/SpruceSensor; $(JAR) $(JARFLAGS) SpruceSensor.jar ../../iotcode/SpruceSensor/*.class ../../iotcode/interfaces/MoistureSensor*.class ../../iotcode/interfaces/Camera*.class ../../IrrigationController/MotionDetection*.class
        cd $(BIN_DIR)/iotcode/SpruceSensor; $(JAR) $(JARFLAGS) SpruceSensor.jar ../../iotcode/SpruceSensor/*.class ../../iotcode/interfaces/MoistureSensor*.class ../../iotcode/interfaces/Camera*.class
 
@@ -68,48 +75,56 @@ PHONY += weathergateway
 weathergateway:
        $(JAVAC) $(JFLAGS) WeatherPhoneGateway/*.java
        cp WeatherPhoneGateway/WeatherPhoneGateway.config $(BIN_DIR)/iotcode/WeatherPhoneGateway
+       cp WeatherPhoneGateway/WeatherPhoneGateway.tomoyo $(BIN_DIR)/iotcode/WeatherPhoneGateway
        cd $(BIN_DIR)/iotcode/WeatherPhoneGateway; $(JAR) $(JARFLAGS) WeatherPhoneGateway.jar ../../iotcode/WeatherPhoneGateway/*.class ../../iotcode/interfaces/WeatherGateway*.class
 
 PHONY += audioroom
 audioroom:
        $(JAVAC) $(JFLAGS) AudioRoom/*.java
        cp AudioRoom/AudioRoom.config $(BIN_DIR)/iotcode/AudioRoom
+       cp AudioRoom/AudioRoom.tomoyo $(BIN_DIR)/iotcode/AudioRoom
        cd $(BIN_DIR)/iotcode/AudioRoom; $(JAR) $(JARFLAGS) AudioRoom.jar ../../iotcode/AudioRoom/*.class ../../iotcode/interfaces/Room*.class
 
 PHONY += gpsgateway
 gpsgateway:
        $(JAVAC) $(JFLAGS) GPSPhoneGateway/*.java
        cp GPSPhoneGateway/GPSPhoneGateway.config $(BIN_DIR)/iotcode/GPSPhoneGateway
+       cp GPSPhoneGateway/GPSPhoneGateway.tomoyo $(BIN_DIR)/iotcode/GPSPhoneGateway
        cd $(BIN_DIR)/iotcode/GPSPhoneGateway; $(JAR) $(JARFLAGS) GPSPhoneGateway.jar ../../iotcode/GPSPhoneGateway/*.class ../../iotcode/interfaces/GPSGateway*.class
 
 PHONY += ihome
 ihome:
        $(JAVAC) $(JFLAGS) IHome/*.java
        cp IHome/IHome.config $(BIN_DIR)/iotcode/IHome
+       cp IHome/IHome.tomoyo $(BIN_DIR)/iotcode/IHome
        cd $(BIN_DIR)/iotcode/IHome; $(JAR) $(JARFLAGS) IHome.jar ../../iotcode/IHome/*.class ../../iotcode/interfaces/Speaker*.class
 
 PHONY += homeroom
 homeroom:
        $(JAVAC) $(JFLAGS) HomeRoom/*.java
        cp HomeRoom/HomeRoom.config $(BIN_DIR)/iotcode/HomeRoom
+       cp HomeRoom/HomeRoom.tomoyo $(BIN_DIR)/iotcode/HomeRoom
        cd $(BIN_DIR)/iotcode/HomeRoom; $(JAR) $(JARFLAGS) HomeRoom.jar ../../iotcode/HomeRoom/*.class ../../iotcode/interfaces/Room*.class
 
 PHONY += alarm
 alarm:
        $(JAVAC) $(JFLAGS) EspAlarm/*.java
        cp EspAlarm/EspAlarm.config $(BIN_DIR)/iotcode/EspAlarm
+       cp EspAlarm/EspAlarm.tomoyo $(BIN_DIR)/iotcode/EspAlarm
        cd $(BIN_DIR)/iotcode/EspAlarm; $(JAR) $(JARFLAGS) EspAlarm.jar ../../iotcode/EspAlarm/*.class ../../iotcode/interfaces/Alarm*.class ../../iotcode/interfaces/ZoneState*.class
        
 PHONY += dlink-alarm
 dlink-alarm:
        $(JAVAC) $(JFLAGS) DlinkAlarm/*.java
        cp DlinkAlarm/DlinkAlarm.config $(BIN_DIR)/iotcode/DlinkAlarm
+       cp DlinkAlarm/DlinkAlarm.tomoyo $(BIN_DIR)/iotcode/DlinkAlarm
        cd $(BIN_DIR)/iotcode/DlinkAlarm; $(JAR) $(JARFLAGS) DlinkAlarm.jar ../../iotcode/DlinkAlarm/*.class ../../iotcode/interfaces/Alarm*.class ../../iotcode/interfaces/ZoneState*.class
 
 PHONY += motion
 motion:
        $(JAVAC) $(JFLAGS) MotionSensor/*.java
        cp MotionSensor/MotionSensor.config $(BIN_DIR)/iotcode/MotionSensor
+       cp MotionSensor/MotionSensor.tomoyo $(BIN_DIR)/iotcode/MotionSensor
        #cd $(BIN_DIR)/iotcode/MotionSensor; $(JAR) $(JARFLAGS) MotionSensor.jar ../../iotcode/MotionSensor/*.class ../../iotcode/interfaces/SmartthingsSensor*.class ../../iotcode/interfaces/Camera*.class ../../IrrigationController/MotionDetection*.class
        cd $(BIN_DIR)/iotcode/MotionSensor; $(JAR) $(JARFLAGS) MotionSensor.jar ../../iotcode/MotionSensor/*.class ../../iotcode/interfaces/SmartthingsSensor*.class ../../iotcode/interfaces/Camera*.class
 
@@ -117,6 +132,7 @@ PHONY += multipurpose
 multipurpose:
        $(JAVAC) $(JFLAGS) MultipurposeSensor/*.java
        cp MultipurposeSensor/MultipurposeSensor.config $(BIN_DIR)/iotcode/MultipurposeSensor
+       cp MultipurposeSensor/MultipurposeSensor.tomoyo $(BIN_DIR)/iotcode/MultipurposeSensor
        #cd $(BIN_DIR)/iotcode/MultipurposeSensor; $(JAR) $(JARFLAGS) MultipurposeSensor.jar ../../iotcode/MultipurposeSensor/*.class ../../iotcode/interfaces/SmartthingsSensor*.class ../../iotcode/interfaces/Camera*.class ../../IrrigationController/MotionDetection*.class
        cd $(BIN_DIR)/iotcode/MultipurposeSensor; $(JAR) $(JARFLAGS) MultipurposeSensor.jar ../../iotcode/MultipurposeSensor/*.class ../../iotcode/interfaces/SmartthingsSensor*.class ../../iotcode/interfaces/Camera*.class
 
@@ -124,6 +140,7 @@ PHONY += waterleak
 waterleak:
        $(JAVAC) $(JFLAGS) WaterLeakSensor/*.java
        cp WaterLeakSensor/WaterLeakSensor.config $(BIN_DIR)/iotcode/WaterLeakSensor
+       cp WaterLeakSensor/WaterLeakSensor.tomoyo $(BIN_DIR)/iotcode/WaterLeakSensor
        #cd $(BIN_DIR)/iotcode/WaterLeakSensor; $(JAR) $(JARFLAGS) WaterLeakSensor.jar ../../iotcode/WaterLeakSensor/*.class ../../iotcode/interfaces/SmartthingsSensor*.class ../../iotcode/interfaces/Camera*.class ../../IrrigationController/MotionDetection*.class
        cd $(BIN_DIR)/iotcode/WaterLeakSensor; $(JAR) $(JARFLAGS) WaterLeakSensor.jar ../../iotcode/WaterLeakSensor/*.class ../../iotcode/interfaces/SmartthingsSensor*.class ../../iotcode/interfaces/Camera*.class
 
@@ -131,12 +148,14 @@ PHONY += doorlock
 doorlock:
        $(JAVAC) $(JFLAGS) DoorlockSensor/*.java
        cp DoorlockSensor/DoorlockSensor.config $(BIN_DIR)/iotcode/DoorlockSensor
+       cp DoorlockSensor/DoorlockSensor.tomoyo $(BIN_DIR)/iotcode/DoorlockSensor
        cd $(BIN_DIR)/iotcode/DoorlockSensor; $(JAR) $(JARFLAGS) DoorlockSensor.jar ../../iotcode/DoorlockSensor/*.class ../../iotcode/interfaces/SmartthingsSensor*.class ../../iotcode/interfaces/Camera*.class
 
 PHONY += doorlockactuator
 doorlockactuator:
        $(JAVAC) $(JFLAGS) DoorlockActuator/*.java
        cp DoorlockActuator/DoorlockActuator.config $(BIN_DIR)/iotcode/DoorlockActuator
+       cp DoorlockActuator/DoorlockActuator.tomoyo $(BIN_DIR)/iotcode/DoorlockActuator
        cd $(BIN_DIR)/iotcode/DoorlockActuator; $(JAR) $(JARFLAGS) DoorlockActuator.jar ../../iotcode/DoorlockActuator/*.class ../../iotcode/interfaces/SmartthingsActuator*.class ../../iotcode/interfaces/Camera*.class
 
 # Compile - with checker
@@ -145,42 +164,49 @@ PHONY += check-light
 check-light:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) LifxLightBulb/*.java
        cp LifxLightBulb/LifxLightBulb.config $(BIN_DIR)/iotcode/LifxLightBulb
+       cp LifxLightBulb/LifxLightBulb.tomoyo $(BIN_DIR)/iotcode/LifxLightBulb
        cd $(BIN_DIR)/iotcode/LifxLightBulb; $(JAR) $(JARFLAGS) LifxLightBulb.jar ../../iotcode/LifxLightBulb/*.class ../../iotcode/interfaces/LightBulb*.class
 
 PHONY += check-camera
 check-camera:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) AmcrestCamera/*.java
        cp AmcrestCamera/AmcrestCamera.config $(BIN_DIR)/iotcode/AmcrestCamera
+       cp AmcrestCamera/AmcrestCamera.tomoyo $(BIN_DIR)/iotcode/AmcrestCamera
        cd $(BIN_DIR)/iotcode/AmcrestCamera; $(JAR) $(JARFLAGS) AmcrestCamera.jar ../../iotcode/AmcrestCamera/*.class ../../iotcode/interfaces/Camera*.class ../../iotcode/interfaces/Resolution*.class
 
 PHONY += check-labroom
 check-labroom:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) LabRoom/*.java
        cp LabRoom/LabRoom.config $(BIN_DIR)/iotcode/LabRoom
+       cp LabRoom/LabRoom.tomoyo $(BIN_DIR)/iotcode/LabRoom
        cd $(BIN_DIR)/iotcode/LabRoom; $(JAR) $(JARFLAGS) LabRoom.jar ../../iotcode/LabRoom/*.class ../../iotcode/interfaces/Room*.class
 
 PHONY += check-greenlawn
 check-greenlawn:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) GreenLawn/*.java
        cp GreenLawn/GreenLawn.config $(BIN_DIR)/iotcode/GreenLawn
+       cp GreenLawn/GreenLawn.tomoyo $(BIN_DIR)/iotcode/GreenLawn
        cd $(BIN_DIR)/iotcode/GreenLawn; $(JAR) $(JARFLAGS) GreenLawn.jar ../../iotcode/GreenLawn/*.class ../../iotcode/interfaces/Lawn*.class
 
 PHONY += check-sprinkler
 check-sprinkler:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) EspSprinkler/*.java
        cp EspSprinkler/EspSprinkler.config $(BIN_DIR)/iotcode/EspSprinkler
+       cp EspSprinkler/EspSprinkler.tomoyo $(BIN_DIR)/iotcode/EspSprinkler
        cd $(BIN_DIR)/iotcode/EspSprinkler; $(JAR) $(JARFLAGS) EspSprinkler.jar ../../iotcode/EspSprinkler/*.class ../../iotcode/interfaces/Sprinkler*.class ../../iotcode/interfaces/ZoneState*.class
        
 PHONY += check-blossomsprinkler
 check-blossomsprinkler:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) BlossomSprinkler/*.java
        cp BlossomSprinkler/BlossomSprinkler.config $(BIN_DIR)/iotcode/BlossomSprinkler
+       cp BlossomSprinkler/BlossomSprinkler.tomoyo $(BIN_DIR)/iotcode/BlossomSprinkler
        cd $(BIN_DIR)/iotcode/BlossomSprinkler; $(JAR) $(JARFLAGS) BlossomSprinkler.jar ../../iotcode/BlossomSprinkler/*.class ../../iotcode/interfaces/Sprinkler*.class ../../iotcode/interfaces/ZoneState*.class
 
 PHONY += check-moisture
 check-moisture:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) SpruceSensor/*.java
        cp SpruceSensor/SpruceSensor.config $(BIN_DIR)/iotcode/SpruceSensor
+       cp SpruceSensor/SpruceSensor.tomoyo $(BIN_DIR)/iotcode/SpruceSensor
        #cd $(BIN_DIR)/iotcode/SpruceSensor; $(JAR) $(JARFLAGS) SpruceSensor.jar ../../iotcode/SpruceSensor/*.class ../../iotcode/interfaces/MoistureSensor*.class ../../iotcode/interfaces/Camera*.class ../../IrrigationController/MotionDetection*.class
        cd $(BIN_DIR)/iotcode/SpruceSensor; $(JAR) $(JARFLAGS) SpruceSensor.jar ../../iotcode/SpruceSensor/*.class ../../iotcode/interfaces/MoistureSensor*.class ../../iotcode/interfaces/Camera*.class
 
@@ -188,72 +214,84 @@ PHONY += check-weathergateway
 check-weathergateway:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) WeatherPhoneGateway/*.java
        cp WeatherPhoneGateway/WeatherPhoneGateway.config $(BIN_DIR)/iotcode/WeatherPhoneGateway
+       cp WeatherPhoneGateway/WeatherPhoneGateway.tomoyo $(BIN_DIR)/iotcode/WeatherPhoneGateway
        cd $(BIN_DIR)/iotcode/WeatherPhoneGateway; $(JAR) $(JARFLAGS) WeatherPhoneGateway.jar ../../iotcode/WeatherPhoneGateway/*.class ../../iotcode/interfaces/WeatherGateway*.class
 
 PHONY += check-audioroom
 check-audioroom:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) AudioRoom/*.java
        cp AudioRoom/AudioRoom.config $(BIN_DIR)/iotcode/AudioRoom
+       cp AudioRoom/AudioRoom.tomoyo $(BIN_DIR)/iotcode/AudioRoom
        cd $(BIN_DIR)/iotcode/AudioRoom; $(JAR) $(JARFLAGS) AudioRoom.jar ../../iotcode/AudioRoom/*.class ../../iotcode/interfaces/Room*.class
 
 PHONY += check-gpsgateway
 check-gpsgateway:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) GPSPhoneGateway/*.java
        cp GPSPhoneGateway/GPSPhoneGateway.config $(BIN_DIR)/iotcode/GPSPhoneGateway
+       cp GPSPhoneGateway/GPSPhoneGateway.tomoyo $(BIN_DIR)/iotcode/GPSPhoneGateway
        cd $(BIN_DIR)/iotcode/GPSPhoneGateway; $(JAR) $(JARFLAGS) GPSPhoneGateway.jar ../../iotcode/GPSPhoneGateway/*.class ../../iotcode/interfaces/GPSGateway*.class
 
 PHONY += check-ihome
 check-ihome:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) IHome/*.java
        cp IHome/IHome.config $(BIN_DIR)/iotcode/IHome
+       cp IHome/IHome.tomoyo $(BIN_DIR)/iotcode/IHome
        cd $(BIN_DIR)/iotcode/IHome; $(JAR) $(JARFLAGS) IHome.jar ../../iotcode/IHome/*.class ../../iotcode/interfaces/Speaker*.class
 
 PHONY += check-homeroom
 check-homeroom:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) HomeRoom/*.java
        cp HomeRoom/HomeRoom.config $(BIN_DIR)/iotcode/HomeRoom
+       cp HomeRoom/HomeRoom.tomoyo $(BIN_DIR)/iotcode/HomeRoom
        cd $(BIN_DIR)/iotcode/HomeRoom; $(JAR) $(JARFLAGS) HomeRoom.jar ../../iotcode/HomeRoom/*.class ../../iotcode/interfaces/Room*.class
 
 PHONY += check-alarm
 check-alarm:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) EspAlarm/*.java
        cp DlinkAlarm/EspAlarm.config $(BIN_DIR)/iotcode/EspAlarm
+       cp DlinkAlarm/EspAlarm.tomoyo $(BIN_DIR)/iotcode/EspAlarm
        cd $(BIN_DIR)/iotcode/EspAlarm; $(JAR) $(JARFLAGS) EspAlarm.jar ../../iotcode/EspAlarm/*.class ../../iotcode/interfaces/Alarm*.class ../../iotcode/interfaces/ZoneState*.class
 
 PHONY += check-dlink-alarm
 check-dlink-alarm:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) DlinkAlarm/*.java
        cp EspAlarm/DlinkAlarm.config $(BIN_DIR)/iotcode/DlinkAlarm
+       cp EspAlarm/DlinkAlarm.tomoyo $(BIN_DIR)/iotcode/DlinkAlarm
        cd $(BIN_DIR)/iotcode/DlinkAlarm; $(JAR) $(JARFLAGS) DlinkAlarm.jar ../../iotcode/DlinkAlarm/*.class ../../iotcode/interfaces/Alarm*.class ../../iotcode/interfaces/ZoneState*.class
 
 PHONY += check-motion
 check-motion:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) MotionSensor/*.java
        cp MotionSensor/MotionSensor.config $(BIN_DIR)/iotcode/MotionSensor
+       cp MotionSensor/MotionSensor.tomoyo $(BIN_DIR)/iotcode/MotionSensor
        cd $(BIN_DIR)/iotcode/MotionSensor; $(JAR) $(JARFLAGS) MotionSensor.jar ../../iotcode/MotionSensor/*.class ../../iotcode/interfaces/SmartthingsSensor*.class ../../iotcode/interfaces/Camera*.class ../../IrrigationController/MotionDetection*.class
 
 PHONY += check-multipurpose
 check-multipurpose:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) MultipurposeSensor/*.java
        cp MultipurposeSensor/MultipurposeSensor.config $(BIN_DIR)/iotcode/MultipurposeSensor
+       cp MultipurposeSensor/MultipurposeSensor.tomoyo $(BIN_DIR)/iotcode/MultipurposeSensor
        cd $(BIN_DIR)/iotcode/MultipurposeSensor; $(JAR) $(JARFLAGS) MultipurposeSensor.jar ../../iotcode/MultipurposeSensor/*.class ../../iotcode/interfaces/SmartthingsSensor*.class ../../iotcode/interfaces/Camera*.class ../../IrrigationController/MotionDetection*.class
 
 PHONY += check-waterleak
 check-waterleak:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) WaterLeakSensor/*.java
        cp WaterLeakSensor/WaterLeakSensor.config $(BIN_DIR)/iotcode/WaterLeakSensor
+       cp WaterLeakSensor/WaterLeakSensor.tomoyo $(BIN_DIR)/iotcode/WaterLeakSensor
        cd $(BIN_DIR)/iotcode/WaterLeakSensor; $(JAR) $(JARFLAGS) WaterLeakSensor.jar ../../iotcode/WaterLeakSensor/*.class ../../iotcode/interfaces/SmartthingsSensor*.class ../../iotcode/interfaces/Camera*.class ../../IrrigationController/MotionDetection*.class
 
 PHONY += check-doorlock
 check-doorlock:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) DoorlockSensor/*.java
        cp DoorlockSensor/DoorlockSensor.config $(BIN_DIR)/iotcode/DoorlockSensor
+       cp DoorlockSensor/DoorlockSensor.tomoyo $(BIN_DIR)/iotcode/DoorlockSensor
        cd $(BIN_DIR)/iotcode/DoorlockSensor; $(JAR) $(JARFLAGS) DoorlockSensor.jar ../../iotcode/DoorlockSensor/*.class ../../iotcode/interfaces/SmartthingsSensor*.class ../../iotcode/interfaces/Camera*.class
 
 PHONY += check-doorlockactuator
 check-doorlockactuator:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) DoorlockActuator/*.java
        cp DoorlockActuator/DoorlockActuator.config $(BIN_DIR)/iotcode/DoorlockActuator
+       cp DoorlockActuator/DoorlockActuator.tomoyo $(BIN_DIR)/iotcode/DoorlockActuator
        cd $(BIN_DIR)/iotcode/DoorlockActuator; $(JAR) $(JARFLAGS) DoorlockActuator.jar ../../iotcode/DoorlockActuator/*.class ../../iotcode/interfaces/SmartthingsActuator*.class ../../iotcode/interfaces/Camera*.class
 
 .PHONY: $(PHONY)
index 73b43f1..5056c9b 100644 (file)
@@ -5,3 +5,6 @@ INTERFACE_STUB_CLASS=SmartthingsSensorSmart
 
 # Language
 LANGUAGE=Java
+
+# Tomoyo
+ADDITIONAL_MAC_POLICY=No
index a9bb3cb..21a5f20 100644 (file)
@@ -5,3 +5,6 @@ INTERFACE_STUB_CLASS=MoistureSensorSmart
 
 # Language
 LANGUAGE=Java
+
+# Tomoyo
+ADDITIONAL_MAC_POLICY=No
index 2d5b44f..454ca30 100644 (file)
@@ -127,6 +127,7 @@ public final class IoTMaster {
        private static final String STR_INT_STUB_CLS_CFG = "INTERFACE_STUB_CLASS";
        private static final String STR_FILE_TRF_CFG = "ADDITIONAL_ZIP_FILE";
        private static final String STR_LANGUAGE = "LANGUAGE";
+       private static final String STR_ADD_MAC_POL = "ADDITIONAL_MAC_POLICY";
        private static final String STR_YES = "Yes";
        private static final String STR_NO = "No";
        private static final String STR_JAVA = "Java";
@@ -645,6 +646,12 @@ public final class IoTMaster {
                                processJailConfig.configureProcessJailDeviceDriverPolicies(strIoTSlaveObjectHostAdd, strObjName, strObjClassName,
                                        strFileName, strIoTMasterHostAdd, commHan.getComPort(strObjName), commHan.getRMIRegPort(strObjName), 
                                        commHan.getRMIStubPort(strObjName));
+                   // Check for additional MAC policy
+                   String strMACConfigPath = STR_IOT_CODE_PATH + strObjClassName + "/";
+                   String strCfgFile = strMACConfigPath + strObjClassName + STR_CFG_FILE_EXT;
+                       String strAddMACPolicy = parseConfigFile(strCfgFile, STR_ADD_MAC_POL);
+                   if (strAddMACPolicy != null && strAddMACPolicy.equals("Yes"))
+                       processJailConfig.combineAdditionalMACPolicy(strMACConfigPath, strObjClassName, strIoTSlaveObjectHostAdd);
                                processJailConfig.configureProcessJailContRMIPolicies(strObjControllerName, strIoTSlaveObjectHostAdd, 
                                        commHan.getRMIRegPort(strObjName), commHan.getRMIStubPort(strObjName));
                        }
@@ -1996,6 +2003,7 @@ public final class IoTMaster {
                        strIoTMasterHostAdd = routerConfig.getIPFromMACAddress(STR_MASTER_MAC_ADD);
                    // Assign a new list of PrintWriter objects
            routerConfig.renewPrintWriter();
+           HashSet<String> setAddresses = null;
                        // Loop as we can still find controller/device classes
                        for(int i=0; i<strObjectNames.length; i++) {
                                // PROFILING
@@ -2081,6 +2089,12 @@ public final class IoTMaster {
                                        String strFileName = STR_MAC_POL_PATH + STR_JAVA + STR_MAC_POLICY_EXT;
                                        processJailConfig.configureProcessJailControllerPolicies(strObjControllerName, strFileName, 
                                                strIoTMasterHostAdd, commHan.getComPort(strObjControllerName));
+                               // Whether or not we need additional Tomoyo policy?
+                                   String strAddMACPolicy = parseConfigFile(strControllerCfg, STR_ADD_MAC_POL);
+                                   if (strAddMACPolicy != null && strAddMACPolicy.equals("Yes")) {
+                                   String strContMACCfg = STR_CONT_PATH + strObjControllerName + "/";
+                                       processJailConfig.combineAdditionalMACPolicy(strContMACCfg, strObjControllerName, strObjControllerName);
+                                   }
                                }
                                // PROFILING
                                result = System.currentTimeMillis()-start;
@@ -2146,7 +2160,7 @@ public final class IoTMaster {
                                // Combine controller MAC policies with the main policy file for the host
                                String strTempFileName = "./" + strObjControllerName + STR_MAC_POLICY_EXT;
                                processJailConfig.combineControllerMACPolicies(strIoTSlaveControllerHostAdd, strObjControllerName, strTempFileName);
-                               processJailConfig.close();
+                               processJailConfig.flush();
 
                                // PROFILING
                                result = System.currentTimeMillis()-start;
@@ -2165,7 +2179,7 @@ public final class IoTMaster {
                                setRouterBasicPolicies(STR_ROUTER_ADD);
                                routerConfig.closeMain();
                                // Deploy the policy
-                               HashSet<String> setAddresses = new HashSet<String>(commHan.getHosts());
+                               setAddresses = new HashSet<String>(commHan.getHosts());
                                setAddresses.add(strIoTMasterHostAdd);
                                createPolicyThreads(STR_ROUTER_ADD, setAddresses);
 
@@ -2214,11 +2228,12 @@ public final class IoTMaster {
                                commHan.printLists();
                                commHan.clearCommunicationHandler();
                                lbIoT.printHostInfo();
-                               if (STR_ACTIVATE_SANDBOXING.equals("Yes"))
-                                       createMACPolicyThreads(setAddresses);
                        }
                        // Close access to policy files and deploy policies
                        routerConfig.close();
+                       processJailConfig.close();
+                       if (STR_ACTIVATE_SANDBOXING.equals("Yes"))
+                               createMACPolicyThreads(setAddresses);
 
                } catch (IOException          |
                                 InterruptedException |
index e19ee15..fba8cad 100644 (file)
@@ -36,6 +36,7 @@ public final class ProcessJailConfig {
        private static final String STR_TCPGW_PROTOCOL = "tcpgw";
        private static final String STR_NO_PROTOCOL = "nopro";
 
+       private static final String STR_ADD_MAC_EXT             = ".tomoyo";
        private static final String STR_MAC_POLICY_EXT          = ".tomoyo.pol";
        private static final String STR_OBJECT_NAME             = "<object-name>";
        private static final String STR_OBJECT_CLASS_NAME       = "<object-class-name>";
@@ -104,6 +105,19 @@ public final class ProcessJailConfig {
                }
        }
        
+       
+       /**
+        * flush() flushes all PrintWriter objects
+        *
+        * @return  void
+        */
+       public void flush() {
+
+               for(PrintWriter pwConfig: mapHostToFile.values()) {
+                       pwConfig.flush();
+               }
+       }
+       
 
        /**
         * close() closes all PrintWriter objects
@@ -403,6 +417,21 @@ public final class ProcessJailConfig {
        }
 
 
+       /**
+        * combineAdditionalMACPolicy() method combines the additional MAC policies into the right host policy file
+        *
+        * @param   strConfigHost                       String hostname to be configured
+        * @param   strFileName                         String policy file path and name
+        * @return  void
+        */
+       public void combineAdditionalMACPolicy(String strMACCfgPath, String strObjectName, String strConfigHost) {
+
+               PrintWriter pwConfig = getPrintWriter(strConfigHost);
+               String strPolicyList = readFile(strMACCfgPath + strObjectName + STR_ADD_MAC_EXT);
+               pwConfig.println(strPolicyList);
+       }
+
+
        /**
         * combineControllerMACPolicies() method combines the controller MAC policies into the right host policy file
         *
index 0a35a61..e84b464 100644 (file)
@@ -1,5 +1,5 @@
 SELECT * FROM
 CameraSmart
 WHERE
-ID='CM3' OR ID='CM4'
+ID='CM1' or ID='CM2'
 ;
index 7970cff..9408186 100644 (file)
@@ -1,5 +1,5 @@
-SELECT * FROM\r
-IoTAddress\r
-WHERE\r
-ID='CL1'\r
-;\r
+SELECT * FROM
+IoTAddress
+WHERE
+ID='CL1'
+;
index 5da7318..4403ee9 100644 (file)
@@ -4,5 +4,5 @@ LawnSmart
 OTHER\r
 SprinklerSmart\r
 WHERE\r
-ID_DESTINATION='SP1'\r
+ID_DESTINATION='SP2'\r
 ;\r