- Figure out revision number of old good version
svn log http://svn.domain.com/app/branches/3_3_0 -r {2010-09-15}:{2010-09-20}
- See what code will be reverted
svn merge --dry-run -r 25951:25950 http://svn.domain.com/app/branches/3_3_0
- Perform the revision
svn merge -r 25951:25950 http://svn.domain.com/app/branches/3_3_0
- Commit your change
svn commit -m "Description"
Category Archives: Linux / Unix
Merge all changes from branch to trunk while leaving merge conflicts up to developers
- This document is assuming you have already checked out & updated trunk.
svn checkout http://server/svn/project/trunk ~/workspaces/project_trunk svn update ~/workspaces/project_trunk
- Check out the branch to merge from
svn checkout http://server/svn/project/branches/0.0.6 ~/workspaces/project_0.0.6
- Figure out the revision the branch began
$ svn log --verbose --stop-on-copy http://server/svn/project/branches/0.0.6 ------------------------------------------------------------------------ r3 | joe | 2010-08-03 12:50:08 -0700 (Tue, 03 Aug 2010) | 1 line Changed paths: A /branches/0.0.6/test A /branches/0.0.6/global Adding dirs for test sprint 1 ------------------------------------------------------------------------ r2 | joe | 2010-08-03 12:49:12 -0700 (Tue, 03 Aug 2010) | 1 line Changed paths: A /branches/0.0.6 (from /trunk:1) Creating branch for test Sprint 1 ------------------------------------------------------------------------
NOTE: The revision where the branch was created ($BCV = 2)
- CD into the trunk you are merging to & get the revision num.
cd /workspaces/project_trunk svn update
This will return a message “At revision XXXXX”
jsmith@PC-JSMITH /workspaces/project_trunk $ svn update At revision 92.
$TV=92
- CD to your trunk which you are merging TO
$ cd /workspaces/project_trunk
- Merge the changes from the branch to the trunk
$ svn merge --accept postpone -r ${BCV}:${TV} http://server/svn/project/branches/0.0.6 --- Merging r2 through r92 into '.': C test-3pom.xml Skipped 'foo.bar' C test-parentpom.xml U test-1srcmainjavacomarrisilibTest.java U test-1srcmainjavacomarrisilibApp.java C test-1pom.xml C test-2pom.xml Summary of conflicts: Text conflicts: 4 Skipped paths: 1
- Generate a report of merge conflicts
cd /workspaces/project_trunk find . -type f -name "*.working"
EX:
jsmith@PC-JSMITH /workspaces/project_trunk/trunk $ find . -type f -name "*.working" ./test-1/pom.xml.working ./test-2/pom.xml.working ./test-3/pom.xml.working ./test-parent/pom.xml.working
Copy this list into an email & remove working from the end of each line.
- Get rid of all conflict resolution files
find . -type f -name "*.working" -exec rm {} ; find . -type f -name "*-left.r*" -exec rm {} ; find . -type f -name "*-left.l*" -exec rm {} ;
- Commit your changes
svn commit -m "EM-300 - Merge project 0.0.6 to trunk"
- Send email to DEV team to handle merge conflicts
Solaris – Shutdown zone
<cmsys1:2388># zoneadm -z ${zonename} halt
Solaris – Reboot a zone
<cmsys1:2388># zoneadm -z ${zonename} reboot
Solaris – Log into zone
<cmsys1:2388># zlogin -C nagios
Solaris – List zones / status in a container
Include only running zones:
<cmsys1:114># zoneadm list -v ID NAME STATUS PATH BRAND IP 0 global running / native shared 1 sirls running /data/zones/sirls native shared
Include halted zones:
<cmsys1:2392># zoneadm list -vi ID NAME STATUS PATH BRAND IP 0 global running / native shared 7 sasvn running /data/zones/sasvn native shared 8 saldp running /data/zones/saldp native shared 9 nagios running /data/zones/nagios native shared 10 garls running /data/zones/garls native shared 11 dvrls running /data/zones/dvrls native shared 12 sirls running /data/zones/sirls native shared 13 qarls running /data/zones/qarls native shared - saweb installed /data/zones/saweb native shared - sacvs installed /data/zones/sacvs native shared
Is Solaris 32 or 64 bit?
<cmsys8:457># isainfo -v 64-bit amd64 applications amd_lzcnt popcnt amd_sse4a tscp cx16 mon sse3 sse2 sse fxsr amd_3dnowx amd_3dnow amd_mmx mmx cmov amd_sysc cx8 tsc fpu 32-bit i386 applications amd_lzcnt popcnt amd_sse4a tscp cx16 mon sse3 sse2 sse fxsr amd_3dnowx amd_3dnow amd_mmx mmx cmov amd_sysc cx8 tsc fpu <cmsys8:858># isainfo -kv 64-bit amd64 kernel modules
Solaris does not come with rsync. Install it
401 wget http://rsync.samba.org/ftp/rsync/rsync-3.0.7.tar.gz 402 gunzip ./rsync-3.0.7.tar.gz 403 ls 404 tar -xvf rsync-3.0.7.tar 405 cd rsync-3.0.7 406 ./configure 407 echo $PATH 408 id 409 make 410 ls /usr/ccs/bin 411 export PATH=$PATH:/usr/ccs/bin 412 make install 413 which rsync
Configure iptables (firewall) in Fedora
Basic Setup:
Here I have mentioned the basic configurations for enabling iptables in fedora linux.
List your current iptables configuration.:
[root@cmlin02:~]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT icmp -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:bb ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh ACCEPT tcp -- anywhere anywhere tcp dpt:snmp ACCEPT udp -- anywhere anywhere udp dpt:snmp ACCEPT udp -- anywhere anywhere udp dpt:netbios-ns ACCEPT udp -- anywhere anywhere udp dpt:netbios-dgm ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:netbios-ssn ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:microsoft-ds ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:https ACCEPT udp -- anywhere anywhere udp dpt:domain ACCEPT tcp -- anywhere anywhere tcp dpt:domain ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ldap ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ldaps ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ndmp REJECT all -- anywhere anywhere reject-with icmp-host-prohibited ACCEPT udp -- anywhere anywhere state NEW udp dpt:49222 ACCEPT udp -- anywhere anywhere state NEW udp dpt:mdns Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination
1) To allow established sessions to receive traffic
# iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
2) You could start by blocking traffic, but you might be working over SSH, where you would need to allow SSH before blocking everything else.
To allow incoming traffic on the default ssh port (22)
# iptables -A INPUT -p tcp --dport 22 -j ACCEPT
To allow incoming traffic on the default Squid port (3128)
# iptables -A INPUT -p tcp --dport 3128 -j ACCEPT
To allow incoming traffic on the default Apache port
# iptables -A INPUT -p tcp --dport 80 -j ACCEPT
To allow incoming traffic on the default samba port
# iptables -A INPUT -p udp --dport 137 -j ACCEPT # iptables -A INPUT -p udp --dport 138 -j ACCEPT # iptables -A INPUT -p udp --dport 139 -j ACCEPT # iptables -A INPUT -p tcp --dport 139 -j ACCEPT # iptables -A INPUT -p tcp --dport 445 -j ACCEPT
To allow incoming traffic on the default SNMP port (161)
# iptables -A INPUT -p tcp --dport 161 -j ACCEPT # iptables -A INPUT -p udp --dport 161 -j ACCEPT
Now check the current configuration
[root@cmlin02:~]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere tcp dpt:http ACCEPT tcp -- anywhere anywhere udp dpt:netbios-ns ACCEPT tcp -- anywhere anywhere udp dpt:netbios-dgm ACCEPT tcp -- anywhere anywhere udp dpt:netbios-ssn ACCEPT tcp -- anywhere anywhere tcp dpt:netbios-ssn ACCEPT tcp -- anywhere anywhere tcp dpt:snmp ACCEPT tcp -- anywhere anywhere udp dpt:snmp ACCEPT tcp -- anywhere anywhere tcp dpt:microsoft-ds ACCEPT tcp -- anywhere anywhere tcp dpt:squid
3) Once we enabled the above port.we can drop all other incoming ports.
# iptables -A INPUT -j DROP
Now check the rule
# iptables -L
For Interface based access for eth0 specify -i eth0
4) In the final step we have to enable loopback interface. After all the traffic has been dropped. We need to insert this rule before that. Since this is a lot of traffic, we’ll insert it as the first rule so it’s processed first.
#iptables -I INPUT 1 -i lo -j ACCEPT
5) To enabling logging
# iptables -I INPUT 5 -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
6) To save this configuration
# iptables-save > /etc/sysconfig/iptables
or
#service iptables save #service iptables start
This configuration will enable ssh port and disable all other incoming ports.
To manually edit iptables config
Also you can manual edit /etc/sysconfig/iptables
IP Tables configuration for other Services
1) Iptables for default ldap port
# iptables -A INPUT -p tcp --dport 389 -j ACCEPT # iptables -A INPUT -p tcp --dport 636 -j ACCEPT
or manually edit /etc/sysconfig/iptables and add the below mentioned line
-A INPUT -p tcp -m tcp --dport 389 -j ACCEPT
2) Iptables for Backup Exec
3) IP tables for smtp
#iptables -A INPUT -p tcp --dport 25 -j ACCEPT
or manually edit /etc/sysconfig/iptables and add the below mentioned line
-A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
4) iptables for smtps
#iptables -A INPUT -p tcp --dport 465 -j ACCEPT
or manually edit /etc/sysconfig/iptables and add the below mentioned line
-A INPUT -p tcp -m tcp --dport 465 -j ACCEPT
5) iptables for pop3 , pop3s
#iptables -A INPUT -p tcp --dport 110 -j ACCEPT #iptables -A INPUT -p tcp --dport 995 -j ACCEPT
or manually edit /etc/sysconfig/iptables and add the below mentioned line
-A INPUT -p tcp -m tcp --dport 110 -j ACCEPT -A INPUT -p tcp -m tcp --dport 995 -j ACCEPT
6) iptables for imap , imaps
#iptables -A INPUT -p tcp --dport 143 -j ACCEPT #iptables -A INPUT -p tcp --dport 993 -j ACCEPT
or manually edit /etc/sysconfig/iptables and add the below mentioned line
-A INPUT -p tcp -m tcp --dport 143 -j ACCEPT -A INPUT -p tcp -m tcp --dport 993 -j ACCEPT
7) iptables for webmin default port
#iptables -A INPUT -p tcp --dport 10000 -j ACCEPT
or manually edit /etc/sysconfig/iptables and add the below mentioned line
-A INPUT -p tcp -m tcp --dport 1000 -j ACCEPT
8) IPtables for named, domain
#iptables -A INPUT -p tcp --dport 53 -j ACCEPT #iptables -A INPUT -p udp --dport 53 -j ACCEPT
or manually edit /etc/sysconfig/iptables and add the below mentioned line
-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT -A INPUT -p udp -m udp --dport 53 -j ACCEPT
9) iptables for TFTP server
#iptables -A INPUT -p udp --dport 69 -j ACCEPT
or manually edit /etc/sysconfig/iptables and add the below mentioned line
-A INPUT -p udp -m udp --dport 69 -j ACCEPT
10) iptable configuration for DHCP server
#iptables -A INPUT -p udp --dport 67 -j ACCEPT #iptables -A INPUT -p udp --dport 68 -j ACCEPT
or manually edit /etc/sysconfig/iptables and add the below mentioned line
-A INPUT -p udp -m udp --dport 67 -j ACCEPT -A INPUT -p udp -m udp --dport 68 -j ACCEPT
11) iptables for NFS server- click here
12) iptables for FTP server – click here
13) iptables for NTP server
#iptables -A INPUT -p udp --dport 123 -j ACCEPT
or manually edit /etc/sysconfig/iptables and add the below mentioned line
-A INPUT -p udp -m udp --dport 123 -j ACCEPT
One of my iptables files:
[root@cmlin02:~]# more /etc/sysconfig/iptables *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [85:9266] -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT # HTTP -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT # XYMON #-A INPUT -p tcp --destination-port 80 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 1984 -j ACCEPT # SSH -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT # SNMP -A INPUT -p tcp --dport 161 -j ACCEPT -A INPUT -p udp --dport 161 -j ACCEPT # SAMBA -A INPUT -p udp -m udp --dport 137 -j ACCEPT -A INPUT -p udp -m udp --dport 138 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 139 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 445 -j ACCEPT # HTTPS -A INPUT -p tcp -m state --state NEW --dport 443 -j ACCEPT # BIND -A INPUT -p udp -m udp --dport 53 -j ACCEPT -A INPUT -p tcp --dport 53 -j ACCEPT # LDAP -A INPUT -m state --state NEW -m tcp -p tcp --dport 389 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 636 -j ACCEPT # WEBMIN -A INPUT -m state --state NEW -m tcp -p tcp --dport 10000 -j ACCEPT #-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited # avahi -A INPUT -m state --state NEW -p udp --dport 49222 -j ACCEPT -A INPUT -m state --state NEW -p udp --dport 5353 -j ACCEPT COMMIT
Get port usage report on Solaris
#!/usr/bin/ksh for pid in `ps -ef -o pid | tail +2` do foundport=`pfiles $pid 2>&1 | grep "sockname: AF_INET" | grep -v "port: 0" | awk '{print $NF}'` if [ "$foundport" != "" ]; then foundproc=`pfiles $pid 2>&1 | grep "^$pid:"` echo "$foundprocn$foundport" fi done exit