title: SELinux Unix Socket permission denied. How to fix?
body: <p>I have modified bluedroid to include a small unix socket server for reasons.</p>
  
  <p>When client starts, I see that SElinux doesn't like it, and throws out  this:</p>
  
  <pre><code>05-26 18:01:41.072 6248-6248/? I/com.gps.uclient: type=1400 audit(0.0:20): avc: denied { connectto } for path=00236264726F696468696472617773727663 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:bluetooth:s0 tclass=unix_stream_socket permissive=1
  </code></pre>
  
  <p>This socket does not have a real path. How do I add SELinux rule to allow this socket?</p>
  
  <p><strong>Update</strong></p>
  
  <p>Tried audit2allow as mentioned by Google <a href="https://source.android.com/security/selinux/validate.html" rel="nofollow">here</a></p>
  
  <p>Got errors.</p>
  
  <pre><code>gps@gps-HP-ProBook-4540s:~$ audit2allow -i sedeny.txt -p ./andsrc/android-6.0.1_r25/out/target/product/flo/root/sepolicy 
  libsepol.policydb_read: policydb version 30 does not match my version range 15-29
  libsepol.context_from_record: user u is not defined
  libsepol.context_from_record: could not create context structure
  libsepol.context_from_string: could not create context structure
  libsepol.sepol_context_to_sid: could not convert u:r:untrusted_app:s0:c512,c768 to sid
  </code></pre>
  
  <p>I have no real experience in SELinux, so I am pretty much stuck here.</p>