Wednesday, February 29, 2012

mod_security bypass administrator backend (forbidden)

edit the /etc/httpd/modsecurity.d/modsecurity_localrules.conf


SecRule REQUEST_FILENAME "/joomla/administrator/index2.php" \
"allow,phase:1,nolog,ctl:ruleEngine=Off"


Ref: http://optics.csufresno.edu/~kriehn/fedora/fedora_files/f7/howto/joomla.html

Tuesday, February 28, 2012

centos install usb modem sms gateway

http://catatanlepas.com/komputer/37-aplikasi-linux/194-membuat-sms-gateway-di-centos-55.html

1. install wvdial

yum install wvdial

2. scan for usb device


[root@local ~]# wvdialconf /etc/wvdial.conf
Scanning your serial ports for a modem.

WvModem<*1>: Cannot get information for serial port.
ttyS0<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyS0<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud
ttyS0<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
ttyS1: No such device or address
Port Scan<*1>: S1
ttyS2: No such device or address
Port Scan<*1>: S2
ttyS3: No such device or address
Port Scan<*1>: S3


Sorry, no modem was detected!  Is it in use by another program?
Did you configure it properly with setserial?

Please read the FAQ at http://open.nit.ca/wvdial/

If you still have problems, send mail to wvdial-list@lists.nit.ca.

3. switch from usb mass storage to modem mode

http://www.linuxquestions.org/questions/linux-newbie-8/zte-ac2627-usb-modem-not-working-in-fedora-9-a-795499/
yum install usb_modeswitch



Saturday, February 25, 2012

rsync + ssh on different port

rsync -av --progress --inplace --rsh='ssh -p8023' somefile user@host:somedir/

In the example above, rsync will use ssh on port 8023.


ref:http://www.linuxquestions.org/questions/linux-software-2/rsync-ssh-on-different-port-448112/

Wednesday, February 22, 2012

svn without SP3

use silksvn to checkout svn repository for older sp2 windows xp. sp3 users can use tortise svn

http://www.sliksvn.com/en/download/

Sunday, February 12, 2012

install git on centos

http://www.davegardner.me.uk/blog/2010/01/29/setting-up-git-on-centos-5-server/
http://www.jedi.be/blog/2009/05/06/8-ways-to-share-your-git-repository/#apachehttp

#yum install git

(using rpmforge repository)


Creating and sharing a repository

Creating a repository is easy! Simply create a folder and type git init.
mkdir newrepo
cd newrepo
git init
Once created, we can copy/create our files (think svn import) and then do:
git add .
git commit


Share over apache http

Preparing the repository
# On the web server we assume var/git as the central repository place and will create a new project-X dir
$ cd /var/git
$ mkdir project-X
$ cd project-X


# now we initialize this directory
# but instead of using git init, we use  git --bare init
# "A short aside about what git means by bare: A default git repository assumes that you will be using it as your working directory
# , so git stores the actual bare repository files in a .git directory alongside all the project files. Remote repositories don't need copies of the
 files on the filesystem unlike working copies, all they need are the deltas and binary what-nots of the repository itself. This is what "bare" means to git. Just the repository itself."
$ git --bare init
Now that we created the project directory we need to give apache access to it:
  • Be sure to set the correct permissions on the /var/git directory so that it can be read by the webuser. chown -R apache:apache /var/git/project-X
  • If you have selinux enabled: chcon -R -t httpd_sys_content_t /var/git/project-X
  • Enable the post-update hook: chmod +x /var/git/project-X/hooks/post-update

When you did not set the post commithook:
$ git clone http://git.yourdomain.com/project-X
Initialized empty Git repository in /Users/mydir/project-X/.git/
fatal: http://git.yourdomain.com/project-X.git/info/refs not found: did you run git update-server-info on the server?
Then you can need to run it manually the first time
$ cd /var/git/project-X
$ sudo -u apache git update-server-info

Preparing apache
This document assumes you have a basic apache setup. And you have virtual name server working. Most of it is standard acces to the directory.
To allow write access, we need to have Webdav enabled. 
http://www.kernel.org/pub/software/scm/git/docs/howto/setup-git-server-over-http.txt 

 Servername git.mydomain.com
 DocumentRoot /var/git
 
    DAV On
    Options +Indexes +FollowSymLinks 
  AllowOverride None
  Allow from all
  Order allow,deny
 

This will add a virtual server that has access to the /var/git directory using simple browsing.
In case you are experiencing trouble:
  • Remove the restrictions from welcome.conf: in this default file, it disables the index option. Error: ...
  • Note the + before the options, to allow the merge of permissions
Controlling access
We control access to your repository using apache groupfiles and password files

 ServerName git.yourdomain.com
 DocumentRoot /var/git
 
  DAV On
  Options ExecCGI FollowSymLinks Indexes
  # Deny everyything here
  Deny from all
  AuthType Basic
  AuthName "git repository"
  AuthUserFile /var/git/htpasswd.git
  AuthGroupFile /var/git/htgroup.git
 


 
  Allow from all
  Order allow,deny
  
   Require group project-X-read
  
  
   Require group project-X-write
  
  




Accessing the repository
Git uses curl to access http repositories. Because our repository is now protected we need to create an entry in our $HOME/.netrc file
$ cat $HOME/.netrc
machine git.yourdomain.com
login reader
password reader
Now you should be able to clone project-X
$ git clone http://git.mydomain.com/project-X
Possible Errors
Trying update
error: Cannot access URL http://git.yourdomain.com/project-X/, return code 22
error: failed to push some refs to 'http://git.yourdomain.com/project-X'
If there's something wrong with the permissions. Maybe you don't have webdav enabled, the user is in the wrong group, or filepermissions are not set correctly. Check your apache error_log 

$ git clone http://git.yourdomain.com/project-X
$ git push
fatal: git-push is not available for http/https repository when not compiled with USE_CURL_MULTIerror: failed to push some refs to 'http://git.yourdomain.com/project-X'
Either you compile your git client with the correct curl options. Or you can alternatively mount the remote repository as webdav share and access it via file:// references. See http://wiki.dreamhost.com/Talk:Git
The following happens if your curl library  was not compiled with the correct options to post to 
http://kerneltrap.org/mailarchive/git/2008/1/13/564431
After a bit of research it seems that CURL compilation into GIT was not entirely successful for the Git on Mac OS X. As I was already mounting the git repository via WebDAV you an push and pull to your locally mounted repository by replacing the http URL with the path to your mounted WebDAV (/Volumes//). This worked pretty well for me and works well with Dreamhost with very little configuration.


$ git push
Fetching remote heads...
   refs/
   refs/tags/
   refs/heads/
   No refs in common and none specified; doing nothing.

This happens when you cloned an empty repository: Because you cloned an empty repository , you need to specify the origin and master , after this first push, you can use git push as usual
$ git push origin master

Thursday, February 09, 2012

svn + ssh on another port

http://www.techper.net/2009/01/11/changing-port-number-of-svnssh-subversion-protocol/


configuration in .subversion/config:
[tunnels]
sshtunnel = ssh -p 12345
I can use a subversion URL like this: svn+sshtunnel:// and subversion will spawn the given command with the port option.
Related Posts Plugin for WordPress, Blogger...