summaryrefslogtreecommitdiff
path: root/src/agent/weechat.cil
blob: dca659120f6bb9c195bf69e2d8974fde324ccaa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
(in agent
    (block weechat

        (blockinherit .subj.common.template)
        (call subj.common.type (subj))

        (roletype .sys.role subj)

        (call exec.subj_type_transition (.sys.subj subj))
        (call exec.entrypoint_file_files (subj))
        (call exec.mapexecute_file_files (subj))
        (call exec.read_file_files (subj))

        ;; unix socket
        (allow subj self (unix_dgram_socket (create sendto read write)))

        ;; network
        (allow subj self create_tcp_socket)
        (call irc.nameconnect_port_tcp_sockets (subj))
        
        ;; use ssl certs
        (call .cert.search_file_dirs (subj))
        (call .cert.read_file_files (subj))

        ;; use terminal
        (call .sys.use_subj_fds (subj))
        (call .dev.readwriteinherited_file_chr_files (subj))
        (call .ptytermdev.readwriteinherited_all_chr_files (subj))

        ;; use pipes
        (call .sys.readwriteinherited_subj_fifo_files (subj))
        
        ;; read root
        (call .root.search_file_dirs (subj))

        ;; read /etc
        (call .conf.search_file_dirs (subj))
        (call .conf.read_file_files (subj))
        (call .conf.read_file_lnk_files (subj))
        
        ;; read /usr/share
        (call data.search_file_dirs (subj))
        (call data.read_file_files (subj))
        
        ;; access config stuff
        (call .home.search_file_dirs (subj))
        (call .user.home.search_file_dirs (subj))
        (call .user.home.create_file_dirs (subj))
        (call home.search_file_dirs (subj))
        (call home.readwrite_file_files (subj))

        ;; access /run/user
        (call .run.search_file_dirs (subj))
        (call .runuser.search_file_dirs (subj))
        (call .runuser.create_file_dirs (subj))

        (block exec
            
            (filecon "/usr/bin/weechat" file file_context)

            (blockinherit .file.exec.template))

        (block home

            (filecon "HOME_DIR/\.config/weechat(/.*)?" any file_context)
            (filecon "HOME_DIR/\.local/share/weechat(/.*)?" any file_context)
            (filecon "HOME_DIR/\.local/state/weechat(/.*)?" any file_context)
            (filecon "HOME_DIR/\.cache/weechat(/.*)?" any file_context)

            (blockinherit .file.home.user.template))))