MEWBIES@:  Facebook  Twitter  G+  YouTube  DeviantArt  Forum  Wall
 SHARE:
    ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
   ██                                                                       ██
  █▌                    -   DELEGATE - PROXY SERVER   -                      █▌
 █▌                                                                           █▌
 █                                                                            ▐▌
 █ DeleGate's site is HERE. It comes with instructions; INSTALL, that are     ▐▌
 █ HERE. It has a tutorial HERE. Delegate help mailing list/open forum in     ▐▌
 █ English to feedback@delegate.org which will then be posted HERE, more      ▐▌
 █ information HERE. This is what I did:                                      ▐▌
 █                                                                            ▐▌
 █ INSTALL:                                                                   ▐▌
 █ ````````                                                                   ▐▌
 █ Check for latest stable here: http://www.delegate.org/delegate/download/   ▐▌
 █ *You must enter an email address to access it:                             ▐▌
 █ wget ftp://ftp:none%40none%2Ecom@ftp.delegate.org/pub/DeleGate/delegate9.9.3.tar.gzgzip -d < delegate9.9.3.tar.gz | tar xfv -                                 ▐▌
 █ cd delegate9.9.3                                                           ▐▌
 █ sudo su                                                                    ▐▌
 █ make                                                                       ▐▌
 █ When prompted for email address enter yours                                ▐▌
 █ When prompted to continue enter: Y                                         ▐▌
 █ It took a few minutes and a 'VERY' long reply with a lot of these types of ▐▌
 █ warnings:                                                                  ▐▌
 █ warning: deprecated conversion from string constant to char*               ▐▌
 █ for: syslog.c:90: , yshell.c:255: , dgsign.c:1229: , inets.c:36: ,         ▐▌
 █ http.c:4844: , httpd.c:243: , htccx.c:775: , nntpgw.c:2969: , ftp.c:7507:  ▐▌
 █ , _builtin.c:6378:                                                         ▐▌
 █ and                                                                        ▐▌
 █ inets.c:188: warning: non-local variable <anonymous struct> resolv_errmsg  ▐▌
 █ uses anonymous type                                                        ▐▌
 █                                                                            ▐▌
 █ When it was done at the end the reply will look similar to:                ▐▌
 █ make[2]: Leaving directory `/home/user/delegate9.9.3/src'                  ▐▌
 █ make[1]: Leaving directory `/home/user/delegate9.9.3/src'                  ▐▌
 █ "src/dg.exe" "-Fsrcmd5" -f srcfiles -type f                                ▐▌
 █ source MD5 = 9ed558e2141fbcc9149e0987d15be3ca                              ▐▌
 █ *** OK, this is the original source from DeleGate.ORG                      ▐▌
 █ "src/dg.exe" "-Fcksum" -x -c -f srcfiles                                   ▐▌
 █ Total-file-line-byte-csum: 485 2510 67294 1DF706D0 123.456.789             ▐▌
 █ ================                                                           ▐▌
 █ sh make-fin.sh                                                             ▐▌
 █ user@****:/home/user/delegate9.9.3#                                        ▐▌
 █                                                                            ▐▌
 █ exit                                                                       ▐▌
 █                                                                            ▐▌
 █ START DELEGATE:                                                            ▐▌
 █ ```````````````                                                            ▐▌
 █ Start a http proxy on port 2121 - you can use any free port above 1024     ▐▌
 █ (1024 and below requires superuser):                                       ▐▌
 █ ~/delegate9.9.3/src/delegated -P2121 SERVER=http                           ▐▌
 █ If you get an error such as:                                               ▐▌
 █ -delegated[12694]- DeleGate: cannot open server port :2121                 ▐▌
 █ -delegated[12694]- DeleGate: use -r option to restart                      ▐▌
 █ It's most likely because that port isn't free. To check do this:           ▐▌
 █ su                                                                         ▐▌
 █ netstat -tulpn | grep :2121                                                ▐▌
 █ If no reply; than that port is free. If it is being used reply will look   ▐▌
 █ similar to:                                                                ▐▌
 █ tcp6       0      0 :::2121        :::*            LISTEN     1970/java    ▐▌
 █ To view all active Internet connections:                                   ▐▌
 █ netstat -antp                                                              ▐▌
 █ exit                                                                       ▐▌
 █                                                                            ▐▌
 █ EXAMPLES:                                                                  ▐▌
 █ `````````                                                                  ▐▌
 █ FTP proxy:                                                                 ▐▌
 █ delegated -P8021 SERVER=ftp                                                ▐▌
 █ POP3 proxy:                                                                ▐▌
 █ delegated -P8110 SERVER=pop                                                ▐▌
 █ SMTP server:                                                               ▐▌
 █ delegated -P25 SERVER=smtp                                                 ▐▌
 █ Telnet proxy:                                                              ▐▌
 █ delegated -P8023 SERVER=telnet                                             ▐▌
 █ Socks5 proxy:                                                              ▐▌
 █ delegated -P8025 SERVER=socks5                                             ▐▌
 █                                                                            ▐▌
 █ CONFIGURATION FILES:                                                       ▐▌
 █ ````````````````````                                                       ▐▌
 █ Now at this point if you were to use that in, for example, your IE browser ▐▌
 █ you would get a webpage from your delegate proxy server saying             ▐▌
 █ denied...etc. So lets make a permission file to run with the cmd.          ▐▌
 █ Stop delegate first if you have it running:                                ▐▌
 █ ~/delegate9.9.3/src/delegated -P2121 -Fkill                                ▐▌
 █ cd ~/delegate/etc/                                                         ▐▌
 █ pico http (this file doesn't exist yet, call it anything you like)         ▐▌
 █ Paste this in replacing 'name:pass' with your own name and pass that you   ▐▌
 █ would like to use- (keep it easy to remember as you'll have to type this   ▐▌
 █ in on prompts if you don't save it in your browser):                       ▐▌
 █ SERVER=http                                                                ▐▌
 █ AUTHORIZER=-list{name:pass}                                                ▐▌
 █ PERMIT="*:*:*"                                                             ▐▌
 █ CACHE=do                                                                   ▐▌
 █                                                                            ▐▌
 █ Make another one for socks:                                                ▐▌
 █ pico socks5 (this file doesn't exist yet, call it anything you like)       ▐▌
 █ Paste this in replacing 'name:pass' with your own name and pass that you   ▐▌
 █ would like to use:                                                         ▐▌
 █ SERVER=socks5                                                              ▐▌
 █ AUTHORIZER=-list{name:pass}                                                ▐▌
 █ PERMIT="*:*:*"                                                             ▐▌
 █ CACHE=do                                                                   ▐▌
 █                                                                            ▐▌
 █ START DELEGATE WITH YOUR CONFIGURATIONS:                                   ▐▌
 █ ````````````````````````````````````````                                   ▐▌
 █ To start it now do the cmd with the file you made:                         ▐▌
 █ ~/delegate9.9.3/src/delegated -P2121 +=http                                ▐▌
 █ Or to watch it work in debug mode:                                         ▐▌
 █ ~/delegate9.9.3/src/delegated -P2121 -v +=http                             ▐▌
 █ To stop the proxy and debug mode press ctrl+c keys                         ▐▌
 █                                                                            ▐▌
 █ Start the socks in the same manner:                                        ▐▌
 █ ~/delegate9.9.3/src/delegated -P88025 +=socks5                             ▐▌
 █ Stop it in the same manner as stopping the http:                           ▐▌
 █ ~/delegate9.9.3/src/delegated -P88025 -Fkill                               ▐▌
 █                                                                            ▐▌
 █ AUTOSTART DELEGATE:                                                        ▐▌
 █ ```````````````````                                                        ▐▌
 █ If you want your delegate to run automatically even after reboot it's      ▐▌
 █ simple- just a few steps are involved. We will make a 'bash script' and    ▐▌
 █ 'crontab' it:                                                              ▐▌
 █                                                                            ▐▌
 █ LOCATION OF BASH:                                                          ▐▌
 █ First find the location of your bash:                                      ▐▌
 █ which bash                                                                 ▐▌
 █ My reply is: /bin/bash so that will be the path in the top line of the the ▐▌
 █ bash script.                                                               ▐▌
 █                                                                            ▐▌
 █ UNIQUE PROCESS NAME:                                                       ▐▌
 █ Then to find something unique in delegate's process name - something that  ▐▌
 █ isn't in your other processes. This will show your current running         ▐▌
 █ processes:                                                                 ▐▌
 █ ps x                                                                       ▐▌
 █ For example reply might be:                                                ▐▌
 █   PID TTY      STAT   TIME COMMAND                                         ▐▌
 █  2052 ?        Sl    17:41 ./eggdrop Bot1.conf                             ▐▌
 █ 18526 ?        Sl     0:14 ./eggdrop Bot2.conf                             ▐▌
 █ 19383 ?        Ss     0:00 hts -p /var/run/hts.pid -F 74.125.45.100:22 74.125.45.100:8383
 █ 21551 ?        Ss     0:00 ~/delegate9.9.3/src/delegated -{000}[RPM=0.00(0.0 0.0 0.0),IDLE=29764s]-P8025 --
 █ 21552 ?        Ss     0:00 ~/delegate9.9.3/src/delegated -{000}[RPM=0.00(0.0 0.0 0.0),IDLE=29764s]-P2121 --
 █ 24395 ?        R      0:00 sshd: user@pts/3                                ▐▌
 █ 24396 pts/3    Rs     0:00 -bash                                           ▐▌
 █ 24419 pts/3    R+     0:00 ps x                                            ▐▌
 █                                                                            ▐▌
 █ If I was going to run only one instance of delegate I would choose the     ▐▌
 █ word 'delegated'. But since I'm running two instances of delegate, http    ▐▌
 █ and socks5, I'll choose the words 'P2121' and 'P8025'.                     ▐▌
 █                                                                            ▐▌
 █ CREATE BASH SCRIPT:                                                        ▐▌
 █ OK Lets create a bash script for each, using our key words for 'SERVICE':  ▐▌
 █ cd ~                                                                       ▐▌
 █ Create the file naming it anything you like by doing this:                 ▐▌
 █ pico delegatehttp.sh                                                       ▐▌
 █ paste in- changing all to your correct path- replace user with your path   ▐▌
 █ name:                                                                      ▐▌
#!/bin/bash
SERVICE="P2121"
RUNIT="/home/user/delegate9.9.3/src/delegated -P2121 +=http"
if /bin/ps ax | /bin/grep -v /bin/grep | /bin/grep $SERVICE > /dev/null
then
    echo "$SERVICE service running, everything is fine"

else

$RUNIT

fi
exit
 █                                                                            ▐▌
 █ Now set the perms on your new file:                                        ▐▌
 █ chmod 744 delegatehttp.sh                                                  ▐▌
 █                                                                            ▐▌
 █ Kill delegate if it's running:                                             ▐▌
 █ ~/delegate9.9.3/src/delegated -P2121 -Fkill                                ▐▌
 █ Test the bash script it works correctly:                                   ▐▌
 █ ./delegatehttp.sh                                                          ▐▌
 █                                                                            ▐▌
 █ CRONTAB BASH SCRIPT:                                                       ▐▌
 █ If all went well kill it again so we can test crontab:                     ▐▌
 █ ~/delegate9.9.3/src/delegated -P2121 -Fkill                                ▐▌
 █ This will make crontab run the *delegatehttp.sh every 10 minutes. Where    ▐▌
 █ ever you pico/created your bash script is its path- you need to have the   ▐▌
 █ correct full path. Create a crontab:                                       ▐▌
 █ crontab -e                                                                 ▐▌
 █ Paste in, below the other crontab jobs if there are any:                   ▐▌
 █ 0,10,20,30,40,50 * * * * /home/user/delegatehttp.sh >/dev/null 2>&1        ▐▌
 █                                                                            ▐▌
 █ It will reply: crontab: installing new crontab                             ▐▌
 █ Wait 10 minutes and then see if it's running:                              ▐▌
 █ ps x                                                                       ▐▌
 █ If it is, in the reply you'll see similar to:                              ▐▌
 █ ~/delegate9.9.3/src/delegated -{000}[RPM=0.00(0.0 0.00.0),IDLE=29764s]-P2121 --
 █                                                                            ▐▌
 █ To list all your crontab jobs: crontab -l                                  ▐▌
 █ To remove 'all' your crontab jobs: crontab -r                              ▐▌
 █ To remove only certain jobs of course do: crontab -e                       ▐▌
 █ then remove them.                                                          ▐▌
 █                                                                            ▐▌
 █ MORE THAN ONE INSTANCE OF DELEGATE TO AUTO RUN:                            ▐▌
 █ If you are running more than one instance of delegate then repeat the      ▐▌
 █ steps above 'CREATE BASH SCRIPT' and 'CRONTAB BASH SCRIPT' changing the    ▐▌
 █ names and paths accordingly. For example a bash script to run the socks5:  ▐▌
 █ cd ~                                                                       ▐▌
 █ pico delegatesocks5.sh  (this file doesn't exist yet, call it anything.sh  ▐▌
 █ you like)                                                                  ▐▌
 █ paste in (changing all to your correct path- replace user with your path   ▐▌
 █ name):                                                                     ▐▌
#!/bin/bash
SERVICE="P8025"
RUNIT="/home/user/delegate9.9.3/src/delegated -P8025 +=socks5"
if /bin/ps ax | /bin/grep -v /bin/grep | /bin/grep $SERVICE > /dev/null
then
    echo "$SERVICE service running, everything is fine"

else

$RUNIT

fi
exit
 █                                                                            ▐▌
 █ Now set the perms on your new file:                                        ▐▌
 █ chmod 744 delegatesocks5.sh                                                ▐▌
 █                                                                            ▐▌
 █ Kill delegate if it's running:                                             ▐▌
 █ ~/delegate9.9.3/src/delegated -P8025 -Fkill                                ▐▌
 █ Test the bash script it works correctly:                                   ▐▌
 █ ./delegatesocks5.sh                                                        ▐▌
 █ Kill it again so we can test crontab working:                              ▐▌
 █ ~/delegate9.9.3/src/delegated -P8025 -Fkill                                ▐▌
 █                                                                            ▐▌
 █ Create a crontab for it:                                                   ▐▌
 █ crontab -e                                                                 ▐▌
 █ Paste in, below the other crontab jobs if there are any:                   ▐▌
 █ 0,10,20,30,40,50 * * * * /home/user/delegatesocks5.sh >/dev/null 2>&1      ▐▌
 █ Wait 10 minutes and then see if it's running:                              ▐▌
 █ ps x                                                                       ▐▌
 █                                                                            ▐▌
 █ Done :)                                                                    ▐▌
 █                                                                            ▐▌
 █ Btw there is an easy bash script tutorial HERE and crontab HERE explaining ▐▌
 █ different times you can set.                                               ▐▌
 █                                                                            ▐▌
 █ DELEGATE LOGS:                                                             ▐▌
 █ ``````````````                                                             ▐▌
 █ To disable logging of the proxies we created and use 'logrotate' for the   ▐▌
 █ other logs- delegate's, follow below, adjusting to your own preferences.   ▐▌
 █ The logs are here:                                                         ▐▌
 █ ls -al ~/delegate/log/                                                     ▐▌
 █ If you used the configurations above for the proxies you'll most likely    ▐▌
 █ have these files after using the proxies:                                  ▐▌
 █ 0                                                                          ▐▌
 █ 0.ftp                                                                      ▐▌
 █ 0.http                                                                     ▐▌
 █ 2025                                                                       ▐▌
 █ 2025.ftp                                                                   ▐▌
 █ 2025.http                                                                  ▐▌
 █ 2121                                                                       ▐▌
 █ 2121.ftp                                                                   ▐▌
 █ 2121.http                                                                  ▐▌
 █ errors.log                                                                 ▐▌
 █ stdout.log                                                                 ▐▌
 █                                                                            ▐▌
 █ To view a log, for example:                                                ▐▌
 █ tail -20 ~/delegate/log/errors.log                                         ▐▌
 █ tail -20 ~/delegate/log/2121.http                                          ▐▌
 █                                                                            ▐▌
 █ To disable the logging actions of the http proxy:                          ▐▌
 █ pico /home/mewbie/delegate/etc/http                                        ▐▌
 █ Add this:                                                                  ▐▌
 █ LOGFILE=""                                                                 ▐▌
 █ PROTOLOG=""                                                                ▐▌
 █                                                                            ▐▌
 █ Kill the proxy:                                                            ▐▌
 █ ~/delegate9.9.3/src/delegated -P2121 -Fkill                                ▐▌
 █ Then restart it:                                                           ▐▌
 █ ~/delegate9.9.3/src/delegated -P2121 +=http                                ▐▌
 █                                                                            ▐▌
 █ Do the same thing for your socks5 file:                                    ▐▌
 █ pico /home/mewbie/delegate/etc/socks5                                      ▐▌
 █ Add this:                                                                  ▐▌
 █ PROTOLOG=""                                                                ▐▌
 █ LOGFILE=""                                                                 ▐▌
 █                                                                            ▐▌
 █ Kill and restart the proxy:                                                ▐▌
 █ ~/delegate9.9.3/src/delegated -P2025 -Fkill                                ▐▌
 █ ~/delegate9.9.3/src/delegated -P2025 +=socks5                              ▐▌
 █                                                                            ▐▌
 █ Remove the proxy logs that you have disabled:                              ▐▌
 █ rm ~/delegate/log/2025*                                                    ▐▌
 █ rm ~/delegate/log/*tp                                                      ▐▌
 █ rm ~/delegate/log/2121                                                     ▐▌
 █ ls -al ~/delegate/log/                                                     ▐▌
 █                                                                            ▐▌
 █ Now to use 'logrotate' on the other logs.                                  ▐▌
 █ man logrotate                                                              ▐▌
 █ Or you can view it HERE.                                                   ▐▌
 █ First you'll need to know the perms, owner and group of the logs you want  ▐▌
 █ to rotate so that when logrotate creates a fresh log it will be the same   ▐▌
 █ as you have:                                                               ▐▌
 █ ls -al ~/delegate/log/                                                     ▐▌
 █ Example output:                                                            ▐▌
 █ -rw-r--r-- 1 mewbie mewbie 113299 2010-05-17 02:18 errors.log              ▐▌
 █ The perms are -rw-r--r-- which is 644.                                     ▐▌
 █ The owner is mewbie, the group is mewbie.                                  ▐▌
 █                                                                            ▐▌
 █ su                                                                         ▐▌
 █ Create a directives file for logrotate:                                    ▐▌
 █ pico /etc/logrotate.d/delegate                                             ▐▌
 █ Paste in, changing the path to the correct path, the logs you want to      ▐▌
 █ rotate, and user user to the correct owner group:                          ▐▌
/home/user/delegate/log/*.log /home/user/delegate/log/0 {
        weekly
        missingok
        rotate 5
        delaycompress
        notifempty
        create 644 user user
}

 █ This will rotate the log weekly, leaving 5 backups.                        ▐▌
 █ For myself this is what I have:                                            ▐▌

/home/mewbie/delegate/log/*.log /home/mewbie/delegate/log/0 {
        daily
        missingok
        rotate 1
        nocompress
        delaycompress
        create 640 mewbie mewbie
}

 █ The differences are that my logs will rotate daily, leaving only 1 backup  ▐▌
 █ log with no compressed. It will rotate the logs even if it is 0 bytes, and ▐▌
 █ will recreate the file chmod 640 as I don't want it to be world readable.  ▐▌
 █ The reason I have it rotate even if it is 0 bytes is that if there are no  ▐▌
 █ log changes for extended periods the old data will remain until there is   ▐▌
 █ new data to rotate it.                                                     ▐▌
 █                                                                            ▐▌
 █ To test changes, but NOT actually rotate your logs:                        ▐▌
 █ logrotate --debug --force /etc/logrotate.d/delegate                        ▐▌
 █                                                                            ▐▌
 █ To rotate the logs manually:                                               ▐▌
 █ logrotate --force -v /etc/logrotate.d/delegate                             ▐▌
 █                                                                            ▐▌
 █ ls -al /home/mewbie/delegate/log/                                          ▐▌
 █ exit                                                                       ▐▌
 █                                                                            ▐▌
 █ DELEGATE CACHE:                                                            ▐▌
 █ ```````````````                                                            ▐▌
 █ ls -al ~/delegate/cache/http                                               ▐▌
 █ Settings for the validity of the cache, read HERE, and to have old cache   ▐▌
 █ deleted, read HERE, can be defined in each proxy configuration file:       ▐▌
 █ pico ~/delegate/etc/http                                                   ▐▌
 █ &                                                                          ▐▌
 █ pico ~/delegate/etc/socks5                                                 ▐▌
 █ Add this to have cache files, that aren't being accessed within one day,   ▐▌
 █ to expire and remove them:                                                 ▐▌
 █ EXPIRE=1d                                                                  ▐▌
 █ CRON="* * * * * -expire 1d"                                                ▐▌
 █                                                                            ▐▌
 █ Or another method, to have have those expired removed at Midnight          ▐▌
 █ for example:                                                               ▐▌
 █ CRON="0 0 * * * /home/user/delegate9.9.3/src/delegated -Fexpire /home/user/delegate/cache/http -rm -atime +1 -sum"
 █                                                                            ▐▌
 █ Other parameters for time are d|h|m|s. So if for example you wanted the    ▐▌
 █ validity to expire in one hour and have them removed:                      ▐▌
 █ EXPIRE=1h                                                                  ▐▌
 █ CRON="* * * * * -expire 1h"                                                ▐▌
 █                                                                            ▐▌
 █ Kill and restart the proxy:                                                ▐▌
 █ ~/delegate9.9.3/src/delegated -P2121 -Fkill                                ▐▌
 █ ~/delegate9.9.3/src/delegated -P2121 +=http                                ▐▌
 █                                                                            ▐▌
 █ Or to not use cache:                                                       ▐▌
 █ CACHE=no                                                                   ▐▌
 █ Another Cache setting to read only:                                        ▐▌
 █ CACHE=ro                                                                   ▐▌
 █                                                                            ▐▌
 █ You might need to manually delete your present cached files:               ▐▌
 █ rm ~/delegate/cache/http/* -rf                                             ▐▌
 █                                                                            ▐▌
 █ There will be a new log from this setting; expire.log.                     ▐▌
 █ If you used logrotate on the logs with the settings above, it will be      ▐▌
 █ included in the rotattion as well because of this line:                    ▐▌
 █ /home/user/delegate/log/*.log                                              ▐▌
 █                                                                            ▐▌
 █ NOTES:                                                                     ▐▌
 █ ``````                                                                     ▐▌
 █ 1. If you aren't sure how to use these proxies see my SOCKS5 tutorial      ▐▌
 █ HERE. Use the settings to enter directly into the program. The port        ▐▌
 █ forwarding in PuTTy method won't work for this.                            ▐▌
 █                                                                            ▐▌
 █ 2. On servers that check your ident (such as IRC), your ident will be your ▐▌
 █ user name on the shell.                                                    ▐▌
 █                                                                            ▐▌
 █ 3. You can test this in your browser by going to whatismyipaddress.com.    ▐▌
 █ You'll probably see a message like:                                        ▐▌
 █ Proxy Server Detected!                                                     ▐▌
 █ (proxy test results)                                                       ▐▌
 █ Proxy Server IP address: 123.456.789                                       ▐▌
 █ Proxy Server Details: 1.1 - (DeleGate/9.9.3)                               ▐▌
 █ So these settings above aren't going to hide that fact. Refer to           ▐▌
 █ DeleGate's site for more settings.                                         ▐▌
 █                                                                            ▐▌
 █ //----------------------------------------------------------------------   ▐▌
 █                                                                            ▐▌
 █ If you find mistakes, have suggestions, and or questions please post at    ▐▌
 █ mewbies forum HERE - thank you.                                            ▐▌
 █                                                                            ▐▌
 █ Last update on 07 Jul '10                                                  ▐▌
 █                                                                            ▐▌
 █▌                                                                           █▌
  █▌                          -   mewbies.com   -                            █▌
   █▌                                                                       █▌
    ██▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄██