View previous topic :: View next topic |
Author |
Message |
xsteadfastx Tux's lil' helper
Joined: 27 Sep 2004 Posts: 132 Location: germany/belgium
|
Posted: Mon Sep 27, 2004 1:45 pm Post subject: leafnode and the user "news" |
|
|
hi,
i try to use leafnode here in my home-network to fetch the news for the whole family. i already ran leafnode on my suse desktop box but now i wanted to switch on an older gentoo box which just is there for leafnode and as test webserver. leafnode seems to work cause tells me that
so now i want start to fetch mail and i saw that there is the user "news" for that but how can i do that? under suse i know that it worked unter root and then "su news" but when i do this on gentoo i have this here in my /var/log/messages
Code: | Sep 27 15:44:21 eden su(pam_unix)[20465]: session opened for user news by root(uid=0)
Sep 27 15:44:21 eden su(pam_unix)[20465]: session closed for user news |
i would be so happy about every help...thanks |
|
Back to top |
|
|
TNorthover Guru
Joined: 25 Jan 2004 Posts: 434 Location: Edinburgh, UK
|
Posted: Mon Sep 27, 2004 2:02 pm Post subject: |
|
|
The reason that's happening is because the shell for news is set to /bin/false in /etc/passwd, so it exits immediately. This *could* be fixed by changing that to /bin/bash.
The best way of fixing this (IMO) is to use sudo instead of su directly (for security reasons). To do this you'd add a line like this to /etc/sudoers:
Code: | ALL ALL=(news) NOPASSWD: /usr/sbin/fetchnews |
To break it down this says that anyone (first ALL), can run /usr/sbin/fetchnews as user news on any machine (second ALL) without giving a password.
Then to use this you'd type "sudo -u news /usr/sbin/fetchnews". When I did this I setup an alias in .bashrc (or wherever you want to put it):
Code: | alias fetchnews=sudo -u news /usr/sbin/fetchnews" |
|
|
Back to top |
|
|
xsteadfastx Tux's lil' helper
Joined: 27 Sep 2004 Posts: 132 Location: germany/belgium
|
Posted: Mon Sep 27, 2004 2:47 pm Post subject: |
|
|
thanks alot...thats alot i needed to know
and how does it look like when i want to run it as cronjob? can i just uncomment the fetchnews file in /etc/cron.hour/ ?
a other question. i cant connect with slrn on the newsserver.....but when i use thunderbird from a other computer in the network it works...what do i wrong? thanks so much for all your help |
|
Back to top |
|
|
TNorthover Guru
Joined: 25 Jan 2004 Posts: 434 Location: Edinburgh, UK
|
Posted: Mon Sep 27, 2004 3:23 pm Post subject: |
|
|
I've just noticed a slight mistake in my above post (you probably would have spotted it when you tried, but just in case), it should be:
Code: | alias fetchnews="sudo -u news /usr/sbin/fetchnews" |
(I forgot the first ").
Right, I'd be inclined to change the /etc/cron.hourly thing to the sudo command I gave (put "sudo -u news" at the beginning), and of course uncomment it.
Also, make sure there's a /etc/leafnode/config file that looks correct. The package comes with a config.example, so copy that and edit it to your needs.
I'm not entirely sure about the other problem you're having, could you tell me what happens when you type "telnet localhost 119" from the computer?
To get you started, here are a couple of possibilities:
1. Connection refused error. In this case, it seems to use xinetd by default so edit /etc/xinetd.d/leafnode-nntp and change the "yes" on the disabled line to "no", and make sure xinetd gets started ("/etc/init.d/xinetd start" for now and "rc-update add xinetd default" for when you reboot). Then try again.
2. An error about unique, fully qualified domain names, in this case, go to /usr/share/doc/README-FQDN.gz and see what it has to say. It didn't seem particularly useful to me, but basically if you have some kind of domain that no-one else is likely to be using, use that (I may get shot by news admins, but I think that's what I did). To set it, though, use the "hostname =" option in /etc/leafnode/config as it's less invasive than editing hosts.
If it's something else, tell me and I'll try to think what could be causing it if you want. |
|
Back to top |
|
|
xsteadfastx Tux's lil' helper
Joined: 27 Sep 2004 Posts: 132 Location: germany/belgium
|
Posted: Mon Sep 27, 2004 3:45 pm Post subject: |
|
|
i will try that tomorrow at work with the sudo command in the crontab. that sounds like it would work
i will tell you tomorrow what telnet says cause i first need to emerge telnet...
thank you so much for the help and i will try everything tomorrow thanks alot |
|
Back to top |
|
|
xsteadfastx Tux's lil' helper
Joined: 27 Sep 2004 Posts: 132 Location: germany/belgium
|
Posted: Tue Sep 28, 2004 6:09 am Post subject: |
|
|
hi.
so i testet that with the telnet and this is what happens...it doesnt look that good
Code: | eden root # telnet localhost 119
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host. |
but i really wonder how that come....i mean nmap tells me that here:
Code: | eden root # nmap -sT localhost
Starting nmap 3.55 ( http://www.insecure.org/nmap/ ) at 2004-09-28 08:09 CEST
Interesting ports on eden.xsteadfastx.de (127.0.0.1):
(The 1657 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
119/tcp open nntp
Nmap run completed -- 1 IP address (1 host up) scanned in 0.519 seconds |
i hope you can help me |
|
Back to top |
|
|
TNorthover Guru
Joined: 25 Jan 2004 Posts: 434 Location: Edinburgh, UK
|
Posted: Tue Sep 28, 2004 8:14 am Post subject: |
|
|
What that output indicates is that the port is open and has something listening on it, but that thing immediately closes the connection once it's opened. So nmap is doing what I'd expect for that output -- showing that something's listening on the port, it doesn't care that the program terminates immediately.
Anyway, I've managed reproduce the effects you see by fiddling with the only_from line in /etc/xinetd.conf. Mine says "only_from = localhost", I'd assume yours doesn't since you can access it from the LAN. It looks like it's a space separated list of hosts (if ip addresses 0 counts as wildcard). Could you make sure localhost (or 127.0.0.1 of course) is in that list, and spelled correctly? If it isn't, try restarting xinetd after correcting it and see if that works.
If that doesn't work, could you post the whole xinetd.conf file, in case there's anything else there? |
|
Back to top |
|
|
xsteadfastx Tux's lil' helper
Joined: 27 Sep 2004 Posts: 132 Location: germany/belgium
|
Posted: Tue Sep 28, 2004 9:00 am Post subject: |
|
|
where i can find the list with the allowed hosts?
i looked into my /etc/xinet.conf and it lookes like this:
Code: | defaults
{
only_from = localhost
instances = 60
log_type = SYSLOG authpriv info
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
}
includedir /etc/xinetd.d |
i so wish i would know why this doesnt work. on my suse box i did this too with xinetd and i just did the same like here... |
|
Back to top |
|
|
TNorthover Guru
Joined: 25 Jan 2004 Posts: 434 Location: Edinburgh, UK
|
Posted: Tue Sep 28, 2004 9:35 am Post subject: |
|
|
I can't see anything particularly wrong there.
As an option, you could edit /etc/xinetd.d/leafnode-nntp and add the line "only_from = localhost" just above "socket_type = stream", and restart xinetd to register the changes. That may work, though I'm doubtful.
Could you try the telnet, then post the output of "tail /var/log/messages", see if that gives any hint over what's happening? |
|
Back to top |
|
|
xsteadfastx Tux's lil' helper
Joined: 27 Sep 2004 Posts: 132 Location: germany/belgium
|
Posted: Tue Sep 28, 2004 9:40 am Post subject: |
|
|
after
Code: | eden root # telnet localhost 119 |
/vat/log/messages say
Code: | Sep 28 11:37:05 eden xinetd[20236]: START: nntp pid=24187 from=127.0.0.1
Sep 28 11:37:05 eden xinetd[24187]: FAIL: nntp address from=127.0.0.1
|
and i tried the "only_from=localhost" but it doesnt work
|
|
Back to top |
|
|
TNorthover Guru
Joined: 25 Jan 2004 Posts: 434 Location: Edinburgh, UK
|
Posted: Tue Sep 28, 2004 10:17 am Post subject: |
|
|
Firstly (except it's an edit):
Quote: |
and i tried the "only_from=localhost" but it doesnt work
|
I've checked, and it appears that spaces around the "=" are important. It must be "only_from = localhost", or it won't work. This may or may not be what's causing the problem. If it's not, carry on:
OK, that message pretty much proves it's a problem with xinetd.
Looking at xinetd's source, that error can only be produced in 3 ways:
1. The service is actually a sensor (I'll explain later).
2. no_access
3. only_from
And it gets dealt with in that order. So, let's check those 3 conditions:
1. A sensor seems to be something that monitors for access on dodgy ports and bans those IPs temporarily, I think it's unlikely that there is one involved here, but to check: go to /etc/xinetd.d and try "grep nntp *", if any file other than leafnode-nntp shows up this could be a problem. Edit the other files and put a "disable = yes" option in. That should clear up this issue.
2. Put "no_access = " in /etc/xinetd.d/leafnode-nntp (that's just nothing after the no_access part). This will override any previous setting.
3. Put "only_allow = 127.0.0.1" in /etc/xinetd.d/leafnode-nntp. We've tried localhost, and it's possible that for some reason it's not looking up the hostname properly, this is more guaranteed to be reliable (and probably slightly faster).
Then restart xinetd again, and see if it works. |
|
Back to top |
|
|
xsteadfastx Tux's lil' helper
Joined: 27 Sep 2004 Posts: 132 Location: germany/belgium
|
Posted: Tue Sep 28, 2004 11:54 am Post subject: |
|
|
yes i did that with the spaces around the "=" and i still have the same problem.
for the 3 points
1. i checked all files in /etc/xinet.d/ and everything is "disable = yes" except leafnode-nntp
2. "no_access = " without anything behind the "="? i did that and restarted..nothing changed..
3. the same like with 2. i tried that and nothing changed
can it be that its cause leafnode has problems with my config? |
|
Back to top |
|
|
TNorthover Guru
Joined: 25 Jan 2004 Posts: 434 Location: Edinburgh, UK
|
Posted: Tue Sep 28, 2004 12:22 pm Post subject: |
|
|
It's definitely xinetd blocking access, that FAIL line you posted translates to it blocking access because of the address it was coming from, and if leafnode was getting started it would put some messages in /var/log/messages -- even if just to say it didn't like the config file.
Hmm, OK, let's see what xinetd thinks is going on. Could you do "killall xinetd", then "xinetd -d" to run it in debug mode. It'll give lots of output, then keep running in the foreground. Could you post the output it gives (there may well be some that scrolled off the screen)?
When it's just waiting you can Ctrl-C it and start xinetd daemon as normal again.
I'm sorry this is taking so long, I expect it'll turn out to be something trivial I've overlooked. |
|
Back to top |
|
|
xsteadfastx Tux's lil' helper
Joined: 27 Sep 2004 Posts: 132 Location: germany/belgium
|
Posted: Tue Sep 28, 2004 12:38 pm Post subject: |
|
|
so i run xinetd -d and this comes out..the last messages come when i try to connect again with slrn..i hope that maybe shows where the problem is..thank you
Code: | eden xinetd.d # xinetd -d
04/9/28@14:36:12: DEBUG: 28056 {handle_includedir} Reading included configuration file:
/etc/xinetd.d/chargen-tcp [file=/etc/xinetd.conf] [line=17]
04/9/28@14:36:12: DEBUG: 28056 {handle_includedir} Reading included configuration file:
/etc/xinetd.d/chargen-udp [file=/etc/xinetd.d/chargen-udp] [line=13]
04/9/28@14:36:12: DEBUG: 28056 {handle_includedir} Reading included configuration file:
/etc/xinetd.d/cups-lpd [file=/etc/xinetd.d/cups-lpd] [line=14]
04/9/28@14:36:12: DEBUG: 28056 {handle_includedir} Reading included configuration file:
/etc/xinetd.d/daytime-tcp [file=/etc/xinetd.d/daytime-tcp] [line=13]
04/9/28@14:36:12: DEBUG: 28056 {handle_includedir} Reading included configuration file:
/etc/xinetd.d/daytime-udp [file=/etc/xinetd.d/daytime-udp] [line=13]
04/9/28@14:36:12: DEBUG: 28056 {handle_includedir} Reading included configuration file:
/etc/xinetd.d/echo-tcp [file=/etc/xinetd.d/echo-tcp] [line=14]
04/9/28@14:36:12: DEBUG: 28056 {handle_includedir} Reading included configuration file:
/etc/xinetd.d/echo-udp [file=/etc/xinetd.d/echo-udp] [line=13]
04/9/28@14:36:12: DEBUG: 28056 {handle_includedir} Reading included configuration file:
/etc/xinetd.d/leafnode-nntp [file=/etc/xinetd.d/leafnode-nntp] [line=14]
04/9/28@14:36:12: DEBUG: 28056 {handle_includedir} Reading included configuration file:
/etc/xinetd.d/time-tcp [file=/etc/xinetd.d/time-tcp] [line=12]
04/9/28@14:36:12: DEBUG: 28056 {handle_includedir} Reading included configuration file:
/etc/xinetd.d/time-udp [file=/etc/xinetd.d/time-udp] [line=13]
04/9/28@14:36:12: DEBUG: 28056 {remove_disabled_services} removing chargen
04/9/28@14:36:12: DEBUG: 28056 {remove_disabled_services} removing chargen
04/9/28@14:36:12: DEBUG: 28056 {remove_disabled_services} removing printer
04/9/28@14:36:12: DEBUG: 28056 {remove_disabled_services} removing daytime
04/9/28@14:36:12: DEBUG: 28056 {remove_disabled_services} removing daytime
04/9/28@14:36:12: DEBUG: 28056 {remove_disabled_services} removing echo
04/9/28@14:36:12: DEBUG: 28056 {remove_disabled_services} removing echo
04/9/28@14:36:12: DEBUG: 28056 {remove_disabled_services} removing time
04/9/28@14:36:12: DEBUG: 28056 {remove_disabled_services} removing time
Service defaults
Instances = 60
CPS = max conn:25 wait:30
Bind = All addresses.
Only from: localhost(HOST)
No access: No blocked sites
Logging to syslog. Facility = authpriv, level = info
Log_on_success flags = HOST PID
Log_on_failure flags = HOST
Service configuration: nntp
id = nntp
flags = IPv4
socket_type = stream
Protocol (name,number) = (tcp,6)
port = 119
wait = no
user = 9
Groups = no
PER_SOURCE = -1
Bind = All addresses.
Server = /usr/sbin/leafnode
Server argv = leafnode
Only from: localhost(HOST)
No access: No blocked sites
Logging to syslog. Facility = authpriv, level = info
Log_on_success flags = HOST PID
Log_on_failure flags = HOST
04/9/28@14:36:12: DEBUG: 28056 {cnf_start_services} Started service: nntp
04/9/28@14:36:12: DEBUG: 28056 {cnf_start_services} mask_max = 6, services_started = 1
04/9/28@14:36:12: NOTICE: 28056 {main} xinetd Version 2.3.12 started with libwrap loada
vg options compiled in.
04/9/28@14:36:12: NOTICE: 28056 {main} Started working: 1 available service
04/9/28@14:36:12: DEBUG: 28056 {main_loop} active_services = 1
04/9/28@14:36:50: NOTICE: 28056 {general_handler} Unexpected signal 28 (Window changed)
04/9/28@14:36:50: DEBUG: 28056 {main_loop} active_services = 1
04/9/28@14:37:15: DEBUG: 28056 {main_loop} select returned 1
04/9/28@14:37:15: DEBUG: 28056 {server_start} Starting service nntp
04/9/28@14:37:15: DEBUG: 28056 {main_loop} active_services = 1
04/9/28@14:37:15: DEBUG: 28056 {main_loop} active_services = 1
04/9/28@14:37:15: DEBUG: 28056 {main_loop} select returned 1
04/9/28@14:37:15: DEBUG: 28056 {check_pipe} Got signal 17 (Child exited)
04/9/28@14:37:15: DEBUG: 28056 {child_exit} waitpid returned = 28069
04/9/28@14:37:15: DEBUG: 28056 {server_end} nntp server 28069 exited
04/9/28@14:37:15: INFO: 28056 {conn_free} freeing connection
04/9/28@14:37:15: DEBUG: 28056 {child_exit} waitpid returned = -1
04/9/28@14:37:15: DEBUG: 28056 {main_loop} active_services = 1
|
and with the config file its that...that i use the same as i used on my suse box and which worked pretty fine.... |
|
Back to top |
|
|
TNorthover Guru
Joined: 25 Jan 2004 Posts: 434 Location: Edinburgh, UK
|
Posted: Tue Sep 28, 2004 2:02 pm Post subject: |
|
|
I'm afraid I've only been able to dredge up one more simple suggestion: put "only_from = 0.0.0.0" in /etc/xinetd.d/leafnode-nntp. If this works, make sure you've got a firewall stopping any machine on the internet getting in, otherwise trouble could be caused.
After that, things get a little more complicated. First you could try "emerge xinetd", either with or without tcpd in the USE flags. I can't see this making much difference, but it could.
Then we get onto serious debugging, which is quite involved -- I'd suggest modifying xinetd to print more output. Basically, I'd post a patch here and instructions on compiling an xinetd with it in, and we'd see what that extra output gives (I think I'd post something to confirm absolutely that leafnode isn't involved first). I'm perfectly willing to proceed with this, but you may not be -- it involves trusting some random weirdo on the internet who you've never met not to be malicious. |
|
Back to top |
|
|
xsteadfastx Tux's lil' helper
Joined: 27 Sep 2004 Posts: 132 Location: germany/belgium
|
Posted: Tue Sep 28, 2004 4:09 pm Post subject: |
|
|
hi,
ok i need to say im really sorry. i took the computer home and put it here in the internet and now its working. it looks like leafnode needed to have to fetch enws for one time till it works complete...i did that and now it works...i was just so curious about that..i mean i thought a telnet would work no matter what...ok but now its working and i thank you a million times for all the time and help...thanks so much |
|
Back to top |
|
|
TNorthover Guru
Joined: 25 Jan 2004 Posts: 434 Location: Edinburgh, UK
|
Posted: Tue Sep 28, 2004 4:19 pm Post subject: |
|
|
That is definitely strange. Oh well, as long as it's working; and I'm sorry I didn't spot that. |
|
Back to top |
|
|
xsteadfastx Tux's lil' helper
Joined: 27 Sep 2004 Posts: 132 Location: germany/belgium
|
Posted: Tue Sep 28, 2004 4:23 pm Post subject: |
|
|
im the person who need to say sorry so...
but one last question....i user syslog-ng and leafnode writes all the output into /var/log/messages....is there a better resolution? |
|
Back to top |
|
|
TNorthover Guru
Joined: 25 Jan 2004 Posts: 434 Location: Edinburgh, UK
|
Posted: Tue Sep 28, 2004 5:08 pm Post subject: |
|
|
OK, that's a syslog-ng matter. I think (at least it works on mine...) that if you add these 3 lines to /etc/syslog-ng/syslog-ng.conf just above the two existing "log {..." lines, it should work:
Code: | destination leafnode_dest { file("/var/log/leafnode"); };
filter leafnode_filter { program("leafnode"); };
log { source(src); filter(leafnode_filter); destination(leafnode_dest); flags(final); };
|
If you want the messages to go to /var/log/messages as well, leave out the "flags(final);" part. |
|
Back to top |
|
|
xsteadfastx Tux's lil' helper
Joined: 27 Sep 2004 Posts: 132 Location: germany/belgium
|
Posted: Wed Sep 29, 2004 9:46 am Post subject: |
|
|
for you it was from the beginning that syslogd-ng writes the output in /var/log/message? i just wonder |
|
Back to top |
|
|
TNorthover Guru
Joined: 25 Jan 2004 Posts: 434 Location: Edinburgh, UK
|
Posted: Wed Sep 29, 2004 4:41 pm Post subject: |
|
|
I'm not quite sure what you mean. Is it that leafnode logs went to /var/log/messages on my computer as well? If so, then yes they did until I added those lines to syslog-ng.conf. |
|
Back to top |
|
|
xsteadfastx Tux's lil' helper
Joined: 27 Sep 2004 Posts: 132 Location: germany/belgium
|
Posted: Wed Sep 29, 2004 7:47 pm Post subject: |
|
|
yes thats what i meant ok thank you..i will try that thank you so much for all your help....i already love gentoo just cause the pretty good community |
|
Back to top |
|
|
|