File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ # coding: utf-8
2+ from bsdploy .bootstrap_utils import BootstrapUtils
3+ from fabric .api import env , run , sudo
4+ from time import sleep
5+
6+ # a plain, default fabfile for jailhosts on digital ocean
7+
8+
9+ env .shell = '/bin/sh -c'
10+
11+
12+ def bootstrap (** kwargs ):
13+ """Digital Oceans FreeBSD droplets are pretty much already pre-bootstrapped,
14+ including having python2.7 and sudo etc. pre-installed.
15+ the only thing we need to change is to allow root to login (without a password)
16+ """
17+ original_host = env .host_string
18+ env .host_string = 'freebsd@%s' % env .instance .uid
19+ sudo ("""sysrc pf_enable=YES""" )
20+ sudo ("""sysrc -f /boot/loader.conf pfload=YES""" )
21+ sudo ('kldload pf' , warn_only = True )
22+ sudo ('service pf start' )
23+ sudo ("""echo 'PermitRootLogin without-password' > /etc/ssh/sshd_config""" )
24+ sudo ("""service sshd fastreload""" )
25+ # revert back to root
26+ env .host_string = original_host
27+ # give sshd a chance to restart
28+ sleep (2 )
29+
30+ # allow overwrites from the commandline
31+ env .instance .config .update (kwargs )
32+
33+ bu = BootstrapUtils ()
34+ bu .ssh_keys = None
35+ bu .upload_authorized_keys = False
You can’t perform that action at this time.
0 commit comments