Header Ads

  • New Updates

    stunnel latest verstion installation in ubuntu




    To Installation

    $ sudo apt-get install stunnel4

    Then Enabling run stunnel at startup

    $ vi /etc/default/stunnel4
    Change

    ENABLED=0
    to
    ENABLED=1

    Otherwise, you will get below error,
    SSL tunnels disabled, see /etc/default/stunnel4

    Then Configure stunnel
    Copy default copy of configuration stunnel.conf from stunnel examples directory as below,

    $ sudo cp /usr/share/doc/stunnel4/examples/stunnel.conf-sample /etc/stunnel/stunnel.conf
    Create an open certificat to run stunnel
    Generate the certification with oppenssl
    $ sudo openssl req -new -out mail.pem -keyout mail.pem -nodes -x509 -days 365

    Type and fill all the question it ask and it will generates a certificate that is valid for 365 days.
    Then open and edit the config file stunnel.conf

    $ vim /etc/stunnel/stunnel.conf
    add the path where we create certificate mail.pem

    ; Certificate/key is needed in server mode and optional in client mode
    cert = /etc/stunnel/mail.pem
    ;key = /etc/stunnel/mail.pem

    then add below lines to setup for gmail.

    [gmail]
    accept=192.168.1.100:25
    connect=smtp.gmail.com:465

    save and write the file.(:wq!)

    stop and restart stunnel
    $ sudo /etc/init.d/stunnel4 stop
    $ sudo /etc/init.d/stunnel4 start
    Or
    $ sudo /etc/init.d/stunnel4 restart

    :)

    check service is working or not by below command

    service --status-all

    and check port is listening status

    sudo netstat -ntlp | grep LISTEN
    or
    nmap <IP address of stunnel machine>

    if nmap is not installed, install it by

    apt-get install nmap


    At last check the it is listening port 25 use telnet from same machine or any other machine

    telnet 127.0.0.1 25

    or from other system
    telnet 192.168.1.100 25

    If telnet client is not installed in ubuntu machine ,install by

    sudo apt-get install xinetd telnetd

    If telnet is getting responds from port 25, then connection is successful.

    If your getting "Could not open connection to the host, on port 25
    : Connect failed" message then need to reconfigure stunnel service again.

    :)



    No comments

    Post Top Ad

    Post Bottom Ad

    Ads