Added automatic ufw disable to Captain node join

This commit is contained in:
Kasra Bigdeli
2019-01-18 23:19:23 -08:00
parent 65f917d29f
commit 82b6b260d8
3 changed files with 18 additions and 8 deletions
+6 -4
View File
@@ -659,10 +659,12 @@ class CaptainManager {
Logger.d('SSH Client :: ready')
// TODO also run ufw allow stuff
conn.exec(
dockerApi.createJoinCommand(
captainIpAddress,
token
),
CaptainConstants.disableFirewallCommand +
' ' +
dockerApi.createJoinCommand(
captainIpAddress,
token
),
function(err, stream) {
if (err) {
Logger.e(err)
+11 -2
View File
@@ -7,8 +7,12 @@ const CAPTAIN_DATA_DIRECTORY = CAPTAIN_BASE_DIRECTORY + '/data' // data that sit
const CAPTAIN_ROOT_DIRECTORY_TEMP = CAPTAIN_BASE_DIRECTORY + '/temp'
const CAPTAIN_ROOT_DIRECTORY_GENERATED = CAPTAIN_BASE_DIRECTORY + '/generated'
const CONSTANT_FILE_OVERRIDE_BUILD = path.join(__dirname, '../../config-override.json')
const CONSTANT_FILE_OVERRIDE_USER = CAPTAIN_DATA_DIRECTORY + '/config-override.json'
const CONSTANT_FILE_OVERRIDE_BUILD = path.join(
__dirname,
'../../config-override.json'
)
const CONSTANT_FILE_OVERRIDE_USER =
CAPTAIN_DATA_DIRECTORY + '/config-override.json'
const configs = {
publishedNameOnDockerHub: 'caprover/caprover',
@@ -134,6 +138,11 @@ let data = {
headerAuth: 'x-captain-auth',
headerNamespace: 'x-namespace',
// ********************* ETC ************************
disableFirewallCommand:
'ufw allow 80,443,3000,996,7946,4789,2377/tcp; ufw allow 7946,4789,2377/udp; ',
}
function overrideFromFile(fileName: string) {
+1 -2
View File
@@ -131,8 +131,7 @@ function checkPortOrThrow(ipAddr: string, portToTest: number) {
'A simple solution on Ubuntu systems is to run "ufw disable"'
)
console.log('Or just allowing necessary ports:')
console.log(' ufw allow 80,443,3000,996,7946,4789,2377/tcp')
console.log(' ufw allow 7946,4789,2377/udp')
console.log(CaptainConstants.disableFirewallCommand)
console.log(' ')
console.log(' ')
console.log('See docs for more details on how to fix firewall issues')