Plesk DNS – Force reloading of config files from database records
by midnight on Sep.19, 2011, under Plesk
Plesk has created an easy to use script that will automatically reload all DNS records from the database.
You can download the script directly from their site at http://kb.parallels.com/879
or if for any reason they have removed the article, you can download it from our site at here
Once you run the script you need to restart the dns server by issuing the command “service named restart”.
That’s it!
Show or Verify Asterisk Password Field Hidden Value with View Passwords Bookmarklet
by midnight on Jun.06, 2011, under Javascript
This is a great javascript bookmark-let to reveal any password fields on a website, if you’ve forgotten saved password that get automatically filled.
JS Code:
javascript:void((function(){var%20a,b;b=”<”+”html>%5Cn<body>Passwords%20in%20this%20page:<p>%5Cn”;(function(c){var%20d,e,f,g,h;for(d=0;d<c.length;d++){try{arguments.callee(c.frames[d]);}catch(i){}}e=c.document.forms;for(f=0;f<e.length;f++){g=e[f];for(h=0;h<g.length;h++){if(g[h].type.toLowerCase()==”password”)b+=g[h].value+”<br>%5Cn”;}}})(top);b+=”</body>%5Cn</html>%5Cn”;a=window.open(“”,”",”width=200,height=300″).document;a.open();a.write(b);a.close();})())
Installing Plesk 8.6 on CentOS 5.5
by midnight on Jan.28, 2011, under Plesk
Installing Plesk 8.6 on a clean server install of CentOS 5.5 has some additional packages you need to add for the auto installer to install with no problems.
You first should remove PHP and the php-commons which are newer than the version that the plesk autoinstaller will initially install and it makes it freak out and cause it to exit out of the installer. This is also the case with mysql, so remove those packages prior to running the Plesk auto-installer.
yum remove php php-common mysql
The installer will also complain about the db4 package have some conflicts with existing files in the system. I don’t know why this is caused but it can be easily resolved by installing the db4-utils and db4-devel packages.
yum install db4-devel db4-utils
After taken care of those packages you should be able to successfully install Plesk 8.6 from the auto-installer script.
Show all usernames and passwords for Plesk email addresses
by midnight on Jan.05, 2011, under Plesk
Terminal – Show all usernames and passwords for Plesk email addresses
mysql -uadmin -p` cat /etc/psa/.psa.shadow` -Dpsa -e”select mail_name,name,password from mail left join domains on mail.dom_id = domains.id inner join accounts where mail.account_id = accounts.id;”
via Show all usernames and passwords for Plesk email addresses | commandlinefu.com.
SNMP v3 on Redhat Linux
by midnight on Jan.04, 2011, under Linux
Install required linux packages through yum.
yum install net-snmp-utils net-snmp-devel
Yum will pick up the dependencies you need. Now as root, run (make sure snmpd is stopped first)
/usr/bin/net-snmp-config –create-snmpv3-user -a PASSWORD MYUSERNAME
You’ll get the following output…
adding the following line to /var/net-snmp/snmpd.conf:
createUser MYUSERNAME MD5 “PASSWORD” DES
adding the following line to /usr/share/snmp/snmpd.conf:
rwuser MYUSERNAME
Before testing make sure that UDP 161 is permitted through iptables, and restart snmpd
/etc/init.d/snmpd start
now from another box, you can test, snmpwalk is the command, if it works your screen will fill up with loads of interesting snmp stuff, if it fails you’ll get an error. Timeout usually means UDP 161 is blocked or they can’t ping each other, and you’ll get authentication failure messages if there is a problem with your snmp accounts.
snmpwalk -v 3 -l authpriv -a md5 -A PASSWORD -x des -X PASSWORD -u MYUSERNAME 123.321.123.321
123.321.123.321 = IP Address
Import sql dump file to mysql database
by midnight on Jan.02, 2011, under MySQL
How to create mySQL dump file (export database to sql file)?
The easiest way to export is use next syntax in command prompt (cmd):
mysqldump -u USER -p PASSWORD DATABASE > filename.sql
For example we have database with next parameters:
database username baseu01
database password h4z56s3
database name database01
sql export file name export.sql
Appropriate command line for export is:
mysqldump -u baseu01 -p h4z56s3 database01 > filename.sql
After executing export command you will have file “export.sql” in your folder.
Example how sql export dump file looks like:
– phpMyAdmin SQL Dump
– version 2.9.0.2
– http://www.phpmyadmin.net
–
– Host: localhost
– Generation Time: Feb 26, 2007 at 07:14 AM
– Server version: 4.1.21
– PHP Version: 4.4.2
–
– Database: `optimumd_search`
–
– ——————————————————–
–
– Table structure for table `PLD`
–
CREATE TABLE `PLD` (
`ID` int(11) NOT NULL auto_increment,
`TITLE` varchar(255) NOT NULL default ”,
`CACHE_TITLE` text,
`TITLE_URL` varchar(255) default NULL,
`CACHE_URL` text,
`DESCRIPTION` longtext,
`PARENT_ID` int(11) NOT NULL default ’0′,
`STATUS` int(11) NOT NULL default ’1′,
`DATE_ADDED` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
…
INSERT INTO `PLD` VALUES (1, ‘Arts’, ‘Arts’, ‘Arts’, ‘index.php?c=1′, ”, 0, 2, ’2007-, ”);
INSERT INTO `PLD` VALUES (2, ‘Business’, ‘Business’, ‘Business’, ‘index.php?c=2’01′, 264,);
INSERT INTO `PLD` VALUES (3, ‘Computers and Internet’, ‘Computers aernet’, ‘Compd_I …);
INSERT INTO `PLD` VALUES (4, ‘Games’, ‘Games’, ‘Games’, ‘index.php1′, 88, 0, 0, ”, ”);
INSERT INTO `PLD` VALUES (5, ‘Health’, ‘Health’, ‘Health’, ‘index.php?c=5”, 170, 0,, ”);
INSERT INTO `PLD` VALUES (6, ‘Home’, ‘Home’, ‘Home’, ‘index.php?c=6′, ”, 0, 0, ”, ”);
INSERT INTO `PLD` VALUES (7, ‘Kids and Teens’, ‘Kids and Teens’, ‘Kids_and_Tee2-22 12:46 …);
INSERT INTO `PLD` VALUES (8, ‘News’, ‘News’, ‘News’, ‘index.php?c=8, 53, 0, 0, ”, ”);
INSERT INTO `PLD` VALUES (9, ‘Recreation’, ‘Recreation’, ‘Recreati007-02-25 151′, 118, …);
…
So what to do with sql dump file? Simple… Use it as an archive if some disaster happends and you loose your database or windows server crashes – you can allways import sql dump file back in mySQL database.
How to import sql dump file to mySQL database?
The scenario: server crashes and you got mysql dump file stored on your hard drive.
First you install mySQL database – then create database, database user and database password and then use next command line:
mysql -u username -p password database_name < filename.sql
If we use the same example as we used for export command line for export is:
mysql -u baseu01 -p h4z56s3 database01 < export.sql
Advanced options for exporting or importing a database
How to Export A MySQL Database Structures Only
If you no longer need the data inside the database’s tables (unlikely), simply add –no-data switch to export only the tables’ structures.
For example, the syntax is:
mysqldump -u username -ppassword –no-data database_name > dump.sql
How to Backup Only Data of a MySQL Database
If you only want the data to be backed up, use –no-create-info option. With this setting, the dump will not re-create the database, tables, fields, and other structures when importing. Use this only if you pretty sure that you have a duplicate databases with same structure, where you only need to refresh the data.
Syntax:
mysqldump -u username -ppassword –no-create-info database_name > dump.sql
How to Dump Several MySQL Databases into Text File
–databases option allows you to specify more than 1 database.
Example syntax:
mysqldump -u username -ppassword –databases db_name1 [db_name2 ...] > dump.sql
How to Dump All Databases in MySQL Server
To dump all databases, use the –all-databases option, and no databases’ name need to be specified anymore.
mysqldump -u username -ppassword –all-databases > dump.sql
How to Online Backup InnoDB Tables
Backup the database inevitable cause MySQL server unavailable to applications because when exporting, all tables acquired a global read lock using FLUSH TABLES WITH READ LOCK at the beginning of the dump until finish. So although READ statements can proceed, all INSERT, UPDATE and DELETE statements will have to queue due to locked tables, as if MySQL is down or stalled. If you’re using InnoDB, –single-transaction is the way to minimize this locking time duration to almost non-existent as if performing an online backup. It works by reading the binary log coordinates as soon as the lock has been acquired, and lock is then immediately released.
Syntax:
mysqldump -u username -ppassword –all-databases –single-transaction > dump.sql
How to renew plesk services ssl certificates (self signed)
by midnight on Jan.02, 2011, under Plesk
For Parallels Plesk Panel version 7.x, 8.x:
Server -> Certificates -> Add New Certificate
For Parallels Plesk Panel version 9.x:
Settings -> SSL Certificates -> Add SSL Certificate
Fill in required preferences and click button {Self-Signed}
New self-signed SSL certificate will be created in server certificate repository.
To assign this SSL certificate for securing your Parallels Plesk Panel mark enabled new SSL certificate in the list and push Secure control panel if you have Plesk 8.2 or later, or Install if you have older Plesk version.
Also, see Plesk documentation how to setup self-signed certificates.
After you created or uploaded new certificate into Plesk and wish to use it for domains you should set it for every IP you need, so domains use it when you access them via HTTPS.
It can be done on page Server -> IP Addresses -> “choose IP” by selecting needed Certificate in “SSL Certificate” drop down menu.
or
I use 1 SSL cert for plesk control-panel, pop3s, imaps and smtps.
After generating the new certificate in the administrator repository. make it your default certificate and mark it again and press setup to install it on your plesk admin server on port 8443. then put the certificate at your main ip-adresse in your ip-pool(maybee this step is not necessary).
copy /usr/local/psa/admin/conf/httpsd.pem
to
/usr/share/courier-imap/pop3d.pem, /usr/share/courier-imap/imapd.pem and /var/qmail/control/servercert.pem
please have a look that the owner(very important) and the chmod rights are the same of pop3d.pem, imapd.pem and servercert.pem. like before otherwhise qmail will for example not work/start, because it can’t read the file.
restart courier(imap,pop3) and qmail(smtp) in the plesk server service control panel.
after this plesk control-panel 8443, pop3s, imaps and smtps should work without warning messages and with only 1 ssl cert, if you use for all services the same main hostname.domain.com address like me.
(maybee you should also have a look, that the same hostname is configured in the qmail config file)
finally to test certificates :
openssl s_client -connect [host]:993
openssl s_client -connect [host]:995
openssl s_client -connect [host]:465
openssl s_client -connect [host]:8443
where for e.g. host=localhost
via How to renew plesk services ssl certificates (self signed) | Tech Stuff.
GRE tunneling
by midnight on Dec.11, 2010, under Linux
5.3. GRE tunneling
GRE is a tunneling protocol that was originally developed by Cisco, and it can do a few more things than IP-in-IP tunneling. For example, you can also transport multicast traffic and IPv6 through a GRE tunnel.
In Linux, you’ll need the ip_gre.o module.
5.3.1. IPv4 Tunneling
Let’s do IPv4 tunneling first:
Let’s say you have 3 networks: Internal networks A and B, and intermediate network C (or let’s say, Internet).
So we have network A:
network 10.0.1.0
netmask 255.255.255.0
router 10.0.1.1
The router has address 172.16.17.18 on network C. Let’s call this network neta (ok, hardly original)n and network B:
network 10.0.2.0
netmask 255.255.255.0
router 10.0.2.1
The router has address 172.19.20.21 on network C. Let’s call this network netb (still not original) As far as network C is concerned, we assume that it will pass any packet sent from A to B and vice versa. How and why, we do not care.
On the router of network A, you do the following:
ip tunnel add netb mode gre remote 172.19.20.21 local 172.16.17.18 ttl 255
ip link set netb up
ip addr add 10.0.1.1 dev netb
ip route add 10.0.2.0/24 dev netb
Let’s discuss this for a bit. In line 1, we added a tunnel device, and called it netb (which is kind of obvious because that’s where we want it to go). Furthermore we told it to use the GRE protocol (mode gre), that the remote address is 172.19.20.21 (the router at the other end), that our tunneling packets should originate from 172.16.17.18 (which allows your router to have several IP addresses on network C and let you decide which one to use for tunneling) and that the TTL field of the packet should be set to 255 (ttl 255).
The second line enables the device.
In the third line we gave the newly born interface netb the address 10.0.1.1. This is OK for smaller networks, but when you’re starting up a mining expedition (LOTS of tunnels), you might want to consider using another IP range for tunneling interfaces (in this example, you could use 10.0.3.0).
In the fourth line we set the route for network B. Note the different notation for the netmask. If you’re not familiar with this notation, here’s how it works: you write out the netmask in binary form, and you count all the ones. If you don’t know how to do that, just remember that 255.0.0.0 is /8, 255.255.0.0 is /16 and 255.255.255.0 is /24. Oh, and 255.255.254.0 is /23, in case you were wondering.
But enough about this, let’s go on with the router of network B.
ip tunnel add neta mode gre remote 172.16.17.18 local 172.19.20.21 ttl 255
ip link set neta up
ip addr add 10.0.2.1 dev neta
ip route add 10.0.1.0/24 dev neta
And when you want to remove the tunnel on router A:
ip link set netb down
ip tunnel del netb
Of course, you can replace netb with neta for router B.
5.3.2. IPv6 Tunneling
See Section 6 for a short bit about IPv6 Addresses.
On with the tunnels.
Let’s assume that you have the following IPv6 network, and you want to connect it to 6bone, or a friend.
Network 3ffe:406:5:1:5:a:2:1/96
Your IPv4 address is 172.16.17.18, and the 6bone router has IPv4 address 172.22.23.24.
ip tunnel add sixbone mode sit remote 172.22.23.24 local 172.16.17.18 ttl 255
ip link set sixbone up
ip addr add 3ffe:406:5:1:5:a:2:1/96 dev sixbone
ip route add 3ffe::/15 dev sixbone
Let’s discuss this. In the first line, we created a tunnel device called sixbone. We gave it mode sit (which is IPv6 in IPv4 tunneling) and told it where to go to (remote) and where to come from (local). TTL is set to maximum, 255. Next, we made the device active (up). After that, we added our own network address, and set a route for 3ffe::/15 (which is currently all of 6bone) through the tunnel.
GRE tunnels are currently the preferred type of tunneling. It’s a standard that is also widely adopted outside the Linux community and therefore a Good Thing.
Viewing Linux Disk Utilization
by midnight on Dec.10, 2010, under Linux
iostat syntax for disk utilization report
iostat -d -x interval count
- -d : Display the device utilization report (d == disk)
- -x : Display extended statistics including disk utilization
- interval : It is time period in seconds between two samples . iostat 2 will give data at each 2 seconds interval.
- count : It is the number of times the data is needed . iostat 2 5 will give data at 2 seconds interval 5 times
Remove Header Information from Postfix using Regexp
by midnight on Jan.22, 2010, under Postfix
GENERAL NOTES:
This document is intended for people who want to set up Postfix to remove specific headers within emails that pass through their systems. The most common use for this is to set up a relaying server that will remove any reference of where source emails originated and relevant information about the sender’s computer. Another useful application for this type of header_checks is to remove details about additional functions of your mail server that you do not want made available to the world.
This guide focuses on postfix’s header_checks capabilities, and although there are other ways to do so, we’ve found that this is by far the simplest.
IMPORTANT NOTES:
Use these instructions at your own risk.
Never test things out in a production environment!
In order for this to work, your main.cf file will have to have a reference to the header_checks file as follows:
header_checks = regexp:/etc/postfix/maps/header_checks
It is recomended that you keep all of your postfix map files in one directory along with any checks files. In this case, these will be kept in /etc/postfix/maps.
HEADER_CHECKS DETAILS:
In addition to any spam filters (see our header_checks file for more information), the below lines should be added to your header_checks file to preserve privacy and remove headers for the internal operations of your mail server:
# Sample For Dropping Headers: #/^Header: IfContains/ IGNORE /^Received: from 127.0.0.1/ IGNORE /^User-Agent:/ IGNORE /^X-Mailer:/ IGNORE /^X-Originating-IP:/ IGNORE
Each line above will search for headers tha have the content between the /^ and the / and will remove each line within the email headers that matches. As an example, the line “/^Received: from 127.0.0.1 .*/ IGNORE” will erase any lines from the email headers that list previous handoffs from an internal mail process to another. This is most commonly used for antivirus or antispam functions on a mail server.
The following lines are related to Anomy Sanitizer and SpamAssassin – two very useful products. These three lines will remove references from the headers for the two software packages, making sure that the users of the system will not easily identify the software that is running on the back end.
# Sample For Dropping Headers: #/^Header: IfContains/ IGNORE /^Received: from 127.0.0.1/ IGNORE /^X-Sanitizer:/ IGNORE /^X-Spam-Status:/ IGNORE /^X-Spam-Level:/ IGNORE
If one were to want to remove all headers relevant to personal information and previous hosts on which the email has passed, the following would be a possible configuration. Note that by removing all of this information, some mail servers will automatically identify emails passing through this system as spam. You will also be removing useful information for troubleshooting any problems that may arise with the mail server.
# Sample For Dropping Headers: #/^Header: IfContains/ IGNORE /^Received:/ IGNORE /^User-Agent:/ IGNORE /^Message-ID:/ IGNORE /^X-Mailer:/ IGNORE /^X-MimeOLE:/ IGNORE /^X-MSMail-Priority:/ IGNORE /^X-Spam-Status:/ IGNORE /^X-Spam-Level:/ IGNORE /^X-Sanitizer:/ IGNORE /^X-Originating-IP:/ IGNORE
OTHER METHODS OF IMPLEMENTATION:
Another method of keeping only the headers that you want would be as follows:
/^((Resent-)?From|To|Cc|Date|Return-Path|Message-ID):/ OK
/./ IGNORE
In this case, we are specifying all of the headers that are OK on the fist line, and removing all of the rest on the second line.
Note that this is just an example, and you will almost certainly want to add more headers to the OK list.
FINAL DETAILS:
Restart postfix once you have made your changes to main.cf and header_checks, and you should have the capabilities and filtering that are described above.
Original Source: http://www.posluns.com/guides/hedrem.html