Deleting Comments from Tickets in Trac 0.12

About a year ago, I wrote about a way to delete comments from tickets in Trac prior to version 0.12 (as it didn’t exist back then). Basically, the method was to directly delete the comment from the database. Lately, spammers have been harassing one of my Trac installations, bypassing the spam filtering and changing ticket properties. The old method wouldn’t revert those changes. After searching for a solution, I found a little-documented option in Trac 0.12 that allows you to delete comments and revert changes to tickets.

To enable it, go to the admin panel->Plugins->Trac 0.12 and enable TicketDeleter under tracopt.ticket.deleter.*. This will add a “Delete” button right next to the “Reply” and “Edit” buttons of every comment. It will also revert any changes to the ticket properties.

See #3641 and [9270] for the relevant ticket and changeset in Trac’s own Trac.

Deleting Comments from Tickets in Trac

Spammers apparently love Trac. After trying to fight spam tickets and later installing the SpamFilter plugin, I’ve managed to control spam tickets in the Open Yahtzee Trac site. But now spammers have started spamming the ticket comments. The bad news is that Trac (at least in version 0.11) doesn’t have built-in facilities to completely remove ticket comments.


Continue reading Deleting Comments from Tickets in Trac

Starting tracd without Root Privileges at Startup

I use Trac for the Open Yahtzee website. I’ve decided to use tracd for serving the requests (due to a configuration issue I didn’t want to mess with), which requires starting it each time the server restarts. I’ve already written one solution for this, in the form of an init.d script for tracd. However, it bothered me that tracd runs with root privileges, which it doesn’t really require.

After searching a bit, I’ve found out that cron can run tasks on startup using the special @reboot keyword instead of the normal time fields. So, edit your crontab and add the following line:

@reboot /usr/bin/tracd --daemonize --pidfile=~/run/tracd.pid --port=PORT --hostname=HOSTNAME -s TRAC_ENV

Just replace PORT, HOSTNAME, and TRAC_ENV with the appropriate values for your environment, and make sure you have a run/ subdirectory in your home folder (or change the pidfile value).

To stop the server, just do:

kill `cat ~/run/tracd.pid`

While there is no straightforward way to restart the server (like /etc/init.d/tracd restart), it’s a good compromise for dropping root privileges.

Deleting a Range of Tickets in Trac

Recently, the Open Yahtzee website, which runs Trac, has fallen victim to several spam attacks. The spammers submit a large number of tickets containing links to various sites. This post was written mainly to allow me to copy and paste a command to delete a range of tickets at once, but I thought it might be useful to others as well.
Continue reading Deleting a Range of Tickets in Trac

Start Trac on Startup – Init.d Script for tracd

As part of a server move, I went on to reinstall Trac. I tried to install it as FastCGI, but I failed to configure the clean URLs properly. I got the clean URLs to work if the user accessed them, but Trac insisted on adding trac.fcgi to the beginning of every link it generated. So I decided to use the Trac standalone server, tracd.

The next problem I faced was how to start Trac automatically upon startup. The solution was to use an init.d script for starting Trac. After some searching, I didn’t find an init.d script for tracd that was satisfactory (most were poorly written). So I went on and wrote my own init.d script for tracd.
Continue reading Start Trac on Startup – Init.d Script for tracd