Пример #1
0
#===============================================================================
# Check for package install of freeswitch and distro trusty
#===============================================================================

if FPBXParms.PARMS["Distro"][0] == "trusty" and FPBXParms.PARMS["FS_Install_Type"][0] == 'P':
    print("There are no packages for Ubuntu trusty, I will install from source")
    FPBXParms.PARMS["FS_Install_Type"][0] = 's'

FPBXParms.save_parms()

#===============================================================================
# One last time let the user verify we are ready to begin
#===============================================================================

FPBXParms.show_parms()
print("The Linux distribution appears to be code named %s" % (FPBXParms.PARMS["Distro"][0]))
print()
INSTALL_PROGRESS = load_parms(INSTALL_PROGRESS)



#===============================================================================
# Ask the burning question
#===============================================================================

if not args.restart:
    answer = ask_yn("Do you want to start the install")
else:
    answer = ask_yn("Do you want to re-start the install")
if answer == "Yes":
Пример #2
0
    # reachable
    s = socket.create_connection((host, 80), 2)
except:
    print("I don't seem to be connected to the Internet")
    print("This script requires Internet connection")
    print("Please insure Internet availability and run this script again")
    sys.exit(2)


FPBXParms.save_parms()

#===============================================================================
# One last time let the user verify we are ready to begin
#===============================================================================

FPBXParms.show_parms()
print("The Debian Linux distribution appears to be code named %s" % (FPBXParms.PARMS["Distro"][0]))
print()
INSTALL_PROGRESS = load_parms(INSTALL_PROGRESS)

#===============================================================================
# Ask the burning question
#===============================================================================

if not args.restart:
    answer = ask_yn("Do you want to start the install")
else:
    answer = ask_yn("Do you want to re-start the install")
if answer == "Yes":
    # print("Progress %d" % (INSTALL_PROGRESS))
def iask_questions():    
    
    print("I am checking to see if there are parameters already defined")
    
    #===============================================================================
    # Load the previously saved parameters
    #===============================================================================
    
    if os.path.isfile("%s/resources/install.json" % (INSTALL_ROOT)):
    
        FPBXParms.PARMS = FPBXParms.load_parms(FPBXParms.PARMS)
    
        print("I found the following parameters")
        FPBXParms.show_parms()
    
        USEPARMS = ask_yn("Do you want to use them")
        if USEPARMS == "Yes":
            pass
#             print("In loop %d" % (LOOPNUMBER))
#             LOOPNUMBER += 1
        else:
    #===============================================================================
    # Start asking the hard questions
    #===============================================================================
            print("Very well I will ask you several questions.")
            print("Note: if a question has '(a/B)' in it, 'B' is the default")
            print("If a question has a value listed that is the default")
            print("All default values can be selected by just pressing Enter")
            print("If a parameter does not have a default, a value must be entered")
            
            s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
            s.connect(('google.com', 0))
            FPBXParms.PARMS["IP"][0] = (s.getsockname()[0])
        
            BDR_ANS = "No"
#             BDR_ANS = ask_yn(FPBXParms.PARMS["BDR"][1])
            FPBXParms.PARMS["BDR"][0] = BDR_ANS
            if BDR_ANS == "Yes":
                PARM_LIST = FPBXParms.BDR_PARMS
            else:
                PARM_LIST = FPBXParms.NON_BDR_PARMS
    
            if len(PARM_LIST) > 0:
                for index in PARM_LIST:
                    FPBXParms.ask_parm(index)
    
            for index in FPBXParms.COMMON_PARMS:
                FPBXParms.ask_parm(index)
    
    #======================================================================
    # Make up some passwords that are secure and easy to remember
    #======================================================================
    
    #         FPBXParms.PARMS["FPBXuserPassword"][0] = mkpass()
    #         FPBXParms.PARMS["FPBXDBUserPassword"][0] = mkpass()
    
            FPBXParms.save_parms()
    else:
        print("There is no predefined parameter file.")
        print("Please answer the following questions.")
        
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect(('google.com', 0))
        FPBXParms.PARMS["IP"][0] = (s.getsockname()[0])
#        For now we are only installing a single switch, No BDR
        BDR_ANS = "No"
#         BDR_ANS = ask_yn(FPBXParms.PARMS["BDR"][1])
        FPBXParms.PARMS["BDR"][0] = BDR_ANS
        if BDR_ANS == "Yes":
            PARM_LIST = FPBXParms.BDR_PARMS
        else:
            PARM_LIST = FPBXParms.NON_BDR_PARMS
        if len(PARM_LIST) > 0:
            for index in PARM_LIST:
                FPBXParms.ask_parm(index)
    
        for index in FPBXParms.COMMON_PARMS:
            FPBXParms.ask_parm(index)
    
    #======================================================================
    # Make up some passwords that are secure and easy to remember
    #======================================================================
    
    #     FPBXParms.PARMS["FPBXuserPassword"][0] = mkpass()
    #     FPBXParms.PARMS["FPBXDBUserPassword"][0] = mkpass()
    
    #===========================================================================
    # We need to check for Ubuntu and insure it is a source install
    #===========================================================================
        
        if FPBXParms.PARMS["Distro"][0] == "trusty":
            FPBXParms.PARMS["FS_Install_Type"][0] = "s"
            print("This install is on Ubuntu and only source is currently configured")
            print("I have set your Freeswitch install type to source")
        
        FPBXParms.save_parms()
            
    return
Пример #4
0
def iask_questions():
    print("Welcome to FusionPBX installation.")
    print("I am checking to see if there are parameters already defined")

    #===============================================================================
    # Load the previously saved parameters
    #===============================================================================

    if os.path.isfile("%s/resources/install.json" % (INSTALL_ROOT)):

        FPBXParms.PARMS = FPBXParms.load_parms(FPBXParms.PARMS)

        print("I found the following parameters")
        FPBXParms.show_parms()

        USEPARMS = ask_yn("Do you want to use them")
        if USEPARMS == "Yes":
            pass
#             print("In loop %d" % (LOOPNUMBER))
#             LOOPNUMBER += 1
        else:
            #===============================================================================
            # Start asking the hard questions
            #===============================================================================
            print("Very well I will ask you several questions.")
            print("Note: if a question has '(a/B)' in it, 'B' is the default")
            print("If a question has a value listed that is the default")
            print("All default values can be selected by just pressing Enter")
            print(
                "If a parameter does not have a default, a value must be entered"
            )
            BDR_ANS = "No"
            #             BDR_ANS = ask_yn(FPBXParms.PARMS["BDR"][1])
            FPBXParms.PARMS["BDR"][0] = BDR_ANS
            if BDR_ANS == "Yes":
                PARM_LIST = FPBXParms.BDR_PARMS
            else:
                PARM_LIST = FPBXParms.NON_BDR_PARMS

            for index in PARM_LIST:
                FPBXParms.ask_parm(index)

            for index in FPBXParms.COMMON_PARMS:
                FPBXParms.ask_parm(index)

    #======================================================================
    # Make up some passwords that are secure and easy to remember
    #======================================================================

    #         FPBXParms.PARMS["FPBXuserPassword"][0] = mkpass()
    #         FPBXParms.PARMS["FPBXDBUserPassword"][0] = mkpass()

            FPBXParms.save_parms()
    else:
        print("There is no predefined parameter file.")
        print("Please answer the following questions.")
        #        For now we are only installing a single switch, No BDR
        BDR_ANS = "No"
        #         BDR_ANS = ask_yn(FPBXParms.PARMS["BDR"][1])
        FPBXParms.PARMS["BDR"][0] = BDR_ANS
        if BDR_ANS == "Yes":
            PARM_LIST = FPBXParms.BDR_PARMS
        else:
            PARM_LIST = FPBXParms.NON_BDR_PARMS

        for index in PARM_LIST:
            FPBXParms.ask_parm(index)

        for index in FPBXParms.COMMON_PARMS:
            FPBXParms.ask_parm(index)

    #======================================================================
    # Make up some passwords that are secure and easy to remember
    #======================================================================

    #     FPBXParms.PARMS["FPBXuserPassword"][0] = mkpass()
    #     FPBXParms.PARMS["FPBXDBUserPassword"][0] = mkpass()

        FPBXParms.save_parms()

#         if FPBXParms.PARMS["FS_Install_Type"][0] == "s":
#             print("WARNING: There are currently problems with Video and installing from source")
#             print("As of Freeswitch 1.6.")
#             print("You may need to disable video to compile Freeswitch")
#             ans = ask_yn("Do you wish to continue")
#             if ans == "No":
#                 sys.exit()

    return
def ifusionpbx():
	INSTALL_ROOT = os.getcwd()
	if os.path.isfile("%s/resources/install.json" % (INSTALL_ROOT)):
		FPBXParms.PARMS = FPBXParms.load_parms(FPBXParms.PARMS)
	else:
		print("No predefined parameters to install FusionPBX")
		sys.exit(1)
		
	#=======================================================================
	# Determine web server type
	#=======================================================================
	
	if FPBXParms.PARMS["WebServer"][0] == "a":
		ws = "apache2"
	if FPBXParms.PARMS["WebServer"][0] == "N":
		ws = "nginx"
		
	#===============================================================================
	# Set up Postgresql
	#===============================================================================
	
	if FPBXParms.PARMS["DatabaseType"][0] == "P":
		print("Setting up Postgresql to support FusionPBX")
		# temp fix for pg_hba.conf permission problem
		if os.path.isfile("%s/resources/postgresql/pg_hba.conf" % (INSTALL_ROOT)):
			shutil.copyfile("%s/resources/postgresql/pg_hba.conf" % (INSTALL_ROOT), "/etc/postgresql/9.4/main/pg_hba.conf")
			ret = subprocess.call("systemctl restart postgresql", stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
			FPBXParms.check_ret(ret, "Restarting postgres for pg_hba.conf changes")
			time.sleep(5) # Give postgresql time to settle
		tmp = open("/var/lib/postgresql/install.sql", 'w')
		tmp.write("CREATE ROLE %s WITH SUPERUSER CREATEROLE CREATEDB LOGIN PASSWORD '%s';\n" % (FPBXParms.PARMS["DBUser"][0], FPBXParms.PARMS["DBUserPassword"][0]))
		tmp.write("ALTER ROLE %s WITH PASSWORD '%s';\n" % (FPBXParms.PARMS["DBUser"][0], FPBXParms.PARMS["DBUserPassword"][0]))
		tmp.write("CREATE DATABASE %s with OWNER = %s;\n" % (FPBXParms.PARMS["DBName"][0], FPBXParms.PARMS["DBUser"][0]))
		tmp.write("CREATE DATABASE freeswitch with OWNER = %s;\n" % (FPBXParms.PARMS["DBUser"][0]))
		tmp.write("GRANT ALL PRIVILEGES ON DATABASE %s to %s;\n" % (FPBXParms.PARMS["DBName"][0], FPBXParms.PARMS["DBUser"][0]))
		tmp.write("GRANT ALL PRIVILEGES ON DATABASE freeswitch to %s;\n" % (FPBXParms.PARMS["DBUser"][0]))
		tmp.close()
		ret = subprocess.call("su -l postgres -c \"psql < /var/lib/postgresql/install.sql\"", stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
		FPBXParms.check_ret(ret, "Create DB, User, Password")
		os.remove("/var/lib/postgresql/install.sql")
	
	#=============================================================================== 
	# Install FusionPBX
	#=============================================================================== 
	
	os.chdir("/var/www")
	
	#=============================================================================== 
	# Create a git repository and clone from GitHub
	#=============================================================================== 
	
	if os.path.isfile(".git"):
		print("Updating FusionPBX code from GitHub")
		if os.path.isfile("/usr/bin/git"):
			ret = subprocess.call("/usr/bin/git pull", stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
		else:
			print("git version control is not installed")
			sys.exit(6)

	else:
		print("Cloning the FusionPBX code from GitHub")
		if os.path.isfile("/usr/bin/git"):
			ret = subprocess.call("/usr/bin/git init", stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
			ret = subprocess.call("/usr/bin/git clone http://github.com/fusionpbx/fusionpbx", stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
		else:
			print("git version control is not installed")
			sys.exit(6)
		
	#=============================================================================== 
	# make sure www-data and freeswitch have access to the land
	#=============================================================================== 
	
	if FPBXParms.PARMS["FS_Install_Type"][0] == "P":
		for folder in paclfolders:
			if os.path.isdir(folder):
				ret = subprocess.call("setfacl -R -d -m u:www-data:rwx,g:www-data:rwx %s" % (folder), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
				FPBXParms.check_ret(ret, "Setting user acl for %s" % (folder))
				ret = subprocess.call("setfacl -R -m u:www-data:rwx,g:www-data:rwx %s" % (folder), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
				FPBXParms.check_ret(ret, "Setting user acl for %s" % (folder))
				ret = subprocess.call("setfacl -R -d -m u:freeswitch:rwx,g:freeswitch:rwx %s" % (folder), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
				FPBXParms.check_ret(ret, "Setting user acl for %s" % (folder))
				ret = subprocess.call("setfacl -R -m u:freeswitch:rwx,g:freeswitch:rwx %s" % (folder), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
				FPBXParms.check_ret(ret, "Setting user acl for %s" % (folder))
			else:
				print("SetFacl:")
				print("%s is not a directory on this system" % (folder))
	else:
		for folder in saclfolders:
			if os.path.isdir(folder):
				ret = subprocess.call("setfacl -R -d -m u:www-data:rwx,g:www-data:rwx %s" % (folder), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
				FPBXParms.check_ret(ret, "Setting user acl for %s" % (folder))
				ret = subprocess.call("setfacl -R -m u:www-data:rwx,g:www-data:rwx %s" % (folder), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
				FPBXParms.check_ret(ret, "Setting user acl for %s" % (folder))
				ret = subprocess.call("setfacl -R -d -m u:freeswitch:rwx,g:freeswitch:rwx %s" % (folder), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
				FPBXParms.check_ret(ret, "Setting user acl for %s" % (folder))
				ret = subprocess.call("setfacl -R -m u:freeswitch,g:freeswitch:rwx %s" % (folder), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
				FPBXParms.check_ret(ret, "Setting user acl for %s" % (folder))
			else:
				print("SetFacl:")
				print("%s is not a directory on this system" % (folder))
					
	#===============================================================================
	# Insure FusionPBX config.php is not present
	#===============================================================================
	if os.path.isfile("/var/www/fusionpbx/resources/config.php"):
		os.remove("/var/www/fusionpbx/resources/config.php")
	
	#========================================================================
	# Make sure we are back in the install root directory
	#========================================================================
	os.chdir(INSTALL_ROOT)
	   
	#===========================================================================
	# Set up the ssl certificate
	#TODO: Set up our own signed certificate when we can
	#===========================================================================
	
	if not os.path.islink("/etc/ssl/private/%s.key" % (ws)):
		os.symlink("/etc/ssl/private/ssl-cert-snakeoil.key", "/etc/ssl/private/%s.key" % (ws))
	if not os.path.islink("/etc/ssl/certs/%s.crt" % (ws)):
		os.symlink("/etc/ssl/certs/ssl-cert-snakeoil.pem", "/etc/ssl/certs/%s.crt" % (ws))
	
	#===============================================================================
	# Set up Web Server configuration to support FusionPBX
	#===============================================================================
	
	print("Setting Webserver to run FusionPBX")
	ret = subprocess.call("systemctl stop %s" % (ws), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
	FPBXParms.check_ret(ret, "Stopping %s" % (ws))
	if FPBXParms.PARMS["WebServer"][0] == "a":
		ret = subprocess.call("a2enmod ssl", stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
		FPBXParms.check_ret(ret, "Enableing ssl")
	if FPBXParms.PARMS["WebServer"][0] == "a":
		print("We need to set up a temporary certificate for ssl")
		print("Use the server IP address for the FQDN question")
		print("This temporary certificate is set to expire in 1 year")
		print("Please set up a permanant certificate before your switch in placed in service")
		print("Please answer the questions when they appear")
		os.mkdir("/etc/apache2/ssl")
		subprocess.call("openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt", shell=True)
		
	shutil.copyfile("%s/resources/%s/sites-available/fusionpbx.conf" % (INSTALL_ROOT, ws), "/etc/%s/sites-available/fusionpbx.conf" % (ws))
	if not os.path.islink("/etc/%s/sites-enabled/fusionpbx.conf" % (ws)):
		os.symlink("/etc/%s/sites-available/fusionpbx.conf" % (ws), "/etc/%s/sites-enabled/fusionpbx.conf" % (ws))
	# We need to remove the default so it does not interfere with FusionPBX
	if os.path.islink("/etc/%s/sites-enabled/default.conf" % (ws)):
		os.remove("/etc/%s/sites-enabled/default.conf" % (ws))
	if os.path.islink("/etc/%s/sites-enabled/000-default.conf" % (ws)):
		os.remove("/etc/%s/sites-enabled/000-default.conf" % (ws))
	if os.path.islink("/etc/%s/sites-enabled/default" % (ws)):
		os.remove("/etc/%s/sites-enabled/default" % (ws))
	ret = subprocess.call("systemctl start %s" % (ws), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
	FPBXParms.check_ret(ret, "Starting %s" %(ws))
	
	#===============================================================================
	# Request user to run the install procedure in FusionPBX
	#===============================================================================
	
	print("The installation of FusionPBX is almost done.")
	print("Point your browser at https://%s/" % (FPBXParms.PARMS["IP"][0]))
	print("Hint: you may copy and paste the URL from the line above.")
	print("Please fill out the install pages using the information listed here.")
	FPBXParms.show_parms()
	print("I'll wait here while you do that.")
	input("Press Enter after the login screen appears. ")
	if os.path.isfile("/var/www/fusionpbx/resources/config.php"):
		print("Thank you")
	else:
		print("The configuration file is missing,")
		print("Confiuration of FusionPBX failed,")
		print("Your FusionPBX server is not installed!")
		sys.exit(6)
	return

#===============================================================================
# Restart freeswitch so FS will see any changes to config we just made.
#===============================================================================
	
	ret = subprocess.call("sytemctl restart freeswitch", stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
	FPBXParms.check_ret(ret, "Restarting Freeswitch")
	
def ifusionpbx():
    INSTALL_ROOT = os.getcwd()
    if os.path.isfile("%s/resources/install.json" % (INSTALL_ROOT)):
        FPBXParms.PARMS = FPBXParms.load_parms(FPBXParms.PARMS)
    else:
        print("No predefined parameters to install FusionPBX")
        sys.exit(1)

    #===============================================================================
    # Set up Postgresql
    #===============================================================================

    if FPBXParms.PARMS["DatabaseType"][0] == "P":
        print("Setting up Postgresql to support FusionPBX")
        # temp fix for pg_hba.conf permission problem
        if os.path.isfile("%s/resources/postgresql/pg_hba.conf" %
                          (INSTALL_ROOT)):
            shutil.copyfile(
                "%s/resources/postgresql/pg_hba.conf" % (INSTALL_ROOT),
                "/etc/postgresql/9.4/main/pg_hba.conf")
            ret = subprocess.call("systemctl restart postgresql",
                                  stdout=subprocess.DEVNULL,
                                  stderr=subprocess.DEVNULL,
                                  shell=True)
            FPBXParms.check_ret(ret,
                                "Restart postgres for pg_hba.conf changes")
            time.sleep(5)  # Give postgresql time to settle
        tmp = open("/var/lib/postgresql/install.sql", 'w')
        tmp.write(
            "CREATE ROLE %s WITH SUPERUSER CREATEROLE CREATEDB LOGIN PASSWORD '%s';\n"
            % (FPBXParms.PARMS["DBUser"][0],
               FPBXParms.PARMS["DBUserPassword"][0]))
        tmp.write("ALTER ROLE %s WITH PASSWORD '%s';\n" %
                  (FPBXParms.PARMS["DBUser"][0],
                   FPBXParms.PARMS["DBUserPassword"][0]))
        tmp.write("CREATE DATABASE %s with OWNER = %s;\n" %
                  (FPBXParms.PARMS["DBName"][0], FPBXParms.PARMS["DBUser"][0]))
        tmp.write("CREATE DATABASE freeswitch with OWNER = %s;\n" %
                  (FPBXParms.PARMS["DBUser"][0]))
        tmp.write("GRANT ALL PRIVILEGES ON DATABASE %s to %s;\n" %
                  (FPBXParms.PARMS["DBName"][0], FPBXParms.PARMS["DBUser"][0]))
        tmp.write("GRANT ALL PRIVILEGES ON DATABASE freeswitch to %s;\n" %
                  (FPBXParms.PARMS["DBUser"][0]))
        tmp.close()
        ret = subprocess.call(
            "su -l postgres -c \"psql < /var/lib/postgresql/install.sql\"",
            stdout=subprocess.DEVNULL,
            stderr=subprocess.DEVNULL,
            shell=True)
        FPBXParms.check_ret(ret, "Create DB, User, Password")
        os.remove("/var/lib/postgresql/install.sql")

    #===============================================================================
    # Install FusionPBX
    #===============================================================================

    os.chdir("/var/www")

    #===============================================================================
    # Create a git repository and clone from GitHub
    #===============================================================================

    if os.path.isfile(".git"):
        print("Updating FusionPBX code from GitHub")
        if os.path.isfile("/usr/bin/git"):
            ret = subprocess.call("/usr/bin/git pull",
                                  stdout=subprocess.DEVNULL,
                                  stderr=subprocess.DEVNULL,
                                  shell=True)
        else:
            print("git version control is not installed")
            sys.exit(6)

    else:
        print("Cloning the FusionPBX code from GitHub")
        if os.path.isfile("/usr/bin/git"):
            ret = subprocess.call("/usr/bin/git init",
                                  stdout=subprocess.DEVNULL,
                                  stderr=subprocess.DEVNULL,
                                  shell=True)
            ret = subprocess.call(
                "/usr/bin/git clone http://github.com/fusionpbx/fusionpbx",
                stdout=subprocess.DEVNULL,
                stderr=subprocess.DEVNULL,
                shell=True)
        else:
            print("git version control is not installed")
            sys.exit(6)

    #===============================================================================
    # make www-data has access to the land
    #===============================================================================

    if FPBXParms.PARMS["FS_Install_Type"][0] == "P":
        for folder in paclfolders:
            if os.path.isdir(folder):
                ret = subprocess.call(
                    "setfacl -R -d -m u:www-data:rwx,g:www-data:rwx %s" %
                    (folder),
                    stdout=subprocess.DEVNULL,
                    stderr=subprocess.DEVNULL,
                    shell=True)
                FPBXParms.check_ret(ret, "Setting user acl for %s" % (folder))
                ret = subprocess.call(
                    "setfacl -R -m u:www-data:rwx,g:www-data:rwx %s" %
                    (folder),
                    stdout=subprocess.DEVNULL,
                    stderr=subprocess.DEVNULL,
                    shell=True)
                FPBXParms.check_ret(ret, "Setting user acl for %s" % (folder))
            else:
                print("SetFacl:")
                print("Error: %s is not a directory" % (folder))
    else:
        for folder in saclfolders:
            if os.path.isdir(folder):
                ret = subprocess.call(
                    "setfacl -R -d -m u:www-data:rwx,g:www-data:rwx %s" %
                    (folder),
                    stdout=subprocess.DEVNULL,
                    stderr=subprocess.DEVNULL,
                    shell=True)
                FPBXParms.check_ret(ret, "Setting user acl for %s" % (folder))
                ret = subprocess.call(
                    "setfacl -R -m u:www-data:rwx,g:www-data:rwx %s" %
                    (folder),
                    stdout=subprocess.DEVNULL,
                    stderr=subprocess.DEVNULL,
                    shell=True)
                FPBXParms.check_ret(ret, "Setting user acl for %s" % (folder))
            else:
                print("SetFacl:")
                print("Error: %s is not a directory" % (folder))

    #===============================================================================
    # Insure FusionPBX config.php is not present
    #===============================================================================
    if os.path.isfile("/var/www/fusionpbx/resources/config.php"):
        os.remove("/var/www/fusionpbx/resources/config.php")

    #========================================================================
    # Make sure we are back in the install root directory
    #========================================================================
    os.chdir(INSTALL_ROOT)

    #===========================================================================
    # Set up the ssl certificate
    #TODO: Set up our own signed cert when we can
    #===========================================================================

    if not os.path.islink("/etc/ssl/private/nginx.key"):
        os.symlink("/etc/ssl/private/ssl-cert-snakeoil.key",
                   "/etc/ssl/private/nginx.key")
    if not os.path.islink("/etc/ssl/certs/nginx.crt"):
        os.symlink("/etc/ssl/certs/ssl-cert-snakeoil.pem",
                   "/etc/ssl/certs/nginx.crt")

    #===============================================================================
    # Set up Nginx config to support FusionPBX
    #===============================================================================

    print("Setting nginx to run FusionPBX")
    ret = subprocess.call("systemctl stop nginx",
                          stdout=subprocess.DEVNULL,
                          stderr=subprocess.DEVNULL,
                          shell=True)
    shutil.copyfile(
        "%s/resources/nginx/sites-available/fusionpbx" % (INSTALL_ROOT),
        "/etc/nginx/sites-available/fusionpbx")
    if not os.path.islink("/etc/nginx/sites-enabled/fusionpbx"):
        os.symlink("/etc/nginx/sites-available/fusionpbx",
                   "/etc/nginx/sites-enabled/fusionpbx")
    # We need to remove the default so it does not interfere with FusionPBX
    if os.path.islink("/etc/nginx/sites-enabled/default"):
        os.remove("/etc/nginx/sites-enabled/default")
    ret = subprocess.call("systemctl start nginx",
                          stdout=subprocess.DEVNULL,
                          stderr=subprocess.DEVNULL,
                          shell=True)

    #===============================================================================
    # Request user to run the install procedure in FusionPBX
    #===============================================================================

    print("The installation of FusionPBX is almost done.")
    print("Point your browser at http://%s/" % (FPBXParms.PARMS["IP"][0]))
    print("Hint: you may copy and paste the URL from the line above.")
    print(
        "Please fill out the install pages with the information listed here.")
    FPBXParms.show_parms()
    input(
        "I'll wait here while you do that press Enter when you are finished. ")
    if os.path.isfile("/var/www/fusionpbx/resources/config.php"):
        print("Thank you")
    else:
        print("The configuration did not get saved I can not go on.")
        sys.exit(6)
    return