Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

WTF is udhcpc and why did it run?

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
18 posts • Page 1 of 1
Author
Message
curmudgeon
Veteran
Veteran
Posts: 1746
Joined: Fri Aug 08, 2003 1:39 pm

WTF is udhcpc and why did it run?

  • Quote

Post by curmudgeon » Sat May 18, 2013 6:50 am

After experiencing days of absolutely horrible network performance, an investigation revealed that /etc/resolv.conf had been wiped out (not even backed up) and replaced with:

Code: Select all

# Generated by udhcpc for eth0
search localdomain.loc
nameserver 1.2.3.4
nameserver 1.2.3.5
I am not using dhcp. My /etc/conf.d/net have the same two lines as always, and I still have the same static address as always.

Code: Select all

config_eth0='192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0'
routes_eth0='default via 192.168.0.1'
What can trigger this, and (more important) how can I keep this from EVER running again?
Top
krinn
Watchman
Watchman
User avatar
Posts: 7476
Joined: Fri May 02, 2003 6:14 am

Re: WTF is udhcpc and why did it run?

  • Quote

Post by krinn » Sat May 18, 2013 7:11 am

curmudgeon wrote: What can trigger this, and (more important) how can I keep this from EVER running again?
To make story short, udev was update, a note has been put udev change network device name, so your config targetting eth0 is targetting a non existing device now, and the new device name (a stupid mqlkdafjqsdmlfksdj like name) now have no rules and so openrc trigger dhcp to get an ip.

If it's that, it's because you didn't read the note, so the answer to "What can trigger this" must be "udev stupid names" & "you".
Top
curmudgeon
Veteran
Veteran
Posts: 1746
Joined: Fri Aug 08, 2003 1:39 pm

Re: WTF is udhcpc and why did it run?

  • Quote

Post by curmudgeon » Sat May 18, 2013 10:42 am

krinn wrote:If it's that, it's because you didn't read the note, so the answer to "What can trigger this" must be "udev stupid names" & "you".
I did read that note (especially the part about configuring rules to keep eth0 :) ).

I am still (very much) interested in the idea of some way to completely disable any possibility of a dhcp client automatically running if something fails (that is a very bad idea in my opinion).
Top
Maitreya
Guru
Guru
Posts: 448
Joined: Wed Jan 11, 2006 12:58 am

Re: WTF is udhcpc and why did it run?

  • Quote

Post by Maitreya » Sat May 18, 2013 11:32 am

curmudgeon wrote:
krinn wrote:If it's that, it's because you didn't read the note, so the answer to "What can trigger this" must be "udev stupid names" & "you".
I did read that note (especially the part about configuring rules to keep eth0 :) ).

I am still (very much) interested in the idea of some way to completely disable any possibility of a dhcp client automatically running if something fails (that is a very bad idea in my opinion).
Well in this particular case it is probably handy to have it try dhcp. Not everyone reads the notes carefully. So if someone rebooted after the udev update they could still reach it remotely. Also it fires only when it gets a network device, so why not probe for a automatic adres?
Top
khayyam
Watchman
Watchman
User avatar
Posts: 6227
Joined: Thu Jun 07, 2012 2:45 am
Location: Room 101

Re: WTF is udhcpc and why did it run?

  • Quote

Post by khayyam » Sat May 18, 2013 1:11 pm

curmudgeon ...

simply provide the nameserver, like so:

Code: Select all

config_eth0="192.168.0.2/24"
routes_eth0="default via 192.168.0.1"
dns_servers_eth0="192.168.0.1"
I suspect some hotplugging here as I've not seen udhcpc run when a static address is asigned (though I would generally always provide a nameserver in such cases). Anyhow, none of this should result in "horrible network performance" so the actual issue may be elsewhere.

best ... khay
Top
curmudgeon
Veteran
Veteran
Posts: 1746
Joined: Fri Aug 08, 2003 1:39 pm

Re: WTF is udhcpc and why did it run?

  • Quote

Post by curmudgeon » Sun May 19, 2013 2:14 am

khayyam wrote:Anyhow, none of this should result in "horrible network performance" so the actual issue may be elsewhere.
It blew up /etc/resolv.conf (without backing it up, which is doubly annoying). The DNS servers that udhcpc picked up were horrible (minimum fifteen seconds to return anything), and on top of that, I run dnsmasq (which any decent dhcp client would have incorporated into a modified resolv.conf, but udhcpc didn't).

Beyond that, there are security implications involved in running a dhcp client when one is not desired.

Since my question has not been answered yet, I will repeat it - how do I block udhcpc from ever running under any circumstances?
Top
khayyam
Watchman
Watchman
User avatar
Posts: 6227
Joined: Thu Jun 07, 2012 2:45 am
Location: Room 101

Re: WTF is udhcpc and why did it run?

  • Quote

Post by khayyam » Sun May 19, 2013 1:41 pm

curmudgeon wrote:
khayyam wrote:Anyhow, none of this should result in "horrible network performance" so the actual issue may be elsewhere.
It blew up /etc/resolv.conf (without backing it up, which is doubly annoying). The DNS servers that udhcpc picked up were horrible (minimum fifteen seconds to return anything), and on top of that, I run dnsmasq (which any decent dhcp client would have incorporated into a modified resolv.conf, but udhcpc didn't).
curmudgeon ... none of which are directly related to the quote above. It "blows up" resolv.conf because dhcp clients do this *unless* they are told not to request DNS (using the "nodns" switch in dhcp_${IFACE}), the dns servers "picked up" are provided by whatever is serving dhcp on the network, and if you want resolv.conf to be handled by multiple sources, or be static, then you need to figure out why udhcpc is started in the first place. As I said, the issue seems to be elsewhere as having a static address defined should be sufficent for the interface to be brought up, and no dhcp client should be called. So, something else is no doubt causing udhcpc to be started, what I can't tell, as there is too little information to go on.
curmudgeon wrote:Beyond that, there are security implications involved in running a dhcp client when one is not desired.
There are security implication to any number of things, but it is by understanding the cause behind an event that allows for its mitigation. So, sure, we can state "that shouldn't happen" but that is in the realm of the obvious, and provides no clue as to the why.
curmudgeon wrote:Since my question has not been answered yet, I will repeat it - how do I block udhcpc from ever running under any circumstances?
As I stated above with a staticly defined address it shouldn't, so you need to look for the root cause and/or provide some clue as to why it might. Generally, to get your question answered its best to present the question in a way in which others can help, your "question has not been answered yet" because, quite frankly, no one has any idea what might be at work here, all we have is two lines from your /etc/conf.d/net ... and lots of huffing and puffing.

best ... khay
Top
nix213
n00b
n00b
User avatar
Posts: 23
Joined: Fri Feb 08, 2013 1:42 am
Location: Illinois

  • Quote

Post by nix213 » Sun May 19, 2013 5:42 pm

There's a net.example file in /usr/share/doc/openrc*/ that might be of help to you.
You could, for example, install net-misc/dhcp then add stuff like this to /etc/conf.d/net:

config_eth0="dhcp"
modules_eth0="dhcpd !udhcp"
dhcp_eth0="release nodns"
dns_servers_eth0="8.26.56.26 198.153.192.40"



just a few ideas :idea:
"Wherever you go, go with all your heart." -Confucius
Top
curmudgeon
Veteran
Veteran
Posts: 1746
Joined: Fri Aug 08, 2003 1:39 pm

Re: WTF is udhcpc and why did it run?

  • Quote

Post by curmudgeon » Wed May 22, 2013 9:39 am

khayyam wrote:none of which are directly related to the quote above. It "blows up" resolv.conf because dhcp clients do this *unless* they are told not to request DNS (using the "nodns" switch in dhcp_${IFACE}),
Well-behaved dhcp clients will back up the original, and restore it when shutting down.
khayyam wrote:the dns servers "picked up" are provided by whatever is serving dhcp on the network, and if you want resolv.conf to be handled by multiple sources, or be static, then you need to figure out why udhcpc is started in the first place.
In looking at the time stamp on the altered resolv.conf, it appears that it happened several cycles (boots) ago. I have never watched for that before, and it has not happened since (and I have been paying VERY close attention to it. The log files (/var/log/messages*) contain no information about it.
khayyam wrote:There are security implication to any number of things, but it is by understanding the cause behind an event that allows for its mitigation. So, sure, we can state "that shouldn't happen" but that is in the realm of the obvious, and provides no clue as to the why.
This is why running a dhcp client on a machine that is NEVER supposed to use dhcp is so pernicious. If the machine finds a rogue dhcp server on the network, it is easy to end up with hijacked dns servers, and it doesn't take much imagination to see the types of problems that can cause.
khayyam wrote:
curmudgeon wrote:Since my question has not been answered yet, I will repeat it - how do I block udhcpc from ever running under any circumstances?
As I stated above with a staticly defined address it shouldn't, so you need to look for the root cause and/or provide some clue as to why it might.
As I stated above, it has a static address, and should always use it. I want to protect against the "known unknown" of activating a dhcp client that should never be activated under any circumstances.

I don't believe it should be that difficult (in fact, it should be trivial) to disable a program that should never be run.
nix213 wrote:There's a net.example file in /usr/share/doc/openrc*/ that might be of help to you.
You could, for example, install net-misc/dhcp then add stuff like this to /etc/conf.d/net:

config_eth0="dhcp"
modules_eth0="dhcpd !udhcp"
dhcp_eth0="release nodns"
dns_servers_eth0="8.26.56.26 198.153.192.40"
I absolutely do not want ANOTHER dhcp client on the machine, and I don't want to EVER use ANY dhcp client.

Would this work in isolation (or in combination with something else)?

modules_eth0="!udhcp"

I doubt it, but it will probably be the next thing I test?
Top
Jaglover
Watchman
Watchman
User avatar
Posts: 8291
Joined: Sun May 29, 2005 1:57 am
Location: Saint Amant, Acadiana

  • Quote

Post by Jaglover » Wed May 22, 2013 9:45 am

Well, you can set immutable flag on resolv.conf, but this is hardly an elegant soulution. Why is this udhcpc present in your box? I use static conf and there is no DHCP client in the system.
My Gentoo installation notes.
Please learn how to denote units correctly!
Top
Gusar
Advocate
Advocate
Posts: 2665
Joined: Sat Apr 09, 2005 10:19 pm
Location: Slovenia

  • Quote

Post by Gusar » Wed May 22, 2013 10:42 am

Jaglover wrote:Why is this udhcpc present in your box?
Every gentoo user has it, it's part of busybox.
Top
Jaglover
Watchman
Watchman
User avatar
Posts: 8291
Joined: Sun May 29, 2005 1:57 am
Location: Saint Amant, Acadiana

  • Quote

Post by Jaglover » Wed May 22, 2013 10:23 pm

Right you are ... it just didn't show up on PATH ...
My Gentoo installation notes.
Please learn how to denote units correctly!
Top
curmudgeon
Veteran
Veteran
Posts: 1746
Joined: Fri Aug 08, 2003 1:39 pm

  • Quote

Post by curmudgeon » Thu May 23, 2013 2:13 am

Jaglover wrote:Well, you can set immutable flag on resolv.conf, but this is hardly an elegant soulution.
Still wouldn't solve the problem of a rogue dhcp server setting a malicious router.
Jaglover wrote:I use static conf and there is no DHCP client in the system.
I use a static ip address, and I didn't think there was any dhcp client either.

In a way this reminds me of the stupid programming in browsers now. If something doesn't work, it is automatically "searched for" instead of displaying the proper messages.

What I want is that if, for any reason (such as whatever happened that one time a few boots ago), the static address assignation fails, there should be a CLEAR AND UNAMBIGUOUS ERROR, because something is obviously wrong.
Top
krinn
Watchman
Watchman
User avatar
Posts: 7476
Joined: Fri May 02, 2003 6:14 am

  • Quote

Post by krinn » Thu May 23, 2013 3:15 am

then how about just

Code: Select all

echo 'INSTALL_MASK="${INSTALL_MASK} /usr/share/udhcpc"' >> /etc/portage/make.conf
Top
khayyam
Watchman
Watchman
User avatar
Posts: 6227
Joined: Thu Jun 07, 2012 2:45 am
Location: Room 101

  • Quote

Post by khayyam » Thu May 23, 2013 3:28 am

krinn wrote:then how about just

Code: Select all

echo 'INSTALL_MASK="${INSTALL_MASK} /usr/share/udhcpc"' >> /etc/portage/make.conf
krinn ... udhcpc is a component of /bin/busybox, busybox doesn't install anything to /usr/share/udhcpc. Anyhow, the problem isn't with udhcpc, thats meerly the effect.

best ... khay
Top
krinn
Watchman
Watchman
User avatar
Posts: 7476
Joined: Fri May 02, 2003 6:14 am

  • Quote

Post by krinn » Thu May 23, 2013 3:50 am

damnit this thing is a virus :)

maybe change /etc/udhcpcd.conf

Code: Select all

interface     anonexistantname
Top
The Doctor
Bodhisattva
Bodhisattva
User avatar
Posts: 2678
Joined: Tue Jul 27, 2010 10:56 pm

  • Quote

Post by The Doctor » Thu May 23, 2013 4:20 am

If you just want to kill it, then why not configure busybox not to build it. Build busybox with USE="savedconfig" and edit the file. I think the file should be located at /etc/portage/savedconfig/sys-apps/busybox-1.21.0

You probably want to be careful not to rip too much out.
First things first, but not necessarily in that order.

Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Thu May 23, 2013 9:36 am

nix213 wrote:There's a net.example file in /usr/share/doc/openrc*/ that might be of help to you.
You could, for example, install net-misc/dhcp then add stuff like this to /etc/conf.d/net:

config_eth0="dhcp"
modules_eth0="dhcpd !udhcp"
dhcp_eth0="release nodns"
dns_servers_eth0="8.26.56.26 198.153.192.40"



just a few ideas :idea:

Better yet disable dhcp globally

modules="!dhcp"

may work, if that fails specify each dhcp module

modules="!dhcpcd !udhcpc"
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
Post Reply

18 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic