도커 특정 유저의 .bashrc(bash shell일 경우)를 불러오고 명령어 실행하기


$ docker exec -it -u whkong ct1107 bash -ic "ls"


bash 뒤에 -i 옵션을 붙여주면 bashrc를 불러오고 명령을 실행한다.



gtags를 입력하면 현재 모든 디렉토리의 파일을 링크를 건다.


그러면 필요없는것 까지 링크가 되기때문에 불편하다.


그래서 특정 폴더만 링크를 걸기위한 방법!


$ find folder1 folder2 folder3 -type f -print | gtags -f -


또는


$ find folder1 folder2 folder3 -type f -print >gtags.files

$ gtags


현재 폴더에 gtags.files 파일이 존재하면 해당 파일의 내용만 타겟이 되어 gtag를 생성한다.


'리눅스(ubuntu) > Emacs 관련' 카테고리의 다른 글

한글입력 설정  (0) 2018.02.02
renew emacs.el 파일  (0) 2017.12.04
c/c++ emacs 설정 동영상 URL  (0) 2017.12.01
이맥스 관련 자료 모음  (0) 2017.01.08
관련 사이트  (0) 2017.01.08

neverallow 관련 처리


-기본적인 neverallow 되어있는 곳은 system/sepolicy/public/domain.te 파일 에 작성되어 있다.

neverallow로 등록된 정책들은 단순히 allow만 해서 사용할 수 없다.

allow로 처리를 해놔도 neverallow에서 걸러지기 때문이다.

그래서 type을 따로 설정해서 사용해야 한다.




busybox로 정책 처리 예


< 정책 위반으로 denied가 뜨는 로그 >

 type=1400 audit(0.0:34avc: denied { getattr } for path="/system/vendor/bin/busybox" dev="mmcblk0p7" ino=1713 scontext=u:r:netd:s0 tcontext=u:object_r:busybox_exec:s0 tclass=file permissive=1

 type=1400 audit(0.0:33avc: denied { getattr } for path="/system/vendor/bin/busybox" dev="mmcblk0p7" ino=1713 scontext=u:r:netd:s0 tcontext=u:object_r:busybox_exec:s0 tclass=file permissive=1
 type=1400 audit(0.0:35avc: denied { execute } for name="busybox" dev="mmcblk0p7" ino=1713 scontext=u:r:netd:s0 tcontext=u:object_r:busybox_exec:s0 tclass=file permissive=1

 type=1400 audit(0.0:36avc: denied { execute } for name="busybox" dev="mmcblk0p7" ino=1713 scontext=u:r:netd:s0 tcontext=u:object_r:busybox_exec:s0 tclass=file permissive=1

 type=1400 audit(0.0:38avc: denied { read open } for path="/system/vendor/bin/busybox" dev="mmcblk0p7" ino=1713 scontext=u:r:netd:s0 tcontext=u:object_r:busybox_exec:s0 tclass=file permissive=1

 type=1400 audit(0.0:37avc: denied { read open } for path="/system/vendor/bin/busybox" dev="mmcblk0p7" ino=1713 scontext=u:r:netd:s0 tcontext=u:object_r:busybox_exec:s0 tclass=file permissive=1

 type=1400 audit(0.0:39avc: denied { execute_no_trans } for path="/system/vendor/bin/busybox" dev="mmcblk0p7" ino=1713 scontext=u:r:netd:s0 tcontext=u:object_r:busybox_exec:s0 tclass=file permissive=1

 

- 위와 같이 로그가 뜨면 로그를 보고 파악 할 수 있다.

denied : 어떤이유로 거부되었는지 알 수 있다.

scontext : 사용하는 소스 프로세스 레이블  - 여기서는 netd

tcontext : 사용되는 타겟 오브젝트 레이블 - 여기서는 busybox_exec 

tclass : 사용되는 타겟 오브젝트 클래스 - 여기서는 file



file_contexts 파일수정


파일위치는 보통 /device/[manufacturer]/[device-name]/sepolicy  존재한다. (제조사마다 다르다.)

다음을 추가한다.

(만약 busybox_exec 레이블이 neverallow에 등록되어 있다면 레이블 이름을 바꿔줘야한다.)


/system/vendor/bin/busybox u:object_r:busybox_exec:s0

busybox_exec가 레이블 이름이다.

ex)





busybox.te 파일 만들기


- sepolicy 디렉토리에 busybox.te파일을 만들고 다음과 같이 작성한다.

- allow 를 이용하여 정책을 등록한다.

<busybox.te>

1
2
3
type busybox_exec, exec_type, file_type;
 
allow netd busybox_exec:file rx_file_perms;
cs


- rx_file_perms 는 매크로이다.

/system/sepolicy/public/global_macros 에 가면 매크로를 볼 수 있다.


- 안드로이드 8 이상부터는

BoardConfig.mk 파일에

BOARD_SEPOLICY_DIR 변수에 sepolicy 폴더위치를 넣어줘야 한다.




 



+ Recent posts