class.ISPConfigUbuntuOS.inc.php 2.88 KB
Newer Older
1
2
3
4
5
6
7
<?php
/**
 * Description of class
 *
 * @author croydon
 */
class ISPConfigUbuntuOS extends ISPConfigDebianOS {
Marius Burkard's avatar
Marius Burkard committed
8
9
10
	protected function configureApt() {
		// enable contrib and non-free
		ISPConfigLog::info('Configuring apt repositories.', true);
11

Marius Burkard's avatar
Marius Burkard committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
		$contents = '# created by ISPConfig auto installer
deb http://de.archive.ubuntu.com/ubuntu/ bionic main restricted
deb http://de.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb http://de.archive.ubuntu.com/ubuntu/ bionic universe
deb http://de.archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://de.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://de.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb http://de.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
		';
		file_put_contents('/etc/apt/sources.list', $contents);
	}
Marius Burkard's avatar
Marius Burkard committed
26

Marius Burkard's avatar
Marius Burkard committed
27
28
29
30
31
32
33
34
35
36
	protected function beforePackageInstall($section = '') {
		$this->stopService('apparmor');
		$this->stopService('sendmail');

		$cmd = 'update-rc.d -f apparmor remove ; update-rc.d -f sendmail remove ; apt-get -y -qq remove apparmor apparmor-utils';
		$result = $this->exec($cmd);
		if($result === false) {
			throw new ISPConfigOSException('Command ' . $cmd . ' failed.');
		}
	}
Marius Burkard's avatar
Marius Burkard committed
37

Marius Burkard's avatar
Marius Burkard committed
38
39
40
41
42
	protected function afterPackageInstall($section = '') {
		if($section === 'mail') {
			$cmd = 'freshclam';
			$result = $this->exec($cmd, array(62));
			if($result === false) {
Marius Burkard's avatar
Marius Burkard committed
43
				//throw new ISPConfigOSException('Command ' . $cmd . ' failed.');
Marius Burkard's avatar
Marius Burkard committed
44
			}
Marius Burkard's avatar
Marius Burkard committed
45

Marius Burkard's avatar
Marius Burkard committed
46
47
48
			$this->startService('clamav-daemon');
		}
	}
Marius Burkard's avatar
Marius Burkard committed
49

Marius Burkard's avatar
Marius Burkard committed
50
51
	protected function addSuryRepo() {
		ISPConfigLog::info('Activating sury php repository.', true);
Marius Burkard's avatar
Marius Burkard committed
52

Marius Burkard's avatar
Marius Burkard committed
53
54
55
56
57
58
		$cmd = 'add-apt-repository -y ppa:ondrej/php';
		$result = $this->exec($cmd);
		if($result === false) {
			throw new ISPConfigOSException('Command ' . $cmd . ' failed.');
		}
	}
Marius Burkard's avatar
Marius Burkard committed
59

Marius Burkard's avatar
Marius Burkard committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
	protected function getFail2BanJail() {
		$jk_jail = '[pure-ftpd]
enabled = true
port = ftp
filter = pure-ftpd
logpath = /var/log/syslog
maxretry = 3

[dovecot]
enabled = true
filter = dovecot
action = iptables-multiport[name=dovecot-pop3imap, port="pop3,pop3s,imap,imaps", protocol=tcp]
logpath = /var/log/mail.log
maxretry = 5

[postfix-sasl]
enabled = true
port = smtp
filter = postfix
logpath = /var/log/mail.log
maxretry = 3';
		return $jk_jail;
	}

	protected function setDefaultPHP() {
		ISPConfigLog::info('Settings default system php version.', true);
Marius Burkard's avatar
Marius Burkard committed
86
		$cmd = 'update-alternatives --set php /usr/bin/php7.2 ; update-alternatives --set php-cgi /usr/bin/php-cgi7.2 ; update-alternatives --set php-fpm.sock /run/php/php7.2-fpm.sock';
Marius Burkard's avatar
Marius Burkard committed
87
88
89
90
91
		$result = $this->exec($cmd);
		if($result === false) {
			throw new ISPConfigOSException('Command ' . $cmd . ' failed.');
		}
	}
Marius Burkard's avatar
Marius Burkard committed
92

93
94
95
	protected function getSystemPHPVersion() {
		return '7.2';
	}
Marius Burkard's avatar
Marius Burkard committed
96

97
}