Opened 8 years ago

Closed 8 years ago

#3614 closed defect (fixed)

When using arm to configure tor, arm wipes /etc/tor/torrc

Reported by: runa Owned by: atagar
Priority: Medium Milestone:
Component: Core Tor/Nyx Version:
Severity: Keywords:
Cc: runa Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

I am running Debian Squeeze on the DreamPlug, version 0.2.1.29 of tor from deb.torproject.org, and version 1.4.2.4 (released April 21, 2011) of arm from squeeze-backports.

When using arm to configure tor, arm wipes /etc/tor/torrc completely. I have tried to write to the existing configuration file, as well as create a new one. In both cases, the configuration file is empty after arm reports that it has saved the config.

This is what I do:
Go to page three, select Nickname, hit enter, type 'foobar', hit enter, press 'w', choose "Save", and confirm that I want to save to /etc/tor/torrc. I then see a message from arm telling me that the config has been saved. The result is that /etc/tor/torrc is completely empty.

The same thing happens if I choose "Save As..." and write /etc/tor/torrc.test instead. The file is created, but it is empty.

I have tried to edit src/interface/controller.py with the following on line 1773:

log.log(log.ERR, "attempting to save the following... %s" % "\n".join(configLines))

... but I still get an empty config file. Same result when moving the line above to line 1759 in controller.py

Child Tickets

Change History (5)

comment:1 Changed 8 years ago by runa

I guess it's worth mentioning that I ran arm as root (necessary to read files in /etc, I believe).

The tl;dr of #tor-dev is that arm should read it's own config file, not deal with /etc/tor/torrc. The config file can then be set up with ControlPort and CookieAuthentication, which means that the user doesn't have to do anything before running arm for the first time. I wonder if the new version takes care of all this.

comment:2 Changed 8 years ago by atagar

Status: newassigned

... but I still get an empty config file. Same result when moving the line above to line 1759 in controller.py

The purpose of that line isn't to fix your issue. Go back to the first page (the one with the logs) and it should have that message. If...

  1. It has the configuration file contents that you expect then, as mentioned on irc, the python process is silently failing to write anywhere on your filesystem (which is very, very weird). That would be an issue with your environment. Arm expects to be able to, at least, know when it fails to write files. You can try this to confirm...

atagar@fenrir:~$ python

myFile = open("/tmp/foobar", "w")
myFile.write("hello world\n")
myFile.close()

atagar@fenrir:~$ cat /tmp/foobar
hello world

  1. Arm logs "attempting to save the following..." without anything after it. In that case something's odd on arm's part and I'll work through further debugging steps with you.

Cheers! -Damian

comment:3 in reply to:  2 Changed 8 years ago by runa

Replying to atagar:

  1. Arm logs "attempting to save the following..." without anything after it. In that case something's odd on arm's part and I'll work through further debugging steps with you.

I put the line back on line 1773 in controller.py, and the log now shows 11:28:31 [ARM_ERR] attempting to save the following... [1 duplicate hidden]. This happens both when writing to /etc/tor/torrc and /etc/tor/torrc.test (i.e. existing files and new files).

comment:4 Changed 8 years ago by atagar

Ah, think I might know what's going on. When you press 'w' to get the confirmation dialog is it showing you a torrc that it will write or is that blank? Getting the torrc to be written requires the "GETINFO config-text" option which was introduced in Tor version 0.2.2.7.

The save function sees the empty output and thinks that the torrc should be empty. This is a bug, both with 1.4.2 and the current master (though it would only manifest in 1.4.3 when you chose "Save As..." since "Save" uses SAVECONF). I'll add a tor version check and display an error rather than writing a blank config.

Thanks for the catch!

-Damian

comment:5 Changed 8 years ago by atagar

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.