From f748e86c638500c4a28cb678de657ffae8a5ea54 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Fri, 9 Feb 2018 12:10:35 +0000
Subject: [PATCH 01/91] Bump peertube commit
---
src/freedombone-app-peertube | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index 604ba56c..667f03ea 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -39,7 +39,7 @@ SHOW_ON_ABOUT=1
PEERTUBE_DOMAIN_NAME=
PEERTUBE_CODE=
PEERTUBE_REPO="https://github.com/Chocobozzz/PeerTube"
-PEERTUBE_COMMIT='fef2c7164e025b12a64185dbab058ef4129733c6'
+PEERTUBE_COMMIT='c525c093751aba9f1152adbe405daae20a0dc400'
PEERTUBE_ONION_PORT=8136
PEERTUBE_PORT=9004
MESH_PEERTUBE_PORT=8500
From 45ade39c8060114743edaa004d70f9f5439bef31 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Fri, 9 Feb 2018 12:42:43 +0000
Subject: [PATCH 02/91] Include architecture
---
src/freedombone-app-peertube | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index 667f03ea..9c027750 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -51,6 +51,7 @@ peertube_variables=(PEERTUBE_DOMAIN_NAME
ONION_ONLY
DDNS_PROVIDER
MY_USERNAME
+ ARCHITECTURE
MY_EMAIL_ADDRESS)
function peertube_create_database {
From 12b95f0e7673bb15d8a5ab29e275bd3b73de7f1e Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Fri, 9 Feb 2018 15:20:34 +0000
Subject: [PATCH 03/91] Try building peertube locally with a recent node
version
---
src/freedombone-app-peertube | 46 +++++++++++++++++++++++++-----------
1 file changed, 32 insertions(+), 14 deletions(-)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index 9c027750..b0043010 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -200,7 +200,9 @@ function upgrade_peertube {
function_check set_repo_commit
set_repo_commit $PEERTUBE_DIR "peertube commit" "$PEERTUBE_COMMIT" $PEERTUBE_REPO
- npm run upgrade-peertube
+ alias npm-exec='PATH=$(npm bin):$PATH'
+ npm-exec npm run upgrade-peertube
+
chown -R peertube:peertube $PEERTUBE_DIR
systemctl start peertube
}
@@ -770,23 +772,39 @@ function install_peertube {
git checkout $PEERTUBE_COMMIT -b $PEERTUBE_COMMIT
set_completion_param "peertube commit" "$PEERTUBE_COMMIT"
- npm install -g yarn
+ npm install npm@5.6.0
+ if [ ! "$?" = "0" ]; then
+ echo $'Failed to install local npm version 5.6.0'
+ exit 45465774
+ fi
+ alias npm-exec='PATH=$(npm bin):$PATH'
+ npm-exec install node@9.5.0
+ if [ ! "$?" = "0" ]; then
+ echo $'Failed to install local nodejs version 9.5.0'
+ exit 54875459
+ fi
+ npm install npm@5.6.0
+ if [ ! "$?" = "0" ]; then
+ echo $'Failed to install local npm version 5.6.0'
+ exit 678356845684
+ fi
+ npm install yarn@1.3.2
if [ ! "$?" = "0" ]; then
echo $'Failed to install yarn'
- exit 79353234
+ exit 578947946
fi
- yarn add -D webpack --network-concurrency 1
- yarn install
- if [ ! "$?" = "0" ]; then
- echo $'Failed to run yarn install'
- exit 63754235
- fi
- npm install
+ npm-exec yarn add -D webpack --network-concurrency 1
+ #npm-exec yarn install --non-interactive
+ #if [ ! "$?" = "0" ]; then
+ # echo $'Failed to run yarn install'
+ # exit 63754235
+ #fi
+ npm-exec npm install
if [ ! "$?" = "0" ]; then
echo $'Failed to install peertube'
exit 7835243
fi
- npm run build
+ npm-exec npm run build
if [ ! "$?" = "0" ]; then
echo $'Failed to build peertube'
exit 5293593
@@ -803,13 +821,13 @@ function install_peertube {
echo 'User=peertube' >> /etc/systemd/system/peertube.service
echo 'Group=peertube' >> /etc/systemd/system/peertube.service
echo "WorkingDirectory=$PEERTUBE_DIR" >> /etc/systemd/system/peertube.service
- echo "ExecStart=/usr/local/bin/npm start" >> /etc/systemd/system/peertube.service
- echo "ExecStop=/usr/local/bin/npm stop" >> /etc/systemd/system/peertube.service
+ echo "ExecStart=$PEERTUBE_DIR/node_modules/.bin/npm start" >> /etc/systemd/system/peertube.service
+ echo "ExecStop=$PEERTUBE_DIR/node_modules/.bin/npm stop" >> /etc/systemd/system/peertube.service
echo 'StandardOutput=syslog' >> /etc/systemd/system/peertube.service
echo 'StandardError=syslog' >> /etc/systemd/system/peertube.service
echo 'SyslogIdentifier=peertube' >> /etc/systemd/system/peertube.service
echo 'Restart=always' >> /etc/systemd/system/peertube.service
- echo "Environment=NODE_ENV=production" >> /etc/systemd/system/peertube.service
+ echo "Environment=NODE_ENV=production PATH=\$(npm bin):\$PATH" >> /etc/systemd/system/peertube.service
echo '' >> /etc/systemd/system/peertube.service
echo '[Install]' >> /etc/systemd/system/peertube.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/peertube.service
From 161ca39a89bcb84a398162f848dcb7ca408944b5 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Fri, 9 Feb 2018 15:24:35 +0000
Subject: [PATCH 04/91] Missing command
---
src/freedombone-app-peertube | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index b0043010..db4dbc23 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -778,7 +778,7 @@ function install_peertube {
exit 45465774
fi
alias npm-exec='PATH=$(npm bin):$PATH'
- npm-exec install node@9.5.0
+ npm-exec npm install node@9.5.0
if [ ! "$?" = "0" ]; then
echo $'Failed to install local nodejs version 9.5.0'
exit 54875459
From 0f13d6b12dcd2ec93464183b3ce54bb5d5253112 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Fri, 9 Feb 2018 15:32:04 +0000
Subject: [PATCH 05/91] no alias
---
src/freedombone-app-peertube | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index db4dbc23..583caf74 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -777,8 +777,8 @@ function install_peertube {
echo $'Failed to install local npm version 5.6.0'
exit 45465774
fi
- alias npm-exec='PATH=$(npm bin):$PATH'
- npm-exec npm install node@9.5.0
+ PATH=$(npm bin):$PATH
+ npm install node@9.5.0
if [ ! "$?" = "0" ]; then
echo $'Failed to install local nodejs version 9.5.0'
exit 54875459
@@ -793,18 +793,18 @@ function install_peertube {
echo $'Failed to install yarn'
exit 578947946
fi
- npm-exec yarn add -D webpack --network-concurrency 1
- #npm-exec yarn install --non-interactive
+ yarn add -D webpack --network-concurrency 1
+ #yarn install --non-interactive
#if [ ! "$?" = "0" ]; then
# echo $'Failed to run yarn install'
# exit 63754235
#fi
- npm-exec npm install
+ npm install
if [ ! "$?" = "0" ]; then
echo $'Failed to install peertube'
exit 7835243
fi
- npm-exec npm run build
+ npm run build
if [ ! "$?" = "0" ]; then
echo $'Failed to build peertube'
exit 5293593
From 1ed1a4a56df5596fbd0276860d0607d47a796f3f Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Fri, 9 Feb 2018 15:37:37 +0000
Subject: [PATCH 06/91] Switching paths
---
src/freedombone-app-peertube | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index 583caf74..6f44b059 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -777,12 +777,15 @@ function install_peertube {
echo $'Failed to install local npm version 5.6.0'
exit 45465774
fi
+ PREV_PATH=$PATH
PATH=$(npm bin):$PATH
npm install node@9.5.0
if [ ! "$?" = "0" ]; then
+ PATH=$PREV_PATH
echo $'Failed to install local nodejs version 9.5.0'
exit 54875459
fi
+ PATH=$PREV_PATH
npm install npm@5.6.0
if [ ! "$?" = "0" ]; then
echo $'Failed to install local npm version 5.6.0'
@@ -793,6 +796,7 @@ function install_peertube {
echo $'Failed to install yarn'
exit 578947946
fi
+ PATH=$(npm bin):$PATH
yarn add -D webpack --network-concurrency 1
#yarn install --non-interactive
#if [ ! "$?" = "0" ]; then
@@ -801,14 +805,17 @@ function install_peertube {
#fi
npm install
if [ ! "$?" = "0" ]; then
+ PATH=$PREV_PATH
echo $'Failed to install peertube'
exit 7835243
fi
npm run build
if [ ! "$?" = "0" ]; then
+ PATH=$PREV_PATH
echo $'Failed to build peertube'
exit 5293593
fi
+ PATH=$PREV_PATH
PEERTUBE_ONION_HOSTNAME=$(add_onion_service peertube 80 ${PEERTUBE_ONION_PORT})
From 21614bece9a36ffd309a42a98b31d92ac2178059 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Fri, 9 Feb 2018 15:43:19 +0000
Subject: [PATCH 07/91] Switch path during upgrades
---
src/freedombone-app-peertube | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index 6f44b059..a573795e 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -200,8 +200,10 @@ function upgrade_peertube {
function_check set_repo_commit
set_repo_commit $PEERTUBE_DIR "peertube commit" "$PEERTUBE_COMMIT" $PEERTUBE_REPO
- alias npm-exec='PATH=$(npm bin):$PATH'
- npm-exec npm run upgrade-peertube
+ PREV_PATH=$PATH
+ PATH=$(npm bin):$PATH
+ npm run upgrade-peertube
+ PATH=$PREV_PATH
chown -R peertube:peertube $PEERTUBE_DIR
systemctl start peertube
From f5cea90040450860a9fe109386db88e0b923f2f7 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Fri, 9 Feb 2018 21:02:28 +0000
Subject: [PATCH 08/91] More peertube fixes
---
src/freedombone-app-peertube | 45 ++++++++++++++++++++++++++++--------
1 file changed, 35 insertions(+), 10 deletions(-)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index a573795e..4659d2c0 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -39,11 +39,13 @@ SHOW_ON_ABOUT=1
PEERTUBE_DOMAIN_NAME=
PEERTUBE_CODE=
PEERTUBE_REPO="https://github.com/Chocobozzz/PeerTube"
-PEERTUBE_COMMIT='c525c093751aba9f1152adbe405daae20a0dc400'
+PEERTUBE_COMMIT='a7fea183f0f69104b209e7bfdd6435be28165f22'
PEERTUBE_ONION_PORT=8136
PEERTUBE_PORT=9004
MESH_PEERTUBE_PORT=8500
PEERTUBE_DIR=/etc/peertube
+peertube_npm_version='5.3.0'
+peertube_node_version='8.6.0'
peertube_variables=(PEERTUBE_DOMAIN_NAME
PEERTUBE_CODE
@@ -774,23 +776,23 @@ function install_peertube {
git checkout $PEERTUBE_COMMIT -b $PEERTUBE_COMMIT
set_completion_param "peertube commit" "$PEERTUBE_COMMIT"
- npm install npm@5.6.0
+ npm install npm@$peertube_npm_version
if [ ! "$?" = "0" ]; then
- echo $'Failed to install local npm version 5.6.0'
+ echo $"Failed to install local npm version $peertube_npm_version"
exit 45465774
fi
PREV_PATH=$PATH
PATH=$(npm bin):$PATH
- npm install node@9.5.0
+ npm install node@$peertube_node_version
if [ ! "$?" = "0" ]; then
PATH=$PREV_PATH
- echo $'Failed to install local nodejs version 9.5.0'
+ echo $"Failed to install local nodejs version $peertube_node_version"
exit 54875459
fi
PATH=$PREV_PATH
- npm install npm@5.6.0
+ npm install npm@$peertube_npm_version
if [ ! "$?" = "0" ]; then
- echo $'Failed to install local npm version 5.6.0'
+ echo $"Failed to install local npm version $peertube_npm_version"
exit 678356845684
fi
npm install yarn@1.3.2
@@ -818,9 +820,31 @@ function install_peertube {
exit 5293593
fi
PATH=$PREV_PATH
+ npm install npm@$peertube_npm_version
+ if [ ! "$?" = "0" ]; then
+ echo $"Failed to install local npm version $peertube_npm_version"
+ exit 678356845684
+ fi
+
+ # Hacky stuff to fix runtime errors
+ sed -i 's|const url_1 = require("url");|const url_1 = require("url").Url;|g' dist/server/helpers/core-utils.js
+ sed -i 's|const urlObject = new url_1.URL(url);|const urlObject = new url_1(url);|g' dist/server/helpers/core-utils.js
+ sed -i 's|return urlObject.href.replace(/\/$/, '');|return urlObject.href;|g' dist/server/helpers/core-utils.js
PEERTUBE_ONION_HOSTNAME=$(add_onion_service peertube 80 ${PEERTUBE_ONION_PORT})
+ echo '#!/bin/bash' > $PEERTUBE_DIR/start
+ echo "cd $PEERTUBE_DIR" >> $PEERTUBE_DIR/start
+ echo 'PATH=$(npm bin):$PATH' >> $PEERTUBE_DIR/start
+ echo 'npm start' >> $PEERTUBE_DIR/start
+ chmod +x $PEERTUBE_DIR/start
+
+ echo '#!/bin/bash' > $PEERTUBE_DIR/stop
+ echo "cd $PEERTUBE_DIR" >> $PEERTUBE_DIR/stop
+ echo 'PATH=$(npm bin):$PATH' >> $PEERTUBE_DIR/stop
+ echo 'npm stop' >> $PEERTUBE_DIR/stop
+ chmod +x $PEERTUBE_DIR/stop
+
echo '[Unit]' > /etc/systemd/system/peertube.service
echo 'Description=PeerTube Decentralized video streaming platform' >> /etc/systemd/system/peertube.service
echo 'After=syslog.target' >> /etc/systemd/system/peertube.service
@@ -830,13 +854,14 @@ function install_peertube {
echo 'User=peertube' >> /etc/systemd/system/peertube.service
echo 'Group=peertube' >> /etc/systemd/system/peertube.service
echo "WorkingDirectory=$PEERTUBE_DIR" >> /etc/systemd/system/peertube.service
- echo "ExecStart=$PEERTUBE_DIR/node_modules/.bin/npm start" >> /etc/systemd/system/peertube.service
- echo "ExecStop=$PEERTUBE_DIR/node_modules/.bin/npm stop" >> /etc/systemd/system/peertube.service
+ echo "ExecStart=$PEERTUBE_DIR/start" >> /etc/systemd/system/peertube.service
+ echo "ExecStop=$PEERTUBE_DIR/stop" >> /etc/systemd/system/peertube.service
echo 'StandardOutput=syslog' >> /etc/systemd/system/peertube.service
echo 'StandardError=syslog' >> /etc/systemd/system/peertube.service
echo 'SyslogIdentifier=peertube' >> /etc/systemd/system/peertube.service
echo 'Restart=always' >> /etc/systemd/system/peertube.service
- echo "Environment=NODE_ENV=production PATH=\$(npm bin):\$PATH" >> /etc/systemd/system/peertube.service
+ echo 'Environment=NODE_ENV=production' >> /etc/systemd/system/peertube.service
+ echo "Environment=NODE_CONFIG_DIR=$PEERTUBE_DIR/config" >> /etc/systemd/system/peertube.service
echo '' >> /etc/systemd/system/peertube.service
echo '[Install]' >> /etc/systemd/system/peertube.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/peertube.service
From abd7011b70966ca2a3378a6b145f04630139f26d Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Fri, 9 Feb 2018 21:25:44 +0000
Subject: [PATCH 09/91] No peertube stop script
---
src/freedombone-app-peertube | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index 4659d2c0..82414e11 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -829,7 +829,7 @@ function install_peertube {
# Hacky stuff to fix runtime errors
sed -i 's|const url_1 = require("url");|const url_1 = require("url").Url;|g' dist/server/helpers/core-utils.js
sed -i 's|const urlObject = new url_1.URL(url);|const urlObject = new url_1(url);|g' dist/server/helpers/core-utils.js
- sed -i 's|return urlObject.href.replace(/\/$/, '');|return urlObject.href;|g' dist/server/helpers/core-utils.js
+ sed -i 's|return urlObject.href.replace.*|return urlObject.href;|g' dist/server/helpers/core-utils.js
PEERTUBE_ONION_HOSTNAME=$(add_onion_service peertube 80 ${PEERTUBE_ONION_PORT})
@@ -839,12 +839,6 @@ function install_peertube {
echo 'npm start' >> $PEERTUBE_DIR/start
chmod +x $PEERTUBE_DIR/start
- echo '#!/bin/bash' > $PEERTUBE_DIR/stop
- echo "cd $PEERTUBE_DIR" >> $PEERTUBE_DIR/stop
- echo 'PATH=$(npm bin):$PATH' >> $PEERTUBE_DIR/stop
- echo 'npm stop' >> $PEERTUBE_DIR/stop
- chmod +x $PEERTUBE_DIR/stop
-
echo '[Unit]' > /etc/systemd/system/peertube.service
echo 'Description=PeerTube Decentralized video streaming platform' >> /etc/systemd/system/peertube.service
echo 'After=syslog.target' >> /etc/systemd/system/peertube.service
@@ -855,7 +849,6 @@ function install_peertube {
echo 'Group=peertube' >> /etc/systemd/system/peertube.service
echo "WorkingDirectory=$PEERTUBE_DIR" >> /etc/systemd/system/peertube.service
echo "ExecStart=$PEERTUBE_DIR/start" >> /etc/systemd/system/peertube.service
- echo "ExecStop=$PEERTUBE_DIR/stop" >> /etc/systemd/system/peertube.service
echo 'StandardOutput=syslog' >> /etc/systemd/system/peertube.service
echo 'StandardError=syslog' >> /etc/systemd/system/peertube.service
echo 'SyslogIdentifier=peertube' >> /etc/systemd/system/peertube.service
From 43b5121aa06b3429df3c1ad3d16553590450ac9b Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sat, 10 Feb 2018 20:07:50 +0000
Subject: [PATCH 10/91] Revert recent peertube changes
---
src/freedombone-app-peertube | 68 ++++++------------------------------
src/freedombone-utils-nodejs | 2 +-
2 files changed, 12 insertions(+), 58 deletions(-)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index 82414e11..604ba56c 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -39,13 +39,11 @@ SHOW_ON_ABOUT=1
PEERTUBE_DOMAIN_NAME=
PEERTUBE_CODE=
PEERTUBE_REPO="https://github.com/Chocobozzz/PeerTube"
-PEERTUBE_COMMIT='a7fea183f0f69104b209e7bfdd6435be28165f22'
+PEERTUBE_COMMIT='fef2c7164e025b12a64185dbab058ef4129733c6'
PEERTUBE_ONION_PORT=8136
PEERTUBE_PORT=9004
MESH_PEERTUBE_PORT=8500
PEERTUBE_DIR=/etc/peertube
-peertube_npm_version='5.3.0'
-peertube_node_version='8.6.0'
peertube_variables=(PEERTUBE_DOMAIN_NAME
PEERTUBE_CODE
@@ -53,7 +51,6 @@ peertube_variables=(PEERTUBE_DOMAIN_NAME
ONION_ONLY
DDNS_PROVIDER
MY_USERNAME
- ARCHITECTURE
MY_EMAIL_ADDRESS)
function peertube_create_database {
@@ -202,11 +199,7 @@ function upgrade_peertube {
function_check set_repo_commit
set_repo_commit $PEERTUBE_DIR "peertube commit" "$PEERTUBE_COMMIT" $PEERTUBE_REPO
- PREV_PATH=$PATH
- PATH=$(npm bin):$PATH
npm run upgrade-peertube
- PATH=$PREV_PATH
-
chown -R peertube:peertube $PEERTUBE_DIR
systemctl start peertube
}
@@ -776,69 +769,30 @@ function install_peertube {
git checkout $PEERTUBE_COMMIT -b $PEERTUBE_COMMIT
set_completion_param "peertube commit" "$PEERTUBE_COMMIT"
- npm install npm@$peertube_npm_version
- if [ ! "$?" = "0" ]; then
- echo $"Failed to install local npm version $peertube_npm_version"
- exit 45465774
- fi
- PREV_PATH=$PATH
- PATH=$(npm bin):$PATH
- npm install node@$peertube_node_version
- if [ ! "$?" = "0" ]; then
- PATH=$PREV_PATH
- echo $"Failed to install local nodejs version $peertube_node_version"
- exit 54875459
- fi
- PATH=$PREV_PATH
- npm install npm@$peertube_npm_version
- if [ ! "$?" = "0" ]; then
- echo $"Failed to install local npm version $peertube_npm_version"
- exit 678356845684
- fi
- npm install yarn@1.3.2
+ npm install -g yarn
if [ ! "$?" = "0" ]; then
echo $'Failed to install yarn'
- exit 578947946
+ exit 79353234
fi
- PATH=$(npm bin):$PATH
yarn add -D webpack --network-concurrency 1
- #yarn install --non-interactive
- #if [ ! "$?" = "0" ]; then
- # echo $'Failed to run yarn install'
- # exit 63754235
- #fi
+ yarn install
+ if [ ! "$?" = "0" ]; then
+ echo $'Failed to run yarn install'
+ exit 63754235
+ fi
npm install
if [ ! "$?" = "0" ]; then
- PATH=$PREV_PATH
echo $'Failed to install peertube'
exit 7835243
fi
npm run build
if [ ! "$?" = "0" ]; then
- PATH=$PREV_PATH
echo $'Failed to build peertube'
exit 5293593
fi
- PATH=$PREV_PATH
- npm install npm@$peertube_npm_version
- if [ ! "$?" = "0" ]; then
- echo $"Failed to install local npm version $peertube_npm_version"
- exit 678356845684
- fi
-
- # Hacky stuff to fix runtime errors
- sed -i 's|const url_1 = require("url");|const url_1 = require("url").Url;|g' dist/server/helpers/core-utils.js
- sed -i 's|const urlObject = new url_1.URL(url);|const urlObject = new url_1(url);|g' dist/server/helpers/core-utils.js
- sed -i 's|return urlObject.href.replace.*|return urlObject.href;|g' dist/server/helpers/core-utils.js
PEERTUBE_ONION_HOSTNAME=$(add_onion_service peertube 80 ${PEERTUBE_ONION_PORT})
- echo '#!/bin/bash' > $PEERTUBE_DIR/start
- echo "cd $PEERTUBE_DIR" >> $PEERTUBE_DIR/start
- echo 'PATH=$(npm bin):$PATH' >> $PEERTUBE_DIR/start
- echo 'npm start' >> $PEERTUBE_DIR/start
- chmod +x $PEERTUBE_DIR/start
-
echo '[Unit]' > /etc/systemd/system/peertube.service
echo 'Description=PeerTube Decentralized video streaming platform' >> /etc/systemd/system/peertube.service
echo 'After=syslog.target' >> /etc/systemd/system/peertube.service
@@ -848,13 +802,13 @@ function install_peertube {
echo 'User=peertube' >> /etc/systemd/system/peertube.service
echo 'Group=peertube' >> /etc/systemd/system/peertube.service
echo "WorkingDirectory=$PEERTUBE_DIR" >> /etc/systemd/system/peertube.service
- echo "ExecStart=$PEERTUBE_DIR/start" >> /etc/systemd/system/peertube.service
+ echo "ExecStart=/usr/local/bin/npm start" >> /etc/systemd/system/peertube.service
+ echo "ExecStop=/usr/local/bin/npm stop" >> /etc/systemd/system/peertube.service
echo 'StandardOutput=syslog' >> /etc/systemd/system/peertube.service
echo 'StandardError=syslog' >> /etc/systemd/system/peertube.service
echo 'SyslogIdentifier=peertube' >> /etc/systemd/system/peertube.service
echo 'Restart=always' >> /etc/systemd/system/peertube.service
- echo 'Environment=NODE_ENV=production' >> /etc/systemd/system/peertube.service
- echo "Environment=NODE_CONFIG_DIR=$PEERTUBE_DIR/config" >> /etc/systemd/system/peertube.service
+ echo "Environment=NODE_ENV=production" >> /etc/systemd/system/peertube.service
echo '' >> /etc/systemd/system/peertube.service
echo '[Install]' >> /etc/systemd/system/peertube.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/peertube.service
diff --git a/src/freedombone-utils-nodejs b/src/freedombone-utils-nodejs
index c3cc8486..a8ec2935 100755
--- a/src/freedombone-utils-nodejs
+++ b/src/freedombone-utils-nodejs
@@ -205,7 +205,7 @@ function upgrade_nodejs {
npm upgrade -g n@${NODEJS_N_VERSION} --save
fi
if [[ "$CURR_NODE_VERSION" != "v${NODEJS_VERSION}" ]]; then
- n {NODEJS_VERSION}
+ n ${NODEJS_VERSION}
fi
cp /usr/local/bin/n /usr/bin/n
if [ -f /usr/local/bin/npm ]; then
From 9eb9e7f46cb75c230f085cd178ecba9910a99f3b Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sat, 10 Feb 2018 20:11:47 +0000
Subject: [PATCH 11/91] Add architecture
---
src/freedombone-app-peertube | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index 604ba56c..77417417 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -51,6 +51,7 @@ peertube_variables=(PEERTUBE_DOMAIN_NAME
ONION_ONLY
DDNS_PROVIDER
MY_USERNAME
+ ARCHITECTURE
MY_EMAIL_ADDRESS)
function peertube_create_database {
From f6960ccba0cf88105f330bfea5618eabf8db61b1 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sat, 10 Feb 2018 20:42:53 +0000
Subject: [PATCH 12/91] peertube config
---
src/freedombone-app-peertube | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index 77417417..d82aaa45 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -590,11 +590,11 @@ function peertube_create_config {
echo ' size: 10 # Max number of previews you want to cache' >> $peertube_config_file
echo '' >> $peertube_config_file
echo 'admin:' >> $peertube_config_file
- echo " email: 'root@local'" >> $peertube_config_file
+ echo " email: 'admin@localhost'" >> $peertube_config_file
echo '' >> $peertube_config_file
echo 'signup:' >> $peertube_config_file
echo ' enabled: true' >> $peertube_config_file
- echo ' limit: 2 # When the limit is reached, registrations are disabled. -1 == unlimited' >> $peertube_config_file
+ echo ' limit: 5 # When the limit is reached, registrations are disabled. -1 == unlimited' >> $peertube_config_file
echo '' >> $peertube_config_file
echo 'user:' >> $peertube_config_file
echo ' # Default value of maximum video BYTES the user can upload (does not take into account transcoded files).' >> $peertube_config_file
From 69f90f12141e527bf9bd8cc033e94b44429bf290 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 10:41:42 +0000
Subject: [PATCH 13/91] Not using a conventional email address in the peertube
admin setting prevents it from installing
---
src/freedombone-app-peertube | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index d82aaa45..9cf13ca4 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -590,7 +590,7 @@ function peertube_create_config {
echo ' size: 10 # Max number of previews you want to cache' >> $peertube_config_file
echo '' >> $peertube_config_file
echo 'admin:' >> $peertube_config_file
- echo " email: 'admin@localhost'" >> $peertube_config_file
+ echo " email: '$MY_EMAIL_ADDRESS'" >> $peertube_config_file
echo '' >> $peertube_config_file
echo 'signup:' >> $peertube_config_file
echo ' enabled: true' >> $peertube_config_file
From e17238eed81d29430f2973d467e8d3e6adeba56d Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 11:42:50 +0000
Subject: [PATCH 14/91] Shenanigans with the admin email address for peertube
If you define it when the config file is created then it doesn't subsequently allow you to signup a user with the same email
---
src/freedombone-app-peertube | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index 9cf13ca4..4e3cd6d6 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -590,7 +590,8 @@ function peertube_create_config {
echo ' size: 10 # Max number of previews you want to cache' >> $peertube_config_file
echo '' >> $peertube_config_file
echo 'admin:' >> $peertube_config_file
- echo " email: '$MY_EMAIL_ADDRESS'" >> $peertube_config_file
+ # This is deliberately a dummy email address
+ echo " email: 'testuser@testdomain.net'" >> $peertube_config_file
echo '' >> $peertube_config_file
echo 'signup:' >> $peertube_config_file
echo ' enabled: true' >> $peertube_config_file
@@ -830,6 +831,12 @@ function install_peertube {
systemctl start peertube
systemctl restart nginx
+ # wait for the database to get generated after initial peertube daemon start
+ sleep 10
+
+ # update the admin email address after creation of the database
+ sed -i "s|email: .*|email: '$MY_EMAIL_ADDRESS'|g" $PEERTUBE_DIR/config/production.yaml
+
set_completion_param "peertube domain" "$PEERTUBE_DOMAIN_NAME"
APP_INSTALLED=1
}
From 09759b7da5c1e8332b13b94a31cf23fdf2cc10fd Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 11:54:06 +0000
Subject: [PATCH 15/91] Changing peertube signup state
---
src/freedombone-app-peertube | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index 4e3cd6d6..5d481322 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -141,8 +141,8 @@ function peertube_disable_signups {
--yesno $"\nDo you wish to disable further PeerTube signups?" 8 75
sel=$?
case $sel in
- 0) sed "0,/RE/s/enabled:.*/enabled: false/" $PEERTUBE_DIR/config/production.yaml;;
- 1) sed "0,/RE/s/enabled:.*/enabled: true/" $PEERTUBE_DIR/config/production.yaml;;
+ 0) sed -i "0,/enabled:.*/s//enabled: false/" $PEERTUBE_DIR/config/production.yaml;;
+ 1) sed -i "0,/enabled:.*/s//enabled: true/" $PEERTUBE_DIR/config/production.yaml;;
255) return;;
esac
From b6ea8db5c68ab284f0d84f2e59d2c3597906616e Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 12:06:08 +0000
Subject: [PATCH 16/91] Drop the database and its owner
---
src/freedombone-app-peertube | 2 +-
src/freedombone-utils-postgresql | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index 5d481322..ffa1142f 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -342,7 +342,7 @@ function remove_peertube {
sed -i '/peertube/d' $COMPLETION_FILE
function_check drop_database_postgresql
- drop_database_postgresql peertube
+ drop_database_postgresql peertube peertube
remove_postgresql_user peertube
groupdel -f peertube
diff --git a/src/freedombone-utils-postgresql b/src/freedombone-utils-postgresql
index c41b6e31..e8be209b 100755
--- a/src/freedombone-utils-postgresql
+++ b/src/freedombone-utils-postgresql
@@ -124,8 +124,12 @@ function remove_postgresql_user {
function drop_database_postgresql {
database_name="$1"
+ database_owner_name="$2"
cd /etc/postgresql
sudo -u postgres psql -c "drop database $database_name"
+ if [ ${#database_owner_name} -gt 0 ]; then
+ sudo -u postgres psql -c "drop user $database_owner_name"
+ fi
}
function run_system_query_postgresql {
From a3579562a0645b1e5acdbe126663bb66cea79205 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 12:11:16 +0000
Subject: [PATCH 17/91] Redundant command
---
src/freedombone-app-peertube | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index ffa1142f..8c360ec9 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -344,7 +344,6 @@ function remove_peertube {
function_check drop_database_postgresql
drop_database_postgresql peertube peertube
- remove_postgresql_user peertube
groupdel -f peertube
userdel -r peertube
From a8f6cd320f921c5598fa1b65b422cc91df801fde Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 12:14:25 +0000
Subject: [PATCH 18/91] Bump go version
---
src/freedombone-utils-go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-utils-go b/src/freedombone-utils-go
index 9595f4ca..b927b044 100755
--- a/src/freedombone-utils-go
+++ b/src/freedombone-utils-go
@@ -32,7 +32,7 @@
# before getting to the version we want
GO_INTERMEDIATE_VERSION=1.4.2
-GO_VERSION=1.9
+GO_VERSION=1.9.4
GO_REPO="https://go.googlesource.com/go"
GO_PACKAGE_MANAGER_REPO="https://github.com/gpmgo/gopm"
From 1e687aa54f5d59ef5ca9830d578362b2ebef01bb Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 13:44:17 +0000
Subject: [PATCH 19/91] i2p utilities
---
src/freedombone-utils-i2p | 62 +++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100755 src/freedombone-utils-i2p
diff --git a/src/freedombone-utils-i2p b/src/freedombone-utils-i2p
new file mode 100755
index 00000000..1a0bb5d1
--- /dev/null
+++ b/src/freedombone-utils-i2p
@@ -0,0 +1,62 @@
+#!/bin/bash
+#
+# .---. . .
+# | | |
+# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
+# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
+# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
+#
+# Freedom in the Cloud
+#
+# i2p functions
+#
+# There's a problem with installing this onto mesh images, which is
+# that qemu appears to run out of RAM when using yarn to add webpack.
+#
+# License
+# =======
+#
+# Copyright (C) 2017-2018 Bob Mottram
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+
+I2P_DOMAIN='deb.i2p2.de'
+
+function install_i2p {
+ if [ ! -d $INSTALL_DIR ]; then
+ mkdir -p $INSTALL_DIR
+ fi
+
+ # install the gpg key
+ cd $INSTALL_DIR
+ if [ -f i2p-debian-repo.key.asc ]; then
+ rm i2p-debian-repo.key.asc
+ fi
+ wget https://geti2p.net/_static/i2p-debian-repo.key.asc
+ if [ ! -f i2p-debian-repo.key.asc ]; then
+ echo $'failed to ontain i2p repo gpg key'
+ exit 7834627345
+ fi
+ apt-key add i2p-debian-repo.key.asc
+
+ echo "deb https://${I2P_DOMAIN}/ stretch main" > /etc/apt/sources.list.d/i2p.list
+ echo "deb-src https://${I2P_DOMAIN}/ stretch main" >> /etc/apt/sources.list.d/i2p.list
+
+ apt-get update
+ apt-get -yq install i2p i2p-keyring
+}
+
+function remove_i2p {
+ apt-get -yq remove i2p i2p-keyring --purge
+}
From 6a54a30e50cf91f736563288358143072b73b3c9 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 19:38:05 +0000
Subject: [PATCH 20/91] Enable ipv6 when i2p is installed
---
src/freedombone-utils-firewall | 2 +-
src/freedombone-utils-i2p | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/freedombone-utils-firewall b/src/freedombone-utils-firewall
index 8c429973..2359fbe4 100755
--- a/src/freedombone-utils-firewall
+++ b/src/freedombone-utils-firewall
@@ -265,7 +265,7 @@ function configure_internet_protocol {
if ! grep -q "ignore pings" /etc/sysctl.conf; then
echo '# ignore pings' >> /etc/sysctl.conf
echo 'net.ipv4.icmp_echo_ignore_all = 1' >> /etc/sysctl.conf
- echo 'net.ipv6.icmp_echo_ignore_all = 1' >> /etc/sysctl.conf
+ #echo 'net.ipv6.icmp_echo_ignore_all = 1' >> /etc/sysctl.conf
fi
if ! grep -q "disable ipv6" /etc/sysctl.conf; then
echo '# disable ipv6' >> /etc/sysctl.conf
diff --git a/src/freedombone-utils-i2p b/src/freedombone-utils-i2p
index 1a0bb5d1..f9c25f06 100755
--- a/src/freedombone-utils-i2p
+++ b/src/freedombone-utils-i2p
@@ -53,10 +53,24 @@ function install_i2p {
echo "deb https://${I2P_DOMAIN}/ stretch main" > /etc/apt/sources.list.d/i2p.list
echo "deb-src https://${I2P_DOMAIN}/ stretch main" >> /etc/apt/sources.list.d/i2p.list
+ # i2p needs ipv6 to be enabled
+ sed -i 's|net.ipv6.conf.all.disable_ipv6.*|net.ipv6.conf.all.disable_ipv6 = 0|g' /etc/sysctl.conf
+ /sbin/sysctl -p -q
+
apt-get update
apt-get -yq install i2p i2p-keyring
}
function remove_i2p {
apt-get -yq remove i2p i2p-keyring --purge
+
+ # It's assumed here that ipv6 is only needed for i2p
+ # This might not be true in future
+ sed -i 's|net.ipv6.conf.all.disable_ipv6.*|net.ipv6.conf.all.disable_ipv6 = 1|g' /etc/sysctl.conf
+ /sbin/sysctl -p -q
+}
+
+function i2p_enable_sam {
+ sed -i 's|clientApp.1.startOnLoad=.*|clientApp.1.startOnLoad=true|g' /var/lib/i2p/i2p-config/clients.config
+ systemctl restart i2p
}
From 637647e207c6546459ec34a3945b56f0502cbdd6 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 19:41:55 +0000
Subject: [PATCH 21/91] Remove directories if they exist
---
src/freedombone-utils-i2p | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/freedombone-utils-i2p b/src/freedombone-utils-i2p
index f9c25f06..c3719131 100755
--- a/src/freedombone-utils-i2p
+++ b/src/freedombone-utils-i2p
@@ -68,6 +68,13 @@ function remove_i2p {
# This might not be true in future
sed -i 's|net.ipv6.conf.all.disable_ipv6.*|net.ipv6.conf.all.disable_ipv6 = 1|g' /etc/sysctl.conf
/sbin/sysctl -p -q
+
+ if [ -d /var/lib/i2p ]; then
+ rm -rf /var/lib/i2p
+ fi
+ if [ -d /etc/i2p ]; then
+ rm -rf /etc/i2p
+ fi
}
function i2p_enable_sam {
From 2ba7792ebbe18626fcaf1e60b0b458021718a32f Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 22:08:12 +0000
Subject: [PATCH 22/91] add bdsmail app
---
man/freedombone-template.1.gz | Bin 1294 -> 1315 bytes
src/freedombone-app-bdsmail | 274 +++++++++++++++++++++++++++++++++
src/freedombone-backup-local | 6 +-
src/freedombone-backup-remote | 4 +
src/freedombone-restore-local | 8 +
src/freedombone-restore-remote | 8 +
6 files changed, 299 insertions(+), 1 deletion(-)
create mode 100755 src/freedombone-app-bdsmail
diff --git a/man/freedombone-template.1.gz b/man/freedombone-template.1.gz
index b91fe51cd10b11b7f14810a4a4afe90ec86c9e34..e6fd942c5b43288daf2d226cc6de396458e519ce 100644
GIT binary patch
literal 1315
zcmV+;1>E`{iwFQ^o`6~a1Kn3`Puw^V{+?ek%9noW?n3WH6*^V7P$)_
z9!&=xUCo#8=>sR%7e@|RV$^YuRL8=C5z?x{0j>cmb3keim%T4{fpDV_{%&HP-12rB
zgf!9O0k>qrRuCftx`U<4b29x-$*se-(b9NGy8|$&9wf4ChY0NsA}+6N!8UGVoZk_l
zbT2sP+>y&|Ib63*>wMTezwCVIL^7?aM?yVXKDihHIifH(_aWCQqaAE+*T-6U&Wtp1
zdeVZ)9Peso%vx#Q>p1e;0mS}Ys2`BiRnprv*qJ42
zVM&`SRDz?l!nVChgSH*c`4Hsj)5+(B$0nW=(^hC5J55Y6^oGxQMagC?*+JJIDQUGT
zVZkJpf&5)Yk}rYo-f8kz(^Ygc;h)*ZSw_X7j|6yQhLopgRl6rvPT?%`sl}B`!6Bb|
z&m7|@+lf0nZtz*}gq?YT9HBG}H*NA^Oh$)YQ|FrT0j&jULcR(N@7@{jx+8L1i_{k)
z-AGs?-j{s{5|-XK^UaI4)wxyA3p}~zxmo#0inJ-24$#{|t0pgeWHLIrrZ)FK4h8(Qx3~B2LNNcv?$yP@%{r3M
zXAk5$OG@-{py|kekE8LI65PC4#CLSM=MfKXg`)EnApNLtc>RIKgeCgmBu!5J&(b6U
zg|)Rgn9Xuxd6P`Zq8Smq*w#1`#xyv5OP^m~on9{E=ujnat}IQn75tK@9g~CMnnx$1e*o}TXuFIM0005Igbn}z
literal 1294
zcmV+p1@ZbHiwFP{+Im_51JzesZ`(E$e%G%!@JnB6JLxVMf}xm`CQX1PF>D9hkQ4zW
z9!XpzQYEPv8v5gRNa|v{PCB4PiUm$0Qarbh-?@0QI)_vva#hAk;@DzY70eTmE%*JzridpHMg+(_y%kti%s6M!3b2iGm(A+-j^8)Y`2QxJ^`9
z3QN!9N@+_Xbs3}X)=m;}-xq_BdV
zYanZ{i<5C7GqBDbhb1Wl_iJ;Mkcy(9BdWHoRoRdkP46_caWZd`qow;XlPJW+6&m@<
zLZZ>#CIkA;_iSg0%`*YB0wI&5n#jfb>70KMv7B2D**&~7i{^2+9H!y4oKo(QEo
z!5Qa{TyD$Zy6svU!{+%#8$&CSYE|wCb!hqIVg%%X!puB`T&Ik7u(@4-*UEEdpo!Cy
zuO(bK;eR8aI-uHuIaLRVo>>@Yur+^2%E->ab{VFCP)Xx
z+fFzH?4F38@InTb6Fna{7#bYeR`sMOpXmr??)1;u<^1S)@Fv|yhvbv
zK8LEPsdqQakHz%T^{IEqgmCOkQMm*9`HGf%cjqk9vPSH1j
zX-+AwlDc3z
zplNfh>MZwQr*v{nE#v=%F8p+GaPW1g&i-R@Z{c;LfFwZKBZbc50zI@eJov9UG#yeJ
zn(y2Qo(C~_8nXQh*!bpneDj_f;{rY2ah*|nu+)1Yx3)4z(`iOrtm6rJG$k75+Zw0B
zm>T=
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+
+VARIANTS='full full-vim'
+
+IN_DEFAULT_INSTALL=0
+SHOW_ON_ABOUT=1
+
+BDSMAIL_REPO="https://github.com/majestrate/bdsmail"
+BDSMAIL_COMMIT='6a2296b0b8e6c3da61081b85802e7b1cc88ca285'
+
+bdsmail=(MY_USERNAME)
+
+function logging_on_bdsmail {
+ echo -n ''
+}
+
+function logging_off_bdsmail {
+ echo -n ''
+}
+
+function remove_user_bdsmail {
+ remove_username="$1"
+}
+
+function add_user_bdsmail {
+ new_username="$1"
+ new_user_password="$2"
+
+ if [ ! -d /home/$new_username/.mutt ]; then
+ mkdir /home/$new_username/.mutt
+ cp /etc/skel/.mutt/bdsmail /home/$new_username/.mutt
+ fi
+ sed -i "s|username|$new_username|g" /home/$new_username/.mutt/bdsmail
+ chown -R $new_username:$new_username /home/$new_username/.mutt
+ echo '0'
+}
+
+function install_interactive_bdsmail {
+ echo -n ''
+ APP_INSTALLED=1
+}
+
+function change_password_bdsmail {
+ curr_username="$1"
+ new_user_password="$2"
+}
+
+function reconfigure_bdsmail {
+ # This is used if you need to switch identity. Dump old keys and generate new ones
+ echo -n ''
+}
+
+function upgrade_bdsmail {
+ CURR_BDSMAIL_COMMIT=$(get_completion_param "bdsmail commit")
+ if [[ "$CURR_BDSMAIL_COMMIT" == "$BDSMAIL_COMMIT" ]]; then
+ return
+ fi
+
+ # update to the next commit
+ set_repo_commit /etc/bdsmail "bdsmail commit" "$BDSMAIL_COMMIT" $BDSMAIL_REPO
+ chown -R bdsmail:bdsmail /etc/bdsmail
+}
+
+function backup_local_bdsmail {
+ systemctl stop bdsmail
+
+ source_directory=/etc/bdsmail
+
+ function_check backup_directory_to_usb
+ dest_directory=bdsmail
+ backup_directory_to_usb $source_directory $dest_directory
+
+ systemctl start bdsmail
+}
+
+function restore_local_bdsmail {
+ systemctl stop bdsmail
+
+ temp_restore_dir=/root/tempbdsmail
+ bdsmail_dir=/etc/bdsmail
+
+ function_check restore_directory_from_usb
+ restore_directory_from_usb $temp_restore_dir bdsmail
+ if [ -d $temp_restore_dir ]; then
+ if [ -d cp $temp_restore_dir$bdsmail_dir ]; then
+ cp -rp $temp_restore_dir$bdsmail_dir $bdsmail_dir/
+ else
+ if [ ! -d $bdsmail_dir ]; then
+ mkdir $bdsmail_dir
+ fi
+ cp -rp $temp_restore_dir/* $bdsmail_dir
+ fi
+ chown -R bdsmail:bdsmail $bdsmail_dir
+ rm -rf $temp_restore_dir
+ fi
+
+ systemctl start bdsmail
+}
+
+function backup_remote_bdsmail {
+ systemctl stop bdsmail
+
+ source_directory=/etc/bdsmail
+
+ function_check backup_directory_to_friend
+ dest_directory=bdsmail
+ backup_directory_to_friend $source_directory $dest_directory
+
+ systemctl start bdsmail
+}
+
+function restore_remote_bdsmail {
+ systemctl stop bdsmail
+
+ temp_restore_dir=/root/tempbdsmail
+ bdsmail_dir=/etc/bdsmail
+
+ function_check restore_directory_from_friend
+ restore_directory_from_friend $temp_restore_dir bdsmail
+ if [ -d $temp_restore_dir ]; then
+ if [ -d cp $temp_restore_dir$bdsmail_dir ]; then
+ cp -rp $temp_restore_dir$bdsmail_dir $bdsmail_dir/
+ else
+ if [ ! -d $bdsmail_dir ]; then
+ mkdir $bdsmail_dir
+ fi
+ cp -rp $temp_restore_dir/* $bdsmail_dir
+ fi
+ chown -R bdsmail:bdsmail $bdsmail_dir
+ rm -rf $temp_restore_dir
+ fi
+
+ systemctl start bdsmail
+}
+
+function remove_bdsmail {
+ if [ -f /etc/systemd/system/bdsmail.service ]; then
+ systemctl stop bdsmail
+ systemctl disable bdsmail
+ rm /etc/systemd/system/bdsmail.service
+ fi
+ userdel -r bdsmail
+
+ remove_app bdsmail
+ remove_completion_param install_bdsmail
+ sed -i '/bdsmail/d' $COMPLETION_FILE
+ rm -rf /etc/skel/.mutt
+ remove_i2p
+}
+
+function install_bdsmail {
+ if [ -d /etc/bdsmail ]; then
+ rm -rf /etc/bdsmail
+ fi
+
+ if [ -d /repos/bdsmail ]; then
+ mkdir /etc/bdsmail
+ cp -r -p /repos/bdsmail/. /etc/bdsmail
+ cd /etc/bdsmail
+ git pull
+ else
+ git_clone $BDSMAIL_REPO /etc/bdsmail
+ fi
+
+ if [ ! -d /etc/bdsmail ]; then
+ echo $'Unable to clone bdsmail repo'
+ exit 5735735
+ fi
+
+ cd /etc/bdsmail
+ git checkout $BDSMAIL_COMMIT -b $BDSMAIL_COMMIT
+ set_completion_param "bdsmail commit" "$BDSMAIL_COMMIT"
+
+ useradd -d /etc/bdsmail -s /bin/false bdsmail
+
+ make make GOROOT=/home/go/go${GO_VERSION}
+ if [ ! -f /etc/bdsmail/bin/bdsconfig ]; then
+ echo $'Unable to make bdsmail'
+ exit 87923567842
+ fi
+
+ install_i2p
+
+ # create configuration file
+ /etc/bdsmail/bin/bdsconfig > /etc/bdsmail/config.ini
+ echo '[maild]' > /etc/bdsmail/config.ini
+ echo 'i2paddr = 127.0.0.1:7656' >> /etc/bdsmail/config.ini
+ echo 'i2pkeyfile = bdsmail-privkey.dat' >> /etc/bdsmail/config.ini
+ echo 'bindmail = 127.0.0.1:2525' >> /etc/bdsmail/config.ini
+ echo 'bindweb = 127.0.0.1:8489' >> /etc/bdsmail/config.ini
+ echo 'domain = localhost' >> /etc/bdsmail/config.ini
+ echo 'maildir = mail' >> /etc/bdsmail/config.ini
+ echo 'database = localhost.sqlite' >> /etc/bdsmail/config.ini
+ echo 'assets = contrib/assets/web' >> /etc/bdsmail/config.ini
+
+ echo '[Unit]' > /etc/systemd/system/bdsmail.service
+ echo 'Description=bdsmail' >> /etc/systemd/system/bdsmail.service
+ echo 'After=syslog.target' >> /etc/systemd/system/bdsmail.service
+ echo 'After=network.target' >> /etc/systemd/system/bdsmail.service
+ echo '' >> /etc/systemd/system/bdsmail.service
+ echo '[Service]' >> /etc/systemd/system/bdsmail.service
+ echo 'Type=simple' >> /etc/systemd/system/bdsmail.service
+ echo 'User=bdsmail' >> /etc/systemd/system/bdsmail.service
+ echo 'Group=bdsmail' >> /etc/systemd/system/bdsmail.service
+ echo 'WorkingDirectory=/etc/bdsmail' >> /etc/systemd/system/bdsmail.service
+ echo 'ExecStart=/etc/bdsmail/bin/maild /etc/bdsmail/config.ini' >> /etc/systemd/system/bdsmail.service
+ echo 'Restart=always' >> /etc/systemd/system/bdsmail.service
+ echo 'Environment="USER=bdsmail"' >> /etc/systemd/system/bdsmail.service
+ echo '' >> /etc/systemd/system/bdsmail.service
+ echo '[Install]' >> /etc/systemd/system/bdsmail.service
+ echo 'WantedBy=multi-user.target' >> /etc/systemd/system/bdsmail.service
+ systemctl enable bdsmail
+ chown -R bdsmail:bdsmail /etc/bdsmail
+ systemctl start bdsmail
+
+ echo '#!/usr/bin/env python2' > /etc/bdsmail/get_address
+ echo 'import base64, hashlib, sys' >> /etc/bdsmail/get_address
+ echo 'with open(sys.argv[1]) as f:' >> /etc/bdsmail/get_address
+ echo " print(base64.b32encode(hashlib.sha256(base64.b64decode(f.read(516), '-~')).digest()).strip('=')+\".b32.i2p\")" >> /etc/bdsmail/get_address
+ chmod +x >> /etc/bdsmail/get_address
+
+ echo '#!/bin/bash' > /usr/bin/bdsmail_domain
+ echo 'cd /etc/bdsmail' >> /usr/bin/bdsmail_domain
+ echo 'python2 get_address bdsmail-privkey.dat' >> /usr/bin/bdsmail_domain
+ chmod +x /usr/bin/bdsmail_domain
+
+ # Create mutt configuration
+ mkdir /etc/skel/.mutt
+ echo 'set mbox_type=Maildir' > /etc/skel/.mutt/bdsmail
+ echo 'set smtp_url=smtp://127.0.0.1:2525/' >> /etc/skel/.mutt/bdsmail
+ echo 'set use_from=yes' >> /etc/skel/.mutt/bdsmail
+ echo "set from=username@$(bdsmail_domain)" >> /etc/skel/.mutt/bdsmail
+ echo 'set spoolfile=/etc/bdsmail/mail/username' >> /etc/skel/.mutt/bdsmail
+
+ # mutt configuration for the admin user
+ if [ ! -d /home/$MY_USERNAME/.mutt ]; then
+ mkdir /home/$MY_USERNAME/.mutt
+ fi
+ cp /etc/skel/.mutt/bdsmail /home/$MY_USERNAME/.mutt
+ sed -i "s|username|$MY_USERNAME|g" /home/$MY_USERNAME/.mutt/bdsmail
+ chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.mutt
+
+ APP_INSTALLED=1
+}
+
+# NOTE: deliberately there is no "exit 0"
diff --git a/src/freedombone-backup-local b/src/freedombone-backup-local
index b324a444..482f6162 100755
--- a/src/freedombone-backup-local
+++ b/src/freedombone-backup-local
@@ -13,7 +13,7 @@
# License
# =======
#
-# Copyright (C) 2015-2016 Bob Mottram
+# Copyright (C) 2015-2018 Bob Mottram
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@@ -177,6 +177,10 @@ function backup_users {
fi
backup_directory_to_usb /home/$USERNAME/tempbackup mutt/$USERNAME
fi
+ if [ -d /home/$USERNAME/.mutt ]; then
+ echo $"Backing up Mutt configurations for $USERNAME"
+ backup_directory_to_usb /home/$USERNAME/.mutt mutt/${USERNAME}configs
+ fi
# Backup email
if [ -d /home/$USERNAME/Maildir ]; then
diff --git a/src/freedombone-backup-remote b/src/freedombone-backup-remote
index bb76192c..69e3f529 100755
--- a/src/freedombone-backup-remote
+++ b/src/freedombone-backup-remote
@@ -231,6 +231,10 @@ function backup_users {
fi
backup_directory_to_friend /home/$USERNAME/tempbackup mutt/$USERNAME
fi
+ if [ -d /home/$USERNAME/.mutt ]; then
+ echo $"Backing up Mutt configurations for $USERNAME"
+ backup_directory_to_friend /home/$USERNAME/.mutt mutt/${USERNAME}configs
+ fi
# procmail settings
if [ -f /home/$USERNAME/.procmailrc ]; then
diff --git a/src/freedombone-restore-local b/src/freedombone-restore-local
index 62e1e3a9..bacbe5cb 100755
--- a/src/freedombone-restore-local
+++ b/src/freedombone-restore-local
@@ -404,10 +404,18 @@ function restore_mutt_settings {
if [ -d $USB_MOUNT/backup/mutt ]; then
for d in $USB_MOUNT/backup/mutt/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
+
+ # skip over configurations
+ if [[ "$USERNAME" == *'configs' ]]; then
+ continue
+ fi
+
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
if [ ! -d /home/$USERNAME ]; then
${PROJECT_NAME}-adduser $USERNAME
fi
+ echo $"Restoring Mutt configurations for $USERNAME"
+ restore_directory_from_usb /home/$USERNAME/.mutt mutt/${USERNAME}configs
echo $"Restoring Mutt settings for $USERNAME"
temp_restore_dir=/root/tempmutt
restore_directory_from_usb $temp_restore_dir mutt/$USERNAME
diff --git a/src/freedombone-restore-remote b/src/freedombone-restore-remote
index b7d55782..61226fdc 100755
--- a/src/freedombone-restore-remote
+++ b/src/freedombone-restore-remote
@@ -360,11 +360,19 @@ function restore_mutt_settings {
fi
for d in $SERVER_DIRECTORY/backup/mutt/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
+
+ # skip over configurations
+ if [[ "$USERNAME" == *'configs' ]]; then
+ continue
+ fi
+
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
if [ -d $SERVER_DIRECTORY/backup/mutt/$USERNAME ]; then
if [ ! -d /home/$USERNAME ]; then
${PROJECT_NAME}-adduser $USERNAME
fi
+ echo $"Restoring Mutt configurations for $USERNAME"
+ restore_directory_from_friend /home/$USERNAME/.mutt mutt/${USERNAME}configs
echo $"Restoring Mutt settings for $USERNAME"
temp_restore_dir=/root/tempmutt
restore_directory_from_friend ${temp_restore_dir} mutt/$USERNAME
From 935fc2234f6aeae8e16a3fa4b472c29f2996c6d0 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 22:10:52 +0000
Subject: [PATCH 23/91] Too many makes
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 102cbe3d..83bef91d 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -201,7 +201,7 @@ function install_bdsmail {
useradd -d /etc/bdsmail -s /bin/false bdsmail
- make make GOROOT=/home/go/go${GO_VERSION}
+ make GOROOT=/home/go/go${GO_VERSION}
if [ ! -f /etc/bdsmail/bin/bdsconfig ]; then
echo $'Unable to make bdsmail'
exit 87923567842
From 862aacf8763f01e18075156bea2708c502e64556 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 22:18:46 +0000
Subject: [PATCH 24/91] Wait for bdsmail initialisation
---
src/freedombone-app-bdsmail | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 83bef91d..426dcbc2 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -252,12 +252,21 @@ function install_bdsmail {
echo 'python2 get_address bdsmail-privkey.dat' >> /usr/bin/bdsmail_domain
chmod +x /usr/bin/bdsmail_domain
+ # wait for domain to be generated by the daemon
+ sleep 10
+
+ bds_domain=$(bdsmail_domain)
+ if [ ! $bds_domain ]; then
+ echo $'Failed to get the bdsmail domain'
+ exit 8934638
+ fi
+
# Create mutt configuration
mkdir /etc/skel/.mutt
echo 'set mbox_type=Maildir' > /etc/skel/.mutt/bdsmail
echo 'set smtp_url=smtp://127.0.0.1:2525/' >> /etc/skel/.mutt/bdsmail
echo 'set use_from=yes' >> /etc/skel/.mutt/bdsmail
- echo "set from=username@$(bdsmail_domain)" >> /etc/skel/.mutt/bdsmail
+ echo "set from=username@${bds_domain}" >> /etc/skel/.mutt/bdsmail
echo 'set spoolfile=/etc/bdsmail/mail/username' >> /etc/skel/.mutt/bdsmail
# mutt configuration for the admin user
From 5b7c64a655aee466ccfd6fc239ed1dc633871b1f Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 22:20:54 +0000
Subject: [PATCH 25/91] Weird typo
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 426dcbc2..a2942ab3 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -245,7 +245,7 @@ function install_bdsmail {
echo 'import base64, hashlib, sys' >> /etc/bdsmail/get_address
echo 'with open(sys.argv[1]) as f:' >> /etc/bdsmail/get_address
echo " print(base64.b32encode(hashlib.sha256(base64.b64decode(f.read(516), '-~')).digest()).strip('=')+\".b32.i2p\")" >> /etc/bdsmail/get_address
- chmod +x >> /etc/bdsmail/get_address
+ chmod +x /etc/bdsmail/get_address
echo '#!/bin/bash' > /usr/bin/bdsmail_domain
echo 'cd /etc/bdsmail' >> /usr/bin/bdsmail_domain
From 98f460273c7ba4f8a4a4d37ae6fec6fe824e4b09 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 22:24:53 +0000
Subject: [PATCH 26/91] Additional waits
---
src/freedombone-app-bdsmail | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index a2942ab3..fe00b8ac 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -253,12 +253,16 @@ function install_bdsmail {
chmod +x /usr/bin/bdsmail_domain
# wait for domain to be generated by the daemon
- sleep 10
-
+ echo $'Waiting for i2p domain to be generated...'
+ sleep 15
bds_domain=$(bdsmail_domain)
if [ ! $bds_domain ]; then
- echo $'Failed to get the bdsmail domain'
- exit 8934638
+ sleep 15
+ bds_domain=$(bdsmail_domain)
+ if [ ! $bds_domain ]; then
+ echo $'Failed to get the bdsmail domain'
+ exit 8934638
+ fi
fi
# Create mutt configuration
From 81810058a98d4be70e4355731cef65c9f2dbdc8e Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 22:27:31 +0000
Subject: [PATCH 27/91] restart
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index fe00b8ac..1967d531 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -239,7 +239,7 @@ function install_bdsmail {
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/bdsmail.service
systemctl enable bdsmail
chown -R bdsmail:bdsmail /etc/bdsmail
- systemctl start bdsmail
+ systemctl restart bdsmail
echo '#!/usr/bin/env python2' > /etc/bdsmail/get_address
echo 'import base64, hashlib, sys' >> /etc/bdsmail/get_address
From bb18a8c9be00087d1eb91edf6845c6d5978358e7 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 22:34:17 +0000
Subject: [PATCH 28/91] Better handling of install failure
---
src/freedombone-app-bdsmail | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 1967d531..99a26025 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -239,7 +239,7 @@ function install_bdsmail {
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/bdsmail.service
systemctl enable bdsmail
chown -R bdsmail:bdsmail /etc/bdsmail
- systemctl restart bdsmail
+ systemctl start bdsmail
echo '#!/usr/bin/env python2' > /etc/bdsmail/get_address
echo 'import base64, hashlib, sys' >> /etc/bdsmail/get_address
@@ -257,10 +257,14 @@ function install_bdsmail {
sleep 15
bds_domain=$(bdsmail_domain)
if [ ! $bds_domain ]; then
+ echo $'Waiting...'
sleep 15
bds_domain=$(bdsmail_domain)
if [ ! $bds_domain ]; then
echo $'Failed to get the bdsmail domain'
+ systemctl stop bdsmail
+ systemctl disable bdsmail
+ remove_i2p
exit 8934638
fi
fi
From 561a74c846567a007456d044fdf9258904565e34 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 22:40:33 +0000
Subject: [PATCH 29/91] Remove i2p share directory
---
src/freedombone-utils-i2p | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/freedombone-utils-i2p b/src/freedombone-utils-i2p
index c3719131..116c63b7 100755
--- a/src/freedombone-utils-i2p
+++ b/src/freedombone-utils-i2p
@@ -75,6 +75,9 @@ function remove_i2p {
if [ -d /etc/i2p ]; then
rm -rf /etc/i2p
fi
+ if [ -d /usr/share/i2p ]; then
+ rm -rf /usr/share/i2p
+ fi
}
function i2p_enable_sam {
From 76e56cd85e5362d5d784e15ea5fdcef0db204491 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 22:43:00 +0000
Subject: [PATCH 30/91] Message order
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 99a26025..77a1ca0d 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -261,10 +261,10 @@ function install_bdsmail {
sleep 15
bds_domain=$(bdsmail_domain)
if [ ! $bds_domain ]; then
- echo $'Failed to get the bdsmail domain'
systemctl stop bdsmail
systemctl disable bdsmail
remove_i2p
+ echo $'Failed to get the bdsmail domain'
exit 8934638
fi
fi
From 218875928e82b64a6c9db5063d64140802d67df8 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 22:48:07 +0000
Subject: [PATCH 31/91] Remove bdsmail if previously installed
---
src/freedombone-app-bdsmail | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 77a1ca0d..38478f65 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -173,12 +173,15 @@ function remove_bdsmail {
remove_completion_param install_bdsmail
sed -i '/bdsmail/d' $COMPLETION_FILE
rm -rf /etc/skel/.mutt
+ if [ -d /etc/bdsmail ]; then
+ rm -rf /etc/bdsmail
+ fi
remove_i2p
}
function install_bdsmail {
if [ -d /etc/bdsmail ]; then
- rm -rf /etc/bdsmail
+ remove_bdsmail
fi
if [ -d /repos/bdsmail ]; then
From d0d46a8b76b75386724fdbd5d80f631b623e2d43 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 22:55:55 +0000
Subject: [PATCH 32/91] Reload sysctl
---
src/freedombone-utils-i2p | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/freedombone-utils-i2p b/src/freedombone-utils-i2p
index 116c63b7..39a81f9f 100755
--- a/src/freedombone-utils-i2p
+++ b/src/freedombone-utils-i2p
@@ -56,6 +56,7 @@ function install_i2p {
# i2p needs ipv6 to be enabled
sed -i 's|net.ipv6.conf.all.disable_ipv6.*|net.ipv6.conf.all.disable_ipv6 = 0|g' /etc/sysctl.conf
/sbin/sysctl -p -q
+ sysctl --system
apt-get update
apt-get -yq install i2p i2p-keyring
@@ -68,6 +69,7 @@ function remove_i2p {
# This might not be true in future
sed -i 's|net.ipv6.conf.all.disable_ipv6.*|net.ipv6.conf.all.disable_ipv6 = 1|g' /etc/sysctl.conf
/sbin/sysctl -p -q
+ sysctl --system
if [ -d /var/lib/i2p ]; then
rm -rf /var/lib/i2p
From a81a98eb5300fe09b5f0b13131d170c70831daba Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 23:00:55 +0000
Subject: [PATCH 33/91] Wait longer
---
src/freedombone-app-bdsmail | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 38478f65..53a89efd 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -257,16 +257,16 @@ function install_bdsmail {
# wait for domain to be generated by the daemon
echo $'Waiting for i2p domain to be generated...'
- sleep 15
+ sleep 20
bds_domain=$(bdsmail_domain)
if [ ! $bds_domain ]; then
echo $'Waiting...'
- sleep 15
+ sleep 20
bds_domain=$(bdsmail_domain)
if [ ! $bds_domain ]; then
- systemctl stop bdsmail
- systemctl disable bdsmail
- remove_i2p
+ #systemctl stop bdsmail
+ #systemctl disable bdsmail
+ #remove_i2p
echo $'Failed to get the bdsmail domain'
exit 8934638
fi
From 9eaca4e4da819e8acf3daa65dc72c5e33e572cca Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 23:21:50 +0000
Subject: [PATCH 34/91] Enable sam
---
src/freedombone-app-bdsmail | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 53a89efd..d8b8a0a2 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -211,6 +211,7 @@ function install_bdsmail {
fi
install_i2p
+ i2p_enable_sam
# create configuration file
/etc/bdsmail/bin/bdsconfig > /etc/bdsmail/config.ini
@@ -257,11 +258,11 @@ function install_bdsmail {
# wait for domain to be generated by the daemon
echo $'Waiting for i2p domain to be generated...'
- sleep 20
+ sleep 10
bds_domain=$(bdsmail_domain)
if [ ! $bds_domain ]; then
echo $'Waiting...'
- sleep 20
+ sleep 10
bds_domain=$(bdsmail_domain)
if [ ! $bds_domain ]; then
#systemctl stop bdsmail
From 1bd492646276bcfa8ae3d09ab3fda062d880c70d Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Sun, 11 Feb 2018 23:36:07 +0000
Subject: [PATCH 35/91] Also autoremove
---
src/freedombone-utils-i2p | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/freedombone-utils-i2p b/src/freedombone-utils-i2p
index 39a81f9f..979394a5 100755
--- a/src/freedombone-utils-i2p
+++ b/src/freedombone-utils-i2p
@@ -64,6 +64,7 @@ function install_i2p {
function remove_i2p {
apt-get -yq remove i2p i2p-keyring --purge
+ apt-get -yq autoremove
# It's assumed here that ipv6 is only needed for i2p
# This might not be true in future
@@ -83,6 +84,10 @@ function remove_i2p {
}
function i2p_enable_sam {
+ if [ ! -f /var/lib/i2p/i2p-config/clients.config ]; then
+ echo $'File not found /var/lib/i2p/i2p-config/clients.config'
+ exit 483648364834
+ fi
sed -i 's|clientApp.1.startOnLoad=.*|clientApp.1.startOnLoad=true|g' /var/lib/i2p/i2p-config/clients.config
systemctl restart i2p
}
From 37ac4dd20ef4797ba25ed7ad9fc089e734c41718 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 10:09:10 +0000
Subject: [PATCH 36/91] Improve removal of i2p
---
src/freedombone-utils-i2p | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/freedombone-utils-i2p b/src/freedombone-utils-i2p
index 979394a5..4dfbac7a 100755
--- a/src/freedombone-utils-i2p
+++ b/src/freedombone-utils-i2p
@@ -56,21 +56,21 @@ function install_i2p {
# i2p needs ipv6 to be enabled
sed -i 's|net.ipv6.conf.all.disable_ipv6.*|net.ipv6.conf.all.disable_ipv6 = 0|g' /etc/sysctl.conf
/sbin/sysctl -p -q
- sysctl --system
apt-get update
apt-get -yq install i2p i2p-keyring
}
function remove_i2p {
- apt-get -yq remove i2p i2p-keyring --purge
+ apt-get -yq remove i2p-router --purge
+ apt-get -yq remove i2p --purge
+ apt-get -yq remove i2p-keyring --purge
apt-get -yq autoremove
# It's assumed here that ipv6 is only needed for i2p
# This might not be true in future
sed -i 's|net.ipv6.conf.all.disable_ipv6.*|net.ipv6.conf.all.disable_ipv6 = 1|g' /etc/sysctl.conf
/sbin/sysctl -p -q
- sysctl --system
if [ -d /var/lib/i2p ]; then
rm -rf /var/lib/i2p
From 6562d131f7a7e9798a398696f733f7e1ee5cfd4a Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 10:23:22 +0000
Subject: [PATCH 37/91] Add a restart
---
src/freedombone-app-bdsmail | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index d8b8a0a2..7beafb0a 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -169,6 +169,7 @@ function remove_bdsmail {
fi
userdel -r bdsmail
+ remove_i2p
remove_app bdsmail
remove_completion_param install_bdsmail
sed -i '/bdsmail/d' $COMPLETION_FILE
@@ -176,7 +177,6 @@ function remove_bdsmail {
if [ -d /etc/bdsmail ]; then
rm -rf /etc/bdsmail
fi
- remove_i2p
}
function install_bdsmail {
@@ -258,11 +258,12 @@ function install_bdsmail {
# wait for domain to be generated by the daemon
echo $'Waiting for i2p domain to be generated...'
- sleep 10
+ sleep 15
bds_domain=$(bdsmail_domain)
if [ ! $bds_domain ]; then
echo $'Waiting...'
- sleep 10
+ systemctl restart bdsmail
+ sleep 15
bds_domain=$(bdsmail_domain)
if [ ! $bds_domain ]; then
#systemctl stop bdsmail
From 97d6524c9018bd06feadee052bddec78d19b8d5a Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 10:34:24 +0000
Subject: [PATCH 38/91] Use the i2p user for bdsmail daemon
---
src/freedombone-app-bdsmail | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 7beafb0a..513482d2 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -86,7 +86,7 @@ function upgrade_bdsmail {
# update to the next commit
set_repo_commit /etc/bdsmail "bdsmail commit" "$BDSMAIL_COMMIT" $BDSMAIL_REPO
- chown -R bdsmail:bdsmail /etc/bdsmail
+ chown -R i2psvc:i2psvc /etc/bdsmail
}
function backup_local_bdsmail {
@@ -118,7 +118,7 @@ function restore_local_bdsmail {
fi
cp -rp $temp_restore_dir/* $bdsmail_dir
fi
- chown -R bdsmail:bdsmail $bdsmail_dir
+ chown -R i2psvc:i2psvc $bdsmail_dir
rm -rf $temp_restore_dir
fi
@@ -154,7 +154,7 @@ function restore_remote_bdsmail {
fi
cp -rp $temp_restore_dir/* $bdsmail_dir
fi
- chown -R bdsmail:bdsmail $bdsmail_dir
+ chown -R i2psvc:i2psvc $bdsmail_dir
rm -rf $temp_restore_dir
fi
@@ -167,7 +167,6 @@ function remove_bdsmail {
systemctl disable bdsmail
rm /etc/systemd/system/bdsmail.service
fi
- userdel -r bdsmail
remove_i2p
remove_app bdsmail
@@ -202,8 +201,6 @@ function install_bdsmail {
git checkout $BDSMAIL_COMMIT -b $BDSMAIL_COMMIT
set_completion_param "bdsmail commit" "$BDSMAIL_COMMIT"
- useradd -d /etc/bdsmail -s /bin/false bdsmail
-
make GOROOT=/home/go/go${GO_VERSION}
if [ ! -f /etc/bdsmail/bin/bdsconfig ]; then
echo $'Unable to make bdsmail'
@@ -232,17 +229,17 @@ function install_bdsmail {
echo '' >> /etc/systemd/system/bdsmail.service
echo '[Service]' >> /etc/systemd/system/bdsmail.service
echo 'Type=simple' >> /etc/systemd/system/bdsmail.service
- echo 'User=bdsmail' >> /etc/systemd/system/bdsmail.service
- echo 'Group=bdsmail' >> /etc/systemd/system/bdsmail.service
+ echo 'User=i2psvc' >> /etc/systemd/system/bdsmail.service
+ echo 'Group=i2psvc' >> /etc/systemd/system/bdsmail.service
echo 'WorkingDirectory=/etc/bdsmail' >> /etc/systemd/system/bdsmail.service
echo 'ExecStart=/etc/bdsmail/bin/maild /etc/bdsmail/config.ini' >> /etc/systemd/system/bdsmail.service
echo 'Restart=always' >> /etc/systemd/system/bdsmail.service
- echo 'Environment="USER=bdsmail"' >> /etc/systemd/system/bdsmail.service
+ echo 'Environment="USER=i2psvc"' >> /etc/systemd/system/bdsmail.service
echo '' >> /etc/systemd/system/bdsmail.service
echo '[Install]' >> /etc/systemd/system/bdsmail.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/bdsmail.service
systemctl enable bdsmail
- chown -R bdsmail:bdsmail /etc/bdsmail
+ chown -R i2psvc:i2psvc /etc/bdsmail
systemctl start bdsmail
echo '#!/usr/bin/env python2' > /etc/bdsmail/get_address
From 89e797a6e8fb2acf840c8360b0dba1faaf0e663e Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 10:41:38 +0000
Subject: [PATCH 39/91] permission on get_address
---
src/freedombone-app-bdsmail | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 513482d2..54122862 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -238,9 +238,6 @@ function install_bdsmail {
echo '' >> /etc/systemd/system/bdsmail.service
echo '[Install]' >> /etc/systemd/system/bdsmail.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/bdsmail.service
- systemctl enable bdsmail
- chown -R i2psvc:i2psvc /etc/bdsmail
- systemctl start bdsmail
echo '#!/usr/bin/env python2' > /etc/bdsmail/get_address
echo 'import base64, hashlib, sys' >> /etc/bdsmail/get_address
@@ -248,6 +245,10 @@ function install_bdsmail {
echo " print(base64.b32encode(hashlib.sha256(base64.b64decode(f.read(516), '-~')).digest()).strip('=')+\".b32.i2p\")" >> /etc/bdsmail/get_address
chmod +x /etc/bdsmail/get_address
+ chown -R i2psvc:i2psvc /etc/bdsmail
+ systemctl enable bdsmail
+ systemctl start bdsmail
+
echo '#!/bin/bash' > /usr/bin/bdsmail_domain
echo 'cd /etc/bdsmail' >> /usr/bin/bdsmail_domain
echo 'python2 get_address bdsmail-privkey.dat' >> /usr/bin/bdsmail_domain
From 580f2293339f45ee01cd39a3335e6983ed985f6a Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 10:52:20 +0000
Subject: [PATCH 40/91] More retries
---
src/freedombone-app-bdsmail | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 54122862..5b618eff 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -255,21 +255,26 @@ function install_bdsmail {
chmod +x /usr/bin/bdsmail_domain
# wait for domain to be generated by the daemon
- echo $'Waiting for i2p domain to be generated...'
- sleep 15
- bds_domain=$(bdsmail_domain)
- if [ ! $bds_domain ]; then
- echo $'Waiting...'
+ # This can take a while, probably because i2p is connecting
+ bds_domain=
+ sleep_ctr=0
+ while [ ! $bds_domain ]; do
+ echo $"Waiting for i2p domain to be generated ${sleep_ctr}/30"
systemctl restart bdsmail
- sleep 15
+ sleep 10
bds_domain=$(bdsmail_domain)
- if [ ! $bds_domain ]; then
- #systemctl stop bdsmail
- #systemctl disable bdsmail
- #remove_i2p
- echo $'Failed to get the bdsmail domain'
- exit 8934638
+ sleep_ctr=$((sleep_ctr + 1))
+ if [ $sleep_ctr -gt 30 ]; then
+ break
fi
+ done
+
+ if [ ! $bds_domain ]; then
+ #systemctl stop bdsmail
+ #systemctl disable bdsmail
+ #remove_i2p
+ echo $'Failed to get the bdsmail domain'
+ exit 8934638
fi
# Create mutt configuration
From 72f753b491628bc8b56b27dfb9f58cdaefd1d433 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 10:57:53 +0000
Subject: [PATCH 41/91] Better handling if private key has not yet been
generated
---
src/freedombone-app-bdsmail | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 5b618eff..b0123ecf 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -251,6 +251,9 @@ function install_bdsmail {
echo '#!/bin/bash' > /usr/bin/bdsmail_domain
echo 'cd /etc/bdsmail' >> /usr/bin/bdsmail_domain
+ echo 'if [ ! -f bdsmail-privkey.dat ]; then' >> /usr/bin/bdsmail_domain
+ echo ' exit 1' >> /usr/bin/bdsmail_domain
+ echo 'fi' >> /usr/bin/bdsmail_domain
echo 'python2 get_address bdsmail-privkey.dat' >> /usr/bin/bdsmail_domain
chmod +x /usr/bin/bdsmail_domain
@@ -259,12 +262,12 @@ function install_bdsmail {
bds_domain=
sleep_ctr=0
while [ ! $bds_domain ]; do
- echo $"Waiting for i2p domain to be generated ${sleep_ctr}/30"
+ echo $"Waiting for i2p domain to be generated ${sleep_ctr}/50"
systemctl restart bdsmail
sleep 10
bds_domain=$(bdsmail_domain)
sleep_ctr=$((sleep_ctr + 1))
- if [ $sleep_ctr -gt 30 ]; then
+ if [ $sleep_ctr -gt 50 ]; then
break
fi
done
From 1ea457c555590ecd89950cc2ca5972198f4ab0fa Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 11:05:43 +0000
Subject: [PATCH 42/91] Message while installing bdsmail
---
src/freedombone-app-bdsmail | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index b0123ecf..8959bdbc 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -257,6 +257,11 @@ function install_bdsmail {
echo 'python2 get_address bdsmail-privkey.dat' >> /usr/bin/bdsmail_domain
chmod +x /usr/bin/bdsmail_domain
+ echo ''
+ echo $'Now we will wait for i2p to connect and a private key to be generated'
+ echo $'This may take a while.'
+ echo ''
+
# wait for domain to be generated by the daemon
# This can take a while, probably because i2p is connecting
bds_domain=
From c0e4a888b9dd478a12fe621785a40aaa08c4cb3d Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 13:02:29 +0000
Subject: [PATCH 43/91] bdsmail integration with mutt
---
src/freedombone-app-bdsmail | 54 +++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 8959bdbc..fe346a90 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -38,6 +38,36 @@ BDSMAIL_COMMIT='6a2296b0b8e6c3da61081b85802e7b1cc88ca285'
bdsmail=(MY_USERNAME)
+function bdsmail_configure_users {
+ for d in /home/*/ ; do
+ USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
+ if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
+ if [ -f /home/$USERNAME/.muttrc ]; then
+ # Create a mutt i2p folder
+ if ! grep -q ' =i2p' /home/$USERNAME/.muttrc; then
+ MUTT_MAILBOXES=$(grep "mailboxes =" /home/$USERNAME/.muttrc)
+ sed -i "s|$MUTT_MAILBOXES|$MUTT_MAILBOXES =i2p|g" /home/$USERNAME/.muttrc
+ fi
+
+ # Create a mutt folder hook to the i2p config
+ if ! grep -q 'folder-hook !i2p' /home/$USERNAME/.muttrc; then
+ echo 'folder-hook !i2p/* source ~/.muttrc' >> /home/$USERNAME/.muttrc
+ fi
+ if ! grep -q 'folder-hook i2p' /home/$USERNAME/.muttrc; then
+ echo 'folder-hook i2p/* source ~/.mutt/bdsmail' >> /home/$USERNAME/.muttrc
+ fi
+ fi
+
+ # Create a directory where i2p mail will be stored
+ if [ ! -d /home/$USERNAME/Maildir/i2p/cur ]; then
+ mkdir -p /home/$USERNAME/Maildir/i2p/cur
+ mkdir -p /home/$USERNAME/Maildir/i2p/new
+ chown -R $USERNAME:$USERNAME /home/$USERNAME/Maildir/i2p
+ fi
+ fi
+ done
+}
+
function logging_on_bdsmail {
echo -n ''
}
@@ -59,6 +89,7 @@ function add_user_bdsmail {
cp /etc/skel/.mutt/bdsmail /home/$new_username/.mutt
fi
sed -i "s|username|$new_username|g" /home/$new_username/.mutt/bdsmail
+ bdsmail_configure_users
chown -R $new_username:$new_username /home/$new_username/.mutt
echo '0'
}
@@ -176,6 +207,29 @@ function remove_bdsmail {
if [ -d /etc/bdsmail ]; then
rm -rf /etc/bdsmail
fi
+
+ for d in /home/*/ ; do
+ USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
+ if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
+ # Remove mutt folder hook to the i2p config
+ if [ -f /home/$USERNAME/.muttrc ]; then
+ if grep -q 'folder-hook !i2p' /home/$USERNAME/.muttrc; then
+ sed -i '/folder-hook !i2p/d' /home/$USERNAME/.muttrc
+ fi
+ if grep -q 'folder-hook i2p' /home/$USERNAME/.muttrc; then
+ sed -i '/folder-hook i2p/d' /home/$USERNAME/.muttrc
+ fi
+ fi
+
+ # Remove folder
+ if grep -q ' =i2p' /home/$USERNAME/.muttrc; then
+ sed -i 's| =i2p||g' /home/$USERNAME/.muttrc
+ fi
+
+ # NOTE: leave Maildir/i2p. We might want to archive that
+ # or just be reinstalling the system without losing mail
+ fi
+ done
}
function install_bdsmail {
From 55e690a84a80689a4801f4e56c4edd25783de36e Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 13:04:42 +0000
Subject: [PATCH 44/91] Set maildir for bdsmail
---
src/freedombone-app-bdsmail | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index fe346a90..46c6b6c8 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -342,6 +342,7 @@ function install_bdsmail {
# Create mutt configuration
mkdir /etc/skel/.mutt
echo 'set mbox_type=Maildir' > /etc/skel/.mutt/bdsmail
+ echo 'set mbox="~/Maildir/i2p"' >> /etc/skel/.mutt/bdsmail
echo 'set smtp_url=smtp://127.0.0.1:2525/' >> /etc/skel/.mutt/bdsmail
echo 'set use_from=yes' >> /etc/skel/.mutt/bdsmail
echo "set from=username@${bds_domain}" >> /etc/skel/.mutt/bdsmail
From 799a31ce8fab6cbd56fdd9a5a737dda979bfde6d Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 13:16:15 +0000
Subject: [PATCH 45/91] Add users to i2p group when bdsmail is installed
---
src/freedombone-app-bdsmail | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 46c6b6c8..f02fc27a 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -42,6 +42,10 @@ function bdsmail_configure_users {
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
+
+ # Add the user to the i2p group
+ usermod -a -G i2psvc $USERNAME
+
if [ -f /home/$USERNAME/.muttrc ]; then
# Create a mutt i2p folder
if ! grep -q ' =i2p' /home/$USERNAME/.muttrc; then
@@ -199,18 +203,12 @@ function remove_bdsmail {
rm /etc/systemd/system/bdsmail.service
fi
- remove_i2p
- remove_app bdsmail
- remove_completion_param install_bdsmail
- sed -i '/bdsmail/d' $COMPLETION_FILE
- rm -rf /etc/skel/.mutt
- if [ -d /etc/bdsmail ]; then
- rm -rf /etc/bdsmail
- fi
-
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
+ # remove the user from the i2p group
+ deluser $USERNAME i2psvc
+
# Remove mutt folder hook to the i2p config
if [ -f /home/$USERNAME/.muttrc ]; then
if grep -q 'folder-hook !i2p' /home/$USERNAME/.muttrc; then
@@ -230,6 +228,15 @@ function remove_bdsmail {
# or just be reinstalling the system without losing mail
fi
done
+
+ remove_i2p
+ remove_app bdsmail
+ remove_completion_param install_bdsmail
+ sed -i '/bdsmail/d' $COMPLETION_FILE
+ rm -rf /etc/skel/.mutt
+ if [ -d /etc/bdsmail ]; then
+ rm -rf /etc/bdsmail
+ fi
}
function install_bdsmail {
From c1c7a6c78c55959dc8ea238f2bfc92cfb7eb3c20 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 13:39:47 +0000
Subject: [PATCH 46/91] Show i2p address on user control panel
---
src/freedombone-controlpanel-user | 50 ++++++++++++++++++++-----------
1 file changed, 33 insertions(+), 17 deletions(-)
diff --git a/src/freedombone-controlpanel-user b/src/freedombone-controlpanel-user
index 6940a81d..84b6d00e 100755
--- a/src/freedombone-controlpanel-user
+++ b/src/freedombone-controlpanel-user
@@ -882,6 +882,20 @@ function menu_run_client_app {
fi
}
+function show_your_email_address {
+ GPG_FINGERPRINT=$(gpg --fingerprint $GPG_ID | sed -n '2p' | sed 's/^[ \t]*//')
+ GPG_DATE=$(gpg --fingerprint $GPG_ID | grep -i "pub" | head -n 1 | awk -F ' ' '{print $3}')
+ if [ ! -d /etc/bdsmail ]; then
+ dialog --title $"Show your Email Address" \
+ --backtitle $"Freedombone User Control Panel" \
+ --msgbox $"Email Address: $MY_EMAIL_ADDRESS\n\nKey ID: $GPG_ID\n\nFingerprint: $GPG_FINGERPRINT\n\nCreated: $GPG_DATE" 12 70
+ else
+ dialog --title $"Show your Email Address" \
+ --backtitle $"Freedombone User Control Panel" \
+ --msgbox $"\nYou can press SHIFT and then drag the mouse and right click to copy.\n\nEmail Address: $MY_EMAIL_ADDRESS\n\nKey ID: $GPG_ID\n\nFingerprint: $GPG_FINGERPRINT\n\nCreated: $GPG_DATE\n\nI2P Address: ${USER}@$(bdsmail_domain)" 17 90
+ fi
+}
+
function menu_top_level {
while true
do
@@ -889,16 +903,17 @@ function menu_top_level {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone User Control Panel" \
--title $"User Control Panel" \
- --radiolist $"Choose an operation:" 19 50 12 \
+ --radiolist $"Choose an operation:" 20 50 13 \
1 $"Use Email" off \
- 2 $"Change Email Filtering Rules" off \
- 3 $"Run an App" off \
- 4 $"Browse the Web" off \
- 5 $"My Encryption Keys" off \
- 6 $"Set an outgoing email proxy" off \
- 7 $"Administrator controls" off \
- 8 $"Exit to the command line" off \
- 9 $"Log out" on 2> $data
+ 2 $"Show your Email Address" off \
+ 3 $"Change Email Filtering/Blocking Rules" off \
+ 4 $"Run an App" off \
+ 5 $"Browse the Web" off \
+ 6 $"My Encryption Keys" off \
+ 7 $"Set an outgoing email proxy" off \
+ 8 $"Administrator controls" off \
+ 9 $"Exit to the command line" off \
+ 10 $"Log out" on 2> $data
sel=$?
case $sel in
1) rm $data
@@ -908,15 +923,16 @@ function menu_top_level {
esac
case $(cat $data) in
1) mutt;;
- 2) menu_email;;
- 3) menu_run_client_app;;
- 4) torify elinks -no-home;;
- 5) menu_encryption_keys;;
- 6) smtp_proxy;;
- 7) menu_admin;;
- 8) rm $data
+ 2) show_your_email_address;;
+ 3) menu_email;;
+ 4) menu_run_client_app;;
+ 5) torify elinks -no-home;;
+ 6) menu_encryption_keys;;
+ 7) smtp_proxy;;
+ 8) menu_admin;;
+ 9) rm $data
break;;
- 9) kill -HUP `pgrep -s 0 -o`;;
+ 10) kill -HUP `pgrep -s 0 -o`;;
esac
rm $data
done
From 5b9246ca7ecb4312d25f2687ba76f2eaebf4e357 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 13:41:00 +0000
Subject: [PATCH 47/91] Increase width
---
src/freedombone-controlpanel-user | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-controlpanel-user b/src/freedombone-controlpanel-user
index 84b6d00e..4dd58a70 100755
--- a/src/freedombone-controlpanel-user
+++ b/src/freedombone-controlpanel-user
@@ -903,7 +903,7 @@ function menu_top_level {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone User Control Panel" \
--title $"User Control Panel" \
- --radiolist $"Choose an operation:" 20 50 13 \
+ --radiolist $"Choose an operation:" 20 60 13 \
1 $"Use Email" off \
2 $"Show your Email Address" off \
3 $"Change Email Filtering/Blocking Rules" off \
From 49f094140cad436d2f89f573d87f3432ecf50a78 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 13:51:45 +0000
Subject: [PATCH 48/91] Configure bdsmail users
---
src/freedombone-app-bdsmail | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index f02fc27a..49fa9b07 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -363,6 +363,8 @@ function install_bdsmail {
sed -i "s|username|$MY_USERNAME|g" /home/$MY_USERNAME/.mutt/bdsmail
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.mutt
+ bdsmail_configure_users
+
APP_INSTALLED=1
}
From db05c3364f946ab3e2db51347996ac503bc82a15 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 14:33:18 +0000
Subject: [PATCH 49/91] Add some restarts
---
src/freedombone-utils-i2p | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/freedombone-utils-i2p b/src/freedombone-utils-i2p
index 4dfbac7a..f75ced03 100755
--- a/src/freedombone-utils-i2p
+++ b/src/freedombone-utils-i2p
@@ -59,6 +59,7 @@ function install_i2p {
apt-get update
apt-get -yq install i2p i2p-keyring
+ systemctl restart i2p
}
function remove_i2p {
@@ -84,6 +85,10 @@ function remove_i2p {
}
function i2p_enable_sam {
+ if [ ! -f /var/lib/i2p/i2p-config/clients.config ]; then
+ systemctl restart i2p
+ sleep 10
+ fi
if [ ! -f /var/lib/i2p/i2p-config/clients.config ]; then
echo $'File not found /var/lib/i2p/i2p-config/clients.config'
exit 483648364834
From 4c8edf2ad636c5b76915f1eaa390a612df986409 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 15:00:02 +0000
Subject: [PATCH 50/91] Wait longer
---
src/freedombone-app-bdsmail | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 49fa9b07..9c20dfa8 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -330,10 +330,10 @@ function install_bdsmail {
while [ ! $bds_domain ]; do
echo $"Waiting for i2p domain to be generated ${sleep_ctr}/50"
systemctl restart bdsmail
- sleep 10
+ sleep 20
bds_domain=$(bdsmail_domain)
sleep_ctr=$((sleep_ctr + 1))
- if [ $sleep_ctr -gt 50 ]; then
+ if [ $sleep_ctr -gt 100 ]; then
break
fi
done
From c1643e475b7aad84be33e00dcdca7106d3a8ab85 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 18:39:44 +0000
Subject: [PATCH 51/91] bdsmail directory
---
src/freedombone-app-bdsmail | 73 +++++++++++++++++++------------------
1 file changed, 37 insertions(+), 36 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 9c20dfa8..874249c2 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -35,6 +35,7 @@ SHOW_ON_ABOUT=1
BDSMAIL_REPO="https://github.com/majestrate/bdsmail"
BDSMAIL_COMMIT='6a2296b0b8e6c3da61081b85802e7b1cc88ca285'
+BDSMAIL_DIR=/bdsmail
bdsmail=(MY_USERNAME)
@@ -120,14 +121,14 @@ function upgrade_bdsmail {
fi
# update to the next commit
- set_repo_commit /etc/bdsmail "bdsmail commit" "$BDSMAIL_COMMIT" $BDSMAIL_REPO
- chown -R i2psvc:i2psvc /etc/bdsmail
+ set_repo_commit $BDSMAIL_DIR "bdsmail commit" "$BDSMAIL_COMMIT" $BDSMAIL_REPO
+ chown -R i2psvc:i2psvc $BDSMAIL_DIR
}
function backup_local_bdsmail {
systemctl stop bdsmail
- source_directory=/etc/bdsmail
+ source_directory=$BDSMAIL_DIR
function_check backup_directory_to_usb
dest_directory=bdsmail
@@ -140,7 +141,7 @@ function restore_local_bdsmail {
systemctl stop bdsmail
temp_restore_dir=/root/tempbdsmail
- bdsmail_dir=/etc/bdsmail
+ bdsmail_dir=$BDSMAIL_DIR
function_check restore_directory_from_usb
restore_directory_from_usb $temp_restore_dir bdsmail
@@ -163,7 +164,7 @@ function restore_local_bdsmail {
function backup_remote_bdsmail {
systemctl stop bdsmail
- source_directory=/etc/bdsmail
+ source_directory=$BDSMAIL_DIR
function_check backup_directory_to_friend
dest_directory=bdsmail
@@ -176,7 +177,7 @@ function restore_remote_bdsmail {
systemctl stop bdsmail
temp_restore_dir=/root/tempbdsmail
- bdsmail_dir=/etc/bdsmail
+ bdsmail_dir=$BDSMAIL_DIR
function_check restore_directory_from_friend
restore_directory_from_friend $temp_restore_dir bdsmail
@@ -234,36 +235,36 @@ function remove_bdsmail {
remove_completion_param install_bdsmail
sed -i '/bdsmail/d' $COMPLETION_FILE
rm -rf /etc/skel/.mutt
- if [ -d /etc/bdsmail ]; then
- rm -rf /etc/bdsmail
+ if [ -d $BDSMAIL_DIR ]; then
+ rm -rf $BDSMAIL_DIR
fi
}
function install_bdsmail {
- if [ -d /etc/bdsmail ]; then
+ if [ -d $BDSMAIL_DIR ]; then
remove_bdsmail
fi
if [ -d /repos/bdsmail ]; then
- mkdir /etc/bdsmail
- cp -r -p /repos/bdsmail/. /etc/bdsmail
- cd /etc/bdsmail
+ mkdir $BDSMAIL_DIR
+ cp -r -p /repos/bdsmail/. $BDSMAIL_DIR
+ cd $BDSMAIL_DIR
git pull
else
- git_clone $BDSMAIL_REPO /etc/bdsmail
+ git_clone $BDSMAIL_REPO $BDSMAIL_DIR
fi
- if [ ! -d /etc/bdsmail ]; then
+ if [ ! -d $BDSMAIL_DIR ]; then
echo $'Unable to clone bdsmail repo'
exit 5735735
fi
- cd /etc/bdsmail
+ cd $BDSMAIL_DIR
git checkout $BDSMAIL_COMMIT -b $BDSMAIL_COMMIT
set_completion_param "bdsmail commit" "$BDSMAIL_COMMIT"
make GOROOT=/home/go/go${GO_VERSION}
- if [ ! -f /etc/bdsmail/bin/bdsconfig ]; then
+ if [ ! -f $BDSMAIL_DIR/bin/bdsconfig ]; then
echo $'Unable to make bdsmail'
exit 87923567842
fi
@@ -272,16 +273,16 @@ function install_bdsmail {
i2p_enable_sam
# create configuration file
- /etc/bdsmail/bin/bdsconfig > /etc/bdsmail/config.ini
- echo '[maild]' > /etc/bdsmail/config.ini
- echo 'i2paddr = 127.0.0.1:7656' >> /etc/bdsmail/config.ini
- echo 'i2pkeyfile = bdsmail-privkey.dat' >> /etc/bdsmail/config.ini
- echo 'bindmail = 127.0.0.1:2525' >> /etc/bdsmail/config.ini
- echo 'bindweb = 127.0.0.1:8489' >> /etc/bdsmail/config.ini
- echo 'domain = localhost' >> /etc/bdsmail/config.ini
- echo 'maildir = mail' >> /etc/bdsmail/config.ini
- echo 'database = localhost.sqlite' >> /etc/bdsmail/config.ini
- echo 'assets = contrib/assets/web' >> /etc/bdsmail/config.ini
+ $BDSMAIL_DIR/bin/bdsconfig > $BDSMAIL_DIR/config.ini
+ echo '[maild]' > $BDSMAIL_DIR/config.ini
+ echo 'i2paddr = 127.0.0.1:7656' >> $BDSMAIL_DIR/config.ini
+ echo 'i2pkeyfile = bdsmail-privkey.dat' >> $BDSMAIL_DIR/config.ini
+ echo 'bindmail = 127.0.0.1:2525' >> $BDSMAIL_DIR/config.ini
+ echo 'bindweb = 127.0.0.1:8489' >> $BDSMAIL_DIR/config.ini
+ echo 'domain = localhost' >> $BDSMAIL_DIR/config.ini
+ echo 'maildir = mail' >> $BDSMAIL_DIR/config.ini
+ echo 'database = localhost.sqlite' >> $BDSMAIL_DIR/config.ini
+ echo 'assets = contrib/assets/web' >> $BDSMAIL_DIR/config.ini
echo '[Unit]' > /etc/systemd/system/bdsmail.service
echo 'Description=bdsmail' >> /etc/systemd/system/bdsmail.service
@@ -292,26 +293,26 @@ function install_bdsmail {
echo 'Type=simple' >> /etc/systemd/system/bdsmail.service
echo 'User=i2psvc' >> /etc/systemd/system/bdsmail.service
echo 'Group=i2psvc' >> /etc/systemd/system/bdsmail.service
- echo 'WorkingDirectory=/etc/bdsmail' >> /etc/systemd/system/bdsmail.service
- echo 'ExecStart=/etc/bdsmail/bin/maild /etc/bdsmail/config.ini' >> /etc/systemd/system/bdsmail.service
+ echo "WorkingDirectory=$BDSMAIL_DIR" >> /etc/systemd/system/bdsmail.service
+ echo "ExecStart=$BDSMAIL_DIR/bin/maild $BDSMAIL_DIR/config.ini" >> /etc/systemd/system/bdsmail.service
echo 'Restart=always' >> /etc/systemd/system/bdsmail.service
echo 'Environment="USER=i2psvc"' >> /etc/systemd/system/bdsmail.service
echo '' >> /etc/systemd/system/bdsmail.service
echo '[Install]' >> /etc/systemd/system/bdsmail.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/bdsmail.service
- echo '#!/usr/bin/env python2' > /etc/bdsmail/get_address
- echo 'import base64, hashlib, sys' >> /etc/bdsmail/get_address
- echo 'with open(sys.argv[1]) as f:' >> /etc/bdsmail/get_address
- echo " print(base64.b32encode(hashlib.sha256(base64.b64decode(f.read(516), '-~')).digest()).strip('=')+\".b32.i2p\")" >> /etc/bdsmail/get_address
- chmod +x /etc/bdsmail/get_address
+ echo '#!/usr/bin/env python2' > $BDSMAIL_DIR/get_address
+ echo 'import base64, hashlib, sys' >> $BDSMAIL_DIR/get_address
+ echo 'with open(sys.argv[1]) as f:' >> $BDSMAIL_DIR/get_address
+ echo " print(base64.b32encode(hashlib.sha256(base64.b64decode(f.read(516), '-~')).digest()).strip('=')+\".b32.i2p\")" >> $BDSMAIL_DIR/get_address
+ chmod +x $BDSMAIL_DIR/get_address
- chown -R i2psvc:i2psvc /etc/bdsmail
+ chown -R i2psvc:i2psvc $BDSMAIL_DIR
systemctl enable bdsmail
systemctl start bdsmail
echo '#!/bin/bash' > /usr/bin/bdsmail_domain
- echo 'cd /etc/bdsmail' >> /usr/bin/bdsmail_domain
+ echo 'cd $BDSMAIL_DIR' >> /usr/bin/bdsmail_domain
echo 'if [ ! -f bdsmail-privkey.dat ]; then' >> /usr/bin/bdsmail_domain
echo ' exit 1' >> /usr/bin/bdsmail_domain
echo 'fi' >> /usr/bin/bdsmail_domain
@@ -353,7 +354,7 @@ function install_bdsmail {
echo 'set smtp_url=smtp://127.0.0.1:2525/' >> /etc/skel/.mutt/bdsmail
echo 'set use_from=yes' >> /etc/skel/.mutt/bdsmail
echo "set from=username@${bds_domain}" >> /etc/skel/.mutt/bdsmail
- echo 'set spoolfile=/etc/bdsmail/mail/username' >> /etc/skel/.mutt/bdsmail
+ echo "set spoolfile=$BDSMAIL_DIR/mail/username" >> /etc/skel/.mutt/bdsmail
# mutt configuration for the admin user
if [ ! -d /home/$MY_USERNAME/.mutt ]; then
From 4d06910eb07aae6d57856b5a463ab883de6a85d1 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 19:53:25 +0000
Subject: [PATCH 52/91] Creating bdsmail users
---
src/freedombone-app-bdsmail | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 874249c2..f69b7ba6 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -64,10 +64,12 @@ function bdsmail_configure_users {
fi
# Create a directory where i2p mail will be stored
- if [ ! -d /home/$USERNAME/Maildir/i2p/cur ]; then
+ if [ ! -d /home/$USERNAME/Maildir/i2p/new ]; then
mkdir -p /home/$USERNAME/Maildir/i2p/cur
mkdir -p /home/$USERNAME/Maildir/i2p/new
chown -R $USERNAME:$USERNAME /home/$USERNAME/Maildir/i2p
+
+ $BDSMAIL_DIR/bin/newmail $MY_USERNAME /home/$MY_USERNAME/MailDir/i2p
fi
fi
done
@@ -225,8 +227,9 @@ function remove_bdsmail {
sed -i 's| =i2p||g' /home/$USERNAME/.muttrc
fi
- # NOTE: leave Maildir/i2p. We might want to archive that
+ # NOTE: leave Maildir/i2p/cur. We might want to archive that
# or just be reinstalling the system without losing mail
+ rm -rf /home/$USERNAME/Maildir/i2p/new
fi
done
@@ -350,11 +353,10 @@ function install_bdsmail {
# Create mutt configuration
mkdir /etc/skel/.mutt
echo 'set mbox_type=Maildir' > /etc/skel/.mutt/bdsmail
- echo 'set mbox="~/Maildir/i2p"' >> /etc/skel/.mutt/bdsmail
echo 'set smtp_url=smtp://127.0.0.1:2525/' >> /etc/skel/.mutt/bdsmail
echo 'set use_from=yes' >> /etc/skel/.mutt/bdsmail
echo "set from=username@${bds_domain}" >> /etc/skel/.mutt/bdsmail
- echo "set spoolfile=$BDSMAIL_DIR/mail/username" >> /etc/skel/.mutt/bdsmail
+ echo "set spoolfile=~/Maildir/i2p" >> /etc/skel/.mutt/bdsmail
# mutt configuration for the admin user
if [ ! -d /home/$MY_USERNAME/.mutt ]; then
From 674d6d835a594c50991d837d29eb79f582d70ba7 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 19:56:54 +0000
Subject: [PATCH 53/91] bdsmail directory
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index f69b7ba6..58f8aaf0 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -35,7 +35,7 @@ SHOW_ON_ABOUT=1
BDSMAIL_REPO="https://github.com/majestrate/bdsmail"
BDSMAIL_COMMIT='6a2296b0b8e6c3da61081b85802e7b1cc88ca285'
-BDSMAIL_DIR=/bdsmail
+BDSMAIL_DIR=/etc/bdsmail
bdsmail=(MY_USERNAME)
From e3bacb54648bf83852fab728fbb5aa91204d9823 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 20:14:02 +0000
Subject: [PATCH 54/91] Missing package installs in documentation
---
doc/EN/armbian.org | 1 +
doc/EN/beaglebone.org | 4 ++--
doc/EN/homeserver.org | 4 ++--
website/EN/armbian.html | 5 +++--
website/EN/beaglebone.html | 12 ++++++------
website/EN/homeserver.html | 6 +++---
6 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/doc/EN/armbian.org b/doc/EN/armbian.org
index 248e079b..6f491934 100644
--- a/doc/EN/armbian.org
+++ b/doc/EN/armbian.org
@@ -62,6 +62,7 @@ sudo su
Then clone the Freedombone repository and checkout the stretch development branch.
#+begin_src bash
+apt-get -y install git dialog build-essential
git clone https://github.com/bashrc/freedombone
cd freedombone
git checkout stretch
diff --git a/doc/EN/beaglebone.org b/doc/EN/beaglebone.org
index ecf358cd..574fe4e0 100644
--- a/doc/EN/beaglebone.org
+++ b/doc/EN/beaglebone.org
@@ -38,7 +38,7 @@ You may need to obtain a domain name and set up a dynamic DNS account for your n
On your laptop or desktop prepare a microSD card image as follows. To create an image on a Debian based system:
#+begin_src bash
-sudo apt-get install git
+sudo apt-get install git dialog build-essential
git clone https://github.com/bashrc/freedombone
cd freedombone
git checkout stretch
@@ -49,7 +49,7 @@ freedombone-image --setup debian
Or on Arch/Parabola:
#+begin_src bash
-sudo pacman -S git
+sudo pacman -S git dialog
git clone https://github.com/bashrc/freedombone
cd freedombone
git checkout stretch
diff --git a/doc/EN/homeserver.org b/doc/EN/homeserver.org
index 03ef0dba..1871ca3b 100644
--- a/doc/EN/homeserver.org
+++ b/doc/EN/homeserver.org
@@ -20,7 +20,7 @@ The quickest way to get started is as follows. You will need to be running a Deb
First install freedombone onto your local system (not the target hardware that you want to run Freedombone on). On a debian based distro:
#+begin_src bash
-sudo apt-get install git
+sudo apt-get install git dialog build-essential
git clone https://github.com/bashrc/freedombone
cd freedombone
git checkout stretch
@@ -32,7 +32,7 @@ freedombone-image -t i386 --onion-addresses-only yes
Or on Arch/Parabola:
#+begin_src bash
-sudo pacman -S git
+sudo pacman -S git dialog
git clone https://github.com/bashrc/freedombone
cd freedombone
git checkout stretch
diff --git a/website/EN/armbian.html b/website/EN/armbian.html
index 9a461d3a..ce00da54 100644
--- a/website/EN/armbian.html
+++ b/website/EN/armbian.html
@@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
+
@@ -326,7 +326,8 @@ Then clone the Freedombone repository and checkout the stretch development branc
-
git clone https://github.com/bashrc/freedombone
+apt-get -y install git dialog build-essential
+git clone https://github.com/bashrc/freedombone
cd freedombone
git checkout stretch
diff --git a/website/EN/beaglebone.html b/website/EN/beaglebone.html
index 23060e4c..dddba8f8 100644
--- a/website/EN/beaglebone.html
+++ b/website/EN/beaglebone.html
@@ -3,10 +3,10 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
+
-
+
-
sudo apt-get install git
+sudo apt-get install git dialog build-essential
git clone https://github.com/bashrc/freedombone
cd freedombone
git checkout stretch
sudo make install
freedombone-image --setup debian
-
+
@@ -300,13 +300,13 @@ Or on Arch/Parabola:
-
sudo pacman -S git
+sudo pacman -S git dialog
git clone https://github.com/bashrc/freedombone
cd freedombone
git checkout stretch
sudo make install
freedombone-image --setup parabola
-
+
diff --git a/website/EN/homeserver.html b/website/EN/homeserver.html
index 42475f8a..cfbda0ed 100644
--- a/website/EN/homeserver.html
+++ b/website/EN/homeserver.html
@@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
+
@@ -256,7 +256,7 @@ First install freedombone onto your local system (not the target hardware that y
-
sudo apt-get install git
+sudo apt-get install git dialog build-essential
git clone https://github.com/bashrc/freedombone
cd freedombone
git checkout stretch
@@ -271,7 +271,7 @@ Or on Arch/Parabola:
-
sudo pacman -S git
+sudo pacman -S git dialog
git clone https://github.com/bashrc/freedombone
cd freedombone
git checkout stretch
From 8548de8fa6d05b5f00af7ad1bcf6286861416819 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 21:00:45 +0000
Subject: [PATCH 55/91] Maximum
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 58f8aaf0..7cc79ce8 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -332,7 +332,7 @@ function install_bdsmail {
bds_domain=
sleep_ctr=0
while [ ! $bds_domain ]; do
- echo $"Waiting for i2p domain to be generated ${sleep_ctr}/50"
+ echo $"Waiting for i2p domain to be generated ${sleep_ctr}/100"
systemctl restart bdsmail
sleep 20
bds_domain=$(bdsmail_domain)
From 0dc6df1095688d47ee6a04f25fdde1ad6a44e940 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 21:03:47 +0000
Subject: [PATCH 56/91] double quotes
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 7cc79ce8..99a11069 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -315,7 +315,7 @@ function install_bdsmail {
systemctl start bdsmail
echo '#!/bin/bash' > /usr/bin/bdsmail_domain
- echo 'cd $BDSMAIL_DIR' >> /usr/bin/bdsmail_domain
+ echo "cd $BDSMAIL_DIR" >> /usr/bin/bdsmail_domain
echo 'if [ ! -f bdsmail-privkey.dat ]; then' >> /usr/bin/bdsmail_domain
echo ' exit 1' >> /usr/bin/bdsmail_domain
echo 'fi' >> /usr/bin/bdsmail_domain
From 2e8a79694688ab00831af5d945b3232585bd0c4d Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 22:13:31 +0000
Subject: [PATCH 57/91] Convert domain to lower case
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 99a11069..930ed8ba 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -319,7 +319,7 @@ function install_bdsmail {
echo 'if [ ! -f bdsmail-privkey.dat ]; then' >> /usr/bin/bdsmail_domain
echo ' exit 1' >> /usr/bin/bdsmail_domain
echo 'fi' >> /usr/bin/bdsmail_domain
- echo 'python2 get_address bdsmail-privkey.dat' >> /usr/bin/bdsmail_domain
+ echo "python2 get_address bdsmail-privkey.dat | tr '[:upper:]' '[:lower:]'" >> /usr/bin/bdsmail_domain
chmod +x /usr/bin/bdsmail_domain
echo ''
From 0702d2448c91777039d22b6aaa00401388c6199a Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 22:24:23 +0000
Subject: [PATCH 58/91] Ask for user password to create maildir account
---
src/freedombone-app-bdsmail | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 930ed8ba..a06add36 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -68,8 +68,6 @@ function bdsmail_configure_users {
mkdir -p /home/$USERNAME/Maildir/i2p/cur
mkdir -p /home/$USERNAME/Maildir/i2p/new
chown -R $USERNAME:$USERNAME /home/$USERNAME/Maildir/i2p
-
- $BDSMAIL_DIR/bin/newmail $MY_USERNAME /home/$MY_USERNAME/MailDir/i2p
fi
fi
done
@@ -97,6 +95,7 @@ function add_user_bdsmail {
fi
sed -i "s|username|$new_username|g" /home/$new_username/.mutt/bdsmail
bdsmail_configure_users
+ $BDSMAIL_DIR/bin/newmail $new_username /home/$new_username/MailDir/i2p "$new_user_password"
chown -R $new_username:$new_username /home/$new_username/.mutt
echo '0'
}
@@ -368,6 +367,24 @@ function install_bdsmail {
bdsmail_configure_users
+ # ask to the ssh login password for the admin user
+ # This is then used to create the maildir account
+ data=$(tempfile 2>/dev/null)
+ trap "rm -f $data" 0 1 2 5 15
+ dialog --title $"Password" \
+ --clear \
+ --passwordbox $"Enter your ssh login password" 8 60 2> $data
+ ret=$?
+ case $ret in
+ 0)
+ $BDSMAIL_DIR/bin/newmail $MY_USERNAME /home/$MY_USERNAME/MailDir/i2p $(cat $data)
+ ;;
+ 1)
+ exit 643856384;;
+ 255)
+ exit 638762424;;
+ esac
+
APP_INSTALLED=1
}
From 64444699676c8a3f66e95b48bd194586722575eb Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 12 Feb 2018 23:21:49 +0000
Subject: [PATCH 59/91] i2p firewall for smtp
---
src/freedombone-app-bdsmail | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index a06add36..5b7c5f63 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -36,6 +36,8 @@ SHOW_ON_ABOUT=1
BDSMAIL_REPO="https://github.com/majestrate/bdsmail"
BDSMAIL_COMMIT='6a2296b0b8e6c3da61081b85802e7b1cc88ca285'
BDSMAIL_DIR=/etc/bdsmail
+I2P_SAM_PORT=7656
+I2P_SMTP_PORT=2525
bdsmail=(MY_USERNAME)
@@ -205,6 +207,9 @@ function remove_bdsmail {
rm /etc/systemd/system/bdsmail.service
fi
+ firewall_remove $I2P_SAM_PORT
+ firewall_remove $I2P_SMTP_PORT
+
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
@@ -277,9 +282,9 @@ function install_bdsmail {
# create configuration file
$BDSMAIL_DIR/bin/bdsconfig > $BDSMAIL_DIR/config.ini
echo '[maild]' > $BDSMAIL_DIR/config.ini
- echo 'i2paddr = 127.0.0.1:7656' >> $BDSMAIL_DIR/config.ini
+ echo "i2paddr = 127.0.0.1:$I2P_SAM_PORT" >> $BDSMAIL_DIR/config.ini
echo 'i2pkeyfile = bdsmail-privkey.dat' >> $BDSMAIL_DIR/config.ini
- echo 'bindmail = 127.0.0.1:2525' >> $BDSMAIL_DIR/config.ini
+ echo "bindmail = 127.0.0.1:$I2P_SMTP_PORT" >> $BDSMAIL_DIR/config.ini
echo 'bindweb = 127.0.0.1:8489' >> $BDSMAIL_DIR/config.ini
echo 'domain = localhost' >> $BDSMAIL_DIR/config.ini
echo 'maildir = mail' >> $BDSMAIL_DIR/config.ini
@@ -352,7 +357,7 @@ function install_bdsmail {
# Create mutt configuration
mkdir /etc/skel/.mutt
echo 'set mbox_type=Maildir' > /etc/skel/.mutt/bdsmail
- echo 'set smtp_url=smtp://127.0.0.1:2525/' >> /etc/skel/.mutt/bdsmail
+ echo "set smtp_url=smtp://127.0.0.1:$I2P_SMTP_PORT/" >> /etc/skel/.mutt/bdsmail
echo 'set use_from=yes' >> /etc/skel/.mutt/bdsmail
echo "set from=username@${bds_domain}" >> /etc/skel/.mutt/bdsmail
echo "set spoolfile=~/Maildir/i2p" >> /etc/skel/.mutt/bdsmail
@@ -385,6 +390,9 @@ function install_bdsmail {
exit 638762424;;
esac
+ firewall_add i2psam $I2P_SAM_PORT
+ firewall_add i2psmtp $I2P_SMTP_PORT
+
APP_INSTALLED=1
}
From 60857daa17ae612029c180f109065fc007d27335 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 10:10:52 +0000
Subject: [PATCH 60/91] Don't need the bdsmail firewall
---
src/freedombone-app-bdsmail | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 5b7c5f63..53dda83e 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -207,9 +207,6 @@ function remove_bdsmail {
rm /etc/systemd/system/bdsmail.service
fi
- firewall_remove $I2P_SAM_PORT
- firewall_remove $I2P_SMTP_PORT
-
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
@@ -390,9 +387,6 @@ function install_bdsmail {
exit 638762424;;
esac
- firewall_add i2psam $I2P_SAM_PORT
- firewall_add i2psmtp $I2P_SMTP_PORT
-
APP_INSTALLED=1
}
From dc0034286b60dc4186628de08db41ab501dffbaf Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 10:19:23 +0000
Subject: [PATCH 61/91] Ask for the user account password first
---
src/freedombone-app-bdsmail | 40 +++++++++++++++++++++----------------
1 file changed, 23 insertions(+), 17 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 53dda83e..dd728cfa 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -249,6 +249,28 @@ function install_bdsmail {
remove_bdsmail
fi
+ # ask to the ssh login password for the admin user
+ # This is then used to create the maildir account
+ user_account_password=''
+ data=$(tempfile 2>/dev/null)
+ trap "rm -f $data" 0 1 2 5 15
+ dialog --title $"Password" \
+ --clear \
+ --passwordbox $"Enter your ssh login password" 8 60 2> $data
+ ret=$?
+ case $ret in
+ 0)
+ user_account_password=$(cat $data)
+ ;;
+ esac
+
+ if [ ${#user_account_password} -lt 2 ]; then
+ echo ''
+ echo $'A password must be provided for your user account.'
+ echo $'This is the same as the original ssh login password shown when you first installed the system.'
+ exit 3656358
+ fi
+
if [ -d /repos/bdsmail ]; then
mkdir $BDSMAIL_DIR
cp -r -p /repos/bdsmail/. $BDSMAIL_DIR
@@ -369,23 +391,7 @@ function install_bdsmail {
bdsmail_configure_users
- # ask to the ssh login password for the admin user
- # This is then used to create the maildir account
- data=$(tempfile 2>/dev/null)
- trap "rm -f $data" 0 1 2 5 15
- dialog --title $"Password" \
- --clear \
- --passwordbox $"Enter your ssh login password" 8 60 2> $data
- ret=$?
- case $ret in
- 0)
- $BDSMAIL_DIR/bin/newmail $MY_USERNAME /home/$MY_USERNAME/MailDir/i2p $(cat $data)
- ;;
- 1)
- exit 643856384;;
- 255)
- exit 638762424;;
- esac
+ $BDSMAIL_DIR/bin/newmail $MY_USERNAME /home/$MY_USERNAME/MailDir/i2p "$user_account_password"
APP_INSTALLED=1
}
From 1ed2a728ed71968427b68a6dd67f1050f9afc818 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 10:21:04 +0000
Subject: [PATCH 62/91] Height of password dialog
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index dd728cfa..4f59e3af 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -256,7 +256,7 @@ function install_bdsmail {
trap "rm -f $data" 0 1 2 5 15
dialog --title $"Password" \
--clear \
- --passwordbox $"Enter your ssh login password" 8 60 2> $data
+ --passwordbox $"Enter your ssh login password.\n\nThis is the same as the original ssh login password shown when you first installed the system." 12 60 2> $data
ret=$?
case $ret in
0)
From 455b2c6f7b035f6bda81d7ced7ef3523b6807742 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 10:21:54 +0000
Subject: [PATCH 63/91] Remove redundant comment
---
src/freedombone-app-bdsmail | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 4f59e3af..b8869eb0 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -267,7 +267,6 @@ function install_bdsmail {
if [ ${#user_account_password} -lt 2 ]; then
echo ''
echo $'A password must be provided for your user account.'
- echo $'This is the same as the original ssh login password shown when you first installed the system.'
exit 3656358
fi
From 1a11a8cfdd1c60ed2814a0d0616f445b9c5546b3 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 10:23:32 +0000
Subject: [PATCH 64/91] Clear password after use
---
src/freedombone-app-bdsmail | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index b8869eb0..ee5a524c 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -391,6 +391,7 @@ function install_bdsmail {
bdsmail_configure_users
$BDSMAIL_DIR/bin/newmail $MY_USERNAME /home/$MY_USERNAME/MailDir/i2p "$user_account_password"
+ user_account_password=
APP_INSTALLED=1
}
From 645bcf9f34d4c481004f9ad8132aea4b708098f9 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 11:33:27 +0000
Subject: [PATCH 65/91] Additional security policy settings for ttrss
---
src/freedombone-app-rss | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/freedombone-app-rss b/src/freedombone-app-rss
index 4639c71b..4e31eb75 100755
--- a/src/freedombone-app-rss
+++ b/src/freedombone-app-rss
@@ -428,7 +428,11 @@ function install_rss_main {
echo ' deny all;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
- echo ' add_header X-Frame-Options DENY;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
+ echo ' add_header X-XSS-Protection "1; mode=block";' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
+ echo ' add_header X-Robots-Tag none;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
+ echo ' add_header X-Download-Options noopen;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
+ echo ' add_header X-Permitted-Cross-Domain-Policies none;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
+ echo ' add_header X-Frame-Options SAMEORIGIN;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
echo ' add_header X-Content-Type-Options nosniff;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
echo ' client_max_body_size 15m;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
echo '}' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
@@ -482,7 +486,11 @@ function install_rss_main {
echo ' deny all;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
echo ' }' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
- echo ' add_header X-Frame-Options DENY;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
+ echo ' add_header X-XSS-Protection "1; mode=block";' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
+ echo ' add_header X-Robots-Tag none;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
+ echo ' add_header X-Download-Options noopen;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
+ echo ' add_header X-Permitted-Cross-Domain-Policies none;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
+ echo ' add_header X-Frame-Options SAMEORIGIN;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
echo ' add_header X-Content-Type-Options nosniff;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
echo ' client_max_body_size 15m;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
echo '}' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
From a8fdb0208560c9c746bd599ce2df9c0d20dc2d19 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 13:29:20 +0000
Subject: [PATCH 66/91] bdsmail install fails in a safe condition
---
src/freedombone-app-bdsmail | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index ee5a524c..b3498171 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -365,9 +365,9 @@ function install_bdsmail {
done
if [ ! $bds_domain ]; then
- #systemctl stop bdsmail
- #systemctl disable bdsmail
- #remove_i2p
+ systemctl stop bdsmail
+ systemctl disable bdsmail
+ remove_i2p
echo $'Failed to get the bdsmail domain'
exit 8934638
fi
From 6e4a9ba84d2b112ceb3c81c213c5942f02f34984 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 15:31:50 +0000
Subject: [PATCH 67/91] upgrades of bdsmail
---
src/freedombone-app-bdsmail | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index b3498171..9d695498 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -97,7 +97,7 @@ function add_user_bdsmail {
fi
sed -i "s|username|$new_username|g" /home/$new_username/.mutt/bdsmail
bdsmail_configure_users
- $BDSMAIL_DIR/bin/newmail $new_username /home/$new_username/MailDir/i2p "$new_user_password"
+ $BDSMAIL_DIR/bin/newmail $BDSMAIL_DIR/config.ini $new_username /home/$new_username/Maildir/i2p "$new_user_password"
chown -R $new_username:$new_username /home/$new_username/.mutt
echo '0'
}
@@ -125,7 +125,10 @@ function upgrade_bdsmail {
# update to the next commit
set_repo_commit $BDSMAIL_DIR "bdsmail commit" "$BDSMAIL_COMMIT" $BDSMAIL_REPO
+ cd $BDSMAIL_DIR
+ make GOROOT=/home/go/go${GO_VERSION}
chown -R i2psvc:i2psvc $BDSMAIL_DIR
+ systemctl restart bdsmail
}
function backup_local_bdsmail {
@@ -288,6 +291,9 @@ function install_bdsmail {
git checkout $BDSMAIL_COMMIT -b $BDSMAIL_COMMIT
set_completion_param "bdsmail commit" "$BDSMAIL_COMMIT"
+ mkdir -p $BDSMAIL_DIR/Maildir/i2p
+ chmod -R 700 $BDSMAIL_DIR/Maildir
+
make GOROOT=/home/go/go${GO_VERSION}
if [ ! -f $BDSMAIL_DIR/bin/bdsconfig ]; then
echo $'Unable to make bdsmail'
@@ -305,7 +311,7 @@ function install_bdsmail {
echo "bindmail = 127.0.0.1:$I2P_SMTP_PORT" >> $BDSMAIL_DIR/config.ini
echo 'bindweb = 127.0.0.1:8489' >> $BDSMAIL_DIR/config.ini
echo 'domain = localhost' >> $BDSMAIL_DIR/config.ini
- echo 'maildir = mail' >> $BDSMAIL_DIR/config.ini
+ echo 'maildir = Maildir/i2p' >> $BDSMAIL_DIR/config.ini
echo 'database = localhost.sqlite' >> $BDSMAIL_DIR/config.ini
echo 'assets = contrib/assets/web' >> $BDSMAIL_DIR/config.ini
@@ -390,7 +396,7 @@ function install_bdsmail {
bdsmail_configure_users
- $BDSMAIL_DIR/bin/newmail $MY_USERNAME /home/$MY_USERNAME/MailDir/i2p "$user_account_password"
+ $BDSMAIL_DIR/bin/newmail $BDSMAIL_DIR/config.ini $MY_USERNAME /home/$MY_USERNAME/Maildir/i2p "$user_account_password"
user_account_password=
APP_INSTALLED=1
From a3c92759b7bdef9043f4616af4a1669f19f733dc Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 16:10:14 +0000
Subject: [PATCH 68/91] bdsmail commit
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 9d695498..f88ef423 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -34,7 +34,7 @@ IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
BDSMAIL_REPO="https://github.com/majestrate/bdsmail"
-BDSMAIL_COMMIT='6a2296b0b8e6c3da61081b85802e7b1cc88ca285'
+BDSMAIL_COMMIT='48838b84adca7a5a89a54b47599f6375ab9dbb68'
BDSMAIL_DIR=/etc/bdsmail
I2P_SAM_PORT=7656
I2P_SMTP_PORT=2525
From 78bcc778969f56c5a97136bb35e3ab1a36238867 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 18:54:26 +0000
Subject: [PATCH 69/91] Add a script to distribute bdsmail to user maildirs
---
src/freedombone-app-bdsmail | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index f88ef423..5a756e3e 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -245,6 +245,9 @@ function remove_bdsmail {
if [ -d $BDSMAIL_DIR ]; then
rm -rf $BDSMAIL_DIR
fi
+ rm /usr/bin/bdsmail_domain
+ sed -i '/bdsmail_distribute/d' /etc/crontab
+ rm /usr/bin/bdsmail_distribute
}
function install_bdsmail {
@@ -342,6 +345,26 @@ function install_bdsmail {
systemctl enable bdsmail
systemctl start bdsmail
+ echo '#!/bin/bash' > /usr/bin/bdsmail_distribute
+ echo 'BDSMAIL_DIR=/etc/bdsmail' >> /usr/bin/bdsmail_distribute
+ echo "MAIL_DIR=\$BDSMAIL_DIR/$(cat \$BDSMAIL_DIR/config.ini | grep 'maildir =' | awk -F ' ' '{print \$3}')" >> /usr/bin/bdsmail_distribute
+ echo 'if [ ! -d $MAIL_DIR/postmaster/new ]; then' >> /usr/bin/bdsmail_distribute
+ echo ' exit 0' >> /usr/bin/bdsmail_distribute
+ echo 'fi' >> /usr/bin/bdsmail_distribute
+ echo 'for filename in $MAIL_DIR/postmaster/new/*; do' >> /usr/bin/bdsmail_distribute
+ echo ' to_line=$(cat $filename | grep "To: " | head -n 1)' >> /usr/bin/bdsmail_distribute
+ echo " to_username=\$(echo \"\$to_line\" | awk -F ' ' '{print \$2}' | awk -F '@' '{print \$1}')" >> /usr/bin/bdsmail_distribute
+ echo ' if [ -d /home/$to_username/Maildir/i2p/new ]; then' >> /usr/bin/bdsmail_distribute
+ echo ' chown $to_username:$to_username $filename' >> /usr/bin/bdsmail_distribute
+ echo ' mv $filename /home/$to_username/Maildir/i2p/new' >> /usr/bin/bdsmail_distribute
+ echo ' fi' >> /usr/bin/bdsmail_distribute
+ echo 'done' >> /usr/bin/bdsmail_distribute
+ chmod +x /usr/bin/bdsmail_distribute
+
+ if ! grep -q 'bdsmail_distribute' /etc/crontab; then
+ echo '*/1 * * * * root /usr/bin/bdsmail_distribute 2> /dev/null' >> /etc/crontab
+ fi
+
echo '#!/bin/bash' > /usr/bin/bdsmail_domain
echo "cd $BDSMAIL_DIR" >> /usr/bin/bdsmail_domain
echo 'if [ ! -f bdsmail-privkey.dat ]; then' >> /usr/bin/bdsmail_domain
From 4b58ea23a8dc0a350eccd7cee08ef258f2f14663 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 19:21:14 +0000
Subject: [PATCH 70/91] bdsmail file permissions
---
src/freedombone-app-bdsmail | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 5a756e3e..7e407ca3 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -356,6 +356,7 @@ function install_bdsmail {
echo " to_username=\$(echo \"\$to_line\" | awk -F ' ' '{print \$2}' | awk -F '@' '{print \$1}')" >> /usr/bin/bdsmail_distribute
echo ' if [ -d /home/$to_username/Maildir/i2p/new ]; then' >> /usr/bin/bdsmail_distribute
echo ' chown $to_username:$to_username $filename' >> /usr/bin/bdsmail_distribute
+ echo ' chmod 600 $filename' >> /usr/bin/bdsmail_distribute
echo ' mv $filename /home/$to_username/Maildir/i2p/new' >> /usr/bin/bdsmail_distribute
echo ' fi' >> /usr/bin/bdsmail_distribute
echo 'done' >> /usr/bin/bdsmail_distribute
From 5bcf9ccdbbcdbdf43f01e92254f6eed513d5a9e2 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 19:27:19 +0000
Subject: [PATCH 71/91] bdsmail commit and change name of mailtool
---
src/freedombone-app-bdsmail | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 7e407ca3..00579423 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -34,7 +34,7 @@ IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
BDSMAIL_REPO="https://github.com/majestrate/bdsmail"
-BDSMAIL_COMMIT='48838b84adca7a5a89a54b47599f6375ab9dbb68'
+BDSMAIL_COMMIT='32f50455ddafafef715917a4458b8a97e99ecd73'
BDSMAIL_DIR=/etc/bdsmail
I2P_SAM_PORT=7656
I2P_SMTP_PORT=2525
@@ -97,7 +97,7 @@ function add_user_bdsmail {
fi
sed -i "s|username|$new_username|g" /home/$new_username/.mutt/bdsmail
bdsmail_configure_users
- $BDSMAIL_DIR/bin/newmail $BDSMAIL_DIR/config.ini $new_username /home/$new_username/Maildir/i2p "$new_user_password"
+ $BDSMAIL_DIR/bin/mailtool $BDSMAIL_DIR/config.ini $new_username /home/$new_username/Maildir/i2p "$new_user_password"
chown -R $new_username:$new_username /home/$new_username/.mutt
echo '0'
}
@@ -420,7 +420,7 @@ function install_bdsmail {
bdsmail_configure_users
- $BDSMAIL_DIR/bin/newmail $BDSMAIL_DIR/config.ini $MY_USERNAME /home/$MY_USERNAME/Maildir/i2p "$user_account_password"
+ $BDSMAIL_DIR/bin/mailtool $BDSMAIL_DIR/config.ini $MY_USERNAME /home/$MY_USERNAME/Maildir/i2p "$user_account_password"
user_account_password=
APP_INSTALLED=1
From 1e4c768b31102d67858960fbee71f642d9c4dfe6 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 19:42:33 +0000
Subject: [PATCH 72/91] Revert "bdsmail commit and change name of mailtool"
This reverts commit 5bcf9ccdbbcdbdf43f01e92254f6eed513d5a9e2.
---
src/freedombone-app-bdsmail | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 00579423..7e407ca3 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -34,7 +34,7 @@ IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
BDSMAIL_REPO="https://github.com/majestrate/bdsmail"
-BDSMAIL_COMMIT='32f50455ddafafef715917a4458b8a97e99ecd73'
+BDSMAIL_COMMIT='48838b84adca7a5a89a54b47599f6375ab9dbb68'
BDSMAIL_DIR=/etc/bdsmail
I2P_SAM_PORT=7656
I2P_SMTP_PORT=2525
@@ -97,7 +97,7 @@ function add_user_bdsmail {
fi
sed -i "s|username|$new_username|g" /home/$new_username/.mutt/bdsmail
bdsmail_configure_users
- $BDSMAIL_DIR/bin/mailtool $BDSMAIL_DIR/config.ini $new_username /home/$new_username/Maildir/i2p "$new_user_password"
+ $BDSMAIL_DIR/bin/newmail $BDSMAIL_DIR/config.ini $new_username /home/$new_username/Maildir/i2p "$new_user_password"
chown -R $new_username:$new_username /home/$new_username/.mutt
echo '0'
}
@@ -420,7 +420,7 @@ function install_bdsmail {
bdsmail_configure_users
- $BDSMAIL_DIR/bin/mailtool $BDSMAIL_DIR/config.ini $MY_USERNAME /home/$MY_USERNAME/Maildir/i2p "$user_account_password"
+ $BDSMAIL_DIR/bin/newmail $BDSMAIL_DIR/config.ini $MY_USERNAME /home/$MY_USERNAME/Maildir/i2p "$user_account_password"
user_account_password=
APP_INSTALLED=1
From 2fa207e1249e9a43a7261c01b5b9ae1b99aa8ebd Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 19:55:21 +0000
Subject: [PATCH 73/91] Deprecate supplying a password for bdsmail
---
src/freedombone-app-bdsmail | 26 ++------------------------
1 file changed, 2 insertions(+), 24 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 7e407ca3..f46780c6 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -97,7 +97,7 @@ function add_user_bdsmail {
fi
sed -i "s|username|$new_username|g" /home/$new_username/.mutt/bdsmail
bdsmail_configure_users
- $BDSMAIL_DIR/bin/newmail $BDSMAIL_DIR/config.ini $new_username /home/$new_username/Maildir/i2p "$new_user_password"
+ $BDSMAIL_DIR/bin/newmail $BDSMAIL_DIR/config.ini $new_username /home/$new_username/Maildir/i2p
chown -R $new_username:$new_username /home/$new_username/.mutt
echo '0'
}
@@ -255,27 +255,6 @@ function install_bdsmail {
remove_bdsmail
fi
- # ask to the ssh login password for the admin user
- # This is then used to create the maildir account
- user_account_password=''
- data=$(tempfile 2>/dev/null)
- trap "rm -f $data" 0 1 2 5 15
- dialog --title $"Password" \
- --clear \
- --passwordbox $"Enter your ssh login password.\n\nThis is the same as the original ssh login password shown when you first installed the system." 12 60 2> $data
- ret=$?
- case $ret in
- 0)
- user_account_password=$(cat $data)
- ;;
- esac
-
- if [ ${#user_account_password} -lt 2 ]; then
- echo ''
- echo $'A password must be provided for your user account.'
- exit 3656358
- fi
-
if [ -d /repos/bdsmail ]; then
mkdir $BDSMAIL_DIR
cp -r -p /repos/bdsmail/. $BDSMAIL_DIR
@@ -420,8 +399,7 @@ function install_bdsmail {
bdsmail_configure_users
- $BDSMAIL_DIR/bin/newmail $BDSMAIL_DIR/config.ini $MY_USERNAME /home/$MY_USERNAME/Maildir/i2p "$user_account_password"
- user_account_password=
+ $BDSMAIL_DIR/bin/newmail $BDSMAIL_DIR/config.ini $MY_USERNAME /home/$MY_USERNAME/Maildir/i2p
APP_INSTALLED=1
}
From 68f2b6faad51e62124a5be011bfc075a8b75d697 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 20:01:57 +0000
Subject: [PATCH 74/91] Revert "Revert "bdsmail commit and change name of
mailtool""
This reverts commit 1e4c768b31102d67858960fbee71f642d9c4dfe6.
---
src/freedombone-app-bdsmail | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index f46780c6..5b875bc9 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -34,7 +34,7 @@ IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
BDSMAIL_REPO="https://github.com/majestrate/bdsmail"
-BDSMAIL_COMMIT='48838b84adca7a5a89a54b47599f6375ab9dbb68'
+BDSMAIL_COMMIT='32f50455ddafafef715917a4458b8a97e99ecd73'
BDSMAIL_DIR=/etc/bdsmail
I2P_SAM_PORT=7656
I2P_SMTP_PORT=2525
@@ -97,7 +97,7 @@ function add_user_bdsmail {
fi
sed -i "s|username|$new_username|g" /home/$new_username/.mutt/bdsmail
bdsmail_configure_users
- $BDSMAIL_DIR/bin/newmail $BDSMAIL_DIR/config.ini $new_username /home/$new_username/Maildir/i2p
+ $BDSMAIL_DIR/bin/mailtool $BDSMAIL_DIR/config.ini $new_username /home/$new_username/Maildir/i2p
chown -R $new_username:$new_username /home/$new_username/.mutt
echo '0'
}
@@ -399,7 +399,7 @@ function install_bdsmail {
bdsmail_configure_users
- $BDSMAIL_DIR/bin/newmail $BDSMAIL_DIR/config.ini $MY_USERNAME /home/$MY_USERNAME/Maildir/i2p
+ $BDSMAIL_DIR/bin/mailtool $BDSMAIL_DIR/config.ini $MY_USERNAME /home/$MY_USERNAME/Maildir/i2p
APP_INSTALLED=1
}
From ae46a1b5e6e88ef0c46728da585e277b622fbb72 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 20:20:14 +0000
Subject: [PATCH 75/91] Create bdsmail admin password
---
src/freedombone-app-bdsmail | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 5b875bc9..05504be9 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -34,7 +34,7 @@ IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
BDSMAIL_REPO="https://github.com/majestrate/bdsmail"
-BDSMAIL_COMMIT='32f50455ddafafef715917a4458b8a97e99ecd73'
+BDSMAIL_COMMIT='2f047942e1cc0e36258fef27dc2fa49be299fca4'
BDSMAIL_DIR=/etc/bdsmail
I2P_SAM_PORT=7656
I2P_SMTP_PORT=2525
@@ -381,10 +381,14 @@ function install_bdsmail {
exit 8934638
fi
+ bdsmail_admin_password="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
+ ${PROJECT_NAME}-pass -u $new_username -a bdsmail -p "$bdsmail_admin_password"
+ $BDSMAIL_DIR/bin/mailtool $BDSMAIL_DIR/config.ini admin $BDSMAIL_DIR/Maildir/i2p/admin $bdsmail_admin_password
+
# Create mutt configuration
mkdir /etc/skel/.mutt
echo 'set mbox_type=Maildir' > /etc/skel/.mutt/bdsmail
- echo "set smtp_url=smtp://127.0.0.1:$I2P_SMTP_PORT/" >> /etc/skel/.mutt/bdsmail
+ echo "set smtp_url=smtp://admin:${bdsmail_admin_password}@127.0.0.1:$I2P_SMTP_PORT/" >> /etc/skel/.mutt/bdsmail
echo 'set use_from=yes' >> /etc/skel/.mutt/bdsmail
echo "set from=username@${bds_domain}" >> /etc/skel/.mutt/bdsmail
echo "set spoolfile=~/Maildir/i2p" >> /etc/skel/.mutt/bdsmail
From 9a7b8183bdf162be54330a43146ad9b7a9ba5229 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 20:23:12 +0000
Subject: [PATCH 76/91] username when creating password entry
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 05504be9..dee4d80f 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -382,7 +382,7 @@ function install_bdsmail {
fi
bdsmail_admin_password="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
- ${PROJECT_NAME}-pass -u $new_username -a bdsmail -p "$bdsmail_admin_password"
+ ${PROJECT_NAME}-pass -u $MY_USERNAME -a bdsmail -p "$bdsmail_admin_password"
$BDSMAIL_DIR/bin/mailtool $BDSMAIL_DIR/config.ini admin $BDSMAIL_DIR/Maildir/i2p/admin $bdsmail_admin_password
# Create mutt configuration
From eeebdbf4e9a7bfbc1cd82673e9b1b257e669e431 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 20:28:09 +0000
Subject: [PATCH 77/91] quotes
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index dee4d80f..8431625c 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -383,7 +383,7 @@ function install_bdsmail {
bdsmail_admin_password="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
${PROJECT_NAME}-pass -u $MY_USERNAME -a bdsmail -p "$bdsmail_admin_password"
- $BDSMAIL_DIR/bin/mailtool $BDSMAIL_DIR/config.ini admin $BDSMAIL_DIR/Maildir/i2p/admin $bdsmail_admin_password
+ $BDSMAIL_DIR/bin/mailtool $BDSMAIL_DIR/config.ini admin $BDSMAIL_DIR/Maildir/i2p/admin "$bdsmail_admin_password"
# Create mutt configuration
mkdir /etc/skel/.mutt
From 224a559c79d6b9df07b018dd0dca0594334a89d3 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 20:53:04 +0000
Subject: [PATCH 78/91] We don't need to gpg sign bdsmail by default
---
src/freedombone-app-bdsmail | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 8431625c..683561d7 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -392,6 +392,10 @@ function install_bdsmail {
echo 'set use_from=yes' >> /etc/skel/.mutt/bdsmail
echo "set from=username@${bds_domain}" >> /etc/skel/.mutt/bdsmail
echo "set spoolfile=~/Maildir/i2p" >> /etc/skel/.mutt/bdsmail
+ echo 'set pgp_autoencrypt=no' >> /etc/skel/.mutt/bdsmail
+ echo 'set pgp_replyencrypt=no' >> /etc/skel/.mutt/bdsmail
+ echo 'set pgp_autosign=no' >> /etc/skel/.mutt/bdsmail
+ echo 'set pgp_replysign=no' >> /etc/skel/.mutt/bdsmail
# mutt configuration for the admin user
if [ ! -d /home/$MY_USERNAME/.mutt ]; then
From ae86a375aa2bc3672b1bcf7bd4ad1a74feedccbe Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 20:57:01 +0000
Subject: [PATCH 79/91] bdsmail commit
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 683561d7..e99262f3 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -34,7 +34,7 @@ IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
BDSMAIL_REPO="https://github.com/majestrate/bdsmail"
-BDSMAIL_COMMIT='2f047942e1cc0e36258fef27dc2fa49be299fca4'
+BDSMAIL_COMMIT='b597371f8a70ae89909f2b629046f49e2ace189a'
BDSMAIL_DIR=/etc/bdsmail
I2P_SAM_PORT=7656
I2P_SMTP_PORT=2525
From b60ff37349b434eeeb03d3e19a994a9d9a45f377 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 21:03:12 +0000
Subject: [PATCH 80/91] pop3 server in bdsmail config
---
src/freedombone-app-bdsmail | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index e99262f3..73975fbb 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -292,6 +292,7 @@ function install_bdsmail {
echo 'i2pkeyfile = bdsmail-privkey.dat' >> $BDSMAIL_DIR/config.ini
echo "bindmail = 127.0.0.1:$I2P_SMTP_PORT" >> $BDSMAIL_DIR/config.ini
echo 'bindweb = 127.0.0.1:8489' >> $BDSMAIL_DIR/config.ini
+ echo 'bindpop3 = 127.0.0.1:1110' >> $BDSMAIL_DIR/config.ini
echo 'domain = localhost' >> $BDSMAIL_DIR/config.ini
echo 'maildir = Maildir/i2p' >> $BDSMAIL_DIR/config.ini
echo 'database = localhost.sqlite' >> $BDSMAIL_DIR/config.ini
From f0fe7828e6f667b8d28ff5518a8d5463847ae124 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 22:55:05 +0000
Subject: [PATCH 81/91] backslash
---
src/freedombone-app-bdsmail | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 73975fbb..3499d4fc 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -326,8 +326,8 @@ function install_bdsmail {
systemctl start bdsmail
echo '#!/bin/bash' > /usr/bin/bdsmail_distribute
- echo 'BDSMAIL_DIR=/etc/bdsmail' >> /usr/bin/bdsmail_distribute
- echo "MAIL_DIR=\$BDSMAIL_DIR/$(cat \$BDSMAIL_DIR/config.ini | grep 'maildir =' | awk -F ' ' '{print \$3}')" >> /usr/bin/bdsmail_distribute
+ echo "BDSMAIL_DIR=$BDSMAIL_DIR" >> /usr/bin/bdsmail_distribute
+ echo "MAIL_DIR=\$BDSMAIL_DIR/\$(cat \$BDSMAIL_DIR/config.ini | grep 'maildir =' | awk -F ' ' '{print \$3}')" >> /usr/bin/bdsmail_distribute
echo 'if [ ! -d $MAIL_DIR/postmaster/new ]; then' >> /usr/bin/bdsmail_distribute
echo ' exit 0' >> /usr/bin/bdsmail_distribute
echo 'fi' >> /usr/bin/bdsmail_distribute
From 8b272df109b12c456121da35447530e22417619c Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 13 Feb 2018 22:58:07 +0000
Subject: [PATCH 82/91] Tidying
---
src/freedombone-app-bdsmail | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 3499d4fc..32555e02 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -248,6 +248,9 @@ function remove_bdsmail {
rm /usr/bin/bdsmail_domain
sed -i '/bdsmail_distribute/d' /etc/crontab
rm /usr/bin/bdsmail_distribute
+ if [ -f /etc/skel/.mutt/bdsmail ]; then
+ rm /etc/skel/.mutt/bdsmail
+ fi
}
function install_bdsmail {
@@ -387,7 +390,9 @@ function install_bdsmail {
$BDSMAIL_DIR/bin/mailtool $BDSMAIL_DIR/config.ini admin $BDSMAIL_DIR/Maildir/i2p/admin "$bdsmail_admin_password"
# Create mutt configuration
- mkdir /etc/skel/.mutt
+ if [ ! -d /etc/skel/.mutt ]; then
+ mkdir /etc/skel/.mutt
+ fi
echo 'set mbox_type=Maildir' > /etc/skel/.mutt/bdsmail
echo "set smtp_url=smtp://admin:${bdsmail_admin_password}@127.0.0.1:$I2P_SMTP_PORT/" >> /etc/skel/.mutt/bdsmail
echo 'set use_from=yes' >> /etc/skel/.mutt/bdsmail
From 159bff133f6b82a2fd970003881dc5bd1a1d2054 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Wed, 14 Feb 2018 11:38:32 +0000
Subject: [PATCH 83/91] Include bdsmail in images
---
src/freedombone-image-customise | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise
index 9611b450..1a1cefe0 100755
--- a/src/freedombone-image-customise
+++ b/src/freedombone-image-customise
@@ -1946,6 +1946,7 @@ function image_preinstall_repos {
git clone $PEERTUBE_REPO $rootdir/repos/peertube
git clone $PRIVATEBIN_REPO $rootdir/repos/privatebin
git clone $EDITH_REPO $rootdir/repos/edith
+ git clone $BDSMAIL_REPO $rootdir/repos/bdsmail
#git clone $WEKAN_REPO $rootdir/repos/wekan
#git clone $FLOW_ROUTER_REPO $rootdir/repos/flowrouter
#git clone $METEOR_USERACCOUNTS_REPO $rootdir/repos/meteoruseraccounts
From 2e72583677bb9b75aa4a4efb05df0c65dce1327f Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Wed, 14 Feb 2018 12:11:50 +0000
Subject: [PATCH 84/91] Detect potential ssh login attacks
---
src/freedombone-tests | 6 ++++++
tests/check-ssh.sh | 5 +++++
tests/output.sh | 5 +++++
3 files changed, 16 insertions(+)
diff --git a/src/freedombone-tests b/src/freedombone-tests
index 7eb69270..123fff5b 100755
--- a/src/freedombone-tests
+++ b/src/freedombone-tests
@@ -892,6 +892,12 @@ function test_stig {
output "SV-86927r2_rule" $? ${SETLANG}
################
+ ##Check that pam_python is not installed
+ bash $STIG_TESTS_DIR/check-ssh.sh pam_python >/dev/null 2>&1 &
+ stig_spinner $!
+ output "SV-86724r2_rule" $? ${SETLANG}
+ ################
+
##RHEL-06-000247
##The system clock must be synchronized continuously, or at least daily.
diff --git a/tests/check-ssh.sh b/tests/check-ssh.sh
index 699d943c..38003d0a 100644
--- a/tests/check-ssh.sh
+++ b/tests/check-ssh.sh
@@ -194,4 +194,9 @@ case $1 in
exit 1
fi
;;
+ pam_python)
+ if grep -q 'pam_python' /etc/pam.d/sshd; then
+ exit 1
+ fi
+ ;;
esac
diff --git a/tests/output.sh b/tests/output.sh
index a94c2e3d..8133a4c4 100644
--- a/tests/output.sh
+++ b/tests/output.sh
@@ -119,6 +119,11 @@ Check_content: Verify the SSH private host key files have mode "0600" or less pe
printf '\n######################\n\nThis system is not intended to support graphical output\n\n######################\n\n' >> $LOG
fi
;;
+ SV-86724r2_rule) log_msg $2 'Dont allow pam_python.'
+ if [ $2 -ne 0 ];then
+ printf '\n######################\n\npam_python within /etc/pam.d/sshd could indicate a possible attack on ssh logins.\n\n######################\n\n' >> $LOG
+ fi
+ ;;
V-38455) if [ "$3" = "en" ]; then
log_msg $2 'The system must use a separate file system for /tmp.'
else
From 0006d463938e2d8e0c5a1535a58245c0e1827a0a Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Wed, 14 Feb 2018 12:29:58 +0000
Subject: [PATCH 85/91] Bump bdsmail commit
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 32555e02..b046a8f9 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -34,7 +34,7 @@ IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
BDSMAIL_REPO="https://github.com/majestrate/bdsmail"
-BDSMAIL_COMMIT='b597371f8a70ae89909f2b629046f49e2ace189a'
+BDSMAIL_COMMIT='e7d20776eaf1f27ec61161f1a4bda4cd4d882dc1'
BDSMAIL_DIR=/etc/bdsmail
I2P_SAM_PORT=7656
I2P_SMTP_PORT=2525
From 63c42cb6ff738f1323a4d12d64b1be26634d158f Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Wed, 14 Feb 2018 12:33:04 +0000
Subject: [PATCH 86/91] Longer waits to allow for key generation
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index b046a8f9..7c781b78 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -369,7 +369,7 @@ function install_bdsmail {
while [ ! $bds_domain ]; do
echo $"Waiting for i2p domain to be generated ${sleep_ctr}/100"
systemctl restart bdsmail
- sleep 20
+ sleep 30
bds_domain=$(bdsmail_domain)
sleep_ctr=$((sleep_ctr + 1))
if [ $sleep_ctr -gt 100 ]; then
From 53f0a66f6efda442a2916389a005de3c6321384b Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Wed, 14 Feb 2018 12:54:08 +0000
Subject: [PATCH 87/91] Reconfigure for bdsmail
---
src/freedombone-app-bdsmail | 54 ++++++++++++++++++++++++++-----------
1 file changed, 38 insertions(+), 16 deletions(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 7c781b78..d7905ffd 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -112,9 +112,44 @@ function change_password_bdsmail {
new_user_password="$2"
}
+function bdsmail_update_domain {
+ sed -i "s|set from=.*|set from=username@$(bdsmail_domain)|g" /etc/skel/.mutt/bdsmail
+ for d in /home/*/ ; do
+ USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
+ if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
+ cp /etc/skel/.mutt/bdsmail /home/${USERNAME}/.mutt/bdsmail
+ sed -i "s|set from=.*|set from=${USERNAME}@$(bdsmail_domain)|g" /home/${USERNAME}/.mutt/bdsmail
+ chown ${USERNAME}:${USERNAME} /home/${USERNAME}/.mutt/bdsmail
+ fi
+ done
+}
+
+function bdsmail_wait_for_key_generation {
+ # wait for domain to be generated by the daemon
+ # This can take a while, probably because i2p is connecting
+ bds_domain=
+ sleep_ctr=0
+ while [ ! $bds_domain ]; do
+ echo $"Waiting for i2p domain to be generated ${sleep_ctr}/100"
+ systemctl restart bdsmail
+ sleep 30
+ bds_domain=$(bdsmail_domain)
+ sleep_ctr=$((sleep_ctr + 1))
+ if [ $sleep_ctr -gt 100 ]; then
+ break
+ fi
+ done
+}
+
function reconfigure_bdsmail {
- # This is used if you need to switch identity. Dump old keys and generate new ones
- echo -n ''
+ systemctl stop bdsmail
+ rm $BDSMAIL_DIR/*.dat
+ rm $BDSMAIL_DIR/*.pem
+ bdsmail_wait_for_key_generation
+ if [ ! -f $BDSMAIL_DIR/bdsmail-privkey.dat ]; then
+ return
+ fi
+ bdsmail_update_domain
}
function upgrade_bdsmail {
@@ -362,20 +397,7 @@ function install_bdsmail {
echo $'This may take a while.'
echo ''
- # wait for domain to be generated by the daemon
- # This can take a while, probably because i2p is connecting
- bds_domain=
- sleep_ctr=0
- while [ ! $bds_domain ]; do
- echo $"Waiting for i2p domain to be generated ${sleep_ctr}/100"
- systemctl restart bdsmail
- sleep 30
- bds_domain=$(bdsmail_domain)
- sleep_ctr=$((sleep_ctr + 1))
- if [ $sleep_ctr -gt 100 ]; then
- break
- fi
- done
+ bdsmail_wait_for_key_generation
if [ ! $bds_domain ]; then
systemctl stop bdsmail
From 0332699f6048cca1eec232049bacb48c05bbaed0 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Wed, 14 Feb 2018 13:21:08 +0000
Subject: [PATCH 88/91] bdsmail commit
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index d7905ffd..a4110771 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -34,7 +34,7 @@ IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
BDSMAIL_REPO="https://github.com/majestrate/bdsmail"
-BDSMAIL_COMMIT='e7d20776eaf1f27ec61161f1a4bda4cd4d882dc1'
+BDSMAIL_COMMIT='3408654a29f7588e6684c11d25172b49c816778b'
BDSMAIL_DIR=/etc/bdsmail
I2P_SAM_PORT=7656
I2P_SMTP_PORT=2525
From 79448aa6033f1c5177ccb2c797d33cce02e92ecf Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Wed, 14 Feb 2018 13:24:52 +0000
Subject: [PATCH 89/91] Update i2p domains during bdsmail upgrade if needed
---
src/freedombone-app-bdsmail | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index a4110771..6b1b5a3d 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -164,6 +164,10 @@ function upgrade_bdsmail {
make GOROOT=/home/go/go${GO_VERSION}
chown -R i2psvc:i2psvc $BDSMAIL_DIR
systemctl restart bdsmail
+
+ if ! grep -q "$(bdsmail_domain)" /etc/skel/.mutt/bdsmail; then
+ bdsmail_update_domain
+ fi
}
function backup_local_bdsmail {
From 70b42d880229bd33fd62bfafc3fe327ad440ba37 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Wed, 14 Feb 2018 14:18:25 +0000
Subject: [PATCH 90/91] Remove and reinstall i2p
---
src/freedombone-utils-i2p | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/freedombone-utils-i2p b/src/freedombone-utils-i2p
index f75ced03..d3ef3163 100755
--- a/src/freedombone-utils-i2p
+++ b/src/freedombone-utils-i2p
@@ -86,8 +86,11 @@ function remove_i2p {
function i2p_enable_sam {
if [ ! -f /var/lib/i2p/i2p-config/clients.config ]; then
- systemctl restart i2p
- sleep 10
+ apt-get -yq remove i2p --purge
+ apt-get -yq remove i2p-router --purge
+ apt-get -yq install i2p
+ apt-get -yq install i2p-router
+ sleep 2
fi
if [ ! -f /var/lib/i2p/i2p-config/clients.config ]; then
echo $'File not found /var/lib/i2p/i2p-config/clients.config'
From 261698c0e279437de81147a72732e0300b1f4c5c Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Wed, 14 Feb 2018 14:23:25 +0000
Subject: [PATCH 91/91] bdsmail commit
---
src/freedombone-app-bdsmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/freedombone-app-bdsmail b/src/freedombone-app-bdsmail
index 6b1b5a3d..ebc077e2 100755
--- a/src/freedombone-app-bdsmail
+++ b/src/freedombone-app-bdsmail
@@ -34,7 +34,7 @@ IN_DEFAULT_INSTALL=0
SHOW_ON_ABOUT=1
BDSMAIL_REPO="https://github.com/majestrate/bdsmail"
-BDSMAIL_COMMIT='3408654a29f7588e6684c11d25172b49c816778b'
+BDSMAIL_COMMIT='8fb00a725edea59b31b8d23eb32e0c21972bb723'
BDSMAIL_DIR=/etc/bdsmail
I2P_SAM_PORT=7656
I2P_SMTP_PORT=2525