Using "nobody" on a root system to send mail

Ask questions about Arch Linux ARM. Please search before making a new topic.

Using "nobody" on a root system to send mail

Postby g8jvm » Sun May 19, 2013 10:33 pm

Hi
running noip2 to update my dynamic ip , or I thought it was , until I got a mail from no-ip.org warning of expiry.
Arch install on a pogoplugV2,
noip2 is being started OK from rc.d/noip2.
from /var/log/everything.log$this->bbcode_second_pass_code('', 'May 19 23:18:22 Pogopig noip2[261]: richard-g8jvm.no-ip.org was already set to 62.31.141.85.
May 19 23:18:22 Pogopig noip2[266]: execl /root/echo "Noip2 update" | mailx -s "noip2 update made" richard@g8jvm.info failed (Permission denied)
')
That was after a reboot, its not updating at 30 min intervals as in the config file.
As after its startup, it changes user from root to nobody.
I've changed group to nobody on echo, mailx & msmtp. Sending mail to me is just a way of checking if its working or not


.
Anything else I'ved missed
TIA
Best wishes
Richard
richard@g8jvm.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ham Call: G8JVM , QRA IO82SP38 interests weak signal propagation
VHF to microwave, http://www.g8jvm.com
g8jvm
 
Posts: 93
Joined: Mon Apr 22, 2013 4:40 pm
Location: United Kingdom

Re: Using "nobody" on a root system to send mail

Postby moonman » Sun May 19, 2013 11:06 pm

noip and dyndns require you to login once a month for free accounts. They dont care if you update the ip or not.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: Using "nobody" on a root system to send mail

Postby g8jvm » Mon May 20, 2013 9:24 am

Hi Moonman
I checked that on their site$this->bbcode_second_pass_quote('', ' ')Free hostnames are deleted after 30 days of inactivity. Inactivity is defined as when a host has not been updated or 'touched' via the web interface or a dynamic update client.


I know my ip address changed as my ISP had a major outage, and I had to reboot the pogoplug after I regained connectivity
as my link to the webcam had dropped out due to an an ip-address change.
Once rebooted the address was updated and |I could access the webcam.
The problem seems to the way the noip2 daemon changes ownership after the initial boot up from root to nobody, qas from tht stage none of the 30 min interval updates take place, or if they do they dont get logged, unlikely.

As the pogoplug is running 24/7 if its not doing an update check every 30 mins it will just sit oblivious to the change of ip-address on the router.$this->bbcode_second_pass_code('', '[root@Pogopig ~]# ps ax|grep noip2
261 ? Ss 0:00 /usr/bin/noip2 -c /etc/no-ip2.conf
1020 pts/0 S+ 0:00 grep noip2
[root@Pogopig ~]# ls -l /etc/no-ip2.conf
-rw------- 1 root root 249 May 19 19:04 /etc/no-ip2.conf
')
no-ip2.conf is not readable so no way to check whats in it :(
So the problem of not being able to send mail as nobody is also unable to update as nobody.

Turning the problem on its head , is there a way of changing the ownership of a running process ?
$this->bbcode_second_pass_code('', '[root@Pogopig ~]# ps aux|grep noip2
nobody 261 0.0 0.3 1940 788 ? Ss May19 0:00 /usr/bin/noip2 -c /etc/no-ip2.conf
root 1039 0.0 0.3 4588 956 pts/0 S+ 09:44 0:00 grep noip2
')
as ls -l shows /usr/bin/noip2 is owned by root and group root, so using chown wont do anything.
However, am I being stupid as usual in assuming the update interval is 30 mins, as running noip2 -C
on update interval just shows default as [30]
looking at noip2.c
$this->bbcode_second_pass_code('', '#define READ_TIMEOUT 90
#define WRITE_TIMEOUT 60
#define CONNECT_TIMEOUT 60
#define FORCE_INTERVAL (1440 * 30) // 30 days in minutes

')
is that interval 30 days ?
again in noip2.c
$this->bbcode_second_pass_code('', ' /* drop root privileges after reading config */
if (geteuid() == 0) {
if ((nobody = getpwnam("nobody")) != NULL) { // if "nobody" exists
setgid(nobody->pw_gid);
setegid(nobody->pw_gid);
setuid(nobody->pw_uid);
seteuid(nobody->pw_uid);')

I don't have any way to cross compile to rebuild with the above hashed out, and as noip2 is in the repository pacman may be overwriten.

Maybe a short shell script to be run by cron to check the gid of noip2 and if nobody use setgid to set it back to root.
But running it from cron is wasteful on limited resources, may be run from rc.d
Which order on boot are the files in rc.d actioned as there is no rc3.d to determine the startup order ?
is it alphabetical ?
Is rc.local used in Arch ?

TIA
Best wishes
Richard
richard@g8jvm.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ham Call: G8JVM , QRA IO82SP38 interests weak signal propagation
VHF to microwave, http://www.g8jvm.com
g8jvm
 
Posts: 93
Joined: Mon Apr 22, 2013 4:40 pm
Location: United Kingdom


Return to User Questions

Who is online

Users browsing this forum: No registered users and 7 guests