Monday, July 30, 2018

Script to Disable Mouse Right Click

Script to Disable Mouse Right Click

  1. <script type="text/javascript">
  2. $(document).ready(function() {
  3. $(".disableEvent").on("contextmenu",function(){
  4. alert('right click disabled');
  5. return false;
  6. });
  7. });
  8. </script>

Script to Disable Cut Copy & Paste

Using this script, you can prevent user to cut (CTRL+X), copy (CTRL+C) and paste (CTRL+V)content from your web pages.
  1. <script type="text/javascript">
  2. $(document).ready(function() {
  3. $('.disableEvent').bind('cut copy paste', function (e) {
  4. e.preventDefault();
  5. });
  6. });
  7. </script>
  8. As far as I can see, the secret sauce is, that Ctrl+S does NOT fire the keypress event, only the keydown event.
    $(document).bind('keydown', 'ctrl+s', function(e) {
        e.preventDefault();
        alert('Ctrl+S');
        return false;
    });
    Only with jQuery:
    $(document).bind('keydown', function(e) {
      if(e.ctrlKey && (e.which == 83)) {
        e.preventDefault();
        alert('Ctrl+S');
        return false;
      }
    });

    Disable saving web page with CTRL-S using JQuery

    Use below JQuery code to disable saving web page using "CTRL-S" keyword directly. This will work well on all browser (IE, Firefox, Google chrome). // To prevent saving web site directly using "ctrl-s" $(document).bind('keydown keypress', 'ctrl+s', function () {         $('#save').click();         return false;     });
     

firewallD command add & remove

port enable or not 
[root@proxy ]# firewall-cmd --zone=public --query-port=80/tcp

remove rules:

firewall-cmd --permanent --zone=public --remove-forward-port port=80:proto=tcp:toport=3128:toaddr=192.168.1.179
success
 


firewall-cmd --reload
 
remove port nmuber: 
 
[root@proxy ~]# firewall-cmd --permanent --zone=public --remove-port=80/tcp
success
[root@proxy ~]# firewall-cmd --reload
success
 
 
 
list firewall rules:
 
 
firewall-cmd --list-all


list active zone


firewall-cmd --get-active-zone




 

Saturday, July 28, 2018

How to Configure Squid 3.x as Transparent Proxy on CentOS 7




 


vi /etc/squid/squid.conf



# Squid normally listens to port 3128
http_port 3128  transparent



visible_hostname proxyserver.nagarajanewlife.com


acl our_network  src 192.168.1.0/24

http_access allow our_network




firewall-cmd --permanent --zone=public --add-forward- port=80:proto=tcp:toport=3128:toaddr=192.168.1.175

firewall-cmd --permanent --zone=public --add-port=3128/tcp
firewall-cmd --permanent --add-masquerade

firewall-cmd --reload

systemctl restart squid

# firewall-cmd --list-all


$ sudo vi /etc/sysctl.conf
then change the following parameter to ‘1’, i.e.
net.ipv4.ip_forward = 1
Save file & exit. Now execute the following command to implement the changes made,
$ sudo sysctl -p






Dhcp server configure 

vi /etc/dhcp/dhcpd.conf
edit the default gateway 192.168.1.175 # systemctl restart squid









How to Set Time centos 7

timedatectl set-timezone Asia/Kolkata
timedatectl set-ntp true

timedatectl set-ntp 1




 or


timedatectl set-timezone UTC
      timedatectl set-time 15:58:30
 
 
Failed to set time: Automatic time synchronization is enabled
 
 
timedatectl set-ntp false 

Setup network on CentOS 7 minimal

First, type “nmcli d” command in your terminal for quick list ethernet card installed on your machine:











"nmcli d" command output 

Type “nmtui” command in your terminal to open Network manager. After opening Network manager chose “Edit connection” and press Enter (Use TAB button for choosing options).
CentOS_7 Network manager screen


service network restart

Friday, July 27, 2018

ERROR: No forward-proxy ports configured centos 7




# tail -f /var/log/squid/cache.log 
ERROR: No forward-proxy ports configured
ERROR: No forward-proxy ports configured
ERROR: No forward-proxy ports configured
ERROR: No forward-proxy ports configured

Solution:

http_port 3128 

http_port 8080 intercept

how to install squid centos 7 minmal

#yum -y install epel-release

 #  yum -y update

   #yum clean all

#yum install squid -y


 
 

Thursday, July 26, 2018

how to remove port number in firewalld centos 7

Solution: Do not forget the --runtime-to-permanent
$ firewall-cmd --zone=public --remove-port=10050/tcp
$ firewall-cmd --runtime-to-permanent 
$ firewall-cmd --reload 
 
# firewall-cmd --list-all