Add ecryptfs key linking in the keyring of root user 65/146265/5 accepted/tizen/unified/20170901.030109 submit/tizen/20170831.072417 submit/tizen_4.0/20170831.090142 submit/tizen_4.0/20170901.010402
authorSungbae Yoo <sungbae.yoo@samsung.com>
Fri, 25 Aug 2017 12:04:08 +0000 (21:04 +0900)
committerSungbae Yoo <sungbae.yoo@samsung.com>
Mon, 28 Aug 2017 11:51:18 +0000 (11:51 +0000)
Change-Id: Ie9eddecc8f6a274ff2e6e030730a49ad5f1dd773
Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
server/external-encryption.cpp
tools/cli/ode-mount-external.sh

index 29c391a..ffaf61b 100644 (file)
@@ -323,6 +323,14 @@ int ExternalEncryption::encrypt(const std::string &password, unsigned int option
                        sync();
                        INFO(SINK, "Encryption completed");
                        ::vconf_set_str(EXTERNAL_STATE_VCONF_KEY, "encrypted");
+
+                       //For smackfsroot, smackfsdef option without CAP_MAC_ADMIN
+                       runtime::File fileToTouch("/tmp/.ode-mount-external");
+                       try {
+                               fileToTouch.remove();
+                       } catch(runtime::Exception &e) {}
+                       fileToTouch.create(O_WRONLY);
+
                        context.notify("ExternalEncryption::mount");
                } catch (runtime::Exception &e) {
                        ::vconf_set_str(EXTERNAL_STATE_VCONF_KEY, "error_partially_encrypted");
index d4e00f6..22ee220 100644 (file)
@@ -5,6 +5,12 @@ STORAGE="/opt/media/SDCardA1"
 
 OPTION=`cat /proc/mounts | grep "${STORAGE} ${STORAGE} ecryptfs" | gawk '{print $4}'`
 
+KEY_DESC=`echo ${OPTION} | sed -e s/.*'ecryptfs_sig='// -e s/','.*//`
+KEY=`su security_fw -s /bin/keyctl search @u user ${KEY_DESC}`
+
+su security_fw -s /bin/keyctl setperm ${KEY} 0x3f111010
+keyctl link ${KEY} @u
+
 if [ -z ${OPTION} ]; then
        exit -1
 fi