Advertisements

Posts Tagged Debian

Simple outbound email configuration for Ubuntu Server 12.04 using sSMTP

If all you really want from your Ubuntu Server is to be able to send you email if something goes wrong, or the occasional email to a trusted partner, friend, colleague, etc, then you want a simple solution. Although Postfix or sendmail, etc, will work in a satellite configuration, it’s still too heavy and over-the-top for this type of setup.

Enter sSMTP.

apt-get install ssmtp

Now open /etc/ssmtp/ssmtp.conf in your favorite text editor and, to get it working on an example gmail account, set it up like so:

root=youremail@gmail.com
mailhub=smtp.gmail.com:587
AuthUser=username
AuthPass=password
UseTLS=YES
UseSTARTTLS=YES
AuthMethod=LOGIN

Save the file, and you’re done.

Example for Amazon SES users. Be sure the sending domain is verified or mail will get rejected.:

root=youremail@gmail.com
# from SES SMTP settings
mailhub=email-smtp.us-east-1.amazonaws.com:587
AuthUser=username
AuthPass=password
UseTLS=YES
AuthMethod=LOGIN

Important: You’re leaving your Gmail account password in a plaintext file. Make sure you’re using strong passwords. Even better, use Google 2-factor authentication so you can use an application-specific password for sSMTP.

UPDATE: Lastly, update the permissions

chown root:mail /etc/ssmtp/ssmtp.conf
chmod 640 /etc/ssmtp/ssmtp.conf

Unprivileged users who have a need to send mail using sendmail must be a member of the mail group, or they will receive the following error:

mail: Cannot open mailhub:25

This was written for Ubuntu Server 12.04 64-bit.

Further reading:

Advertisements

, , , , ,

Leave a comment

Easy Ubuntu data usage monitor

If you’re lucky enough to have a broadband card that works under Linux, your plan probably includes an “allowance” or data usage quota per month. You might be thinking how nice it would be to have a utility that tracks your data usage for the month (or other period) and gives you an easy-to-read report. You might also want said monitoring utility to have pre-built packages for Ubuntu / Debian.

NTM (Network Traffic Monitor) is what you want. As of this post the latest version is NTM 1.2.4.

Start by going to the NTM download site and downloading ntm-1.2.4.deb. Then double-click on it to install it using Ubuntu Software Center.

Once installed, you will find NTM at Applications > Internet.

Upon starting, it minimizes to the tray (next to the clock). You can open the interface by left-clicking the icon, and open the menu to access preferences by right-clicking the icon.

By default NTM monitors ppp0, which is the most likely interface that your broadband card will use. If you want to monitor a different interface, change that under the General tab. If you’re not sure what interface to use, run the following command:

ifconfig -a

This lists all interfaces and will help you locate your desired connection by IP / MAC and other info.

Also by default, NTM is configured with some other settings, such as auto-disconnecting after a data threshold has been reached (98MB by default), and disconnecting after a certain number of usage hours (30). These are likely too low for most mobile broadband users. Be sure to change these settings, under the Traffic, Time Slot, and Time tabs, to prevent unexpected disconnections.

Questions, comments, or other feedback? Please comment below. Thanks!

, ,

Leave a comment

Ubuntu, Apache, VirtualHosts, and SSL – part 2

In my first post about Ubuntu, Apache, VirtualHosts, and SSL I covered generating self-signed certificates and implementing them for Apache VirtualHosts. What I didn’t cover was — if you implemented this without a correct base configuration — you’d end up with some unexpected results if you tried to visit your base domain over SSL.

It’s simple to resolve this. First, edit /etc/apache2/ports.conf and modify as follows:

  
  # If you add NameVirtualHost *:443 here, you will also have to change
  # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
  # to 
  # Server Name Indication for SSL named virtual hosts is currently not
  # supported by MSIE on Windows XP.
+ NameVirtualHost *:443
  Listen 443
  

If you were reading closely, you know what to do next. Modify sites-available/default-ssl file and change the directive as follows:

Now, restart apache:

/etc/init.d/apache2 reload

Your base SSL domain will now display the expected DocumentRoot, but the certificate will contain the URL localhost.localdomain. To fix this run, as root:

make-ssl-cert generate-default-snakeoil --force-overwrite

— From /usr/share/doc/apache2.2-common/README.Debian.gz

If you install the ssl-cert package, a self-signed certificate will be
automatically created using the hostname currently configured on your computer.
You can recreate that certificate (e.g. after you have changed /etc/hosts or
DNS to give the correct hostname) as user root with:

make-ssl-cert generate-default-snakeoil –force-overwrite

Questions, comments, and feedback regarding this guide and welcome!

, , , , ,

Leave a comment

Ubuntu, Apache, VirtualHosts, and SSL

The goal of this guide is to provide you with an Apache SSL configuration with a unique self-signed certificate for each VirtualHost.

These self-signed certificates are not intended for e-commerce or public-facing web sites. Rather, they are intended for SSL encryption of administration areas on personal websites or administration programs that have HTTP interfaces. Of course, if you have a commercially-signed certificate, you can skip the certificate-generation part of the guide, and proceed to implementing it in a VirtualHost configuration.

Written for Apache on Ubuntu Server 10.04.

First, install the base Apache SSL certificate and enable the Apache SSL module

sudo apt-get install ssl-cert
a2enmod ssl

This installs a base SSL certificate and a generic ‘default-ssl’ site configuration. We will be generating per-domain self-signed certificates later. We will also not be using the ‘default-ssl’ site configuration.

Generating Certificates

Generate a hostname-specfic SSL certificate by following these instructions quoted

— From /usr/share/doc/apache2.2-common/README.Debian.gz

To create more certificates with different host names, you can use
make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /path/to/cert-file.crt
This will ask you for the hostname and place both SSL key and certificate in
the file /path/to/cert-file.crt . Use this file with the SSLCertificateFile
directive in the apache config (you don’t need the SSLCertificateKeyFile in
this case as it also contains the key). The file /path/to/cert-file.crt should
only be readable by root. A good directory to use for the additional
certificates/keys is /etc/ssl/private .

Example:

make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/ssl/private/example.com.crt

Implementation

Now that the key is generated, we’re going to create an Apache VirtualHost configuration for SSL connection. Chdir to /etc/apache2/sites-available and copy (for example) example.com.conf to example.com-ssl.conf

Next, edit the example.com-ssl.conf file and make the following changes:

* At the beginning of the file (before the tag, add:

Example:


...

* Change the defined port number in the tag from 80 to 443

Example:

...

...

* At the end of the file, after the tag, add

Example:
...

* Within the tag, add the following directives:

SSLEngine On
# The following should point to your SSL cert file in /etc/ssl/private
SSLCertificateFile    /etc/ssl/private/example.com.crt

— From /etc/apache2/sites-available/default-ssl

#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on
#   A self-signed (snakeoil) certificate can be created by installing
#   the ssl-cert package. See
#   /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
#   If both key and certificate are stored in the same file, only the
#   SSLCertificateFile directive is needed.
SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem

* Add the SSL workaround for MSIE in your section as follows:

BrowserMatch "MSIE [2-6]" 
nokeepalive ssl-unclean-shutdown 
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

— /usr/share/doc/apache2.2-common/README.Debian.gz

SSL workaround for MSIE
———————–
The SSL workaround for MS Internet Explorer needs to be added to your SSL
VirtualHost section (it was previously in ssl.conf but caused keepalive to be
disabled even for non-SSL connections):
BrowserMatch “MSIE [2-6]”
nokeepalive ssl-unclean-shutdown
downgrade-1.0 force-response-1.0
BrowserMatch “MSIE [17-9]” ssl-unclean-shutdown
The default SSL virtual host in /etc/apache2/sites-available/default-ssl
already contains this workaround.

Lastly, enable the newly-created site and reload apache:

a2ensite example.com-ssl.conf

Enabling site example.com-ssl.conf.

Run '/etc/init.d/apache2 reload' to activate new configuration!

(This creates the symlink from /etc/apache2/sites-enabled to your config file in /etc/apache2/sites-available – you can also create it manually if your configuration requires it)

/etc/init.d/apache2 reload

* Reloading web server config apache2                                   [ OK ]

Of course, make sure after all of this that your firewall isn’t blocking port 443.

Questions, comments, and feedback regarding this guide and welcome!

, , , ,

2 Comments

Undo apt-get build-dep

When you want to compile something from source in Ubuntu/Debian, the easiest way to install the dependencies required to compile it is to run apt-get build-dep PACKAGE. Unfortunately, there is no built-in command to remove these dependencies. Thankfully, a discussion on Launchpad gives a good solution to this problem. Using this, you can “undo” an apt-get build-dep by running a single command. Note that this requires aptitude, so if you’re running Ubuntu 10.10, or you’ve removed aptitude, you’ll first need to install it using the following:

sudo apt-get install aptitude

Now, undo the apt-get build-dep:

sudo aptitude markauto $(apt-cache showsrc PACKAGE | grep Build-Depends | perl -p -e 's/(?:[[(].+?[])]|Build-Depends:|,||)//g')

Replace PACKAGE with the name of the package you’ve previously ran apt-get build-dep for, such as kernel or python2.5

After a few moments, the packages will be marked as automatically installed and you will either be prompted to remove them immediately, or you can remove them with the following command, which uninstalls all packages automatically installed but no longer needed:

sudo apt-get autoremove

Questions, comments, and feedback are welcome and appreciated.

, ,

Leave a comment

Ubuntu CUPS Brother Print Self-Test Page Error

If you followed my previous article about setting up the Brother HL-2170W under Linux, and attempted to print a self-test page, you may hav e gotten the following less-than-helpful error message:

Print Self-Test Page Brother Error

Unable to send command to printer driver!

Unsupported format ‘application/vnd.cups-command’!

Two bugs have been reported against this in Launchpad (36532 and 510781) and one in Debian (381743), but the end result is that there are two options, “Print Test Page” and “Print Self Test Page.” The “Self-Test” is what generates the error. If you use the “Test Page”, it seems to work without error. The Launchpad pages show fixes/workarounds, but if printing works fine for you, it may be easier to simply let it be until it’s fixed upstream.

Questions, comments, and feedback are welcome in the comments.

, , ,

Leave a comment

Installing Skype on Ubuntu (or Debian) with updates for Skype URLs

This how to will show you how to install a Skype client in Ubuntu & Debian base operating system.

1. First of all you need to start up Synaptic Package manager. Go to System->Administration->Synaptic Package Manager

2. From Synaptic, go to Settings->Repositories. Click on Other  Software Tab. Check the box next to Canonical Partners.

3. Click Close, and Click ‘Reload’ at the top of Synaptic. Now you can locate Skype and install it from Synaptic or Ubuntu Software Center.

Now to install skype-action-handler to handle skype: URLs:

Download and install the Skype Action Handler
http://search.cpan.org/~ecarroll/Net-DBus-Skype-0.02/script/skype-action-handler (direct download link) and extract.

In a console, navigate to extracted files directory and run these as root:

perl Makefile.PL
make
make test
make install

For Mozilla (Firefox)
* Open Mozilla (Firefox)
* Type about:config in the address-bar to open the configuration editor.
* Use the scroll bar to navigate to the network.protocol… section.
* Check if the network protocol section includes a network.protocol-handler.app.skype key.
* If a key exists, edit it. If no key exists, create a key by right-clicking on any key and selecting New -> String from the pull-down menu.
* Enter network.protocol-handler.app.skype as the key name.
* Enter /usr/local/bin/skype-action-handler as the key value.

### For GNOME-aware browsers (Epiphany, Firefox 1.5)
Run the following two commands:

/usr/bin/gconftool-2 -s -t string /desktop/gnome/url-handlers/skype/command '/usr/local/bin/skype-action-handler "%s"'
/usr/bin/gconftool-2 -s -t bool /desktop/gnome/url-handlers/skype/enabled true

Thats it – Test Call should work in Firefox. UPDATE: Except, it doesn’t work here. I can’t give you a valid link because WordPress keeps eating it. :\ But, try this yourself in an html file:

skype:echo123?call

To undo the above gconftool key changes, you may run the following:

gconftool-2 --recursive-unset /desktop/gnome/url-handlers/skype

Original post by thestudio53 at http://blogs.skype.com/linux/2006/08/making_skype_links_work.html. Rewritten with updates for Ubuntu 10.04 and information from http://ubuntuforums.org/showthread.php?t=449543

Questions, comments, and feedback are welcome. Please share your experience with this so I can improve the guide. Thank you.

, , , , ,

11 Comments

Backing up your server using JungleDisk Server Edition – part 1

 

This guide assumes you’re using a Debian-based (Ubuntu, Debian) build of Linux, and we’ll be using the 64-bit download from JungleDisk. The instructions don’t really change for the 32-bit version, except for the installer file name.

The first steps:

Go over to the JungleDisk Business page and sign up for, and download, the server edition. Now, this edition comes in two very important parts: The server-side program, and the management-side program.

The server-side program is what runs on your server. That’s the “backup engine” if you will. You will download the program appropriate for your server environment.

The management-side program is the program that you remotely connect to the “server” to configure it. You will download the program appropriate for running on your desktop computer.

It is fine to download the server-side version for Linux and the management-side version for Windows, if that is your configuration. In this case, I’m downloading the Linux .deb server-side installer for 64-bit linux, and the Windows management-side program. I can’t give you the actual download links; you’ll find them in your account page.

Now, on the server, I’m going to install the server-side engine as root. Navigate to the directory where you placed the downloaded file, and run:

sudo dpkg -i junglediskserver_315-0_amd64.deb

That will install the server. Follow the directions. Now, since it’s the deb package, it will automatically set up init scripts to make sure the jungledisk engine runs on startup. However, you will notice that at the end of the setup you were prompted to copy and edit an xml file. Copy /usr/local/share/jungledisk/junglediskserver-license-EXAMPLE.xml to /etc/jungledisk/junglediskserver-settings.xml

cp /usr/local/share/jungledisk/junglediskserver-license-EXAMPLE.xml /etc/jungledisk/junglediskserver-settings.xml

Now use your favorite editor to make a few changes to /etc/jungledisk/junglediskserver-settings.xml:

between and , enter your license key (found in your JungleDisk account).

Now, restart the jungledisk service.

/etc/init.d/junglediskserver restart

Myself, I also added my login user name and password between and respectively, but I don’t think it’s necessary. Worth keeping in mind if something doesn’t work right.

That’s all for the server-side configuration.

Now, on your management-side program, simply run the program and log into your JungleDisk account and your server should appear in the list. Double-click on it and the configuration screen will appear, where you can create backup sets and schedule them as you wish.

Want to correctly backup your MySQL databases in your backup set? See part 2 of this article, coming soon!

Comments are welcome, as always!

, , , , , ,

6 Comments

Logitech Devices on Ubuntu Linux (and others)

A friend presented me with an issue a while back where certain buttons on his Logitech keyboard, specifically the zoom bar, didn’t work properly under Ubuntu. After some searching, I found a site that codes Linux drivers for these devices, and directed him to it. They have drivers for Debian, CentOS, Fedora, Mandriva, Mint, RedHat, Suse, and Ubuntu. The full list of supported devices is below.

After testing, he came up with a set of instructions (originally posted at another site) and I have rewritten them here in a [hopefully] more accurate process.

  1. Head over to HIDPoint
  2. Fill in the requested information on the download page (mouse/keyboard/OS/etc…), you can ignore the email field if you wish and select download. Make sure you select correctly if you’re using a 64-bit or non-64-bit OS.
  3. On the next screen, select the link “Download Now“, and save the file to your hard drive.
  4. Navigate to wherever you downloaded the file to.
  5. Right click on the file, and go to Properties > Permissions and check the box for execute.
  6. Double click on the file and select “Run In Terminal“. Type “Y” then hit “Enter”.
  7. Follow all on screen prompts.
  8. After Installation is complete, you will need to reboot.

Supported devices:

Keyboards: Mice: Mice:
  • Logitech Comfort Keyboard
  • Logitech Cordless Desktop
  • Logitech Cordless Elite
  • Logitech Cordless Ultra-Flat
  • Logitech DiNova
  • Logitech diNovo Edge
  • Logitech diNovo Mini
  • Logitech EasyCall Keyboard
  • Logitech EX 100 Keyboard
  • Logitech EX 110 Series
  • Logitech LX 300 Keyboard
  • Logitech LX 500/501 Keyboard
  • Logitech LX 710 Keyboard
  • Logitech Media Keyboard
  • Logitech Media Keyboard Elite
  • Logitech MX 3000 Keyboard
  • Logitech MX 3200 Keyboard
  • Logitech MX 5000 Keyboard
  • Logitech MX5500
  • Logitech Numeric Pad
  • Logitech S510 Keyboard
  • Logitech S520 Keyboard
  • Logitech Wave Corded
  • Logitech Illuminated Keyboard
  • Logitech Wave Cordless
  • Logitech Cordless Click!
  • Logitech Cordless Click! Plus
  • Logitech Cordless Mini Optical Mouse
  • Logitech Cordless Mouse
  • Logitech Cordless Mouse for NoteBook
  • Logitech Cordless Optical
  • Logitech Cordless Optical TrackMan
  • Logitech Cordless TrackMan Wheel
  • Dell BT Travel Mouse
  • Dell BT/XPS M2010 Mouse
  • Logitech diNovo Edge
  • Logitech G1 Optical Mouse
  • Logitech G3 Laser Mouse
  • Logitech G3/MX518 Optical
  • Logitech G5 Laser Mouse
  • Logitech G7 Cordless Laser
  • Logitech Laser Corded Mouse
  • Logitech Laser Tiltwheel Mouse
  • Logitech LX3 Optical Mouse
  • Logitech LX5 Cordless
  • Logitech LX6 Cordless Optical
  • Logitech LX7 Cordless Laser
  • Logitech LX7 Cordless Optical
  • Logitech LX8 Cordless Laser
  • Logitech Marble Mouse
  • Logitech Media Play Cordless
  • Logitech MX 1000 for Bluetooth
  • Logitech MX 518 Optical Mouse
  • Logitech MX 600 Cordless Mouse
  • Logitech MX Air
  • Logitech MX Revolution
  • Logitech MX Revolution Bluetooth
  • Logitech MX1000 Laser
  • Logitech MX1100 Laser
  • Logitech MX310 Corded
  • Logitech MX320/RX1000 Laser Mouse
  • Logitech MX400 Laser Mouse
  • Logitech MX510 mouse
  • Logitech MX600 Cordless Laser
  • Logitech MX610 Laser Cordless
  • Logitech MX610 Left-Handed
  • Logitech MX620 Laser Cordless
  • Logitech MX700 Cordless Optical
  • Logitech MX900 Cordless
  • Logitech NX80
  • Logitech Optical Tilt-Wheel Mouse
  • Logitech Optical Wheel Mouse
  • Logitech Optical Workstation Mouse
  • Logitech RX250 mouse
  • Logitech RX300
  • Logitech RX650 Cordless Optical
  • Logitech TrackMan Wheel
  • Logitech UltraX Optical Mouse
  • Logitech USB Optical Wheel Mouse
  • Logitech V200 Cordless
  • Logitech V220 Cordless Optical
  • Logitech V270 Bluetooth Mouse
  • Logitech V320 Cordless Optical
  • Logitech V400 Laser Cordless Mouse
  • Logitech V450 Laser Cordless Mouse
  • Logitech V450 Laser Mouse
  • Logitech V470 Bluetooth enabled Mouse
  • Logitech V500 Cordless
  • Logitech V550 Nano
  • Logitech VX Nano
  • Logitech VX Revolution
  • Logitech Wheel Mouse
  • Logitech Workstation Mouse

, , , , , , , ,

14 Comments