user-avatar
Today is Thursday
December 5, 2024

Category: linux

October 22, 2009

This blog is from Gscribble.

by viggy — Categories: linux, tech, ubuntu — Tags: Leave a comment

The initial version of gscribble looks great. Looking forward many more features added to it. I hope someday I will also contribute to it greatly.

June 22, 2009

how to extract different types of compressed files.

by viggy — Categories: linux, tech, ubuntu — Tags: , Leave a comment

This is a quick guide for different commands to decompress different types of files. Most of them can just be obtained from readin man page of tar command.

  • .tar.gz – command$: tar xvfz file.

June 12, 2009

how to add more than one homepage in firefox

by viggy — Categories: linux, tech, ubuntu — Tags: , , Leave a comment


It is very simple. Go to Edit->Preference. In the home page tab Enter the different links that you want to set as homepage with each seperated by “|” as shown in figure.

June 11, 2009

Accessing POP3 email accounts using telnet

by viggy — Categories: debian, linux, tech — Tags: , , Leave a comment
  • Coutsey to Bob Peers
  • The basics.

    About POP.

    POP is simply a protocol for retrieving emails from a remote server. The vast majority of mail
    providers use this protocol and it has been around for many years now. The protocol, in it’s
    simplest form, is just a few text commands sent from your computer over the internet which when received by the mail server prompt it to respond with the
    requested information. There’s only 4 or 5 basic commands we need to know to get started so it’s very simple.

    Before starting it’s important to know a few things:

    Mail server address.

    The address of your mail server, this will usually be of the form mail.domain.com. You should look at the settings in your email client or documentation about your
    email account to get this information.

    Security.

    In this demonstration we will be sending our account username and password unencrypted over the internet, if this is a major concern to you then you should not follow
    this exercise.

    Using telnet.

    If you make a mistake in a telnet session you cannot use backspace to delete the entry, you may have to press enter to get an error and then re-type the command or quit and start again.

    Connecting to the host.

    First open up a terminal and type the following, of course replacing mail.yourserver.dk with the address of your POP server:

    telnet mail.myserver.dk 110

    This should return something like:

    telnet mail.myserver.dk 110
    Trying 172.16.0.2...
    Connected to mail.myserver.dk (172.16.0.2).
    Escape character is '^]'.
    +OK Hello there.

    Logging in.

    Next we need to log in using the user command.

    user myusername
    +OK Password required.

    Now give our password using the pass command.

    pass ***********
    +OK logged in.

    The list command.

    To see a list of all the messages on the server and their sizes in bytes use the list command. If you specify a message number then only that message will be shown,
    i.e list 7.

    list
    +OK POP3 clients that break here, they violate STD53.
    1 22683
    2 19870
    3 785
    4 4475
    5 3221
    6 2972
    7 2412

    This just shows that I have 7 emails on the server, they are listed in order from oldest first to newest last.

    Reading the messages using retr.

    To read one of the messages use the retr command followed
    by the message number returned from the list command. It will return the whole message including all headers.

    retr 7
    +OK 2412 octets follow.
    Return-Path: <bounce@domain.com>
    X-Original-To: me@domain.dk
    Delivered-To: me@domain.dk
    Received: from mail-in1.inet.tele.dk (mail-in1.inet.tele.dk [194.182.148.158])
    by cirkeline.ingolf.dk (Postfix) with ESMTP id 554DA180D71
    for <me@domain.dk>; Wed, 1 Feb 2006 10:09:54 +0100 (CET)
    Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28])
    by mail-in1.inet.tele.dk (Postfix) with ESMTP id 2984C7049
    for <me@domain.dk>; Tue, 31 Jan 2006 18:37:01 +0100 (CET)
    Received: from frontend1.internal (mysql-sessions.internal [10.202.2.149])
    by frontend1.messagingengine.com (Postfix) with ESMTP id 2069DD335A7
    for <me@domain.dk>; Tue, 31 Jan 2006 12:36:18 -0500 (EST)
    Received: from web2.messagingengine.com ([10.202.2.211])
    by frontend1.internal (MEProxy); Tue, 31 Jan 2006 12:36:18 -0500
    Received: by web2.messagingengine.com (Postfix, from userid 99)
    id 1148513964; Tue, 31 Jan 2006 12:36:12 -0500 (EST)
    Content-Disposition: inline
    Content-Transfer-Encoding: 7bit
    Content-Type: text/plain
    MIME-Version: 1.0
    X-Mailer: MIME::Lite 5022 (F2.73; T1.15; A1.64; B3.05; Q3.03)
    Date: Tue, 31 Jan 2006 17:36:12 UT
    From: "Email Administrator" <bounce@domain.com>
    Reply-To: "Email Administrator" <webmaster@domain.com>
    To: me@domain.dk
    Subject: Your www.domain.com account activation
    Message-Id: <20060131173612.1148513964@web2.messagingengine.com>

    ..............................

    Reading the top n lines with top.

    The top command is used to read the top n lines of a message, the syntax is ‘top message n’ where n is the number of lines you wish to read. Note
    that the full headers will be returned along with a new line and then the n lines of the message body.

    top 3 5
    Headers appear here.....

    This is a multi-part message in MIME format.

    ------=_NextPart_000_0295_01C5A03F.3E4B4030
    Content-Type: text/plain;
    charset="iso-8859-1"

    The stat command.

    To see the total number and size of all messages issue the stat command.

    stat 
    +OK 7 56418

    Deleting messages using dele.

    To delete a message use dele followed by the message number, note that messages are not immediately deleted, they will only be deleted after quitting the session.

    dele 7
    +OK Deleted.

    The stat command again shows the message is gone.

    stat
    +OK 6 54006

    Resetting the account using rset.

    Since the message is only marked for deletion we can undelete the message (and any other marked for deletion) by using rset (for reset).

    rset
    +OK Resurrected.

    Again, stat shows the message is now back.

    stat
    +OK 7 56418

    To end the session use quit, this will now permanently delete the messages you deleted during this session.

    quit
    +OK Bye-bye.

    Summary

    It’s very simple to read your emails from a POP account using telnet by just remembering a few simple commands, what we have done here is basically exactly
    the same as an email client, like Thunderbird or Outlook Express, does when it retrieves your mail. Of course on a daily basis it’s much nicer to use a web interface
    or email client but in those situations where all you have is an internet connection then this is a great fall-back especially since nearly every computer will
    have telnet already installed.

    June 10, 2009

    How to add a man doc manually

    by viggy — Categories: linux — Tags: , Leave a comment

    you need to set the MANPATH variable to be able to access man pages which are not present in standard path. If for temporary purpose, you can just export MANPATH by the following command.
    $export MANPATH=$MANPATH:/the/path/of/the/man/page/

    Dont keep any space on either sides of “=” as it gives error as
    “bash: export: `=’: not a valid identifier”.

    To add permanently, you need to make changes in /etc/login.defs file. I am looking into it and will update this post as soon as i come to know of it

    June 8, 2009

    The qmail newbie’s guide to relaying

    by viggy — Categories: debian, linux, tech — Tags: , Leave a comment
  • Courtsey to Chris Johnson

  • Answer to ::

    ‘Sorry, that domain isn’t in my list of allowed rcpthosts’

    What exactly is relaying, anyway?

    You’ve set up your qmail server. It’s hosting a few domains (i.e. they’re listed in your locals file or your virtualdomains file). You’ve set things up so that qmail-smtpd can take connections on port 25 to receive mail from other hosts.

    Another host on the Internet connects to your server on port 25. This might be another mail server running qmail, sendmail, or some other mail transfer agent, or it might be an end user, who wants to send mail from his desktop mail client. The SMTP conversation starts off with the remote host identifying itself:

        HELO somehost.somewhere.net

    Your server responds:

        250 mail.yourdomain.net

    The remote host sends the “From” part of the envelope:

        MAIL FROM:

    Your host responds with:

        250 ok

    The remote host now sends one or more RCPT TO commands, which specify the recipients of the message:

        RCPT TO:

    Just a minute! elsewhere.com is not one of the domains that your server hosts. What does your server do? It can agree to accept the message and attempt to deliver it:

        250 ok

    Or it can reject it:

        553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)

    In the first case, your server is acting as a relay: it’s accepting and agreeing to try to deliver a message that’s not destined for a domain that your server hosts. In the second case, it’s refusing to act as a relay.

    qmail’s rcpthosts file, which gets its name from the RCPT TO command, determines whether the recipient will be accepted: it will be accepted if and only if the domain of the address given in the RCPT TO command is listed in rcpthosts. (I’ll talk about exceptions to this rule later on.) If the rcpthosts file does not exist, then any recipient will be accepted.

    An SMTP server is an “open relay” if it agrees to relay mail no matter who’s sending it–if another host connects to port 25 with some mail, an open relay will accept and try to deliver it no matter what its destination is and no matter who is sending it. A qmail server without a rcpthosts file will act as an open relay.

    So why shouldn’t I have an open relay? My customers need to send mail to other domains. And why would anyone but my customers want to use my server as a relay, anyway?

    This was a safe attitude several years ago; people generally used the relay provided by their ISP, employer, or university.

    Then came the spammers, the mass-mailers of unsolicited commercial e-mail. Rather than use their own bandwidth and server resources, they seek open relays that will accept a single message with, say, 100,000 recipients, and distribute it for them. This consumes the bandwidth and server resources of an unwitting third party, and the administrators of the relaying server will likely be flooded with complaints from the spam’s recipients. The relaying server may even find itself blacklisted, so that other hosts on the Internet will refuse to receive mail from it (see http://www.ordb.org, for example). Leaving your mail relay open these days is considered to be irresponsible.

    I’m convinced–I don’t want to have an open relay. How do I fix it?

    Simply list in your rcpthosts file all the domains that your server is hosting (and for which it’s acting as secondary mail exchanger, if any). Now you’re safe.

    But now my own customers get the message “Sorry, that domain isn’t in my list of allowed rcpthosts.” I’d like for my own customers to be able to use my server as a relay, but I can’t possibly list every domain in my rcpthosts file to which they might want to send mail.

    Nor should you try to! Fortunately, there’s a way to get qmail-smtpd selectively to ignore the rcpthosts file. If the variable RELAYCLIENT is set in qmail-smtpd’s environment, rcpthosts will be ignored and relaying will be allowed. What you need is a way to set RELAYCLIENT for your customers, but not for anyone else. (I’ll refer to your users as “customers” here; substitute “employees,” “students at my university,” or whatever is appropriate in your case.)

    First, you need a way to identify them. There’s no sort of user name/password authentication in the SMTP protocol, so how do you identify whether a particular SMTP connection is from one of your customers? The surest way to distinguish a customer of yours from the rest of the world is by the fact that he’s connecting to your server from a host on your network, i.e. a host with an IP address that’s in your address space.

    Once you know he’s connecting from one of your IP addresses, you need a way to set RELAYCLIENT so that he can relay. It’s pretty easy to set up qmail to do this. Read about selective relaying with tcpserver and qmail-smtpd to find out how.

    Most of my customers aren’t on my network–they use various ISPs. Can’t I allow relaying if the mail is coming from one of my domains?

    The way most people define “coming from one of my domains” is “has one of my domains in the sender address.” The problem with this is that forging the sender address on a piece of mail is trivial, and you’d have to take the word of the sender that his address is what he says it is. There’s clearly no security with this method.

    Then how are they supposed to relay their mail?

    The best thing for them to do is to use the SMTP servers provided by their ISPs. There’s (usually) no reason that they should have to use your server to relay their mail; any server that’ll agree to relay their mail will work, and ISPs’ servers are there to relay their customers’ mail.

    Unfortunately, I’ve heard reports of a very small number of ISPs that require not only that the sending host be connected to the ISP’s network, but also that the sender use the address provided by his ISP as his envelope sender address. I’ve never seen a non-Unix mail client that allows one to specify an envelope sender address that’s different from the address that appears in the “From” header, so if your customer wants to relay mail through his ISP’s SMTP server (and he has one of these envelope-checking ISPs) he won’t be able to show in his “From” header the address that you’ve provided him–all his mail will have to appear to come from his ISP address.

    So if my customer has one of these idiot ISPs and wants his mail to show an address with my domain, what is he to do?

    There are some partial solutions to this problem; I don’t think any of them is ideal. Probably the best is “SMTP-after-POP”: you allow a particular IP address to relay through your server for a short period of time after a host at that address authenticates via POP. There are various implementations of SMTP-after-POP; one which doesn’t require any patching is Bruce Guenter’s relay-ctrl. The only problem with this approach is that at least some popular Windows mail clients are hard-wired to send any queued mail before checking mail. Your users will have to get into the habit of checking their mail before putting anything in their outboxes.

    Another possible solution that people have recommended is running a separate instance of qmail-smtpd on a different IP address and a non-standard port, and telling your users to configure their mail clients to use it for their outgoing mail. One problem with this is that some mail clients don’t allow you to set a non-standard SMTP port. Another problem is that it offers no real security, only “security through obscurity.” You can make it somewhat safer, however, with tarpitting. This will help prevent it from being abused if it is discovered.

    There are patches to qmail-smtpd that allow it to use SMTP AUTH, an extension to SMTP that implements user/password authentication for relaying. If your clients support SMTP AUTH, this is an excellent way to allow relaying to selected users who are not on your network. See the qmail web site for more information. <!—

    I think I’ve got everything set up correctly. How can I test my server to make sure it’s not an open relay?

    Try the relay tester at http://www.fabel.dk/relay/test/. Unlike many relay testers, this one requires that its probe message actually be relayed back to it in order for it to determine that you’re an open relay. Other testers may flag you as an open relay if you simply accept a probe, whether or not you ultimately relay it.

    Questions? Comments? I’m glad to hear them.

    —>

    Chris Johnson
    dcj-qmaildoc@palomine.net