New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T791: wireguard #43

Closed
wants to merge 8 commits into
base: current
from

Conversation

Projects
None yet
3 participants
@hagbard-01
Member

hagbard-01 commented Aug 23, 2018

change implementation (proposed by runar):

  • set interfaces wireguard wg01 peer node2 ... instead of using the public key
  • local-port config options is now optional
  • persistent-keepalive is now a range check 1-65535
  • prepared fwmark, mtu on wg interfaces and preshared-key (not active and usable yet)
## endpoint
if c['interfaces'][intf]['peer'][p]['endpoint']:
wg_config['endpoint'] = c['interfaces'][intf]['peer'][p]['endpoint']

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 6 spaces, expected 12 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 6 spaces, expected 12 rule

## persistent-keepalive
if 'persistent-keepalive' in c['interfaces'][intf]['peer'][p]:
wg_config['keepalive'] = c['interfaces'][intf]['peer'][p]['persistent-keepalive']

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 6 spaces, expected 12 rule
MINOR Exactly one space required before assignment rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 6 spaces, expected 12 rule
MINOR Exactly one space required before assignment rule

wg_config['keepalive'] = c['interfaces'][intf]['peer'][p]['persistent-keepalive']
### assemble wg command
cmd = "sudo wg set " + intf

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

### assemble wg command
cmd = "sudo wg set " + intf
cmd += " listen-port " + str(wg_config['listen-port'])

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

### assemble wg command
cmd = "sudo wg set " + intf
cmd += " listen-port " + str(wg_config['listen-port'])
cmd += " private-key " + wg_config['private-key']

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

cmd = "sudo wg set " + intf
cmd += " listen-port " + str(wg_config['listen-port'])
cmd += " private-key " + wg_config['private-key']
cmd += " peer " + wg_config['peer']['pubkey']

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

cmd += " allowed-ips "
for ap in wg_config['allowed-ips']:

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

cmd += " allowed-ips "
for ap in wg_config['allowed-ips']:
if ap != wg_config['allowed-ips'][-1]:

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 6 spaces, expected 12 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 6 spaces, expected 12 rule

if not c['interfaces'][i]['peer']:
raise ConfigError("peer required on interface " + i)
else:
for p in c['interfaces'][i]['peer']:
if not c['interfaces'][i]['peer'][p]['allowed-ips']:
raise ConfigError("allowed-ips required on interface " + i + " for peer " + p)
if not c['interfaces'][i]['peer'][p]['pubkey']:

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

CRITICAL Refactor this code to not nest more than 4 "if", "for", "while", "try" and "with" statements. rule
MINOR Bad indentation. Found 10 spaces, expected 20 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

CRITICAL Refactor this code to not nest more than 4 "if", "for", "while", "try" and "with" statements. rule
MINOR Bad indentation. Found 10 spaces, expected 20 rule

@@ -15,6 +15,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
#### TODO:

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR TODO: rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR TODO: rule

if not c['interfaces'][i]['peer']:
raise ConfigError("peer required on interface " + i)
else:
for p in c['interfaces'][i]['peer']:
if not c['interfaces'][i]['peer'][p]['allowed-ips']:
raise ConfigError("allowed-ips required on interface " + i + " for peer " + p)
if not c['interfaces'][i]['peer'][p]['pubkey']:
raise ConfigError("pubkey from your peer is mandatory on " + i + " for peer " + p)

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 12 spaces, expected 24 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 12 spaces, expected 24 rule

## endpoint is only required if wg runs as client
if c['interfaces'][intf]['peer'][p]['endpoint']:
cmd += " endpoint " + c['interfaces'][intf]['peer'][p]['endpoint']
if wg_config['endpoint']:

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

if c['interfaces'][intf]['peer'][p]['endpoint']:
cmd += " endpoint " + c['interfaces'][intf]['peer'][p]['endpoint']
if wg_config['endpoint']:
cmd += " endpoint " + wg_config['endpoint']

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 6 spaces, expected 12 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 6 spaces, expected 12 rule

if 'persistent-keepalive' in c['interfaces'][intf]['peer'][p]:
cmd += " persistent-keepalive " + str( c['interfaces'][intf]['peer'][p]['persistent-keepalive'])
if wg_config['keepalive'] !=0:

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule
MINOR Exactly one space required after comparison rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule
MINOR Exactly one space required after comparison rule

if 'persistent-keepalive' in c['interfaces'][intf]['peer'][p]:
cmd += " persistent-keepalive " + str( c['interfaces'][intf]['peer'][p]['persistent-keepalive'])
if wg_config['keepalive'] !=0:
cmd += " persistent-keepalive " + wg_config['keepalive']

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 6 spaces, expected 12 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 6 spaces, expected 12 rule

cmd += " persistent-keepalive " + str( c['interfaces'][intf]['peer'][p]['persistent-keepalive'])
if wg_config['keepalive'] !=0:
cmd += " persistent-keepalive " + wg_config['keepalive']
else:

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

if wg_config['keepalive'] !=0:
cmd += " persistent-keepalive " + wg_config['keepalive']
else:
cmd += " persistent-keepalive 0"

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 6 spaces, expected 12 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 6 spaces, expected 12 rule

sl.syslog(sl.LOG_NOTICE, "sudo " + cmd)
subprocess.call([ 'sudo ' + cmd], shell=True)
sl.syslog(sl.LOG_NOTICE, cmd)

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

sl.syslog(sl.LOG_NOTICE, "sudo " + cmd)
subprocess.call([ 'sudo ' + cmd], shell=True)
sl.syslog(sl.LOG_NOTICE, cmd)
subprocess.call([cmd], shell=True)

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

@@ -223,28 +227,61 @@ def apply(c):
open('/sys/class/net/' + str(intf) + '/ifalias','w').write(str(cnf_descr))
def configure_interface(c, intf):

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

CRITICAL Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed. rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

CRITICAL Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed. rule

This comment has been minimized.

@runborg

runborg Aug 23, 2018

you aren't closing the open statement, try wrapping it inside a with statement:

with open('/sys/class/net/%s/ifalias' % intf) as w:
    w.write(str(cnf_descr))

this way the file is properly closed after writing

@runborg

runborg Aug 23, 2018

you aren't closing the open statement, try wrapping it inside a with statement:

with open('/sys/class/net/%s/ifalias' % intf) as w:
    w.write(str(cnf_descr))

this way the file is properly closed after writing

This comment has been minimized.

@hagbard-01

hagbard-01 Aug 23, 2018

Member

not required, the context manger does that for me.
http://book.pythontips.com/en/latest/context_managers.html
aka:
buf = open(file,'r').read()
or open(file,'r').write(buf)

@hagbard-01

hagbard-01 Aug 23, 2018

Member

not required, the context manger does that for me.
http://book.pythontips.com/en/latest/context_managers.html
aka:
buf = open(file,'r').read()
or open(file,'r').write(buf)

This comment has been minimized.

@runborg

runborg Aug 23, 2018

as far as i know this syntax is not using any context manager, i also can't find you syntax mentioned in the link you provided. what i found about the syntax you used is that it might close the file, but it could be different implementations in different python interpreters.
The correct way to do this is to ensure that .close is bee'n run on the object, directly or indirectly with the __exit__() function as executed when wrapping it inside the with statement.
Please enlighten me if i'm wrong? :)

@runborg

runborg Aug 23, 2018

as far as i know this syntax is not using any context manager, i also can't find you syntax mentioned in the link you provided. what i found about the syntax you used is that it might close the file, but it could be different implementations in different python interpreters.
The correct way to do this is to ensure that .close is bee'n run on the object, directly or indirectly with the __exit__() function as executed when wrapping it inside the with statement.
Please enlighten me if i'm wrong? :)

This comment has been minimized.

@hagbard-01

hagbard-01 Aug 23, 2018

Member

https://docs.python.org/3/tutorial/inputoutput.html#index-0
The advantage is that the file is properly closed after its suite finishes, even if an exception is raised at some point. Using with is also much shorter than writing equivalent try-finally blocks:

with open('workfile') as f:
... read_data = f.read()
f.closed
True

If you’re not using the with keyword, then you should call f.close() to close the file and immediately free up...

http://book.pythontips.com/en/latest/context_managers.html
Context managers allow you to allocate and release resources precisely when you want to.
[...]
with open('some_file', 'w') as opened_file:
opened_file.write('Hola!')

[...]
Clear as mud now?

@hagbard-01

hagbard-01 Aug 23, 2018

Member

https://docs.python.org/3/tutorial/inputoutput.html#index-0
The advantage is that the file is properly closed after its suite finishes, even if an exception is raised at some point. Using with is also much shorter than writing equivalent try-finally blocks:

with open('workfile') as f:
... read_data = f.read()
f.closed
True

If you’re not using the with keyword, then you should call f.close() to close the file and immediately free up...

http://book.pythontips.com/en/latest/context_managers.html
Context managers allow you to allocate and release resources precisely when you want to.
[...]
with open('some_file', 'w') as opened_file:
opened_file.write('Hola!')

[...]
Clear as mud now?

This comment has been minimized.

@hagbard-01

hagbard-01 Aug 23, 2018

Member

I'll check once I'm home.

@hagbard-01

hagbard-01 Aug 23, 2018

Member

I'll check once I'm home.

This comment has been minimized.

@hagbard-01

hagbard-01 Aug 23, 2018

Member

code is: open('test','w').write("test")

open("test", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
write(3, "test", 4) = 4
close(3) = 0 <---
rt_sigaction(SIGINT, {sa_

@hagbard-01

hagbard-01 Aug 23, 2018

Member

code is: open('test','w').write("test")

open("test", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
write(3, "test", 4) = 4
close(3) = 0 <---
rt_sigaction(SIGINT, {sa_

This comment has been minimized.

@hagbard-01

hagbard-01 Aug 23, 2018

Member

fd = open('test','w')
fd.write("test")

File not closed when exit:
open("test", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fee1c3c30c0}, {sa_handler=0x55f8c7803a70, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fee1c3c30c0}, 8) = 0
write(3, "test", 4) = 4
close(3) = 0 <-- ouch
brk(0x55f8c8650000) = 0x55f8c8650000
exit_group(0) =

fd = open('test','w')
fd.write("test")
fd.close()

open("test", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
write(3, "test", 4) = 4
close(3) = 0 <--
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fd641ab40c0}, {sa_handler=0x5582db462a70, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fd641ab40c0}, 8) = 0
brk(0x5582dc3b8000) = 0x5582dc3b8000
exit_group(0)

@hagbard-01

hagbard-01 Aug 23, 2018

Member

fd = open('test','w')
fd.write("test")

File not closed when exit:
open("test", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fee1c3c30c0}, {sa_handler=0x55f8c7803a70, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fee1c3c30c0}, 8) = 0
write(3, "test", 4) = 4
close(3) = 0 <-- ouch
brk(0x55f8c8650000) = 0x55f8c8650000
exit_group(0) =

fd = open('test','w')
fd.write("test")
fd.close()

open("test", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
write(3, "test", 4) = 4
close(3) = 0 <--
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fd641ab40c0}, {sa_handler=0x5582db462a70, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fd641ab40c0}, 8) = 0
brk(0x5582dc3b8000) = 0x5582dc3b8000
exit_group(0)

This comment has been minimized.

@runborg

runborg Aug 24, 2018

i see your right :) 👍 i've done the same test myself now and, yea it closes cleanly.
But, i still dont think the command is pythonic and easy to read.. i would prefer to use a 2liner with the "with" statement. but lets leave it there :)

@runborg

runborg Aug 24, 2018

i see your right :) 👍 i've done the same test myself now and, yea it closes cleanly.
But, i still dont think the command is pythonic and easy to read.. i would prefer to use a 2liner with the "with" statement. but lets leave it there :)

This comment has been minimized.

@hagbard-01

hagbard-01 Aug 24, 2018

Member

No prob, I can extend the statement if it's easier to read.

@hagbard-01

hagbard-01 Aug 24, 2018

Member

No prob, I can extend the statement if it's easier to read.

@@ -223,28 +227,61 @@ def apply(c):
open('/sys/class/net/' + str(intf) + '/ifalias','w').write(str(cnf_descr))
def configure_interface(c, intf):
wg_config = {

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 2 spaces, expected 4 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 2 spaces, expected 4 rule

@@ -223,28 +227,61 @@ def apply(c):
open('/sys/class/net/' + str(intf) + '/ifalias','w').write(str(cnf_descr))
def configure_interface(c, intf):
wg_config = {
'interface' : intf,

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

@@ -223,28 +227,61 @@ def apply(c):
open('/sys/class/net/' + str(intf) + '/ifalias','w').write(str(cnf_descr))
def configure_interface(c, intf):
wg_config = {
'interface' : intf,
'listen-port' : 0,

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

wg_config = {
'interface' : intf,
'listen-port' : 0,
'private-key' : '/config/auth/wireguard/private.key',

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

'interface' : intf,
'listen-port' : 0,
'private-key' : '/config/auth/wireguard/private.key',
'peer' :

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

'private-key' : '/config/auth/wireguard/private.key',
'peer' :
{
'pubkey' : ''

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

{
'pubkey' : ''
},
'allowed-ips' : [],

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

'pubkey' : ''
},
'allowed-ips' : [],
'fwmark' : 0x00,

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

},
'allowed-ips' : [],
'fwmark' : 0x00,
'endpoint' : None,

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

'allowed-ips' : [],
'fwmark' : 0x00,
'endpoint' : None,
'keepalive' : 0

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

@@ -107,20 +112,20 @@ def get_config():
{
p : {
'allowed-ips' : [],
'endpoint' : ''
'endpoint' : '',

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

@@ -107,20 +112,20 @@ def get_config():
{
p : {
'allowed-ips' : [],
'endpoint' : ''
'endpoint' : '',
'pubkey' : ''

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Wrong hanging indentation (add 2 spaces). rule

" private-key " + pk + \
" peer " + p
## mandatory settings
wg_config['peer']['pubkey'] = c['interfaces'][intf]['peer'][p]['pubkey']

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

}
}
)
if c.exists(cnf + ' peer ' + p + ' pubkey'):

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

CRITICAL Refactor this code to not nest more than 4 "if", "for", "while", "try" and "with" statements. rule
MINOR Bad indentation. Found 10 spaces, expected 20 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

CRITICAL Refactor this code to not nest more than 4 "if", "for", "while", "try" and "with" statements. rule
MINOR Bad indentation. Found 10 spaces, expected 20 rule

" peer " + p
## mandatory settings
wg_config['peer']['pubkey'] = c['interfaces'][intf]['peer'][p]['pubkey']
wg_config['allowed-ips'] = c['interfaces'][intf]['peer'][p]['allowed-ips']

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 4 spaces, expected 8 rule

}
}
)
if c.exists(cnf + ' peer ' + p + ' pubkey'):
config_data['interfaces'][intfc]['peer'][p]['pubkey'] = c.return_value(cnf + ' peer ' + p + ' pubkey')

This comment has been minimized.

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 12 spaces, expected 24 rule

@vyosbot

vyosbot Aug 23, 2018

Collaborator

MINOR Bad indentation. Found 12 spaces, expected 24 rule

@hagbard-01

This comment has been minimized.

Show comment
Hide comment
@hagbard-01

hagbard-01 Aug 23, 2018

Member

I'm gonna close this one, because of the sonar messages.

Member

hagbard-01 commented Aug 23, 2018

I'm gonna close this one, because of the sonar messages.

@hagbard-01 hagbard-01 closed this Aug 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment