Skip to content

Commit

Permalink
Testing with starting forever with sudo
Browse files Browse the repository at this point in the history
Experimental checks - down pull if you are looking for stability
  • Loading branch information
bmcgonag committed Mar 29, 2020
1 parent 889a425 commit f94495c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
9 changes: 9 additions & 0 deletions server/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ Meteor.startup(() => {
}
});
}

// let's see which user I am.
ShellJS.exec("whoami", function(code, stdout, stderr) {
if (stdout) {
console.log("I am : " + stdout);
} else if (stderr) {
console.log("Error on whoamI cmd: " + stderr);
}
});

// need to check to see if wireguard appears to be installed.
let installed;
Expand Down
22 changes: 21 additions & 1 deletion server/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { WGInstalled } from '../imports/api/wgInstalled.js';
import { ServerInfo } from '../imports/api/serverInfo.js';
import { Interfaces } from '../imports/api/interfaces.js';
import { Configuration } from '../imports/api/configuration.js';
import { Control } from '../imports/api/control.js';

Meteor.methods({
'delete.User' (userId) {
Expand All @@ -22,6 +23,20 @@ Meteor.methods({
// We need to create our Public and Private keys
let installed = WGInstalled.findOne({});
let Configs = Configuration.findOne({});
let Controls = Control.findOne({});

let myMachineUser;
let mysudopass = Controls.mpw;

// let's see which user I am.
ShellJS.exec("whoami", function(code, stdout, stderr) {
if (stdout) {
console.log("I am : " + stdout);
myMachineUser = stdout;
} else if (stderr) {
console.log("Error on whoamI cmd: " + stderr);
}
});

if (typeof Configs.logLevel == "undefined") {
console.log("You must setup the system Configuration before creating your server interface!");
Expand Down Expand Up @@ -79,7 +94,12 @@ Meteor.methods({
console.log("");
}

ShellJS.exec("cp ~/" + interfaceName + ".conf /etc/wireguard/");
// if (myMachineUser == "root") {
ShellJS.exec("cp ~/" + interfaceName + ".conf /etc/wireguard/");
// } else {
// ShellJS.exec("echo '" + mysudopass + "' | sudo -S cp ~/" + interfaceName + ".conf /etc/wireguard/");
// }


// bring up the WireGuard interface we just created.
Meteor.setTimeout(function() {
Expand Down

0 comments on commit f94495c

Please sign in to comment.