티스토리 뷰

타이젠 네이티브 앱을 개발하려면 네이티브 API를 사용해야합니다.

그리고 일부 네이티브 API는 별도의 Privilege 권한이 있어야 사용할 수 있습니다.


타이젠 네이티브 API에 어떤 Privilege가 있는지 살펴보고,

어떤 식으로 관리되고 있는지 훔쳐보도록 하겠습니다.


Tizen 2.3으로 오픈된 소스를 기반으로 정리하였습니다.



타이젠 SDK에서 관리하는 Privilege를 찾아보았습니다.

git://review.tizen.org/sdk/doc/content의 master브랜치,

api-reference/native/tools/privilege_desc.txt 파일에 Privilege가 명시되어 있습니다.

privilege_desc.txt를 그대로 가져오고,

각각 한글로 간단하게 번역해두었습니다.


http://tizen.org/privilege/account.read
Allows the application to read accounts.
계정을 읽을 수 있습니다.

http://tizen.org/privilege/account.write    
Allows the application to create, update, and delete accounts.    
계정을 생성, 수정, 삭제할 수 있습니다.

http://tizen.org/privilege/alarm    
Allows the application to set an alarm and wake the device up at the scheduled time.    
알람을 설정하고 디바이스를 알람시간에 깨울 수 있습니다.

http://tizen.org/privilege/application.launch    
Allows the application to be opened conditionally or to open another application.    
앱을 상황에 맞게 열거나 다른 앱을 런칭할 수 있습니다.

http://tizen.org/privilege/appmanager.kill    
Allows the application to close another application.
다른 앱을 닫을 수 있습니다.

http://tizen.org/privilege/appmanager.launch    
Allows the application to manage another application opening conditionally.    
다른 앱을 조건에 맞게 열 수 있습니다.

http://tizen.org/privilege/appmanager.setting    
Allows the application to read and update default application preferences.    
디폴트 앱의 설정을 읽고 수정할 수 있습니다.

http://tizen.org/privilege/appsetting    
Allows the application to manage application settings.
앱의 설정을 관리할 수 있습니다.    

http://tizen.org/privilege/appusage    
Allows the application to receive notifications about foreground application changes.    
foreground에 있는 앱의 변화를 받을 수 있습니다.

http://tizen.org/privilege/appwidgetprovider.install    
Allows the application to add Dynamic Box to the home screen.    
다이나믹박스를 홈스크린에 추가할 수 있습니다.

http://tizen.org/privilege/audiomanager.route    
Allows the application to set audio input and output routes and receive notifications about route events.    
오디오 입출력 경로를 설정하고 경로이벤트에 대한 알림을 받을 수 있습니다.

http://tizen.org/privilege/audiorecorder    
Allows the application to manage audio recording.    
오디오레코딩을 관리할 수 있습니다.

http://tizen.org/privilege/bluetooth.admin    
Allows the application to change Bluetooth settings, such as turning Bluetooth on or off, and setting the local device name.    
블루투스 설정을 변경할 수 있습니다. - 블루투스 on / off, 로컬 디바이스 이름 변경

http://tizen.org/privilege/bluetooth.gap    
Allows the application to use the Generic Access Profile (GAP), for example, to scan for and pair devices.    
Generic Access Profile(GAP)을 사용할 수 있습니다. - 페어 디바이스를 스캔하기 등

http://tizen.org/privilege/bluetooth.health    
Allows the application to use the Health Device Profile (HDP), for example, to send health data.    
Health Device Profile을 사용할 수 있습니다. - 헬스 데이타 보내기 등

http://tizen.org/privilege/bluetooth.opp    
Allows the application to use the Object Push Profile (OPP), for example, to send files.
Object Push Profile을 사용할 수 있습니다. - 파일 보내기 등

http://tizen.org/privilege/bluetooth.spp    
Allows the application to use the Serial Port Profile (SPP), for example, to send serial data.    
Serial Port Profile을 사용할 수 있습니다. - 시리얼 데이타 보내기 등

http://tizen.org/privilege/bluetoothmanager    
Allows the application to change Bluetooth system settings related to privacy and security, such as the visible mode.    
블루투스 시스템 설정(프라이버시, 시큐리티)을 변경할 수 있습니다. - visible 모드 등

http://tizen.org/privilege/bookmark.read    
Allows the application to read bookmarks.    
북마크를 읽을 수 있습니다.

http://tizen.org/privilege/bookmark.write    
Allows the application to create, update, and delete bookmarks.    
북마크를 생성, 수정, 삭제할 수 있습니다.

http://tizen.org/privilege/calendar.read    
Allows the application to read schedule and task information.    
스케쥴과 업무 정보를 읽을 수 있습니다.

http://tizen.org/privilege/calendar.write
Allows the application to create, update, and delete schedule and task information.    
스캐쥴과 업무 정보를 생성, 수정, 삭제할 수 있습니다.

http://tizen.org/privilege/callforward
Allows the application to control the call forwarding service.    
콜 포워딩 서비스를 컨트롤할 수 있습니다.

http://tizen.org/privilege/camera
Allows the application to manage device cameras to preview and capture pictures.
프리뷰를 보고 사진을 찍을 수 있습니다.

http://tizen.org/privilege/cellbroadcast
Allows the application to manage the Cell Broadcast Service (CBS).    
Cell Broadcast Service를 관리할 수 있습니다.

http://tizen.org/privilege/certificate.read
Allows the application to read certificates.    
인증서를 읽을 수 있습니다.

http://tizen.org/privilege/certificate.write
Allows the application to add, update, and delete certificates.    
인증서를 추가, 수정, 삭제할 수 있습니다.

http://tizen.org/privilege/contact.read
Allows the application to read contacts.
연락처 정보를 읽을 수 있습니다.

http://tizen.org/privilege/contact.write
Allows the application to add, update, and delete contacts.    
연락처 정보를 추가, 수정, 삭제할 수 있습니다.

http://tizen.org/privilege/content.read
Allows the application to read content.    
컨텐츠를 읽을 수 있습니다.

http://tizen.org/privilege/content.write
Allows the application to create, update, and delete content.    
컨텐츠를 추가, 수정, 삭제할 수 있습니다.

http://tizen.org/privilege/customnetaccount
Allows the application to use the Internet with a specified bearer.
특정 배러와 함께 인터넷을 사용할 수 있습니다.

http://tizen.org/privilege/datacontrol.consumer
Allows the application to access specific data exported by other applications.
다른 앱이 준 데이타에 접근할 수 있습니다.

http://tizen.org/privilege/dns
Allows the application to provide the Domain Name Service (DNS).    
Domain Name Service를 제공할 수 있습니다.

http://tizen.org/privilege/download
Allows the application to manage HTTP downloads.    
HTTP 다운로드를 관리할 수 있습니다.

http://tizen.org/privilege/geolocationpermission.read
Allows the application to read geolocation permissions.    
지리정보 권한을 읽을 수 있습니다.

http://tizen.org/privilege/geolocationpermission.write
Allows the application to delete geolocation permissions.    
지리정보 권한을 지울 수 있습니다.

http://tizen.org/privilege/http
Allows the application to communicate with the HTTP server.    
HTTP 서버와 통신할 수 있습니다.

http://tizen.org/privilege/ime
Allows the application to provide a way to input characters and symbols into an associated input field.    
소프트웨어 키보드를 제공할 수 있습니다.

http://tizen.org/privilege/imemanager
Allows the application to manage the installed input methods.    
설치된 소프트웨어 키보드를 관리할 수 있습니다.


http://tizen.org/privilege/inputmanager
Allows the application to generate touch and key events, and capture screens.    
터치, 키 이벤트를 만들고 스크린을 캡쳐할 수 있습니다.


http://tizen.org/privilege/location
Allows the application to use the user location data.  
유저의 지리데이터를 이용할 수 있습니다.  

http://tizen.org/privilege/lockmanager
Allows the application to unlock the device.    
디바이스를 언락할 수 있습니다.

http://tizen.org/privilege/messaging.read
Allows the application to receive messages, and to retrieve messages from the message boxes.    
메시지를 받고 메시지박스에서 메시지를 긁어올 수 있습니다.

http://tizen.org/privilege/messaging.write
Allows the application to write SMS, MMS, and email messages.    
SMS, MMS와 이메일을 쓸 수 있습니다.

http://tizen.org/privilege/netstatisticsmanager
Allows the application to reset network statistics.    
네트워크 정보를 리셋할 수 있습니다.

http://tizen.org/privilege/network.account
Allows the application to manage network accounts.    
네트워크 계정을 관리할 수 있습니다.

http://tizen.org/privilege/network.connection
Allows the application to manage network connections.    
네트워크 커넥션을 관리할 수 있습니다.

http://tizen.org/privilege/network.statistics
Allows the application to read network statistics.    
네트워크 정보를 읽을 수 있습니다.

http://tizen.org/privilege/networkmanager
Allows the application to update system network accounts.
시스템 네트워크 계정을 수정할 수 있습니다.

http://tizen.org/privilege/nfc.admin
Allows the application to change NFC settings, such as turning NFC on or off.    
NFC 설정을 변경할 수 있습니다. - NFC on / off

http://tizen.org/privilege/nfc.common
Allows the application to use NFC common features.    
NFC 공통 기능을 사용할 수 있습니다.

http://tizen.org/privilege/nfc.p2p
Allows the application to push NFC messages to other devices.    
다른 기기에 NFC 메시지를 푸쉬할 수 있습니다.

http://tizen.org/privilege/nfc.tag
Allows the application to read and write NFC tag information.    
NFC 태그정보를 읽고 쓸 수 있습니다.

http://tizen.org/privilege/nfcmanager
Allows the application to change NFC system settings, such as turning on or off reserved push, which sends predefined NDEF messages.    
NFC 시스템 설정을 변경할 수 있습니다. - 예약 푸쉬를 on / off 하기

http://tizen.org/privilege/notification
Allows the application to provide user notifications, such as messages and badges.    
유저 알림을 제공할 수 있습니다. - 메시지나 배지

http://tizen.org/privilege/package.info
Allows the application to receive package information.    
패키지 정보를 받을 수 있습니다.

http://tizen.org/privilege/packagemanager.info
Allows the application to receive detailed package information.    
자세한 패키지 정보를 받을 수 있습니다.

http://tizen.org/privilege/packagemanager.install
Allows the application to install or uninstall application packages.    
앱 패키지를 설치 혹은 삭제할 수 있습니다.

http://tizen.org/privilege/packagemanager.setting
Allows the application to set package configurations.    
패키지 설정값을 변경할 수 있습니다.

http://tizen.org/privilege/power
Allows the application to hold and control power states.    
파워 상태를 유지하거나 조절할 수 있습니다.

http://tizen.org/privilege/privacymanager.read
Allows the application to read privacy settings.    
프라이버시 설정값을 읽을 수 있습니다.

http://tizen.org/privilege/privacymanager.write
Allows the application to change privacy settings.   
프라이버시 설정을 변경할 수 있습니다.  

http://tizen.org/privilege/privilegemanager.read
Allows the application to read privilege information.    
프라이버스 정보를 읽을 수 있습니다.

http://tizen.org/privilege/push
Allows the application to receive push notifications.    
푸쉬 알림을 받을 수 있습니다.

http://tizen.org/privilege/secureelement
Allows the application to access to secure smart card chip such as UICC/SIM, embedded secure element, or secure SD card.    
UICC/SIM 카드에 접근할 수 있습니다.

http://tizen.org/privilege/setting
Allows the application to update or read user settings.    
유저 설정을 읽거나 수정할 수 있습니다.

http://tizen.org/privilege/settingmanager.read
Allows the application to read security or privacy settings.    
시큐리티나 프라이버시 설정을 읽을 수 있습니다.

http://tizen.org/privilege/settingmanager.write
Allows the application to change security or privacy settings.    
시큐리티나 프라이버시 설정을 변경할 수 있습니다.

http://tizen.org/privilege/shortcut.install
Allows the application to add and remove shortcuts from the home screen.    
홈스크린에서 숏컷을 추가 혹은 삭제할 수 있습니다.

http://tizen.org/privilege/smstrigger
Allows the application to receive SMS messages from a specified port.
특정 포트로부터 SMS 메시지를 받을 수 있습니다.

http://tizen.org/privilege/socket
Allows the application to communicate with other devices and servers.
다른 디바이스나 서버와 통신할 수 있습니다.

http://tizen.org/privilege/system
Allows the application to access system information.
시스템 정보에 접근할 수 있습니다.

http://tizen.org/privilege/systemmanager
Allows the application to access secure system information.
보안 시스템 정보에 접근할 수 있습니다.

http://tizen.org/privilege/telephony
Allows the application to retrieve telephony information, such as network, SIM, and call details.
텔레포니 정보를 긁어올 수 있습니다. - Network, SIM, Call 상제정보

http://tizen.org/privilege/telephonymanager
Allows the application to configure the mobile networks.
모바일 네트워크를 설정할 수 있습니다.


http://tizen.org/privilege/uimanager
Allows the application to manage UI properties.    
UI 속성을 관리할 수 있습니다.

http://tizen.org/privilege/userprofile.read
Allows the application to read the user profile.
유저 프로파일을 읽을 수 있습니다.

http://tizen.org/privilege/userprofile.write
Allows the application to manage the user profile.
유저 프로파일을 관리할 수 있습니다.

http://tizen.org/privilege/vibrator
Allows the application to turn on and use vibrate.
진동키능을 켜겨나 사용할 수 있습니다.

http://tizen.org/privilege/videorecorder
Allows the application to manage video recording with the camera.
카메라를 사용하여 비디오 녹화를 할 수 있습니다.

http://tizen.org/privilege/wappush
Allows the application to manage WAP push messages.
WAP 푸쉬 메시지를 관리할 수 있습니다.

http://tizen.org/privilege/web.privacy
Allows the application to manage the user data stored by the Web control or browser.
웹컨트롤이나 브라우저에서 저장된 유저데이터를 관리할 수 있습니다.

http://tizen.org/privilege/web.service
Allows the application to display Web content or use the Web content-related API.
웹컨텐트를 표시하고 웹컨텐트 관련 함수를 사용할 수 있습니다.

http://tizen.org/privilege/wifi.admin
Allows the application to manage Wi-Fi on the device, such as turning Wi-Fi on or off, and connecting to AP.
Wi-Fi를 관리할 수 있습니다. - 와이파이를 on / off 하고, AP에 접속하기

http://tizen.org/privilege/wifi.read
Allows the application to request Wi-Fi information.
Wi-Fi 정보를 요청할 수 있습니다.

http://tizen.org/privilege/wifi.wifidirect.admin
Allows the application to manage Wi-Fi Direct on the device.
Wi-Fi Direct 기능을 관리할 수 있습니다.

http://tizen.org/privilege/wifi.wifidirect.read
Allows the application to request Wi-Fi Direct information.
Wi-Fi Direct 정보를 요청할 수 있습니다.

http://tizen.org/privilege/wifimanager
Allows the application to manage the Wi-Fi system settings, such as updating AP information.
Wi-Fi 시스템 설정을 관리할 수 있습니다. - AP 정보 갱신 등


위에서 기술된 Privilege를 앱에서 사용하는 것이지요.

플랫폼 버전마다 사용할 수 있는 Privilege는 다를 수 있습니다.


SDK에서 개발할 때는,

- Project Explorer에서 자신의 프로젝트 내에 있는 tizen-manifest.xml 선택

- Tizen Manifest Editor에서 Privileges 탭 선택

- Add 버튼을 눌러 Privilege를 추가할 수 있습니다.



SDK 외부에서 개발할 경우에는,

각 앱의 xml파일에 직접 Privilege를 기술해야 합니다.


<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.data-provider-slave" version="1.0.0" install-location="auto" support-mode="screen-reader">
    <!-- ... 생략 ... -->
    <ui-application appid="org.tizen.data-provider-slave" exec="/usr/apps/org.tizen.data-provider-slave/bin/data-provider-slave" nodisplay="true" multiple="true" type="capp" taskmanage="false">
    <!-- ... 생략 ... -->
    </ui-application>
    <privileges>
        <privilege>http://tizen.org/privilege/location</privilege>
        <privilege>http://developer.samsung.com/tizen/privilege/privacymanager.read</privilege> <!-- weather -->
    </privileges>
    <!-- ... 생략 ... -->
</manifest>


위의 코드는 git://review.tizen.org/apps/livebox/data-provider-slave의 tizen_2.3 브랜치,

org.tizen.data-provider-slave.xml 파일에서 따왔습니다.

SDK 외부에서 개발하는 앱은 위처럼 자신에게 필요한 Privilege를 xml 파일에 직접 추가해야 하지요.


Security/Tizen 2.X smack-privilege-config


앱에 추가된 Privilege는,

앱이 설치되는 시점에 Privilege 레벨에서 Smack 레벨로 변경됩니다.


git://review.tizen.org/framework/security/smack-privilege-config의 tizen_2.3 브랜치,

permissions_mobile/permissions_2_3_0 디렉토리에는 수많은 *.smack 파일이 있습니다.

그 중 EFL_org.tizen.privilege.camera.smack 파일을 열어보겠습니다.


~APP~ device::camera rw----
~APP~ mm_qcamera_daemon -w----
~APP~ privilege::tizen::camera rw----
~APP~ system::vconf_multimedia rw----


카메라를 사용하기 위해 필요한 스맥룰이 명시되어 있습니다.

~APP~은 위의 privilege를 설정한 앱의 스맥레이블로 치환될 것입니다.

간단히 내용을 살펴보면,

device::camera에 접근하기 위한 읽고 쓰는 권한,

mm_qcamera_daemon에 쓰기 권한,

privilege::tizen::camera를 읽고 쓰는 권한,

system::vconf_multimedia를 읽고 쓰는 권한 등의 스맥권한을 부여합니다.


이렇게 부여된 스맥레이블은,

네이티브 API가 사용하는 파일/디렉토리 등에 접근할 수 있게 할겁니다.

만약 제대로된 스맥레이블 없이 파일/디렉토리에 접근하려하면 Permission denied 에러가 나오겠죠.


git://review.tizen.org/framework/security/privilege-checker의 tizen_2.3 브랜치,

capi/src/privilege_checker.c 소스를 살펴보면,

앱이 Privilege를 가지고 있는지 여부를 직접 체크하는 부분도 있습니다.


int privilege_checker_check_package_privilege(const char* package_id, const char* privilege_name)
{
    // ... 생략 ...
    //find privilege in cache
    for(i=0; i<g_cached_privileges_size; i++)
    {
        if(hash_value == g_cached_privileges[i].hash_value)
        {
            matched_index = i;
            ++matched_cnt;
        }
    }

    if(matched_cnt == 1){
        LOGD("Found cached hash privilege");
        return PRIV_CHECKER_ERR_NONE;

    }
    // ... 생략 ...
    LOGD("Not Found cached privilege");

    // ... 생략 ...
    res = pkgmgrinfo_pkginfo_foreach_privilege(handle, __privilege_checker_privilege_list_by_pkgid_cb, user_data);
    // ... 생략 ...

    TryReturn(g_isMached == true, PRIV_CHECKER_ERR_INVALID_PRIVILEGE, "[PRIV_CHECKER_ERR_INVALID_PRIVILEGE] %s privilege denied", privilege_name);

    return PRIV_CHECKER_ERR_NONE;
}

그래서 API를 수행할 때, API를 호출한 앱의 권한을 체크하여 수행여부를 결정하게 됩니다.

예를 들어,

git://review.tizen.org/framework/api/application의 tizen_2.3 브랜치,

app_control/app_control.c 소스를 보면 Call Operaion로 런칭요청이 온 경우 Privilege가 있는지 체크합니다.


int app_control_send_launch_request(app_control_h app_control, app_control_reply_cb callback, void *user_data)
{
    // ... 생략 ...
    // Check the privilege for call operation
    if (!strcmp(operation, APP_CONTROL_OPERATION_CALL))
    {
    // ... 생략 ...

        ret = privilege_checker_check_package_privilege(pkg_id, "http://tizen.org/privilege/call");
        pkgmgrinfo_appinfo_destroy_appinfo(app_info);
        if (ret != PRIV_CHECKER_ERR_NONE)
        {
            if (ret == PRIV_CHECKER_ERR_INVALID_PRIVILEGE)
            {
                return app_control_error(APP_CONTROL_ERROR_PERMISSION_DENIED, __FUNCTION__, "no privilege for Call operation");
            }
        }
    }
}


Privilege는 Smack으로 치환되어 관리될 수 있고,

Privilege 자체로 관리될 수도 있습니다.


끝_


* SMACK에 대한 이야기를 쌓아본다

http://storycompiler.tistory.com/51


* References

https://wiki.tizen.org/wiki/Security/Tizen_2.X_smack-privilege-config

https://wiki.tizen.org/wiki/Security/Tizen_2.X_cert-svc#Additional_certificate_service_APIs


출처 : http://storycompiler.tistory.com/53

'Computer > Tizen' 카테고리의 다른 글

Watch Application API  (0) 2017.05.30
SIGNATURE_NO_DEVICE_PROFILE [78]  (0) 2017.05.08
댓글

파트너스 활동을 통해 일정액의 수수료를 제공받을 수 있음



Total
Today
Yesterday
최근에 달린 댓글