This Page

woven.linux

Replaces the ubuntu.py module with more generic linux functions.

woven.linux.add_repositories()

Adds additional sources as defined in LINUX_PACKAGE_REPOSITORIES.

woven.linux.add_user(username='', password='', group='', site_user=False)

Adds the username

woven.linux.change_ssh_port()

For security woven changes the default ssh port.

woven.linux.disable_root()

Disables root and creates a new sudo user as specified by HOST_USER in your settings or your host_string

The normal pattern for hosting is to get a root account which is then disabled.

returns True on success

woven.linux.install_package(package)

apt-get install [package]

woven.linux.install_packages()

Install a set of baseline packages and configure where necessary

woven.linux.lsb_release()

Get the linux distribution information and return in an attribute dict

The following attributes should be available: base, distributor_id, description, release, codename

For example Ubuntu Lucid would return base = debian distributor_id = Ubuntu description = Ubuntu 10.04.x LTS release = 10.04 codename = lucid

woven.linux.port_is_open()

Determine if the default port and user is open for business.

woven.linux.restrict_ssh(rollback=False)

Set some sensible restrictions in Ubuntu /etc/ssh/sshd_config and restart sshd UseDNS no #prevents dns spoofing sshd defaults to yes X11Forwarding no # defaults to no AuthorizedKeysFile %h/.ssh/authorized_keys

uncomments PasswordAuthentication no and restarts sshd

woven.linux.set_timezone(rollback=False)

Set the time zone on the server using Django settings.TIME_ZONE

woven.linux.setup_ufw()

Setup basic ufw rules just for ssh login

woven.linux.setup_ufw_rules()

Setup ufw app rules from application templates and settings UFW_RULES

woven.linux.uninstall_package(package)

apt-get autoremove –purge

woven.linux.uninstall_packages()

Uninstall unwanted packages

woven.linux.upgrade_packages()

apt-get update and apt-get upgrade

woven.linux.upload_etc()

Upload and render all templates in the woven/etc directory to the respective directories on the nodes

Only configuration for installed packages will be uploaded where that package creates it’s own subdirectory in /etc/ ie /etc/apache2.

For configuration that falls in some other non package directories ie init.d, logrotate.d etc it is intended that this function only replace existing configuration files. To ensure we don’t upload etc files that are intended to accompany a particular package.

woven.linux.upload_ssh_key(rollback=False)

Upload your ssh key for passwordless logins