[Pkg-anonymity-tools] [onionshare] 26/57: In Tails OnionShare now creates HS directory in /var/lib/tor, to obey AppArmor rules (fixes #166)

Ulrike Uhlig u-guest at moszumanska.debian.org
Tue May 19 18:18:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

u-guest pushed a commit to annotated tag 0.7
in repository onionshare.

commit 21e25464353b04d81d5bae8a9b38b65a3d0a2369
Author: Micah Lee <micah at micahflee.com>
Date:   Wed Dec 10 02:09:10 2014 +0000

    In Tails OnionShare now creates HS directory in /var/lib/tor, to obey AppArmor rules (fixes #166)
---
 onionshare/onionshare.py | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py
index 55917f1..ac7ff00 100644
--- a/onionshare/onionshare.py
+++ b/onionshare/onionshare.py
@@ -101,11 +101,13 @@ class OnionShare(object):
                 args = ['/usr/bin/gksudo', '-D', 'OnionShare', '--', '/usr/bin/onionshare']
             else:
                 args = ['/usr/bin/sudo', '--', '/usr/bin/onionshare']
+            print "Executing: {0}".format(args+[str(self.port)])
             p = subprocess.Popen(args+[str(self.port)], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
-            stdout = p.stdout.read(22)  # .onion URLs are 22 chars long
+            stdout = p.stdout.read(22) # .onion URLs are 22 chars long
 
             if stdout:
                 self.onion_host = stdout
+                print 'Got onion_host: {0}'.format(self.onion_host)
             else:
                 if p.poll() == -1:
                     raise TailsError(o.stderr.read())
@@ -118,7 +120,18 @@ class OnionShare(object):
 
             else:
                 # come up with a hidden service directory name
-                self.hidserv_dir = tempfile.mkdtemp()
+                if helpers.get_platform() == 'Tails':
+                    # need to create HS directory in /var/lib/tor because of AppArmor rules included in Tails
+                    self.hidserv_dir = tempfile.mkdtemp(dir='/var/lib/tor')
+
+                    # change owner to debian-tor
+                    import pwd
+                    import grp
+                    uid = pwd.getpwnam("debian-tor").pw_uid
+                    gid = grp.getgrnam("debian-tor").gr_gid
+                    os.chown(self.hidserv_dir, uid, gid)
+                else:
+                    self.hidserv_dir = tempfile.mkdtemp()
                 self.cleanup_filenames.append(self.hidserv_dir)
 
                 # connect to the tor controlport

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/onionshare.git



More information about the Pkg-anonymity-tools mailing list