Asides
Remove Atlassian Stash from an Ubuntu system – CommandDump
Remove Atlassian Stash from an Ubuntu system – CommandDump
To remove atlassian stash from an Ubuntu system (in my case I needed a clean clone of a system similar to a system we Atlassian Stash on)
This assumes that you are using the default install and home locations , you may have to change the paths for your system (be careful, you dont want to accidentally do this if you need the information)
sudo service stop atlstash sudo rm /var/atlassian/stash -rf sudo rm /opt/atlassian/stash -rf sudo update-rc.d -f atlstash remove rm /etc/init.d/atlstash
Grep command to find all PHP shortcode entries
Grep command to find all PHP shortcode entries
As PHP files are moved from one server to the other, occassionally we find a situateion where PHP was developed on a server that allowed shortcodes “<?” which does not use the longer “<?php” if this happens, the PHP code does not execute and shows the code that would have executed, on the output of the page.
When this happens I have found that using a simple command I can identify all of the places that use the short code
grep -n '<?[^p=]' *.php
Installing Roundcube 1.1.4 on Postgres 9.3 – invalid identities table
Installing Roundcube 1.1.4 on Postgres 9.3 – invalid identities table
When installing roundcube 1.1.4 on postgres 9.3 the installer script showed that the identities table could not be upgraded correctly.
I looked more deeply by looking at the sql statement that creates the identities table and I see the following definition
CREATE TABLE `identities` ( `identity_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `user_id` int(10) UNSIGNED NOT NULL, `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', `del` tinyint(1) NOT NULL DEFAULT '0', `standard` tinyint(1) NOT NULL DEFAULT '0', `name` varchar(128) NOT NULL, `organization` varchar(128) NOT NULL DEFAULT '', `email` varchar(128) NOT NULL, `reply-to` varchar(128) NOT NULL DEFAULT '', `bcc` varchar(128) NOT NULL DEFAULT '', `signature` text, `html_signature` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY(`identity_id`), CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`) REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE, INDEX `user_identities_index` (`user_id`, `del`), INDEX `email_identities_index` (`email`, `del`) ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
when I look at the database table that I am upgrading from I can see that their is no column for ‘changed’, so when I try to add it\
postgres=# alter table identities add column changed datetime not null default '1000-01-01 00:00:00'; ERROR: type "datetime" does not exist LINE 1: alter table identities add column changed datetime not null ...
It fails so I try again and replace datetime with the timestamp column and it succeeds
postgres=# alter table identities add column changed timestamp not null default '1000-01-01 00:00:00'; RESULT OK
COMMAND DUMP – upgrading a standard proftpd install to TLS
COMMAND DUMP – upgrading a standard proftpd install to TLS
upgrade a basic proftpd install to support FTPS with these commands
cd /etc/proftpd mkdir -p ssl openssl req -new -x509 -days 365 -nodes -out /etc/proftpd/ssl/proftpd.cert.pem -keyout /etc/proftpd/ssl/proftpd.key.pem chmod 600 ssl/proftpd.*
Follow the prompts to put in your valid organization name
Then open the conf file #vi proftpd.conf and add the following (if the <IfModule mod_tls.c> directive already exist, replace the contents with the contenst below)
<IfModule mod_tls.c> TLSEngine on TLSLog /var/log/proftpd/tls.log #TLSProtocol TLSv1.2 TLSCipherSuite AES128+EECDH:AES128+EDH TLSOptions NoCertRequest AllowClientRenegotiations TLSRSACertificateFile /etc/proftpd/ssl/proftpd.cert.pem TLSRSACertificateKeyFile /etc/proftpd/ssl/proftpd.key.pem TLSVerifyClient off TLSRequired on RequireValidShell no </IfModule>
Restart proftpd
/etc/init.d/proftpd stop /etc/init.d/proftpd start
Your can test this by running the following command to make sure that you can connect using the certificate
openssl s_client -connect 127.0.0.1:21 -starttls ftp
COMMANDDUMP – Upgrading from PHP 5.3 to 5.6 on Ubuntu 14.04
COMMANDDUMP – Upgrading from PHP 5.3 to 5.6 on Ubuntu 14.04
When upgrading from PHP version 5.3 to 5.6 there are several things to worry about. On a shared system with multiple sites which do not make use of a common unit testing or library, these tools and commands could be useful to find issues. (this would also work from 5.4 or from 5.5 to 5.6)
COMMAND DUMP of things I ran.
Create a file call 5.4.php.searchterms
#echo import_request_variables >> upgrade.php.searchterms
#echo session_is_registered >> upgrade.php.searchterms
#echo session_register >> upgrade.php.searchterms
#echo session_unregister >> upgrade.php.searchterms
#echo define_syslog_variables >> upgrade.php.searchterms
#echo register_globals >> upgrade.php.searchterms
#echo sqlite >> upgrade.php.searchterms
#echo php_logo_guid >> upgrade.php.searchterms
#echo php_egg_logo_guid >> upgrade.php.searchterms
#echo php_real_logo_guid >> upgrade.php.searchterms
#echo zend_logo_guid >> upgrade.php.searchterms
#echo register_long_arrays >> upgrade.php.searchterms
#find -type f -name ‘*.php’ -exec grep -f upgrade.php.searchterms {} \; -ls
Check the version of your server
#lsb_release -a
#dpkg -l |grep php|grep apache
#php -v
#apache2ctl -vV
To upgrade from ubuntu 14.04 LTS you have to get php 5.6 from another repository as it is not includedin the default repos
apt-get -y update
apt-get install -y software-properties-common
add-apt-repository ppa:ondrej/php5-5.6 -y
apt-get -y update
apt-get -y install php5 php5-cli php5-common php5-curl php5-gd php5-imap php5-json php5-mysql php5-readline
You will be prompted when installing the latest version of PHP5 whether you want to keep the old or new version of PHP5.ini I chosed to install the pakage maintainer’s version, then I compare the two and update the new one with the differences. The following command makes it easy to compare by removing all of the commented lines from the diff against the backed up file
cd /etc/php5/apache2 diff <(grep -v '^\s*;' php.ini|awk '$1 != ""') <(grep -v '^\s*;' php.ini.ucf-old|awk '$1 != ""')|more
I also updated the php.ini date.timezone setting to my area due to this php.net post
date.timezone = America/Boise /etc/init.d/apache2 reload
mysql database dump restore – awk script create one script per table
mysql database dump restore – awk script create one script per table
I have used the following scripts to take a huge mysql dump scripts, with multiple databases and multiple tables, and use it to create one single script file for creating each table and for inserting the records into that table.
This script allows one to create a single large dump file for all databases on a server, yet when it comes time that some incremental restore is needed, the large dump file can be quickly stripped into files that can be used to restore a smaller incremental change.
Current Database: `49erstrivia` awk 'BEGIN{ TABLE="table_not_set"} { if($1=="--" && /Current Database:/) { CURRENTDB=$NF; gsub("`","",CURRENTDB); inserted=false; print CURRENTDB; } if($1=="CREATE" && $2=="TABLE") { TABLE=$3 gsub("`","",TABLE) inserted=false } if($1!="INSERT") { if(!inserted) { print $0 > "mysql."CURRENTDB"."TABLE".beforeinsert"; } else { print $0 > "mysql."CURRENTDB"."TABLE".afterinsert"; } } else { print $0 > "mysql."CURRENTDB"."TABLE".insert"; inserted=true } } '
Matraex Inc – Hiring Inside Sales
Matraex Inc – Hiring Inside Sales
Matraex Inc is hiring an inside sales professional. We are looking to fill this position immediately upon finding the correct person.
View more on our careers page
Bulk MX and DNS lookup enhanced
Bulk MX and DNS lookup enhanced
As our bulk MX and DNS tool has become more popular, Google has sent many people to our site looking for all sorts of DNS lookup tools. It seems that I was not the only one that needed a simple way to quickly gather DNS information on multiple domains at once
Many people have been able to quickly find all of the information they need about a domain (A, MX, NS and WHOIS records) and they move on. It turns out that even though the tool had the ability to lookup records for multiple domains at once, it is also useful for getting a quick DNS overview of a single domain. Web professionals often bookmark the tool and come back often.
The tool evolves as we get special requests, so my request to you is: let me know if I can add some functionality to the tool for you.
Several new features have been added in the last month.
- A premium option allows you to buy credits to remove usage limits
- Whois lookups are turned off on larger requests in order to avoid abuse restrictions
- Large scale lookups can be started by uploading a text file with one domain per line.
- For each file upload a background process builds a downloadable CSV file listing one dns record result per lin
- A row for each www and @ A record with the ip address
- One row for each MX record
- One row for each NS record
- One row displaying the ip addresses for each MX record.
- As the process builds the records file in the background , you can refresh the page withe your premium code in it and watch the progress.
Future upgrades may include
- The ability to choose to only lookup certain record types (A, MX or NS)
- Multithreading options to speed up background lookups.
- They ability to choose the download format of the DNS results list.
If you find the tool useful or you would like a certain type of enhancement, please leave a comment or send us a comment.
If you happen to be a techie that has to look at log files with timestamps, take a look at the tool that bulk converts timestamps to readable dates. You can just cut an paste a big block of text from you log and click
Postfix Configuration: The argument against reject_unverified_sender
Postfix Configuration: The argument against reject_unverified_sender
When configuring a mail server there techniques available which can help you to reduce spam.
A popular spam reduction technique is to ‘greylist’ emails. This method temporarily rejects an email if the server has never seen a prior attempt to send the same combination of From Email, To Email and From IP address , legitimate emails are tried again after a few moments and the email goes through no problem.
Another option in the postfix system which can be used to reduce spam is the ‘reject_unverified_sender’ option. As postfix confirming that the ‘Sender’ is a valid user, a connection is made to the server associated with the Senders domain (by MX record). It goes through the email sending process far enough to find out if the server accepts or rejects the Sender email (RCPT TO: sender@email.com).
While it seems like a good idea to confirm that the email address that is sending email to us is valid, if the sender’s server has greylisting on their domain they would reject the ‘verification’ connection, which would then ‘reject’ the attempted message.
For this reason, we choose not to globally install postfix servers with reject_unverified_sender.
————————–
There is some argument though that this does not cause a permanent problem, because when the reject_unverified_sender_code is set to 450. Because the rejection of the email will only be temporary and when the email is attempted again, the sender verification should pass the grey listing.
However, this is not good enough for me because there are other reasons that the sender verification could fail. Such as the fact that the server does not accept the MAIL FROM email from the verifying server. This could be because the doublebounce@ email address used for verification is not accepted by the server for other reasons such as the fact that THEY may be doing some sender verification, which would fail when an email is attempted to doublebounce, additionally the verifying server could end up getting a bad ‘reputation’ by only checking to see if email addresses are deliverable, but then never actually delivering a mail message.
For these reasons, I recommend skipping this setting and perhaps only using the reject_unknown_sender_domain which just checks whether there is a valid MX record for a domain.
While postfix is powerful with a plethora of options, not all of them immediately helpful.
Ubuntu – Base Secure Apache
Ubuntu – Base Secure Apache
In order to install a server that is able to pass the many SSL problems out there you can not install the default servers.
apt-get install make gcc
Install the latest open ssl from the openssl site first.
– download it to a directory
extract , config and install
then install apache2