LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 11-24-2010, 06:32 PM   #1
josephj
Member
 
Registered: Nov 2007
Location: Northeastern USA
Distribution: kubuntu
Posts: 69

Rep: Reputation: 24
firestarter and kde4


I have kde set to restore my previous session when I login.

In my kde Autostart directory, I have a script that sleeps for a short while to let kde restore my session and then checks to see if firestarter is running. If not, it starts it using kdesudo.

Everything works fine except that every time I login I get two pop up windows. One says that firestarter can't start without root privileges and the other says that kdesudo is being run with no arguments. This is occurring as part of kde restoring my session - before my autostart script kicks in - like kde is treating the kdesudo process and the firestarter process separately.

Once I close these two windows, everything, including autostart starting firestarter, works fine.

I'm open to any solution to this.

What I thought I would do to fix this was to write a script to shutdown firestarter when I logout so that kde wouldn't try to restore it.

Code:
#!/bin/bash
## shutdown firestarter when kde exits
## to avoid messy next startup

kdesudo "kill $(ps -ef | gawk '/firestarter/&&/--starthidden/&&!/gawk/{printf "%s ", $2}END{printf ""}')"
This script works when I test it from the command line, but it has two problems:
1) Where is the best place to put it?
I tried putting it in ~/.kde/shutdown, but that didn't do anything.

2) Since it needs root permissions to shutdown firestarter, it needs to run when kdesudo still has access to my screen and time for me to type in a password. It also has to fail gracefully if I don't enter the password.

TIA
Joe

kubuntu karmic/firestarter 1.0.3/kde 4.3.5
 
Old 11-24-2010, 08:45 PM   #2
mlangdn
Senior Member
 
Registered: Mar 2005
Location: Kentucky
Distribution: Slackware64-current
Posts: 1,377

Rep: Reputation: 170Reputation: 170
I don't know anything about kubuntu, but does it have an /etc/rc.d/rc6.d shutdown script? That's where your script should go. Wherever kubuntu has its shutdown script.
 
Old 11-25-2010, 12:54 AM   #3
josephj
Member
 
Registered: Nov 2007
Location: Northeastern USA
Distribution: kubuntu
Posts: 69

Original Poster
Rep: Reputation: 24
Not sure that's the problem

I want to preface this reply with the fact that I'm pretty green with respect to startup/shutdown scripts.

In general, you're right that a system level utility like a firewall should be handled by init scripts.

There's a k20firestarter script in /etc/rc6.d and an s20firestarter in /etc/rc3.d But, I don't think that's the issue. If it was, wouldn't there be some sort of shutdown or boot up error condition? Is there something I should look for?

I'm not really sure, but I think firestarter itself is getting started and shutdown correctly at the system level through the init scripts.

What I'm doing (or trying to do) at the user level is to start the gui part that puts the firestarter icon in my task bar in my panel and lets me interact with firestarter. That's the part that kde sees. I don't think it is concerned - or even knows about anything in the init scripts. And, if there was a problem at that level, I don't think it would put anything on my user screen. It would show up in the system logs/dmesg, etc..

Please correct me if I am wrong or just looking in the wrong places, etc..

Joe
 
Old 11-25-2010, 04:10 AM   #4
mlangdn
Senior Member
 
Registered: Mar 2005
Location: Kentucky
Distribution: Slackware64-current
Posts: 1,377

Rep: Reputation: 170Reputation: 170
Try this link and see if this is what you are after:

http://www.fs-security.com/docs/faq.php
 
Old 01-05-2011, 06:48 AM   #5
josephj
Member
 
Registered: Nov 2007
Location: Northeastern USA
Distribution: kubuntu
Posts: 69

Original Poster
Rep: Reputation: 24
I had that all set up, but maybe it's incorrect. There may be a blank missing or needed in the part about firestarter.

Here's what I have in sudoers:

Code:
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults        env_reset

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL) ALL

# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Users can start the firewall with no password
bigbird ALL=NOPASSWD:/usr/sbin/firestarter
shelelia ALL=NOPASSWD:/usr/sbin/firestarter
My user is bigbird. It is a member of the admin group.

Here's part of what's in my $HOME/.kde/Autostart/mystart script which does all my startup stuff.

Code:
ps -f -u "$USER" > "$PS"  # the -f is necessary because most of the restores are done by kdeinit and the
                          # actual name of the application being restored just shows up as an argument
## Desktop Independent stuff

## Start the Firewall
sleep 10 ## Give Wifi a small chance to start up first
if [[ ! $(grep "firestarter" ${PS}) ]]
then
  kstart --iconify --skiptaskbar kdesudo "/usr/sbin/firestarter --starthidden"
fi
That works except for the --starthidden part. That's probably one of those weird quoting issues in bash.
If I take the quotes off, then kdesudo grabs the --starthidden option and complains that it doesn't exist.

If I can't fix the problem, I just won't run the gui unless I need to configure a new application, etc..

I found out that $home/.kde/shutdown is the place to put scripts for kde to run when it's closing (although I saw at least one comment saying that it doesn't work.)

What I don't know how to do is to close the firestarter gui from a script. It has a command line option that stops the firewall, but it doesn't close it and the gui keeps running.

I could use ps to get its pid and then kill it, but that doesn't sound like a very good idea to do on a regular basis and it would still have to be rigged somehow to run as root - preferably without asking me for a password every time I want to log out or shutdown. It all seems to come back to getting sudoers to work right.

Any ideas would be appreciated.

Joe
 
  


Reply

Tags
autostart, firestarter, kde4


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
apt-get remove kolf-kde4 will remove kde4? michielv Linux - Software 1 02-10-2009 06:02 AM
Help with Firestarter rsiby Linux - Security 1 03-27-2006 09:49 AM
Firestarter CrEsPo Linux - Security 10 05-02-2005 08:23 PM
Firestarter?? BajaNick Linux - General 1 09-16-2003 07:08 AM
Firestarter Kane2002 Linux - Networking 1 08-27-2003 12:32 PM


All times are GMT -5. The time now is 06:59 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration