Bug 20258 - Making user-PPP start as an arbitrary user instead of root
Summary: Making user-PPP start as an arbitrary user instead of root
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 4.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Brian Somers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-07-28 17:40 UTC by Antoine
Modified: 2000-08-10 01:14 UTC (History)
0 users

See Also:


Attachments
file.diff (549 bytes, patch)
2000-07-28 17:40 UTC, Antoine
no flags Details | Diff
file.diff (836 bytes, patch)
2000-07-28 17:40 UTC, Antoine
no flags Details | Diff
file.diff (508 bytes, patch)
2000-07-28 17:40 UTC, Antoine
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine 2000-07-28 17:40:03 UTC
User PPP is started as the root user from rc.network. I added a
variable to make it start as an arbitrary user.

Fix: Create a "ppp_user" variable which is the user under which ppp should
run. If set to "NO", no su(1) is performed, otherwise, instead of just
calling:

ppp ${ppp_command} -quiet ${ppp_profile}

it is called as

su -c "user" '${ppp_command}'

The meaning of ${ppp_command} is obviously changed, but it should not
interfere with anything else. 
How-To-Repeat: 
Arg, the heck with it, here's the patch
Comment 1 Sheldon Hearn 2000-07-31 10:38:12 UTC
On Fri, 28 Jul 2000 12:23:49 -0400, Antoine@chemcomp.com wrote:,
Beaupre@chemcomp.com wrote:

> + ppp_user="NO"         # Which user to start PPP with (or NO)

I think that it would make more sense to default this value to "root",
and to use this value unconditionally.

Ciao,
Sheldon.
Comment 2 Sheldon Hearn freebsd_committer freebsd_triage 2000-07-31 10:38:20 UTC
Responsible Changed
From-To: freebsd-bugs->brian

Over to the PPP maintainer.
Comment 3 admin 2000-07-31 15:43:23 UTC
Sheldon Hearn wrote:
> 
> On Fri, 28 Jul 2000 12:23:49 -0400, Antoine@chemcomp.com wrote:,
> Beaupre@chemcomp.com wrote:
> 
> > + ppp_user="NO"         # Which user to start PPP with (or NO)
> 
> I think that it would make more sense to default this value to "root",
> and to use this value unconditionally.

Yep. This makes an awful lot of sense.

So here we go again:

New Fix:

*** /etc/defaults/rc.conf.orig        Fri Jul 14 10:54:54 2000
--- /etc/defaults/rc.conf     Fri Jul 14 10:56:19 2000
***************
*** 77,82 ****
--- 77,83 ----
                        # For details see man page for ppp(8). Default
is au
  ppp_nat="YES"         # Use PPP's internal network address translation
or
  ppp_profile="papchap" # Which profile to use from /etc/ppp/ppp.conf.
+ ppp_user="root"       # Which user to start PPP with
      
  ### Network daemon (miscellaneous) & NFS options: ###
  syslogd_enable="YES"          # Run syslog daemon (or NO).

*** /etc/rc.network.orig        Fri Jul 14 10:56:33 2000
--- /etc/rc.network     Mon Jul 31 10:31:06 2000
***************
*** 160,167 ****
                        ;;
                esac
  
!               echo -n 'Starting ppp: '; ppp ${ppp_command} -quiet
${ppp_profile}
!               ;;
        esac
  
        # Initialize IP filtering using ipfw
--- 160,176 ----
                        ;;
                esac
  
!               ppp_command="ppp ${ppp_command} -quiet ${ppp_profile}"
! 
!               echo -n 'Starting ppp: '
!               case ${ppp_user} in
!               root)
!                       ${ppp_command};
!                       ;;
!               *)
!                       su ${ppp_user} -c "${ppp_command}";
!                       ;;
!               esac
        esac
  
        # Initialize IP filtering using ipfw

The same with the man page...

*** /usr/src/share/man/man5/rc.conf.5   Fri Mar  3 09:04:56 2000
--- /tmp/rc.conf.5      Fri Jul 28 12:20:18 2000
***************
*** 329,334 ****
--- 329,338 ----
  .It Ar ppp_profile
  (str) The name of the profile to use from
  .Ar /etc/ppp/ppp.conf .
+ .It Ar ppp_user
+ (str) The name of the user under which ppp should be started. By
default, ppp is started
  as
  .Ar root.
  .It Ar rc_conf_files
  (str) This option is used to specify a list of files that will
override
  the settings in

That's better... BTW, I don't know very much about GNATS protocols.
Should I've send another PR instead of "patching" this one? :)

Antoine Beaupre
System Administrator
Chemical Computing Group, Inc.
Comment 4 Brian Somers freebsd_committer freebsd_triage 2000-08-10 01:13:57 UTC
State Changed
From-To: open->closed

I've committed the functionality to -current and will MFC in 1 week 
assuming no problems.