tor: Fix tor permissions if presant via update.sh

Message ID 20190610113652.11536-1-ummeegge@ipfire.org
State Deferred
Headers
Series tor: Fix tor permissions if presant via update.sh |

Commit Message

ummeegge June 10, 2019, 9:36 p.m. UTC
  Signed-off-by: Erik Kapfer <ummeegge@ipfire.org>
---
 config/rootfiles/core/133/update.sh | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Michael Tremer June 11, 2019, 12:31 a.m. UTC | #1
Hi,

Thanks for sending in that patch.

But I think instead of doing this in the Core Update, this change should be applied in the tor update scripts.

-Michael

> On 10 Jun 2019, at 12:36, Erik Kapfer <ummeegge@ipfire.org> wrote:
> 
> Signed-off-by: Erik Kapfer <ummeegge@ipfire.org>
> ---
> config/rootfiles/core/133/update.sh | 5 +++++
> 1 file changed, 5 insertions(+)
> 
> diff --git a/config/rootfiles/core/133/update.sh b/config/rootfiles/core/133/update.sh
> index a05ad0741..3ecb5651b 100644
> --- a/config/rootfiles/core/133/update.sh
> +++ b/config/rootfiles/core/133/update.sh
> @@ -71,6 +71,11 @@ sudo -u nobody /srv/web/ipfire/cgi-bin/vpnmain.cgi
> /etc/init.d/squid start
> /etc/init.d/collectd restart
> 
> +# Set new permissions for tor
> +if [ -d "/var/lib/tor" ]; then
> +    chown -R tor:tor /var/lib/tor
> +fi
> +
> # Finish
> /etc/init.d/fireinfo start
> sendprofile
> -- 
> 2.12.2
>
  
Peter Müller June 11, 2019, 4:12 a.m. UTC | #2
Hello Michael,

as mentioned in https://bugzilla.ipfire.org/show_bug.cgi?id=12088#c11 ,
the "install.sh" script of the Tor addon contains all required steps.

Since "update.sh" calls "install.sh" at the end of the file, everything
should be fine after an update as well - which is not. However, due to
this, I do not think putting it into "update.sh" makes sense either.

Thanks, and best regards,
Peter Müller

Michael Tremer:
> Hi,
> 
> Thanks for sending in that patch.
> 
> But I think instead of doing this in the Core Update, this change should be applied in the tor update scripts.
> 
> -Michael
> 
>> On 10 Jun 2019, at 12:36, Erik Kapfer <ummeegge@ipfire.org> wrote:
>>
>> Signed-off-by: Erik Kapfer <ummeegge@ipfire.org>
>> ---
>> config/rootfiles/core/133/update.sh | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/config/rootfiles/core/133/update.sh b/config/rootfiles/core/133/update.sh
>> index a05ad0741..3ecb5651b 100644
>> --- a/config/rootfiles/core/133/update.sh
>> +++ b/config/rootfiles/core/133/update.sh
>> @@ -71,6 +71,11 @@ sudo -u nobody /srv/web/ipfire/cgi-bin/vpnmain.cgi
>> /etc/init.d/squid start
>> /etc/init.d/collectd restart
>>
>> +# Set new permissions for tor
>> +if [ -d "/var/lib/tor" ]; then
>> +    chown -R tor:tor /var/lib/tor
>> +fi
>> +
>> # Finish
>> /etc/init.d/fireinfo start
>> sendprofile
>> -- 
>> 2.12.2
>>
>
  
Paul Simmons June 11, 2019, 4:36 a.m. UTC | #3
On 6/10/19 1:12 PM, Peter Müller wrote:
> Hello Michael,
> 
> as mentioned in https://bugzilla.ipfire.org/show_bug.cgi?id=12088#c11 ,
> the "install.sh" script of the Tor addon contains all required steps.
> 
> Since "update.sh" calls "install.sh" at the end of the file, everything
> should be fine after an update as well - which is not. However, due to
> this, I do not think putting it into "update.sh" makes sense either.
> 
> Thanks, and best regards,
> Peter Müller
> 
> Michael Tremer:
>> Hi,
>>
>> Thanks for sending in that patch.
>>
>> But I think instead of doing this in the Core Update, this change should be applied in the tor update scripts.
>>
>> -Michael
>>
>>> On 10 Jun 2019, at 12:36, Erik Kapfer <ummeegge@ipfire.org> wrote:
>>>
>>> Signed-off-by: Erik Kapfer <ummeegge@ipfire.org>
>>> ---
>>> config/rootfiles/core/133/update.sh | 5 +++++
>>> 1 file changed, 5 insertions(+)
>>>
>>> diff --git a/config/rootfiles/core/133/update.sh b/config/rootfiles/core/133/update.sh
>>> index a05ad0741..3ecb5651b 100644
>>> --- a/config/rootfiles/core/133/update.sh
>>> +++ b/config/rootfiles/core/133/update.sh
>>> @@ -71,6 +71,11 @@ sudo -u nobody /srv/web/ipfire/cgi-bin/vpnmain.cgi
>>> /etc/init.d/squid start
>>> /etc/init.d/collectd restart
>>>
>>> +# Set new permissions for tor
>>> +if [ -d "/var/lib/tor" ]; then
>>> +    chown -R tor:tor /var/lib/tor
>>> +fi
>>> +
>>> # Finish
>>> /etc/init.d/fireinfo start
>>> sendprofile
>>> -- 
>>> 2.12.2
>>>
>>
> 

Perhaps the restore_backup in install.sh is undoing the ownership?

p.
  
Michael Tremer June 11, 2019, 4:51 a.m. UTC | #4
Hi,

Yes that will be it. The backup stores permissions and ownership.

Please move the chown line to after the backup is being restored and you will be fine.

-Michael

> On 10 Jun 2019, at 19:36, Paul Simmons <mbatranch@gmail.com> wrote:
> 
> On 6/10/19 1:12 PM, Peter Müller wrote:
>> Hello Michael,
>> 
>> as mentioned in https://bugzilla.ipfire.org/show_bug.cgi?id=12088#c11 ,
>> the "install.sh" script of the Tor addon contains all required steps.
>> 
>> Since "update.sh" calls "install.sh" at the end of the file, everything
>> should be fine after an update as well - which is not. However, due to
>> this, I do not think putting it into "update.sh" makes sense either.
>> 
>> Thanks, and best regards,
>> Peter Müller
>> 
>> Michael Tremer:
>>> Hi,
>>> 
>>> Thanks for sending in that patch.
>>> 
>>> But I think instead of doing this in the Core Update, this change should be applied in the tor update scripts.
>>> 
>>> -Michael
>>> 
>>>> On 10 Jun 2019, at 12:36, Erik Kapfer <ummeegge@ipfire.org> wrote:
>>>> 
>>>> Signed-off-by: Erik Kapfer <ummeegge@ipfire.org>
>>>> ---
>>>> config/rootfiles/core/133/update.sh | 5 +++++
>>>> 1 file changed, 5 insertions(+)
>>>> 
>>>> diff --git a/config/rootfiles/core/133/update.sh b/config/rootfiles/core/133/update.sh
>>>> index a05ad0741..3ecb5651b 100644
>>>> --- a/config/rootfiles/core/133/update.sh
>>>> +++ b/config/rootfiles/core/133/update.sh
>>>> @@ -71,6 +71,11 @@ sudo -u nobody /srv/web/ipfire/cgi-bin/vpnmain.cgi
>>>> /etc/init.d/squid start
>>>> /etc/init.d/collectd restart
>>>> 
>>>> +# Set new permissions for tor
>>>> +if [ -d "/var/lib/tor" ]; then
>>>> +    chown -R tor:tor /var/lib/tor
>>>> +fi
>>>> +
>>>> # Finish
>>>> /etc/init.d/fireinfo start
>>>> sendprofile
>>>> -- 
>>>> 2.12.2
>>>> 
>>> 
>> 
> 
> Perhaps the restore_backup in install.sh is undoing the ownership?
> 
> p.
  
ummeegge June 11, 2019, 5:10 a.m. UTC | #5
Hello Michael & Peter,

On Mo, 2019-06-10 at 18:12 +0000, Peter Müller wrote:
> Hello Michael,
> 
> as mentioned in https://bugzilla.ipfire.org/show_bug.cgi?id=12088#c11
>  ,
> the "install.sh" script of the Tor addon contains all required steps.
> 
> Since "update.sh" calls "install.sh" at the end of the file,
> everything
> should be fine after an update as well - which is not. However, due
> to
> this, I do not think putting it into "update.sh" makes sense either.
Thought a little in the same way since there is also an update for tor
whereby tor´s update.sh (includes install.sh then) should be executed.
To stay save i used the core update.sh for this...

Best,

Erik

> 
> Thanks, and best regards,
> Peter Müller
> 
> Michael Tremer:
> > Hi,
> > 
> > Thanks for sending in that patch.
> > 
> > But I think instead of doing this in the Core Update, this change
> > should be applied in the tor update scripts.
> > 
> > -Michael
> > 
> > > On 10 Jun 2019, at 12:36, Erik Kapfer <ummeegge@ipfire.org>
> > > wrote:
> > > 
> > > Signed-off-by: Erik Kapfer <ummeegge@ipfire.org>
> > > ---
> > > config/rootfiles/core/133/update.sh | 5 +++++
> > > 1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/config/rootfiles/core/133/update.sh
> > > b/config/rootfiles/core/133/update.sh
> > > index a05ad0741..3ecb5651b 100644
> > > --- a/config/rootfiles/core/133/update.sh
> > > +++ b/config/rootfiles/core/133/update.sh
> > > @@ -71,6 +71,11 @@ sudo -u nobody /srv/web/ipfire/cgi-
> > > bin/vpnmain.cgi
> > > /etc/init.d/squid start
> > > /etc/init.d/collectd restart
> > > 
> > > +# Set new permissions for tor
> > > +if [ -d "/var/lib/tor" ]; then
> > > +    chown -R tor:tor /var/lib/tor
> > > +fi
> > > +
> > > # Finish
> > > /etc/init.d/fireinfo start
> > > sendprofile
> > > -- 
> > > 2.12.2
> > > 
> 
>
  

Patch

diff --git a/config/rootfiles/core/133/update.sh b/config/rootfiles/core/133/update.sh
index a05ad0741..3ecb5651b 100644
--- a/config/rootfiles/core/133/update.sh
+++ b/config/rootfiles/core/133/update.sh
@@ -71,6 +71,11 @@  sudo -u nobody /srv/web/ipfire/cgi-bin/vpnmain.cgi
 /etc/init.d/squid start
 /etc/init.d/collectd restart
 
+# Set new permissions for tor
+if [ -d "/var/lib/tor" ]; then
+    chown -R tor:tor /var/lib/tor
+fi
+
 # Finish
 /etc/init.d/fireinfo start
 sendprofile