cntlm on systemd

cntlm.services:

[Unit]
Description=cntlm service
After=syslog.target network.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/cntlm.sh

[Install]
WantedBy=multi-user.target

cntlm.sh

#! /bin/bash
# script used by d$hhhhh.service

/usr/sbin/cntlm -c /etc/cntlm.conf

/etc/profile.d/cntlm.sh

export http_proxy=localhost:3128

export https_proxy=$http_proxy

export ftp_proxy=$http_proxy

cntlm in linux

After installing cntlm in linux and configure it properly, you need to specify http_proxy environment variables in order to use it in command line. To make these environment variables accessible to all users, create a file cntlm_proxy.sh in /etc/profile.d. Any .sh files in this folder will be sourced by /etc/profile. The content of the file is as follows:

export http_proxy=127.0.0.1:3128

export ftp_proxy=$http_proxy

export https_proxy=$http_proxy

(if you need to set these environment variable for all users, you can put them in /etc/bashrc)

To start cntlm, run: /usr/sbin/cntlm -c /etc/cntlm.conf

If you use yum in CentOS, you need to update /etc/yum.conf to add the proxy server information:

ex. proxy=http://localhost:3128