Network

Howto: Android_device_enable_rooting

Posted on Updated on

Download packages:

Kingo-compactable devices : http://www.kingoapp.com/android-root/devices.htm

Kingo-ROOT download : http://www.kingoapp.com/index.htm

Step one: Download and install Kingo Android Root into the PC.

ROOT-2

Step two: Enable USB debugging mode on your phone. If it’s running Android 4.0 or 4.1, tap Settings, Developer Options, then tick the box for “USB debugging.” (You may need to switch “Developer options” to On before you can do so.) On Android 4.2, tap Settings, About Phone, Developer Options, and then tick USB debugging.” Then tap OK to approve the setting change.
On Android 4.3 and later (and some versions of 4.2), tap Settings, About Phone, then scroll down to Build Number. Tap it seven times, at which point you should see the message, “You are now a developer!”

Step three: Run Android Root on your PC, then connect your phone via its USB cable. Make sure Device compactable USB driver installed,

ROOT-1

Step four: Click Root and wait for couple of minutes to complete, including the automated reboot at the end.

HowTo: Authenticated email relay server with Postfix

Posted on Updated on

Setup Postfix as a email relay server which will authenticate with public email server for sending emails. If you want to use a Gmail as a Free SMTP server us, use this as in any of the redhat or ubuntu servers
For Ubuntu

apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules

Replace the ceritficate file in the configuration

cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem

If you do not have postfix installed before, postfix configuration wizard will ask you some questions. Just select your server as Internet Site and for FQDN use something like mail.example.com , For Centos

yum install postfix email mailx cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain
[root@server ~]# vi /etc/postfix/main.cf
biff = no
append_dot_mydomain = no
readme_directory = no
myhostname = smtpout.innovautelabs.intra
mydomain = innovaturelabs.intra
myorigin = $mydomain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localhost.localdomain, , localhost
mynetworks = 192.168.1.0/24, 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl-passwords
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.trust.crt 
smtp_use_tls = yes
smtp_tls_loglevel = 1
smtp_tls_security_level = encrypt
smtp_sasl_mechanism_filter = login

Now create a password file which should have a valid email and password; onece hashed the password file postfix can read the data in it after that, you can delete the plaintext passwd file. Alternately, if you’d feel better keeping the file around for whatever reason, you can run chmod 600 passwd and make it only readable by its owner, which should be root

vi /etc/postfix/sasl-passwords
[smtp.gmail.com]:587 username@gmail.com:password
chmod 600 /etc/postfix/sasl-passwords
postmap /etc/postfix/sasl-passwords

Finally, reload postfix config for changes to take effect:

service postfix restart

HowTo: Increase The Maximum Number Of Open Files / File Descriptors (FD)

Posted on

Sometimes we will get the error message is like “too many files open“, it is because of you have reached the limits of opened file, You could always try doing a ulimit -n 2048. This will only reset the limit for your current shell and the number you specify must not exceed the hard limit.

Each operating system has a different hard limit setup in a configuration file. For instance, the hard open file limit on Solaris can be set on boot from /etc/system.

[anand@planetcure ~]$ cat /proc/sys/fs/file-max
172214

This show the maxmimum number of opened files for the single user, you can also use the below commad.

# ulimit -Hn
# ulimit -Sn

We can set this as System-wide and userlevel, for Global user configuration we can use /etc/sysctl.conf file under Linux operating systems. So you can increase the maximum number of open files by setting a new value in kernel variable /proc/sys/fs/file-max as follows (login as the root):

System-wide File Descriptors (FD) Limits

# sysctl -w fs.file-max=100000

The command allows to extend the new limit as 100000. You need to append the variable “fs.file-max = 100000” in the file /etc/sysctl.conf for the permanent set. It won’t be change after the reboot.

#sysctl -p

Verify by using below command

#sysctl fs.file-max

User-level File Descriptors (FD) Limits

Some of the case we need to specify the different level of setting for the particular users. This will override the sysetm wide settings and give the new limits for the users.

To specific limits by editing /etc/security/limits.conf file, we can all so use this file for all user limits

For apache:

httpd soft nofile 1024
httpd hard nofile 2048

All user limits

* soft nofile 1024
* hard nofile 2048

Save and close the file. You have to re-login to the console to get the new value.

su httpd -c "ulimit -Hn"
su httpd -c "ulimit -Sn"

Howto: mounting remote folder using ssh with fstab

Posted on

Mostly I suggest nfs for network share and it is easy to share over network, also for windows I use samba services, Here I found the suitable solution for remote share mount with out setup any server file share services. We can directly mount folders using SSH , so fuse is working behind this.

For this kind of setup you need to install few packages listed below

fuse-2.7.4-8.el5.i386.rpm  
fuse-libs-2.7.4-8.el5.i386.rpm  
fuse-sshfs-2.4-1.el5.i386.rpm

Direct download package repositories,

ftp://195.220.108.108/linux/centos/5.10/os/i386/CentOS/

Installation steps :

cd /home/downloads
wget ftp://195.220.108.108/linux/centos/5.10/os/i386/CentOS/fuse-libs-2.7.4-8.el5.i386.rpm
wget ftp://195.220.108.108/linux/epel/5/i386/fuse-sshfs-2.4-1.el5.i386.rpm
wget ftp://195.220.108.108/linux/centos/5.10/os/i386/CentOS/fuse-2.7.4-8.el5.i386.rpm
rpm -ivh fuse*.rpm

Password-less authentication

ssh-copyid -i ~/.ssh/id_rsa.pub anand@192.168.1.6

Mounting fstab entries like this

vi /etc/fstab
sshfs#anand@192.168.1.6:/backup/ISO-files /mnt/ISO fuse delay_connect,idmap=user,uid=1000,gid=1000,umask=0,allow_other,_netdev,workaround=rename 0 0

Save the fstab an make it auto moutn

mount -a

Now execute “mount” command, so you can see the entries like this.

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
root@192.168.1.6:/backup/ISO-files on /mnt/ISO type fuse.sshfs (rw,nosuid,nodev,allow_other)

Enjoy the share.

Error: 500 OOPS: vsftpd: refusing to run with writable root inside chroot()

Posted on

Each time while am installing VSFTPD on ubuntu and enable chroot for the users it will refuse to login to the home directory because of write permission in its parent dir, to fix this I used the command

chmod a-w  /path/to/the/ftp/home

but is was most annoying and frustrating problem. I supposed to update the vsftpd package with security fix. the steps are below.

wget http://ftp.us.debian.org/debian/pool/main/v/vsftpd/vsftpd_3.0.2-3_amd64.deb
dpkg -i vsftpd_3.0.2-3_amd64.deb
echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf
echo "seccomp_sandbox=NO" >> /etc/vsftpd.conf
service vsftpd reload

now the FTP service will work calm in my server.

Error: SPF – temperror error while sending email from google apps email service

Posted on Updated on

Configure SPF and DKIM for Google Apps

It was getting failure notification from Google while sending group mails, I was using google apps email accounts and created long time back, right now google not providing free apps email service. While analyzing I was found that the below error in message source, but I have already settup SPF record and its works fine. unfortunately it stop working. it has to be get some other SPF records in my DNS.

Received-SPF: temperror (google.com: error in processing during lookup of sender@domain.com: DNS timeout) client-ip=209.85.193.171;
Authentication-Results: mx.google.com;
 spf=temperror (google.com: error in processing during lookup of sender@domain.com: DNS timeout) smtp.mail=sender@domain.com
Received: by mail-pd0-f171.google.com with SMTP id g10so5691792pdj.16

Google, like most major email providers, actively works to combat forged email, spam, and scam email. For the most part, their defenses work. Open your Gmail spam folder to see the Google spam fighting team’s work. The vast majority of email there will be spam. Here’s how to set up SPF and DKIM records for Google Apps.

Configure SPF for Google Apps

If you use Google Apps for email, you’ll need access to your DNS provider to add an SPF record. In most cases, you simply login and create a new TXT record with the value of:

v=spf1 include:_spf.google.com ~all

Configure DKIM for Google Apps

You’ll need access to your Google Apps control panel and your DNS records to set DKIM. This is a three step process: 1. Create the DKIM key a. Login to your Google Apps Control Panel (e.g., http://www.google.com/a/yourdomain.com) b. Go to the “Advanced tools” tab, then scroll down to “Authenticate email” and click on “Set up email authentication (DKIM)”. This will open a new screen. c. Your domain name should be displayed. Click on “Generate new record”. Leave the default selector prefix as “google”. Click “Generate”. d. Leave this browser window open, and then create a new tab or browser window. 2. Create the DKIM DNS record a. Login to your DNS provider. Get to a place where you can add a TXT record. b. Create a new TXT record. The name of the TXT record should be:

google._domainkey

This creates a domain that, fully resolved, looks like: google._domainkey.yourdomain.com. c. The value for the DNS record will be a very long string of characters, something like:

v=DKIM1; k=rsa; t=y; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCG5in7gQIDAQAB

The actual length of the string will be much longer than that above. I find it simplest to copy-and-paste the information from the Control Panel page displaying the information. Save the DNS record. 3. Start Authenticating a. Wait 24-hours for your changes to propagate, and for Google’s servers to detect the changes. b. Login to your Google Apps Control Panel (e.g., http://www.google.com/a/yourdomain.com) c. Go to the “Advanced tools” tab, then scroll down to “Authenticate email” and click on “Set up email authentication (DKIM)”. This will open a new screen. d. Click “Start authentication”. As always, check Google’s detailed instructions if your setup is more complex.

SPF+DKIM-record-test

Verify that SPF and DKIM are configured

Send an email from your Gmail account to checkauth@verifier.port25.com after you’ve completed the SPF and DKIM setup. You’ll receive an email response in a few minutes. If everything is properly configured, you’ll receive a “PASS” for both the SPF and DKIM settings. This means your email is now more likely to be delivered than email lacking these records. My inbox, and everyone’s spam folders, are grateful for your efforts!

Howto: Installing internet Data card on Ubuntu server Minimal

Posted on Updated on

Ubuntu server comes with not GUI platform and if we go with minimal installation not sufficient packages available for addon’s, I tried to enable internet from my datacard  I can’t use dedicated IP for this server because Google will block the IP since the server was is used for some crawling job.  I used wvdial as a auto dialer. I configured DDNS for the ServerName.

Usb storage is working well but serial communication is not, also getting error like /dev/ttyUSB0 not found , I found some necessary packages are missing. I followed the below steps and now everthing working fine.

Install Dependencies

root@IN186:~# apt-get install libwvstreams4.6-base libuniconf4.6 wvdial gnome-ppp usb-modeswitch usb-modeswitch-data libusb-dev

Enable  usb serial Kernel module

root@IN186:~# modprobe  usbserial

Now configure the Dialer,

root@IN186:~# gedit /etc/wvdial.conf
[Dialer netconnect]
New PPPD = yes
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
Baud = 460800
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
Username = 93********
Password = 93*********
Phone = #777
Stupid Mode = 1
Auto DNS = 1
Check Def Route = 1

Change the username and password with your 10 digit MDN number given on the box of datacard. Save the file and reboot the computer. After reboot plugin your datacard and wait for 5 to 6 seconds. The connection might setup automatically. If not, run the following command

root@IN186:~# wvdial netconnect

If you face error log, saying CARRIER not found, change network settings (broadband 3.1x, high speed 1x, hybrid) as per you area availability using a Windows computer, and try again in Ubuntu. It will work !

Run linux commands through webpage

Posted on Updated on

You my use webinterface to run some bash scripts through you can watch system process and some other things, Lets watch how to do.

CGI support with apache / httpd webserver

$/var/www/cgi-bin
$vi desktop1.cgi

desktop1.cgi code listing:

#!/bin/bash
echo “Content-type: text/html”
echo “”
echo “<html><head><title>Bash as CGI”
echo “</title></head><body>”
echo “<h1>General system information for host $(hostname -s)</h1>”
echo “”
echo “<h1>Memory Info</h1>”
echo “<pre> $(free -m) </pre>”
echo “<h1>Disk Info:</h1>”
echo “<pre> $(df -h) </pre>”
echo “<h1>Logged in user</h1>”
echo “<pre> $(w) </pre>”
echo “<center>Information generated on $(date)</center>”
echo “</body></html>”

Change file permission to execute :

$chmod +X desktop1.cgi

Open your browser and check like this http://Your.server.ip/cgi-bin/disktop1.cgi