Blogs

Turning off safe_mode and open_basedir in Plesk

Create a "vhost.conf" file in "/var/www/vhosts/<DOMAIN.TLD>/conf/"

<Directory /var/www/vhosts/<DOMAIN.TLD>/httpdocs>
php_admin_value safe_mode off
php_admin_value open_basedir none
</Directory>

Rebuild the domain configs for the particular host via:

/usr/local/psa/admin/sbin/websrvmng -u --vhost-name=<DOMAIN.TLD>

or rebuild all via:

# /usr/local/psa/admin/sbin/websrvmng -a

cleanup ftp backups with bash shell script

Here's a small bash code snippet to clean up ftp backups maintained by date. Specifically, if using the SysBK to backup to an external server with just ftp access.

It should be run daily via cron and cleans up folders older than 14 days.

#!/bin/bash
# clean_bak.sh
# Cleans up old backup folders from the remote server.

USR=<user>
PSWD=<password>
HOST=<ftp.domain.tld>
BAK_PATH=</path/to/backups>

LFTP=/usr/bin/lftp
RM_DATE=`/bin/date +%m-%d-%y -d '15 days ago'`

$LFTP << EOF
set ftp:ssl-force true
connect $HOST
user $USR $PSWD
rm -r -f $BAK_PATH/${RM_DATE}
du -h -d 1 $BAK_PATH
quit
EOF

exit 0

The du option will output the space currently being used by the backups.

NOTE: For security reasons, you should use ftps protocol to connect to the remote backup server if possible, and can force it via:

set ftp:ssl-force true

This can also be put in the "~/.lftprc" or "~/.lftp/rc" file.

GalleryRemote on Ubuntu Edgy 6.10

Gallery Remote install kept erroing out with:

Preparing to install...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...
nawk: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/bin/ls: error while loading shared libraries: librt.so.1: cannot open shared object file: No such file or directory
basename: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
basename: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
hostname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory

Launching installer...

grep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/usr/local/java/bin/java: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory

The way around the error was to comment out the assumed kernel.

$ cp GalleryRemote.1.5.Linux.NoVM.bin GalleryRemote.1.5.Linux.NoVM.bin.bak
$ cat GalleryRemote.1.5.Linux.NoVM.bin.bak | \
  sed "s/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/" > GalleryRemote.1.5.Linux.NoVM.bin

Once installed Gallery Remote would not run and I had run the same hack for the Gallery_Remote launcher script as well.

$ cp Gallery_Remote Gallery_Remote.bak
$ cat Gallery_Remote.bak | \
  sed "s/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/" > Gallery_Remote

Securing SSH Using Denyhosts

SSH is a great way to remotely administer a server. However, it still has a number of issues when you open it up to the world. The server and client communications are secure but that doesn’t mean the hosts involved are. Opening an SSH service to the world allows for brute force attacks and means that the carbon interface is still the weakest link.

Full Story

services that are not necessary on a web server

These are some services I would normally turn off on web servers.
NOTE: usage may vary.

  1. gpm -- mouse
  2. mdmonitor -- monitor raid devices
  3. netfs -- nfs, samba etc...
  4. autofs -- automount, nfs, cd etc...
  5. kudzu -- detect new hardware
  6. restorecond -- monitor selinux file context
  7. mcstrans -- mandatory access control selinux translation
  8. messagebus -- routes messages between applications
  9. haldaemon -- maintains database of devices connected

There may be more, but if you've cleaned up your rpm packages, it would probably not exist.

rpm packages not necessary for a web server

Below is a list of rpm packages that are not necessary on a web server. Use it as a reference starting point for cleaning up servers. You may also want to make sure not to run services not required by the server.
NOTE: usage may vary and removal should be in the order listed:

  1. redhat-lsb cups system-config-printer-libs system-config-printer paps -- printer support

  2. system-config-soundcard  -- gui for sound setup

  3. system-config-securitylevel-tui -- gui for setting up security

  4. nfs-utils system-config-nfs nfs-utils-lib -- nfs server

  5. portmap -- manage RPC connections
  6. ypbind yp-tools -- NIS client binding
  7. htmlview  -- view webpages via gui

  8. system-config-services system-config-samba pinfo system-config-users system-config-date -- gui configs

  9. samba samba-client samba-common -- samba support

  10. oprofile oprofile-devel oprofile-gui qt
  11. vnc
  12. libglade2 libgnomecanvas usermode-gtk libbonoboui libgnomeui libglade-java pygtk2-libglade system-config-httpd system-config-network gnome-mount libgnome-java gnome-python2-bonobo gnome-python2-canvas gnome-python2 authconfig-gtk system-config-lvm authconfig-gtk pirut gnome-vfs2 gnome-python2-gnomevfs gnome-python2-gconf libgnome libgsf librsvg2 librsvg2
    ImageMagick
  13. gnome-mime-data gnome-keyring  notify-python

  14. GConf2 notification-daemon bluez-gnome libgconf-java libnotify bluez-utils
  15. libgtk-java libvte-java
  16. pygtk2 system-config-language system-config-rootpassword
  17. vte
  18. libwnck
  19. glib-java cairo-java frysk
  20. libwmf
  21. gtk2
  22. cups-libs

  23. ghostscript ghostscript-fonts

  24. avahi avahi-glib
  25. wpa_supplicant NetworkManager
  26. system-config-rootpassword
  27. system-config-language

  28. system-config-keyboard
  29. system-config-network-tui firstboot-tui
  30. system-config-securitylevel-tui
  31. dhcpv6_client dhcdbd dhclient -- dhcp support

  32. irda-utils -- Infra Red communications
  33. isdn4k-utils -- ISDN
  34. apmd -- laptop power management
  35. cpuspeed -- dynamically changing cpu speed
  36. bluez-libs -- bluetooth
  37. irqbalance -- irq load balancing on multi-cpus (remove only in single cpu situation)
  38. rsh -- unsecure remote access
  39. talk -- internet talk protocol
  40. foomatic -- printer driver database
  41. finger -- finger client
  42. eject -- eject removable media
  43. cvs -- concurrent version control

  44. rcs -- revision control system
  45. dosfstools mkbootdisk -- bootdisk
  46. redhat-menus desktop-file-utils startup-notification -- desktop
  47. ppp rp-pppoe wvdial -- dialup
  48. esound -- sound daemon
  49. pcmciautils -- PCMCIA Cardbus
  50. pcsc-lite coolkey ifd-egate ccid
  51. OpenIPMI net-snmp-libs
  52. ImageMagick-devel -- ImageMagick development package
  53. xorg-x11-devel -- X server development package
  54. acpid -- power management (remove if you don't shutdown using power button)

How to install Tor with Vidalia GUI on Ubuntu

Do you want completely anonymous internet access? For Free? Tor is the open source leader to anonymous connections on the internet, you can anonymize your internet presence from AIM/ICQ/MSN/ Jabber/IRC/WWW/FTP and you can even issue a torify
command at the command prompt to anonymize your wget/ssh/lynx/ftp/perl or whatever. Basically tor is for the people by the people, it is only alive because we make it so, we can choose to use it freely or use it freely and help it out by running a server on your computer to make the internet safer.

How to Install Tor to Surf Anonymously in Ubuntu Feisty with Firefox

Tor is a toolset for a wide range of organizations and people that want to improve their safety and security on the Internet. Using Tor can help you anonymize web browsing and publishing, instant messaging, IRC, SSH, and other applications that use the TCP protocol. Tor also provides a platform on which software developers can build new applications with built-in anonymity, safety, and privacy features.

Full Story

Check your server for rootkits with Chkrootkit

chkrootkit is a tool to locally check your system for signs of a compromise via rootkits. It contains a shell script that checks system binaries for rootkit modification, signs of LKM trojans, interface modes and lastlog, wtmp, utmp deletions.

Install via:

# cd /usr/local
# wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz
# tar xvzf chkrootkit.tar.gz
# rm chkrootkit.tar.gz
# ln -s chkrootkit-x.xx chkrootkit
# cd chkrootkit
# make sense

Make sure to check the md5sum of the download as well.

Put the below into "/etc/cron.daily/chkrootkit.sh" to run a daily report:

#!/bin/bash
# chkrootkit.sh
cd /usr/local/chkrootkit/
./chkrootkit 2>&1 |grep "INFECTED\|Vulnerable"| grep -v "Checking \`bindshell'... INFECTED (PORTS:  465)"

The cron script will only output an email if it detects anything suspicious.

Note, that bindshell port 465 infection is a false alarm as in my case EXIM uses port 465 for secure connections. So, you could similarly grep out any such false alarm and adjust the cron script.

Howto Set Flickr images as Ubuntu desktop wallpaper

Webilder delivers stunning wallpapers to your Linux desktop, directly from Flickr and Webshots. You choose what keywords (tags) to watch for, and photos are automatically downloaded to your computer. Webilder can also change the wallpaper every few minutes.

Full Story

Syndicate content
Comment