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 an SFTP tool.

      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 the Cntlm installation package.
    1
    tar -xvzf cntlm-0.92.3.tar.gz
    
  3. Go to the Cntlm 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 Cntlm startup directory, /opt/cntlm/etc is the directory of the Cntlm configuration file, and /opt/cntlm/share/man is the directory of the Cntlm help guide.

  7. Configure the cntlm.conf file.
    1. Open the file.
      1
      vim /opt/cntlm/etc/cntlm.conf
      
    2. Press i to enter the insert mode and modify the following content in the file. Set the parameters based on actual requirements.
      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

      Parameter

      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 the actual environment.

      NoProxy

      Configures the IP addresses without a proxy, including the IP address segment 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
    

    If the command for restarting the server is invalid, you can add Cntlm 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.
    1
    ps -ef |grep cntlm
    

    If the Cntlm process is displayed in the command output, Cntlm is started.

  10. Configure 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 access any website. If the website information is displayed, the proxy is successfully configured and the Internet is connected, indicating that the installation is successful.