Recent announcements
Showing posts 1 - 8 of 8.
View more »
|
Blog >
Tech Blog
Monitor USB Throughput
VLAN QinQ with tcptrace
This week I had a new problem... analyze traffic in VLAN QinQ with tcptrace. I have traffic capture with some hundreds of megabytes and traffic was encapsulated in QinQ.
For tcptrace, this traffic was not recognized, so I cannot analyze it as it was. And from a bunch of vlans I just need to analyze one of them, in my case 1901.
Googgling during some time I didn't find my answer, so I need to create a work around.# tcpreplay --intf1=dummy0 capture-001-20130529-125129-eth1_2.cap # tshark -i dummy0 -w /tmp/test_03_tshark.pcap "vlan 313 && vlan 1901" |
Logging SSH sessions
During my work activities, I do a lot of ssh sessions to routers, switches, servers and so on, and I allways miss a simple way to record all activities I done.... some time to track problems I made, sometimes to recall a command done some time ago. So, with a simple script and one alias I resolve my problem. The script is not very well done and not very robust, but I think for now do a go job.alias ssh='~/bin/ssh_log_wrapper.sh' If for some reason you need to use the ssh binary, for example, do a tunnel, just invoke it with the full path. One goody, to do the logging, I use script command, which can create a time file and with scriptreplay it shows almost the same when the sessions was record. Show each time I do a ssh session to a machine, it is create one folder, one with the output of the session and other file with the timing information. |
How to check usb device speed
Sometimes we need to see if a device is connect at USB 2.0 speeds or not.
Unfortunately, lsusb do not give this information out of the box. We need to check the /sys/bus/usb and find the right device.So a create a simple script to do it in a simple way. $ ./checkUsbSpeed.sh <string>
$ lsusb Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 003 Device 003: ID 0fe6:9700 Kontron (Industrial Computer Source / ICS Advent) DM9601 Fast Ethernet Adapter Bus 003 Device 002: ID 046d:c526 Logitech, Inc. Nano Receiver Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 003: ID 138a:003c Validity Sensors, Inc. Bus 001 Device 004: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub Bus 002 Device 003: ID 1bcf:0c31 Sunplus Innovation Technology Inc. Bus 001 Device 005: ID 046d:c52e Logitech, Inc. $ ./checkUsbSpeed.sh Sunplus
/sys/bus/usb/devices/2-1.2
Sunplus Innovation Technology.: 480Mbps
It will tell you where in /sys/bus/usb the device is, the name of the manufacturer and the speed. |
Simple MUA
Each time I install a new machine I loose all configuration how the MUA was configured to send emails via google. Today I send a little time to find a way to have a simple configuration... and found a simple MUA: MSMTP I've several goals in mind:
Googling a bit, I've find lots of howtos to configure msmtp, but it was in user land or to system, not combined, and with the touch of no plain text passwords. First I remove all packages from previous MUA/MTA, in my case, sendmail. # sudo dpkg --get-selections | grep sendmail # sudo apt-get remove libmail-sendmail-perl sendmail-base sendmail-bin sendmail-cf Then install MSMTP and certificates: # sudo apt-get install msmtp ca-certificates After, create the configurations files: /etc/msmtprc defaults tls on tls_starttls on tls_trust_file /etc/ssl/certs/ca-certificates.crt aliases /etc/msmtp_aliases account default host smtp.gmail.com port 587 auth on user <gmail email user> password <gmail email password> from <gmail email user> logfile ~/.msmtp.log Then create a aliases file (as configured before) /etc/msmtp_aliase root: <email address> Now it should work, if you test it. But it isn't ready for system wide. First, lets put the command mail working.In each user home directory it is needed to create this file # cat .mailrc set sendmail="/usr/bin/msmtp" And for new accounts, you should also create this file inside /etc/skell, because each new user is created, the content of this directory is copied to the user home. But at this time, cron still not send email to you, because it has hard coded the path to sendmail. So, it is needed to create a sym link: # ln -s /usr/bin/msmtp /usr/lib/sendmail Probably it is not needed, but lets create a sym link to sendmail # ln -s /usr/bin/msmtp /usr/sbin/sendmail note: before create this sym link, check if they already exist, and if yes, do a backup first. The system wide logs should be in /var/log, but with this configuration, msmtp are in home directory of each user. Usually, cron and other jobs run as root, so, let's do a sym link: # ln -s /root/.msmtp.log /var/log/msmtp.log One last problem to solve.... a password in text plain. To workaround this problem, I used the option passwordeval, but if is not a problem to you, you do not need to read more. But this workaround make cron jobs not send emails. First, change in /etc/msmtorc from password <gmail email password> to passwordeval /usr/local/bin/getPass.sh and the content of that script is #!/bin/bash /usr/bin/gpg -q --batch -d ~/.msmtp.password.txt.gpg note: don't forget to do chmod +x /usr/local/bin/getPass.sh to turn it executable From now on, msmtp will use gpg to decrypt a file where the password is. The problem of this solution is the management, because each user must have in it his own home the encrypted file with it own key ring. First, you need to create your key ring which the command "gpg --gen-key". It will ask some questions. Keep the information you provide in this questions: Real Name, Email address and comment. This information is needed to identify your key later. I've attached an example of the output in the files of this post. After the key ring is created, just create a file with the password inside it, and encrypt it with: $ gpg --output ~/.msmtp.password.txt.gpg -e <file> You did not specify a user ID. (you may use "-r") Current recipients: Enter the user ID. End with an empty line: At this time provide any part of the Real Name, Email address or comment, in order gpg find the key to encrypt the file. After the key found, just press enter again to encrypt the file. Remove the files with clear text password, and its done... Now, just test your cron and mail program... Lessons learned:
|
My first time...
... I build a Passive Network Tap. A RJ45 4 way splitter, and two custom made cables, a computer with Linux, a bond interface, and voilá, my set-up. The tower is running Linux and see the traffic pass-through and the Windows Desktop being sniffed. This site was my inspiration. But like kitchen recipes, I like to adapt to my way. In this case, the Surface Mount Box was replaced by the 4 way RJ45 Splitter and two 'special' cables. This cables will only send traffic to the network cards. One have the normal RX cables, and the other only have the TX cables but in RX place. Yeap, the pics are crappy, but it is the best I can do with my mobile phone. |
Google Calendar and Thunderbird
If you google for Thunder/Sunbird and google calendar integration, will lead you to a bunch of add-on and blogs, not this off course. But the best help is in the Google Calendar FAQ: http://www.google.com/support/calendar/bin/answer.py?hl=en&answer=99358#sunbird Neat and clean, with out add-ons, just I like. |
1-8 of 8