Kamis, 11 Juli 2019

How to Install and Configure Squid Proxy in Debian 9 with Auth

1. Install Squid
apt install squid
2. Install Apache util to activate authentication
apt install apache2-utils
3.  edit squid.conf using nano
nano /etc/squid/squid.conf
4. paste the following config and save.

# port of proxy
http_port 5000
# hostname of proxy
visible_hostname debix
# IP header HTTP masking (X-Forwarded-For: unknown)
forwarded_for off
# logs
access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
# no cache
cache deny all
# DNS servers
dns_nameservers 80.67.169.12 80.67.169.40
# DNS cache
positive_dns_ttl 5 minutes #réponse positive
negative_ttl 5 minutes #réponse en erreur
# no wait before close Squid (30 seconds else, use of cache if enabled)
shutdown_lifetime 0 seconds
auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwd
auth_param basic children 5
auth_param basic realm Squid Basic Authentication
auth_param basic credentialsttl 5 hours
acl password proxy_auth REQUIRED
http_access allow password



4. make auth file
htpasswd -c /etc/squid/passwd <your custom username> 
5. restart the squid
systemctl restart squid 

Selasa, 14 Agustus 2018

Install and Configure ownCloud on Ubuntu 16.04

Updated by Angel Guarisma Written by Angel Guarisma

 Before You Begin



  • Update your system:
    sudo apt update && sudo apt upgrade
    
  • Install ownCloud

    Add the repository key to apt, and install ownCloud:
    sudo wget -nv https://download.owncloud.org/download/repositories/9.1/Ubuntu_16.04/Release.key -O Release.key
    sudo apt-key add - < Release.key
    sudo sh -c "echo 'deb http://download.owncloud.org/download/repositories/9.1/Ubuntu_16.04/ /' > /etc/apt/sources.list.d/owncloud.list"
    sudo apt update
    sudo apt install owncloud
    

    Configure MySQL

    1. Log in to your MySQL database, and enter your root password:
      mysql -u root -p
      
    2. Create a new database for ownCloud, and replace strong_password with a new, secure password:
      CREATE DATABASE ownCloud;
      CREATE USER ownCloud@localhost;
      SET PASSWORD FOR 'ownCloud'@'localhost' = PASSWORD('strong_password');
    3. Assign the new user to the database:
      GRANT ALL PRIVILEGES ON ownCloud.* to ownCloud@localhost;
      FLUSH PRIVILEGES;
      exit
    4. Log into MySQL as the newly created user:
      mysql -u ownCloud -p
      
    5. You can check the current user in MySQL using the SELECT current_user(); command:
      SELECT current_user();
      Which will display something similar to:
      +--------------------+
      | current_user()     |
      +--------------------+
      | ownCloud@localhost |
      +--------------------+
      1 row in set (0.00 sec)
      

    Create an Administrator Account

    1. After ownCloud is installed and MySQL is configured, point your browser to ip_address_or_domain/owncloud (where, ip_address_or_domain is your IP or FQDN) and create an administrator account:
      ownCloud login screen
    2. Click Storage & database and enter the database login information:
      ownCloud database information
      Welcome to ownCloud:
      ownCloud greeting

    Install ClamAV and Configure ownCloud

    1. Install ClamAV, an open source antivirus engine which works with ownCloud’s antivirus plugin:
      sudo apt install clamav clamav-daemon
      
      The clamav package starts a daemon on your system.
    2. Enable the antivirus app in ownCloud. Select Apps from the menu, then Not enabled to find “Antivirus App for files” and click Enable:
      Antivirus app for files
    3. Configure the antivirus mode in ownCloud to reflect the changes to your system:
      Antivirus socket configuration
    4. To add new users and groups, select Users in the dropdown menu in the upper right-hand corner:
      User configuration panel

    Secure the System

    Now that ownCloud is installed and configured, you should secure your system. The official documentation has a well-written section on hardening your server, which covers everything from using HTTPS, to JavaScript Asset Managing.

    More Information

    You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

    Rabu, 20 Januari 2016

    How to Use SSH Tunneling with Dynamic Port Forwarding on Linux

    SSH Tunneling merupakan salah satu fitur yeng menarik yang ada di linux, kebanyakan dan secara default SSH server menggunakan OpenSsh server. Kali ini saya akan membahas tentang bagaimana membuat port dinamic untuk forwarding beserta proxyfie nya.
    persiapan yang di butuhkan;
    step 1: dari segi server silahkan install openssh server
    apt-get install openssh-server
    namun jika anda tidak punya server, anda bisa cari gratisan atau beli ssh account, jadi ndak perlu repot-repot ngurus server.
    step 2: persiapan di segi client
    sebenarnya tidak ada persipaan khusus, tanpa bantuan tambahan software apapun bisa, namun kali ini saya akan menconhohkan agar lebih mudah saja. install proxy chains untuk memproxyfie trafik yang nantinya terforward ke dinamic port
    apt-get install proxychains
    edit bagian port forwardingnya dengan cara
    nano /etc/proxychains.conf

    tambahkan baris ini socks5  127.0.0.1 1080, save dengan cara ctrl x confirm y, enter.
    step 3: setting dynamic port forwading
    selanjutnya buat skrip sederhana untuk ssh, saya contohkan saya pake server USA;
    nano /usr/bin/sshusa
    paste baris ini, kemudian save dengan cara ctrl + x confirm y, enter
    ssh -N -p 22 -D 1080 root@us4.tehanget.info
    keterangan:
    -N artinya No shell
    -p 22 artinya menggunakan ssh port 22
    -D 1080 artinya port local forwarding menggunakn port 1080
    root artinya user name, dan bisa di edit sesuai user ente
    us4.tehanget.info adalah sever tujuan ssh.
    selanjutnya kasih hak akses eksekusi pada file sshusa
    chmod +x /usr/bin/sshusa
    step 4: finale
    jika ingin konek ke ssh ke server usa, seperti yang sudah kita buat tadi, cukup ketik kan sshusa dari terminal
    sshusa

    dan untuk port forwading tinggal ketikkan proxychain + program yang mau di jalankan
    contoh:
    proxychains firefox
    untuk menjalankan firefox
    proxychains cromium-browser

    untuk menjalankan chrom, proxychains apt-get untuk menjalankan program apt-get, dan seterusnya.....

    oke itu saja, mudah-mudahan bermanfaaat...



    Senin, 18 Januari 2016

    How to Install OpenVPN; One key for many users on Debian 6, 7

    Openvpn secara default tidak mengizinkan satu user dipake berbarngan atau satu key di pakai berbarengan. Disini saya akan mencoba memberikan solusi bagaimana menerapkan konsep multilogin untuk user yang sama. Dalam tutor ini, saya juga mencoba menerapkan konsep non user tapi key only untuk dipake banyak user. Jadi user hanya membutuhkan satu key tanpa username dan password untuk bisa menggukanakan openvpn.
    untuk perbandingan, silahkan baja juga tutorial cara install openvpn di debian (mode username dan passwd).
    oke langsung saja;
    step 1: login as root ke Server ente
    step 2: install openvpn nya
    apt-get install openvpn
    step 3: Persiapkan untuk pembuatan key server dan client
    secara default, lokasi skrip easy-rsa ada di folder /usr/share/easy-rsa/, mari kita buat duplicate nya dulu untuk keperluan edit meng edit siapa tau melakukan kesalahn.
    mkdir /root/easy-rsa
    cp -prv /usr/share/doc/openvpn/examples/easy-rsa/2.0 /root/easy-rsa

    masuk ke folder easy-rsa atau masuk lagi ke sub direktorinya 2.0
    cd /root/easy-rsa/2.0
    edit data vars nya
    nano vars
    edit bagian ini, dan sesuaikan dengan data server ente
    KEY_COUNTRY="ID"
    KEY_PROVINCE="JATENG"
    KEY_CITY="BANJARNEGARA"
    KEY_ORG="TEHANGET.INFO"
    KEY_EMAIL="admin@tehanget.info"
    exit dan save, ctrl + x confim y enter
    step 4: buat key server dan client
    source ./vars
    ./clean-all
    ./build-ca
    Untuk yng di bawah ini, tehanget.info bisa di ganti dengan nama server/domain ente, tapi ada baiknya di biarkan default dulu aja, biar nanti tidak susah saat edit config server nya.
    ./build-key-server tehanget.info
    ./build-dh
    selanjutnya build client key;
    ./build-key client
    jangan lupa buat HMAC code juga

    openvpn --genkey --secret /root/easy-rsa/2.0/keys/ta.key
    step 5:  pindahkan file-file key tersebut ke folder openvpn
    mkdir -p /etc/openvpn/certs
    cd /root/easy-rsa/2.0/keys
    cp * /etc/openvpn/certs
    step 6: buat server confing filenya
    cd /etc/openvpn
    nano server.conf
    paste kan kode berikut dan pastikan lokasi dan nama key nya sama dengan punya ente
    port 1194
    proto udp
    dev tun
    duplicate-cn
    ca /etc/openvpn/certs/ca.crt
    cert /etc/openvpn/certs/tehanget.info.crt
    key /etc/openvpn/certs/tehanget.info.key
    dh /etc/openvpn/certs/dh1024.pem
    tls-auth /etc/openvpn/certs/ta.key 0
    server 10.9.8.0 255.255.255.0
    ifconfig-pool-persist ipp.txt
    push "redirect-gateway def1 bypass-dhcp"
    push "dhcp-option DNS 8.8.8.8"
    push "dhcp-option DNS 8.8.4.4"
    keepalive 5 30
    comp-lzo
    user nobody
    group nogroup
    persist-key
    persist-tun
    verb 5
    mute 20

    max-clients 10

    save dan exit, ctrl + x , confirm y, enter
    test apakah config server udah bener dengan cara:
    service openvpn restart
    kalo bisa restart tanpa failed brarti aman :D

    step 7: enable forwading dan save ip tables
    enable forwarding dengan cara
    nano  /etc/sysctl.d/ipv4_forwarding.conf
    paste kan ini, save dan exit
    net.ipv4.ip_forward = 1
    apply kasikan dengan cara
    sysctl --system
    untuk routing harus sangat di perhatikan, pilih salah satu!
    untuk openvz
    iptables -t nat -A POSTROUTING -s 10.9.8.0/24 -o venet0 -j SNAT --to IP_ENTE
    untuk dedicated / kvm /cloud
    iptables -t nat -A POSTROUTING -s 10.9.8.0/24 -o eth0 -j MASQUERADE
    selanjutnya untuk menimpan routing nya gunakan perintah ini:
    apt-get install iptables-persistent
    jawab saja yes, yes. 

    step 8: download client keys ke komputer
    ente bisa pake sftp, silahkan pake filezilla atau yng lainnya, intinya pindahkan file ca.crt, client.crt, client.key dan ta.key ke komputer ente bagaimanapun caranya :p
    step 9: buat config client
    silakan buka notepad kalo ente pake windows, paste kan kode berikut
    remote IPSERVERENTE 1194
    client
    dev tun
    proto udp 
    resolv-retry infinite
    nobind
    tun-mtu 1500
    tun-mtu-extra 32
    mssfix 1450
    persist-key
    persist-tun
    #auth-user-pass
    comp-lzo
    verb 3
    route-method exe
    route-delay 2
    ca ca.crt
    cert client.crt
    key client.key
    tls-auth ta.key 1
    jangan lupa edit bagian IPSERVERENTE, dan ganti dengan ip atau domain ente. save satu folder dengan file-file yng sudah di download dari server. Simpan dengan extensi .ovpn dan opsi allfiles pada notepad.

    step 10: finale
    server: restart server atau restart openvpnya
    reboot
    atau
    service openvpn restart
    client: pindahkan semua file yng di download dari server beserta confignya ke folder c:/program files/openvpn/config

    oke itu saja, semoga bermanfaat.... :D

    Minggu, 17 Januari 2016

    How to Install Glype Proxy on Debian 6, 7

    Glype proxy merupakan salah satu php proxy yang berbasis web, memudahkan pengguna awam untuk mengkases situs yang terblokir dengan mudahnya. Disini saya aplikasikan di website saya freepass.xyz


    Adapun cara install nya sangat sederhana sekali;
    step 1: login via ssh sebagai root
    step 2: Install prasyarat yang di butuhkan
    apt-get install curl php5-curl
    step 3: buat direktori glype, download dan extrak
    mkdir /var/www/glype
    cd /var/www/glype
    wget http://dir.tehanget.info/others/glype.zip
    unzip glype.zip
    step 4: seting ownership folder dan permission nya
    chmod 775 -R /var/www/glype
    chown -R www-data:www-data /var/www/glype
    step 5: buat config apache nya
    disini saya contohkan menggunakan web freepass.xyz, freepass.xyz bisa di ganti ip ente atau domain ente.
    nano /etc/apache2/sites-available/glype.conf

    paste kan kode berikut, jangan lupa edit freepass.xyz nya:
    NameVirtualHost webproxyfree.xyz:80
    <VirtualHost webproxyfree.xyz:80>
            ServerAdmin treximaru@gmail.com
            ServerName webproxyfree.xyz

            DocumentRoot /var/www/glype/
           <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
            </Directory>
            ErrorLog ${APACHE_LOG_DIR}/error.log

            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn

            CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    untuk menyimpan dan exit pencet ctrl + x, confrim y, enter.

    step 6: disable default website config dan enable  glype config
    a2dissite default
    a2ensite glype.conf
    a2enmod rewrite
    step 7: reload and restart apache
    service apache2 reload
    service apache2 restart
    step 8: final step; login and seting admin panel
    buka browser kesayangan ente, dan buka url di bwah ini, note; ganti freepass.xyz dengan ip vps ente atau domain ente.
    http://freepass.xyz/admin.php?login

    oke itu saja... semoga bermanfaat....

    Rabu, 16 Desember 2015

    Cara Install dan Setting VNC Server di debian 6, 7 Gnome

    Banyak kendala yang biasa kita temui ketika installasi vnc server, salah satu kendala yng paling sering adalah blank screen / black screen / grey screen, dengan tutorial ini diharapkan bisa mengatasi masalah-masalah tersebut.
    Langsung saja, login as root:
    apt-get update
    lanjut dengan installasi gnome nya:
    apt-get install gnome-desktop-environment
    install fonts:
    apt-get install xfonts-100dpi
    apt-get install xfonts-100dpi-transcoded
    apt-get install xfonts-75dpi
    apt-get install xfonts-75dpi-transcoded
    aget install xfonts-base
    install vnc server nya, kali ini saya pake tightvncserver
    apt-get install tightvncserver
    jalankan vnc nya
    tightvncserver :1
    masukan passwd sesuai selera ente.
    dengan asumsi :1 adalah port yng di pake buat vnc nantinya
    kill dulu vnc nya untuk melakukan konfigurasi selanjutnya:
    tightvncserver -kill :1
    edit config filenya:
    nano ~/.vnc/xstartup
    paste kan kode berikut:
    #!/bin/shxrdb $HOME/.Xresources
    xsetroot -solid grey
    x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
    # x-window-manager &
    gnome-session &

    save dengan cara ctrl + x press y enter
    selanjutnya jalankan vpc server dengan cara
    tightvncserver -geometry 1024x768 :1
    atau hanya seperti ini
    tightvncserver :1
    dan dari komputer client kita bisa mengkases nya dengan cara
    ip-kopmuter-yng-terinstall-vpc:port dan tentunya anda sudah install vnc cliennya...

    contoh:
    10.42.0.1:1
    masukkan passwd nya

    contoh hasil remote vnc nya seperti ini....


    semoga bermanfaat.... :D

    Minggu, 06 Desember 2015

    Cara Install dan Setting Samba di Debian, Ubuntu, Mint

    login ke terminal as root...
    install alat dan bahan :D
    apt-get install samba 
    tambahkan user untuk samba
    smbpasswd -a user
    note: user bisa di ganti sesuka hati
    buat folder yng mau di share dan ambil owenership nya sesuai dengan user samba yang tadi di buat
    mkdir /home/user/shared
    chown user /home/user/shared
    chown :user/home/user/shared
    edit samba config;
    nano /etc/samba/smb.conf
    kemudian paste config ini di baris atas sendir, ini hanya contoh, sesuaikan dengan folder dan user ente
    [shared]
    path = /home/user/shared
    valid users = user
    read only = no

    valid user di isi username samba, exit dan save ctrl + x pencet y enter.
    restart samba:
    service smbd restart
    cek config bilamana ada yng eror...
    testparm
    pastikan hasilnya oke....
    silahkan cek sudah bisa di akses blm fodlernya fia smbclient atau cek langsung di network contoh:
    sambaclient //10.42.0.1/shared -U user
    10.42.0.1 di ganti dengan IP ente, dan user diganti dengan user yng ente buat diatas.....

    sekian semoga bermanfaat....