Sunday, March 22, 2015

Block Access during certain period using EBTABLES

Say, we want to block any packets coming from a device with mac address 00:01:02:03:04:05 (in other words, our router/switch should just silently drop any packets coming from this MAC address) during period of time 00:00 (00:00 AM) to 6:00 AM, do:

#ebtables -A INPUT -s 00:01:02:03:04:05  --timestart 0:0 --timestop 06:00 -j DROP

If we just want to drop IPv4 packets for the above:

#ebtables -A INPUT -p IPv4 -s 00:01:02:03:04:05  --timestart 0:0 --timestop 06:00 -j DROP

So, parameters for ebtables are actually similar (yet subset) of iptables (netfilter).

Wednesday, March 11, 2015

To fix Mute button keyboard shortcut issue on LXDE

Create a script call "amixertoggle" and save it in /usr/local/bin:


amixer $1 sset Headphone toggle
amixer $1 sset Speaker toggle
amixer $1 sset PCM toggle
amixer $1 sset Master toggle

Edit file $HOME/.config/openbox/lxde-rc.xml and replace block that has "XF86AudioMute" to call our script.  For example:


    <keybind key="XF86AudioMute">
      <action name="Execute">
              <command>amixertoggle -c 1 toggle</command>


(" -c 1" above is for machine, where the mixer control is actually on card 1.  If doesn't work, we can try different number)

Reload the modified file lxde-rc.xml by doing:

openbox --reconfigure

That's it.  Everytime we press "Mute" button on our PC keyboard, the mute/unmute will toggle.