Internet News
Total Page:16
File Type:pdf, Size:1020Kb
INN InterNet News Computer Center, CS, NCTU CS, Computer Center, Introduction to INN (1) Originally written by Rich Salz • ISC took over development in 1996 • http://www.isc.org/software/inn INN is a complete Usenet system • innd – NNTP server, main program, inbound receiver Exchange news articles with peers innfeed: outbound, feed articles to peers • nnrpd – NNTP reader server • Separate readers and peers For readers: readers.conf For peers: incoming.conf、innfeed.conf、newsfeeds • A lot of components… 2 Computer Center, CS, NCTU CS, Computer Center, Introduction to INN (2) 3 Computer Center, CS, NCTU CS, Computer Center, Introduction to INN (3) Main configuration • inn.conf Components • innd – main daemon for peers (and users) incoming.conf • innfeed – NNTP feeder innfeed.conf、newsfeeds • nnrpd – for users readers.conf • Newsgroups database active、active.times、newsgroups、history • Overview database buffindexed.conf、ovdb.conf、overview.fmt • Spool storage.conf、cycbuff.conf 4 Computer Center, CS, NCTU CS, Computer Center, Introduction to INN (4) Specific functions • Article and history expiration expire.ctl • Handling of control messages control.ctl • Submission addresses for moderated groups moderators • Cron jobs news.daily • Summery of INN log files innreports.conf • Others … 5 INN Installation Computer Center, CS, NCTU CS, Computer Center, Install INN (1) In FreeBSD ports • news/inn: INN 2.4.6 • 2009-06-08 - INN 2.4.6 was made EOL by the release of 2.5.0. • 2010-Mar-25 - INN v2.5.2 , ISC is pleased to announce a new bug fixed version of INN 2.5 How to install INN 2.5.2? • Tarball: ftp://ftp.isc.org/isc/inn/inn-2.5.2.tar.gz • Dependencies: “Requirements” in http://www.eyrie.org/~eagle/software/inn/ C compiler gcc: built-in Perl and MIME::Parser: lang/perl5.8+、mail/p5-MIME-Tools、graphics/p5-GD GNU make: devel/gmake GnuPG: security/gnupg Berkeley DB: databases/db47+ Yacc implementation: devel/bison 7 Computer Center, CS, NCTU CS, Computer Center, Install INN (2) http://www.eyrie.org/~eagle/software/inn/docs-2.5/checklist.html http://www.eyrie.org/~eagle/software/inn/docs-2.5/install.html Set up account „news‟ news:*:8:8::0:0:News Subsystem:/home/news:/bin/tcsh Set up the home directory for „news‟ • # mkdir –p /home/news && chown news:news /home/news • You *CANNOT* chown -R news:news after installing. Some bins are SUID root. Login as „news‟ • su - news / sudo -u news … • rlogin –l news localhost Enable rlogind via inetd, and set ~news/.rhosts – localhost username 8 Computer Center, CS, NCTU CS, Computer Center, Install INN (3) The source • Fetch the tarball and put it in /tmp by fetch or wget(ftp/wget) • Extract it: tar xzf inn-2.5.2.tar.gz Configure • ./configure --help --prefix=$HOME --with-http-dir=$HOME/public_html --enable-largefiles cannot be used with --enable-tagged-hash --enable-keywords --with-perl --with-berkeleydb=/usr/local • You can copy some environment variables from ports/news/inn make -n CONFIG_DONE_INN=1 /usr/ports/news/inn/work/.configure_done.inn._usr_local CC, CFLAGS, CXXFLAGS, LDFLAGS 9 Computer Center, CS, NCTU CS, Computer Center, Install INN (4) After configure Please check the following files before running make, to ensure that everything was set correctly. Makefile.global include/config.h include/inn/options.h include/inn/paths.h innfeed/innfeed.h Modify Makefile.global ## Berkeley DB support. If this support is configured, anything linking ## against libstorage also needs to link against DB_LDFLAGS and DB_LIBS. DB_CPPFLAGS = -I/usr/local/include/db47 DB_LDFLAGS = -L/usr/local/lib DB_LIBS = -ldb-4.7 –lz DBM_CPPFLAGS = -I/usr/local/include/db47 DBM_LIBS = -L/usr/local/lib -ldb-4.7 10 Computer Center, CS, NCTU CS, Computer Center, Install INN (5) Compile INN • $ gmake (make) Install INN • Login as „root‟ • # gmake (make) install To upgrade INN • # gmake (make) update upgrade binaries, scripts, and manual pages, but not config files Be sure to configure INN with the same options that was used previously. Finally • Create mail alias for usenet@ (which is defined in --with-news-master) • Set .tcshrc setenv PATH $HOME/bin:$PATH setenv MANPATH $HOME/share/man:`manpath` 11 Computer Center, CS, NCTU CS, Computer Center, Install INN (6) Set up syslog • In /etc/syslog.conf # uncomment these if you're running inn news.crit /var/log/news/news.crit news.err /var/log/news/news.err news.notice /var/log/news/news.notice $ cd ~/log && touch news.crit news.err news.notice # cd /var/log && ln –s ~news/log news # /etc/rc.d/syslogd reload Log rotate • Done by news.daily, which is triggered by cron 12 Computer Center, CS, NCTU CS, Computer Center, Install INN (7) Set up cron jobs • crontab for „news‟ • $ crontab –e news.daily 0 3 * * * ~news/bin/news.daily expireover lowmark • If you're using any non-CNFS storage methods, add delayrm to the above option list for news.daily. ~news/log/expire.rm expirerm file rnews 0 3 * * * ~news/bin/rnews -U • Processing spooled messages to the server again 13 Computer Center, CS, NCTU CS, Computer Center, Install INN (8) Copy start-up script from news/inn/files/innd.sh.in • Put it in /usr/local/etc/rc.d/innd • Modify „%%VAR%%‟s %%PREFIX%% ~news (/home/news、/usr/local/news、…) %%DBDIR$$ ~news/db %%NEWSBASE%% ~news • # chmod 555 /usr/local/etc/rc.d/innd Modify /etc/rc.conf innd_enable=“YES” A lot of configurations remain… 14 INN Databases ~news/db/ Computer Center, CS, NCTU CS, Computer Center, active (1) List the newsgroups carried by INN. • Maintained using ctlinnd or control messages • Edit it directly: active.times, overview database Format • Each newsgroup is listed only once • Each line specifies one newsgroup • Four fields separated by a space: <name> <high> <low> <status> cs.test 0000003681 0000000285 y • name: junk、control* • high is the highest article number ever seen • low is not guaranteed to be accurate, and should only be taken to be a hint. Normally updated nightly as part of the expire process • If the lowest article number is greater than the highest article number, then there are no articles in the newsgroup. 16 Computer Center, CS, NCTU CS, Computer Center, active (2) Format • status: y: allow posting and feeding m: moderated, all posting must be approved n: allow feeding only j: fed articles are filed in junk group x: disallow posting and feeding =foo.bar: articles are filed in the newsgroup foo.bar Get a close to complete newsgroups database file • ftp://ftp.isc.org/pub/usenet/CONFIG/ • active、newsgroups tw.bbs.* Big5 newsgroups for tw.bbs.* 17 Computer Center, CS, NCTU CS, Computer Center, active.times Provide a chronological record of when newsgroups were created on the local server Format • Three fields <name> <time> <creator> cs.test 1128713744 [email protected] • time: the time it was created, expressed as Unix timestamp date -r <time> • creator: plain text intended to describe the entity that created the newsgroup This field should be encoded in UTF-8 Usually the e-mail address of the creator 18 Computer Center, CS, NCTU CS, Computer Center, newsgroups Contain a list of newsgroups and its short description • It is not necessary that all the groups carried by the news server be listed in the newsgroups file • It is also not necessary that all the groups listed in the newsgroups file be carried by the news server If you use ctlinnd newgroup to manually create a group, only the active file is updated • edit newsgroups file to add a short description for the created group Format • Each line consists of two fields separated by at least one tab <name>\t<description> cs.computer-center [系計中公告] (Moderated) Preferred format: The total line length should be at most 79 columns. The description should start with a capital and not be more than 55 characters long using UTF-8 for non-ASCII characters in description is recommended 19 Computer Center, CS, NCTU CS, Computer Center, history (1) Keep a record of current and recently expired articles Format • [<Hash>]\t<date>\t<token> • [E7516D3A69051BC9712D093D52A4C67B] 1274105567~- ~1274105565 @0305414C543100000000000E92A20000025E@ • Each line corresponds to one article • Hash: ASCII representation of the hash of the Message-ID header • date: three sub-fields separated by a „~‟, each contains Unix timestamp 1st sub-field: arrival time of the article 2nd sub-field: „Expires:‟ header or „-‟ 3rd sub-field: „Date:‟ header, record of the posting time • token: a token of the article. This field is empty if the article has been expired Use sm utility to retrieve the article 20 Computer Center, CS, NCTU CS, Computer Center, history (2) grephistory • Query the INN history database via Message-ID • Output the token if the article is still on the news server • By use of sm to retrieve the article makehistory • Initialize or rebuild INN history database • Also can be used to rebuild the overview database makehistory –FOx Be sure to stop innd and delete or zero out the existing database 21 INN Configurations ~news/etc/ Computer Center, CS, NCTU CS, Computer Center, Article Storage Format The supported storage formats • tradspool Articles are stored as individual text files, named by the article number, and divided up into directories based on the newsgroups name article 12345 in cs.test would be stored as cs/test/12345 • timehash Articles are stored as individual text files, and divided into directories based on the arrival time. • timecaf Similar to timehash, but multiple articles are put in the same file • cnfs Articles