Ubuntu上的Tripwire静默安装

时间:2016-01-27 07:36:13

标签: bash ubuntu installation

我正在尝试以非交互方式安装tripwire执行以下操作,但我仍然可以使用窗口屏幕插入本地和站点密钥。 我在bash文件中执行的代码如下所示。

有人可以为此提出解决方案吗?

由于

TripWireLocalPassword=something
TripWireSitePassword=something

sudo echo "postfix postfix/main_mailer_type select Internet Site" | sudo debconf-set-selections
sudo echo "postfix postfix/mailname                     string `hostname`"                  | sudo debconf-set-selections
sudo echo "tripwire tripwire/local-passphrase           password ${TripWireLocalPassword}"  | sudo debconf-set-selections
sudo echo "tripwire tripwire/local-passphrase-again     password ${TripWireLocalPassword}"  | sudo debconf-set-selections
sudo echo "tripwire tripwire/site-passphrase            password ${TripWireSitePassword}"   | sudo debconf-set-selections
sudo echo "tripwire tripwire/site-passphrase-again      password ${TripWireSitePassword}"   | sudo debconf-set-selections
sudo echo "tripwire tripwire/rebuild-config             boolean true"                       | sudo debconf-set-selections
sudo echo "tripwire tripwire/use-localkey               boolean true"                       | sudo debconf-set-selections
sudo echo "tripwire tripwire/change-in-default-policy   note"                               | sudo debconf-set-selections
sudo echo "tripwire tripwire/email-report               note"                               | sudo debconf-set-selections
sudo echo "tripwire tripwire/broken-passphrase          note"                               | sudo debconf-set-selections
sudo echo "tripwire tripwire/use-sitekey                boolean true"                       | sudo debconf-set-selections
sudo echo "tripwire tripwire/installed                  note"                               | sudo debconf-set-selections
sudo echo "tripwire tripwire/site-passphrase-incorrect  boolean true"                       | sudo debconf-set-selections
sudo echo "tripwire tripwire/upgrade                    boolean true"                       | sudo debconf-set-selections
sudo echo "tripwire tripwire/rebuild-policy             boolean true"                       | sudo debconf-set-selections
sudo echo "tripwire tripwire/local-passphrase-incorrect boolean true"                       | sudo debconf-set-selections

sudo apt-get install tripwire

2 个答案:

答案 0 :(得分:0)

按照

的方式尝试
export DEBIAN_FRONTEND=noninteractive 
sudo apt-get install -q -y -o Dpkg::Options::="--force-confdef" \ 
-o Dpkg::Options::="--force-confold" tripwire

从我所看到的有一些软件包忽略了"export DEBIAN_FRONTEND=noninteractive",而只是打开了Whiptail对话框。

如果是这种情况,则必须创建一个期望脚本。

答案 1 :(得分:0)

通过一些小修改,你应该可以安静地安装它:

TripWireLocalPassword=$(tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1)
TripWireSitePassword=$(tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1)


sudo echo "postfix postfix/main_mailer_type select Internet Site" | sudo debconf-set-selections
sudo echo "postfix postfix/mailname                     string `hostname`"                  | sudo debconf-set-selections
sudo echo "tripwire tripwire/local-passphrase           password ${TripWireLocalPassword}"  | sudo debconf-set-selections
sudo echo "tripwire tripwire/local-passphrase-again     password ${TripWireLocalPassword}"  | sudo debconf-set-selections
sudo echo "tripwire tripwire/site-passphrase            password ${TripWireSitePassword}"   | sudo debconf-set-selections
sudo echo "tripwire tripwire/site-passphrase-again      password ${TripWireSitePassword}"   | sudo debconf-set-selections
sudo echo "tripwire tripwire/rebuild-config             boolean true"                       | sudo debconf-set-selections
sudo echo "tripwire tripwire/use-localkey               boolean true"                       | sudo debconf-set-selections
sudo echo "tripwire tripwire/change-in-default-policy   note"                               | sudo debconf-set-selections
sudo echo "tripwire tripwire/email-report               note"                               | sudo debconf-set-selections
sudo echo "tripwire tripwire/broken-passphrase          note"                               | sudo debconf-set-selections
sudo echo "tripwire tripwire/use-sitekey                boolean true"                       | sudo debconf-set-selections
sudo echo "tripwire tripwire/installed                  note"                               | sudo debconf-set-selections
sudo echo "tripwire tripwire/site-passphrase-incorrect  boolean true"                       | sudo debconf-set-selections
sudo echo "tripwire tripwire/upgrade                    boolean true"                       | sudo debconf-set-selections
sudo echo "tripwire tripwire/rebuild-policy             boolean true"                       | sudo debconf-set-selections
sudo echo "tripwire tripwire/local-passphrase-incorrect boolean true"                       | sudo debconf-set-selections

DEBIAN_FRONTEND=noninteractive apt-get install tripwire

echo $TripWireLocalPassword | tripwire --init

DEBIAN_FRONTEND=noninteractive apt-get install ...是一个神奇的词。

如果您删除了以前的tripwire安装,请不要忘记apt-get purge tripwire否则安装会抱怨本地密码不正确。

(在Ubuntu 16.04上测试)