Skip to content
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

aker log uses insecure 777 perms #80

Open
anazmy opened this issue Aug 20, 2018 · 7 comments
Open

aker log uses insecure 777 perms #80

anazmy opened this issue Aug 20, 2018 · 7 comments

Comments

@anazmy
Copy link
Contributor

anazmy commented Aug 20, 2018

Explore options to drop the need for 777 perms.

@Dryusdan
Copy link

The perm is not writed by ssh process ?
Else you can add all user on ssh group, make 720 permission (denied read of group) or 760 :)

@anazmy
Copy link
Contributor Author

anazmy commented Aug 20, 2018

Hey @Dryusdan I think there are various options. Exploring what are the best ones.

@Dryusdan
Copy link

Hey o/
There are lot of option :)
Daemon who write logs, user group... :)
Good research :)

@anazmy
Copy link
Contributor Author

anazmy commented Aug 20, 2018

Combining something similar to:

facility = logging.handlers.SysLogHandler.LOG_LOCAL6
syslog = logging.handlers.SysLogHandler(address='/dev/log',facility=facility)
syslog.setFormatter(logging.Formatter('Aker: %(module)s %(levelname)s - %(message)s'))
logging.root.addHandler(syslog)
logging.root.setLevel(config.log_level)

With simple syslog config might be helpful.

@anazmy
Copy link
Contributor Author

anazmy commented Aug 20, 2018

Testing the below combination, I think it provides needed separation with minimal intervention.

mkdir  /var/log/aker
chmod 777 /var/log/aker/
setfacl -Rd -m o::rwX /var/log/aker/
touch /var/log/aker/aker.log
chmod 640 /var/log/aker/aker.log 

@Dryusdan
Copy link

I never seen setfacl command 😅

Question, when user connect, it's execute aker, so /var/log/aker/aker.log can write with lot of user, so I think 640 is not good 🤔

What do you think?

@anazmy
Copy link
Contributor Author

anazmy commented Aug 21, 2018

Well in this test I'm using syslog facilities instead, so that will not be a problem as users are not actually writing directly to aker.log.
Plus users will have separate log dirs for their sessions output, like below:

# ls -altr /var/log/aker/20180820/
total 8
drwxrwxrwx+ 3 root   root     38 Aug 20 21:53 ..
drwxr-x---+ 2 jsmith jsmith 4096 Aug 20 21:53 jsmith
drwxrwxrwx+ 4 jsmith jsmith   34 Aug 20 21:53 .
drwxr-x---+ 2 anazmy anazmy 4096 Aug 20 21:53 anazmy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants