Удалить первый символ многострочной -строки в текстовом файле

Похоже, считается, что если кто-то сможет прочитать pritners.conf и украсть его, ваша система уже скомпрометирована.

Я не нашел решения этой проблемы. На данный момент убедитесь, что вы не используете какие-либо конфиденциальные пароли в качестве пароля для принтера...

Это не большая проблема, так как прочитать его можно только от имени пользователя root.

Справочные ссылки :https://github.com/apple/cups/issues/3174

CUPS.org User: mike

[For future reference, we do not consider this to be a security issue...]

Hardcoding usernames and passwords has never been recommended, but we restrict the permissions on the printers.conf file and sanitize the device-uri that is returned by Get-Printer-Attributes and passed in argv[0] to the backends to minimize exposure for users that chose to go this route.

The recommended solution is to use forwarded credentials, either via Kerberos or regular username/password information passed with the print request. IIRC, the Red Hat print status monitor supports this mechanism and uses the GNOME keyring to remember the necessary authentication information as needed.

Storing system-wide password information in a user keyring will never happen.

https://security.stackexchange.com/questions/109433/samba-printer-usernames-and-passwords-security-problem

I really don't feel this is a problem and I will explain you why. If anybody got root access they could just sniff the traffic so every time anybody tries to authenticate the attacker can grab the hash of the password.

If anyone gets root access they can start arp spoffing DNS spoofing spoofing spoofing, which makes your network if compromised even more compromised.

If anyone gets root access they can log the keystrokes /events /everything going on

*nix users tend to have the most updated version of common sense

Somebody with system on an windows system got the same amount of access.

Worrying about someone reading a clear text password for an account with lover privileges, when they got root, is like worrying about a crack in the floor when the building is crumbling around you

What you should worry about is people getting root ;)

Stay safe

-2
17.06.2021, 08:27
3 ответа

GNU-сед

sed -i -e '
  /^# enable bash completion /,/^#fi/!b
  /^# enable bash completion /n
  s/^#//
' /etc/bash.bashrc

perl -pi -e '
  my $e = /^# enable bash completion /... /^#fi$/m;
  $e =~ /^1?$/ || s/^#//;
' /etc/bash.bashrc
0
28.07.2021, 11:24

Следующее удалит все #в начале строки от строки после # enable bash completion in interactive shellsдо последней непрерывной строки, начинающейся с#:

$ awk '
    f && !sub(/^#/,"") { f=0 }
    $0 == "# enable bash completion in interactive shells" { f=1 }
1' file
# System-wide.bashrc file for interactive bash(1) shells.

...

# enable bash completion in interactive shells
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
   . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
   . /etc/bash_completion
  fi
fi

...

EOF
0
28.07.2021, 11:24
sed -n -e '
 /^# enable bash completion/{
  h 
  :a {
   n
   /^#fi$/!{
    H 
    ba
   }
  }
  g
  s/#//g
  s/.*/#&\nfi/
 }
 p
' data

Сохраните строку в области хранения, если мы получим раздел bash completionи будем добавлять каждую строку в область хранения, пока не достигнем последней fi. В этот момент получите содержимое удерживаемого пространства и :1 )удалите все #, 2 )Поместите #перед enable bash completion...и добавьте последний fiк блоку..

Добавить параметр -i, чтобы позволить sedвносить изменения в сам файл:sed -n -i -e 'the previous sed command'

0
28.07.2021, 11:24

Теги

Похожие вопросы