Autostart problem

Asked by s.d.r

I know that gufw makes his work with iptables and I don't need to run gui at every boot.
But for some strange reason, It works inproperly.
1) I start gufw, enter root password.
2) Click on Status ON, so "Firewall is enabled" and shows me all applications and their ports, everything looks Ok.
3) Restart the system
4) Start gufw to check some rules. Firewall status is OFF.
Why is this happening?
(4.4.1-2 Arch linux with LXDE)

Question information

Language:
English Edit question
Status:
Answered
For:
Gufw Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
costales (costales) said :
#1

Hi!
Could you after the reboot run:
sudo ufw status
Thanks in advance!

--
Sent using Dekko from my Ubuntu device

Revision history for this message
s.d.r (s-driggers) said :
#2

Yes, of course!
Just did it:

% sudo ufw status
Status: inactive

Revision history for this message
costales (costales) said :
#3

could you run:
gufw
and put here the exit?

--
Sent using Dekko from my Ubuntu device

Revision history for this message
s.d.r (s-driggers) said :
#4

Here it is:

% gufw
/usr/lib/python2.7/site-packages/gufw/view/gufw.py:19: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gtk, Gdk, WebKit
/usr/lib/python2.7/site-packages/gufw/view/gufw.py:19: PyGIWarning: WebKit was imported without specifying a version first. Use gi.require_version('WebKit', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gtk, Gdk, WebKit

gufw 11.22s user 2.09s system 47% cpu 28.249 total

Revision history for this message
costales (costales) said :
#5

uhm, i have to try it, the dump is not telling me a clue.
please, which arch version and how can i install gufw on it?
thanks in advance

--
Sent using Dekko from my Ubuntu device

Revision history for this message
s.d.r (s-driggers) said :
#6

Oh, to be honest - it's a little bit complicated...
1) I've installed latest x86 minimal version from here:
https://www.archlinux.org/download/
and upgraded all packages (and core to 4.4.1-2)
2) Installed yaourt to download and install packages from aur
https://archlinux.fr/yaourt-en
3) To install full LXDE group
yaourt -S lxde
https://wiki.archlinux.org/index.php/LXDE#Installation
4) yaourt -S gufw
To install gufw

Thank you for your help!

Revision history for this message
s.d.r (s-driggers) said :
#7

And I've just noticed gufw is in "community", not "aur".
Then step 2) is not necesarry,
and you may install lxde and gufw with "pacman -S" instead of yaourt...

Revision history for this message
s.d.r (s-driggers) said :
#8

I may prepare some logs for you instead tomorrow if necesarry.

Revision history for this message
costales (costales) said :
#9

uhm, then could you change a python file? :)

--
Sent using Dekko from my Ubuntu device

Revision history for this message
s.d.r (s-driggers) said :
#10

Yes, what changes do I need to make?

Revision history for this message
costales (costales) said :
#11

Could you try these steps:

find /usr -name "ufw_backend.py" -type f
Edit that file:
Changing

    def get_status(self):
        if 'Status: active' in self._run_cmd([self.UFW_PATH, 'status'], True):
            return True
        else:
            return False

to this:

    def get_status(self):

        *print(**"Debug 0: " + **self._run_cmd([self.UFW_PATH,
'status'], True))*

        if 'Status: active' in self._run_cmd([self.UFW_PATH, 'status'], True):
            return True
        else:
            return False

And this too please:

    def set_status(self, status):
        if not status:
            cmd = [self.UFW_PATH, 'disable']
        else:
            cmd = [self.UFW_PATH, '--force', 'enable']

        self._run_cmd(cmd)

to this:

    def set_status(self, status):
        if not status:
            cmd = [self.UFW_PATH, 'disable']
        else:
            cmd = [self.UFW_PATH, '--force', 'enable']*
print("Debug 1: " + cmd)*
        self._run_cmd(cmd)
        *print(**"Debug 2: " + self._run_cmd([self.UFW_PATH, 'status'], True))*

Be careful about the tabs! they have to be 4 spaces.

Then, run from terminal again:
gufw
Try to enable and disable the firewall.

And paste here the exit :)

Thanks in advance!
--
Sent using Dekko from my Ubuntu device

Revision history for this message
costales (costales) said :
#12

On Thu, Mar 3, 2016 at 7:47 PM, costales <
<email address hidden>> wrote:

> *print(**"Debug 0: " + **self._run_cmd([self.UFW_PATH,
> 'status'], True))*
>

It was a bold, sorry. Remove any *

*print(**"Debug 0: " + **self._run_cmd([self.UFW_PATH,
'status'], True))*
should be:
print("Debug 0: " + self._run_cmd([self.UFW_PATH,
'status'], True))

--
Sent using Dekko from my Ubuntu device

Revision history for this message
s.d.r (s-driggers) said :
#13

I'm sorry, I don't know perl((
I know php for example.
Now, when I try to run - see

 File "/usr/lib/python2.7/site-packages/gufw/model/ufw_backend.py", line 51
    if 'Status: active' in self._run_cmd([self.UFW_PATH, 'status'], True):
                                                                                                                          ^
IndentationError: unindent does not match any outer indentation level

------
   def get_status(self):

        print("Debug 0: " + self._run_cmd([self.UFW_PATH, 'status'], True))

        if 'Status: active' in self._run_cmd([self.UFW_PATH, 'status'], True):
            return True
        else:
            return False

Revision history for this message
costales (costales) said :
#14

Please, revert your change and tell me your Gufw version. Then I'll send
you a edited file :)

--
Sent using Dekko from my Ubuntu device

On Fri, Mar 4, 2016 at 12:27 AM, s.d.r <<email address hidden>
> wrote:

> Question #287548 on Gufw changed:
> https://answers.launchpad.net/gui-ufw/+question/287548
>
> Status: Answered => Open
>
> s.d.r is still having a problem:
> I'm sorry, I don't know perl((
> I know php for example.
> Now, when I try to run - see
>
> File "/usr/lib/python2.7/site-packages/gufw/model/ufw_backend.py", line 51
> if 'Status: active' in self._run_cmd([self.UFW_PATH, 'status'], True):
>
> ^
> IndentationError: unindent does not match any outer indentation level
>
> ------
> def get_status(self):
>
> print("Debug 0: " + self._run_cmd([self.UFW_PATH, 'status'], True))
>
> if 'Status: active' in self._run_cmd([self.UFW_PATH, 'status'],
> True):
> return True
> else:
> return False
>
> --
> You received this question notification because you are an answer
> contact for Gufw.
>

Revision history for this message
s.d.r (s-driggers) said :
#15

Done.
gufw v15.10.0.
I may put "ufw enable" in autorun, but I don't think that it is right way...

Revision history for this message
costales (costales) said :
#16

Could you overwrite the ufw_backend.py with the attachment?

Then, run Gufw as:
gufw
And paste here the dumps :)

Revision history for this message
s.d.r (s-driggers) said :
#17

Hmm, I don't see attachment...

Revision history for this message
s.d.r (s-driggers) said :
#18

Decided to add here.

When I tried to enable firewall via gui or

"sudo ufw enable" - it was disabled after reboot.
"sudo systemctl enable ufw" - solved my problem.

My problem is solved, but I think, that someone else may have this problem too.
Maybe, I should add this to bug report?
I think - the normal behavoir is to enable it (not only start for this session) by button, without involving console.

Revision history for this message
costales (costales) said :
#19

Ops,
Could you paste here the exit of this command (Just for me information)?
sudo ufw enable
Thanks in advance!

Revision history for this message
s.d.r (s-driggers) said :
#20

% sudo ufw enable
Firewall is active and enabled on system startup

But after reboot his status was always disabled, and enabling via systemctl solved my problem.

Revision history for this message
costales (costales) said :
#21

Thanks for the feedback!
ufw should work as binary with "sudo ufw enable".
Please, could you scale to Arch? I don't know if your version is standard or the process. Thanks in advance!!

Can you help with this problem?

Provide an answer of your own, or ask s.d.r for more information if necessary.

To post a message you must log in.