Rate This Document
Findability
Accuracy
Completeness
Readability

Configuring Cntlm

If a proxy is required for the server to access the Internet, configure Cntlm.

  1. Obtain the Cntlm installation package.
    1. Download the Cntlm installation package using a local browser.

      Download address: https://sourceforge.net/projects/cntlm/files/cntlm/cntlm%200.92.3/cntlm-0.92.3.tar.gz

    2. Upload the downloaded installation package to the server using a tool, such as FTP.

      If the server is connected to the Internet, you can run the wget command on the server to download the binary package.

      1
      2
      cd /home
      wget https://sourceforge.net/projects/cntlm/files/cntlm/cntlm%200.92.3/cntlm-0.92.3.tar.gz --no-check-certificate
      
  2. Decompress installation package.
    1
    tar -xvzf cntlm-0.92.3.tar.gz
    
  3. Go to the source code directory.
    1
    cd /home/cntlm-0.92.3/
    
  4. Configure Cntlm.
    1
    ./configure
    
  5. Compile Cntlm.
    1
    make SYSCONFDIR=/opt/cntlm/etc BINDIR=/opt/cntlm/bin MANDIR=/opt/cntlm/share/man
    
  6. Install Cntlm.
    1
    make install SYSCONFDIR=/opt/cntlm/etc BINDIR=/opt/cntlm/bin MANDIR=/opt/cntlm/share/man
    

    In the preceding command, BINDIR is the startup directory of the Cntlm, /opt/cntlm/etc is the configuration file directory of the Cntlm, and /opt/cntlm/share/man is the help directory of the Cntlm.

  7. Configure the cntlm.conf file.
    1. Open the cntlm.conf file.
      1
      vim /opt/cntlm/etc/cntlm.conf
      
    2. Press i to enter the insert mode and modify the following content in the file:
      Username        Domain account name
      Domain          Domain name
      Password
      
      Proxy           Proxy IP address:Proxy port
      
      Listen          3128
      Auth            NTLM
      PassNT          8FD92A7361BB9EE381B9513410D70495
      PassLM          04DFBB7DB511E0C448A1F372896AB5AF

      Table 1 describes the parameters.

      Table 1 Parameters in cntlm.conf

      Item

      Description

      Example Value

      Username

      Domain account name. Set this parameter based on the actual environment.

      Enter the domain account name based on the actual environment.

      Domain

      Domain

      Enter the domain name based on the actual environment.

      Password

      Domain password. You are advised to leave this parameter blank.

      -

      Proxy

      Proxy address and port number of the company

      Enter the proxy IP address and port number based on site requirements.

      NoProxy

      Configure the IP addresses without proxy, including the network segment of the IP address of the current server.

      localhost, 127.0.0.*, 10.*, 192.168.*, 90.*

      Listen

      Listening port number. The default value is 3128.

      3128

      Authentication configuration

      -

      Auth NTLM

      PassNT 8FD92A7361BB9EE381B9513410D70495

      PassLM 04DFBB7DB511E0C448A1F372896AB5AF

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  8. Start Cntlm.
    1
    /opt/cntlm/bin/cntlm -c /opt/cntlm/etc/cntlm.conf
    

    The command for restarting the server is invalid after the server is restarted. You can add the command to the system startup items to enable Cntlm to automatically start with the server.

    1
    echo "/opt/cntlm/bin/cntlm -c /opt/cntlm/etc/cntlm.conf" >> /etc/rc.local
    
  9. Check whether Cntlm is started.
    If the Cntlm process is displayed in the command output, Cntlm is started.
    1
    ps -ef |grep cntlm
    

  10. Set the environment variables.
    1. Open the /etc/profile file.
      1
      vim /etc/profile
      
    2. Press i to enter the insert mode and add the following content to the file:
      export http_proxy="http://127.0.0.1:3128"
      export https_proxy=$http_proxy
      export JAVA_OPTS="-Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3128"
      export MAVEN_OPTS="-Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3128"
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
    4. Make the environment variables take effect.
      1
      source /etc/profile
      
  11. Verify Cntlm.

    Run the curl command to obtain the web page content. If the web page content is successfully obtained, Cntlm is successfully installed.

    1
    curl www.baidu.com