2008 February

Logitech

Mouse:
Ubuntu:

cat /proc/bus/input/devices
Section "InputDevice"
    Identifier  "Configured Mouse"
    Driver      "evdev"
    Option      "Name" "*Logitech MX Mouse"
    Option      "HWHEELRelativeAxisButtons" "7 6"
EndSection

Section “ServerLayout”
Identifier “Default Layout”
screen 0 “Default Screen” 0 0
Inputdevice “Generic Keyboard”
Inputdevice “Configured Mouse”
“CorePointer”

# Uncomment if you have a wacom tablet
# InputDevice “stylus” “SendCoreEvents”
# InputDevice “cursor” “SendCoreEvents”
# InputDevice “eraser” “SendCoreEvents”
EndSection

start xbindkeys with: LC_ALL=C xbindkeys

http://forums.gentoo.org/viewtopic-p-3735443.html#3735443

.xbindkeyssrc:

“xbindkeys_show”
control+shift + q

# specify a mouse button
“xterm”
control + b:2

#changebackground
“changebackground.py”
m:0×10 + c:175
Mod2 + XF86Close

“xvkbd -text “\[Control]\[w]“”
m:0×10 + b:12

“xvkbd -xsendevent -text “\[Control_L]\[Page_Up]“”
m:0×10 + b:7
“xvkbd -xsendevent -text “\[Control_L]\[Page_Down]“”
m:0×10 + b:6

“xvkbd -xsendevent -text “\[Alt_L]\[Left]“”
m:0×10 + b:8
“xvkbd -xsendevent -text “\[Alt_L]\[Right]“”
m:0×10 + b:9
“xvkbd -text “\[Alt_L]\[F9]“”
m:0×10 + b:10
“xvkbd -text “\[F12]“”
m:0×10 + b:11

Keyboard:

tealc / # cat /etc/init.d/logikeys
setkeycodes e003 177 e002 178 e011 216 e075 148 e074 212 6c 105 6e 106 e001 154 6d 206 e004 202 6a 203 6b 219 e014 181 e013 182 e015 188 e055 187 e031 152 e078 167 e02d 168 e02f 162 e02c 192 e025 195 e026 194 e03b 227 e03c 228 e03d 229 e03e 230 e03f 231 e040 232 e041 233 e042 234 e043 235 e044 236 e057 237 e058 238

# Keys set by above script
# Label scancode keycode
# Messenger e011 216
# Status e075 148
# Webcam e074 212
# 2win e001 154
# X 6d 206
# left 6c 105
# right 6e 106
# zoom_ e004 202
# zoom+ 6a 203
# % 6b 219
# media film e014 181
# media music e013 182
# media photo e015 188
# documents e055 187
# flame e031 152
# record e078 167
# ipod e02d 168
# eject e02f 162
# preset1 e02c 192
# preset2 e025 193
# preset3 e026 194
# F1 help e03b 227
# F2 word e03c 228
# F3 excel e03d 229
# F4 ppt e03e 230
# F5 undo e03f 231
# F6 redo e040 232
# F7 print e041 233
# F8 save e042 234
# F9 progA e043 235
# F10 progB e044 236
# F11 progC e057 237
# F12 progD e058 238

tealc wladyx # cat .Xmodmap
! scancode – linux keycode – xkeycode
!
! Messenger – e011 – 216 – 121
keycode 121 = XF86Messenger
! Status – e075 – 148 – 159
keycode 159 = XF86Calendar
! Webcam – e074 – 212 – 187
keycode 187 = XF86WebCam
!
! 2win – e001 – 154 – 166
keycode 166 = XF86RotateWindows
! X – 6d – 206 – 175
keycode 175 = XF86Close
!
! left – 6c – 105 -
!keycode = Left
! right – 6e – 106 -
!keycode = Right
!
! zoom_ – e004 – 202 – 171
keycode 171 = XF86ZoomOut
! zoom+ – 6a – 203 – 172
keycode 172 = XF86ZoomIn
! % – 6b – 219 – 195
keycode 195 = XF86Finance
!
! media film – e014 – 181 – 137
keycode 137 = XF86Video
! media music – e013 – 182 – 138
keycode 138 = XF86Music
! media photo – e015 – 188 – 247
keycode 247 = XF86Pictures
! documents – e055 – 187 – 131
keycode 131 = XF86Documents
!
! music
! flame – e031 – 152 – 146
keycode 146 = XF86CD
! record – e078 – 167 – 177
keycode 177 = XF86AudioRecord
! ipod – e02d – 168 – 152
keycode 152 = XF86Phone
! eject – e02f – 162 – 253
keycode 253 = XF86Eject
! preset1 – e02c – 192 – 249
keycode 249 = XF86Launch1
! preset2 – e025 – 193 – 149
keycode 149 = XF86Launch2
! preset3 – e026 – 194 – 119
! custom
keycode 207 = XF86Launch3
!
! Function keys
! F1 help – e03b – 227 – 214
keycode 214 = XF86Support
! F2 word – e03c – 228 – 215
keycode 215 = XF86Word
! F3 excel – e03d – 229 – 216
keycode 216 = XF86Excel
! F4 ppt – e03e – 230 – 217
keycode 217 = XF86Calculater
! F5 undo – e03f – 231 – 218
keycode 218 = Undo
! F6 redo – e040 – 232 – 228
keycode 228 = Redo
! F7 print – e041 – 233 – 142
keycode 142 = Print
! F8 save – e042 – 234 – 213
keycode 213 = XF86Save
! F9 progA – e043 – 235 – 240
keycode 240 = XF86Copy
! F10 progB – e044 – 236 – 241
keycode 241 = XF86Cut
! F11 progC – e057 – 237 – 242
keycode 242 = XF86Paste
! F12 progD – e058 – 238 – 243
keycode 243 = XF86Clear

! CUSTOM
keycode 236 = XF86Mail
keycode 223 = XF86Sleep
keycode 161 = XF86Calculator
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext
keycode 162 = XF86AudioPlay
keycode 164 = XF86AudioStop
keycode 174 = XF86AudioLowerVolume
keycode 176 = XF86AudioRaiseVolume
keycode 160 = XF86AudioMute
keycode 237 = XF86AudioMedia

MX1000Mouse – Community Ubuntu Documentation
http://nablasquared.wordpress.com/?s=xbindkeys

By WladyX on 23 February, 2008 | General | A comment?

Firewall 2 connections

By WladyX on 20 February, 2008 | General, Scripts | A comment?

Kde fonts

nocomment script

#! /bin/sh

cat $1 | sed -e '/^$/d;/^#/d'

Apache redirect vhost

RedirectMatch (.*)$ http://aadmin.xxx.ro:2082 

Http redirect

<html>                                                                                                                                        
<head>                                                                                                                                        
<meta http-equiv=”refresh” content=”1;URL=https://wladyx.homelinux.net/index.php”>                                                            
</head>                                                                                                                                       
Please wait while we kick your a**..                                                                                                          
</html> 

metropolitan

#!/bin/bash                                                                                                                                   
cd /admin                                                                                                                                     
wget http://monitor.cyberspace.ro/routes.txt -O /admin/metropolitan.temp                                                                      
mipclasses < metropolitan.temp > metropolitan.txt                                                                                             
rm -f metropolitan.temp                                                                                                                       
squid -k reconfigure     

By WladyX on | Proxy | A comment?

Script ps

if ! ps -A | grep irexec 1> /dev/null 2> /dev/null ; then                                                                                     
echo “Pornesc irecexec”                                                                                                                       
irexec -d                                                                                                                                     
else                                                                                                                                          
echo “irexec merge”                                                                                                                           
fi     

Passwordless su

I did some research, and if you compile the shadow package (the package that supplies su and everything for /etc/passwd and /etc/group) with pa
m, you don’t get suauth. I could hack the configure script and change that, but the developers did it for a reason.

Anywho, the solution is in PAM as many of you have already determined. The following works for me, and works as expected. I tested all exceptio
ns I could think of, but then again it is 1:00 in the morning and I might have overlooked something.

And here it is:

1. Edit /etc/pam.d/su, after
Code:
auth       sufficient   /lib/security/pam_rootok.so
add
Code:
auth       sufficient   /lib/security/pam_listfile.so item=ruser \
onerr=fail sense=allow file=/etc/security/su-nopass

2. Create a /etc/security/su-nopass file, and it put one username per line. Only put users that you want to have access to root without a pa
ssword.
3. Double check the permissions on the file, we don’t want it world writable, and world readable is a matter of personal preference.

Basically, the above says that any user in the su-nopass file is allowed to su without entering a password.

You could move the pam_wheel module before the pam_listfile line to require the user to belong to the wheel group. Again, this is personal pref
ernce based on security needs.

Hope it works, tell me what you think. Tell me if there are any flaws.

PS: This is not my work, can’t remember where i got this :(

In Ubuntu:

groupadd wheel, add yourself to this group, edit /etc/pam.d/su and uncomment the appropriate line.

A brief HOWTO for openvpn.

For more (the best) documentation check the OpenVPN
developer
site at http://openvpn.net/examples.html.

Now, if you’re running on debian sarge just do:

apt-get install openvpn

for installing the VPN software. If you don’t have this linux distribution,
download, install or compile the version that is good for your distro.
The tar.gz archive is good for all linux distros and can be found here.
It is possible to need other packages (check dependencies).

If you use the tar.gz file and compile yourself the sources, make the
device node and load it:

mknod /dev/net/tun c 10 200

modprobe tun

OK! I just install it! What’s next?

Let’s presume that you want to have a tunnel between two linux routers
(router A and router B).

The simples way (without encryption) to do that is shown below.

On router A do:

openvpn –remote x.x.x.x –dev tun0 –ifconfig a.a.a.a a.a.a.b –port
yyyy

On the other router do:

openvpn –remote y.y.y.y –dev tun0 –ifconfig a.a.a.b a.a.a.a –port
yyyy

Where:

x.x.x.x – your public IP on router B

y.y.y.y – your public IP on router A

a.a.a.a – your local IP for tunnel interface (ex.: 192.168.1.1)

a.a.a.b – the other IP of your tunnel (the remote one, ex.: 192.168.1.2)

yyyy – the UDP connection port

Wait 2-10 seconds for establishing the connection, check if your tun
(tun0 in my example) interface is up and if it is try ping a.a.a.b (if
your are connected to router A) or ping a.a.a.a (if your on the router
B).

For a verbose output try –verb 5 option as follow (but will generate
a lot output):

openvpn –remote y.y.y.y –dev tun0 –ifconfig a.a.a.b a.a.a.a \
–port
yyyy –verb 5

This example is working without tunnel encryption. If you want to use
encryption, the easy way is to generate a key:

openvpn –genkey –secret key

The “key” file must be on both router. Do not try to generate the “key”
on each routers !!! Generate it on one router and then copy it on the other.

Now the command will change as follow:

openvpn –remote x.x.x.x –dev tun0 –ifconfig a.a.a.a a.a.a.b \
–port
yyyy –secret key
(for router A) and

openvpn –remote y.y.y.y –dev tun0 –ifconfig a.a.a.b a.a.a.a \
–port
yyyy –secret key
(for router B)

If you want to change your gateway and to move all your traffic to the
tunnel do:

openvpn –remote x.x.x.x –dev tun0 –ifconfig a.a.a.a a.a.a.b \
–port
yyyy –redirect gateway –secret key

and also, if you want to use your own DNS server or just want to send packets to
other route, you can insert an additional route:

openvpn –remote x.x.x.x –dev tun0 –ifconfig a.a.a.a a.a.a.b \

–port yyyy –redirect gateway \
–route 10.5.5.0 255.255.255.0 10.5.5.1
–secret key


where:

10.5.5.0 – is your (local) network

255.255.255.0 – the network mask

10.5.5.1 – the gateway for the 10.5.5.0 route

Now all your packets will go to tunnel except the packet that have
the 10.5.5.0/24 as destination network will go directly to 10.5.5.1 gateway.

What about firewall???

Oh, yeahh…the firewall…

If you don’t manage the firewall check for an open port on it and if
you can pass it (the hping tool can
be useful) use it with the –port x option. The port UDP 1194 is
the default port for openvpn.

I strongly recommend to read and learn about
iptables until you’ll play with fire !!! :-)

If all what you want is to link two routers you must use only INPUT
and OUTPUT iptables chains for ethX interfaces and FORWARD for your tunX interface.

A basic iptables rules looks like this:

echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -A INPUT -i eth0 -p udp -s ip_addr_of_the_other_router –sport
1194 –dport 1194 -j ACCEPT

iptables -A OUTPUT -o eth0 -p udp -d ip_addr_of_the_other_router –dport
1194 –sport 1194 -j ACCEPT

iptables -A INPUT -i tun0 -j ACCEPT

iptables -A OUTPUT -o tun0 -j ACCEPT

iptables -A FORWARD -i tun0 -j ACCEPT

There are other ways to set up a VPN connection using openvpn and my
advice is to read all the documentation and examples that you find on the
OpenVPN page.

Note:

All the examples above use UDP ports. For TCP ports check the documentation.

That’s it…

LiNUX Horizon – OPENVPN – A brief HOWTO for openvpn.