0

i'm a student and i'm trying to make a SSL certificate because i'm following this guide: https://www.server-world.info/en/note?os=Fedora_27&p=httpd&f=13

I'm running in vbox Fedora Server 38

I got this output:

[wlima@wlimaserver certs]$ sudo umask 77 ; /usr/bin/openssl genrsa -aes128 2048 > server.key
[sudo] password for wlima:
bash: server.key: Permission denied

I already checked the audit.log to search for something related with the openssl. [sudo grep "openssl" /var/log/audit/audit.log] , nothing displayed. I have the 731 value in this directory, so i think that it isn't a permissions related problem. I even runned the mount command to make sure that i didn't have this mounted as read-only.

[wlima@wlimaserver certs] mount 
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) 
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel) 
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=4096k,nr_inodes=494111,mode=755,inode64) 
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) 
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel,inode64) 
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000) 
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,size=799124k,nr_inodes=819200,mode=755,inode64) 
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate,memory_recursiveprot) 
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime,seclabel) 
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700) 
ramfs on /run/credentials/systemd-vconsole-setup.service type ramfs (ro,nosuid,nodey,noexec,relatime,seclabel,mode=700) 
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime) 
dev/mapper/fedora-root on / type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota) 
selinuxfs on /sys/fs/selinux type selinuxfs (rw,nosuid,noexec,relatime) 
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=33,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=20733) 
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel,pagesize=2M) 
mqueue on /dev/mqueue type mgueue (rw,nosuid,nodev,noexec,relatime,seclabel) 
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime,seclabel) 
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime,seclabel) 
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime) 
ramfs on /run/credentials/systemd-sysctl.service type ramfs (ro,nosuid,nodev,noexec,relatime,seclabel,mode=700) 
ramfs on /run/credentials/systemd-sysusers.service type ramfs (ro,nosuid,nodev,noexec,relatime,seclabel,mode=700) 
ramfs on /run/credentials/systemd-tmpfiles-setup-dev.service type ramfs (ro,nosuid,nodev,noexec,relatime,seclabel,mode=700) 
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,seclabel,size=1997812k,nr_inodes=1048576,inode64) 
dev/sda2 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,1ogbufs=8,logbsize=32k,noquota) 
ramfs on /run/credentials/systemd-tmpfiles-setup.service type ramfs (ro,nosuid,nodev,noexec,relatime,seclabel,mode=700) 
ramfs on /run/credentials/systemd-resolved.service type ramfs (ro,nosuid,nodev,noexec,relatime,seclabel,mode=700) 
sunrpc on /yar/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime) 
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=399560k,nr_inodes=99890,mode=700,uid=1000,gid=1000,inode64) [wima@wlimaserver certs]$ 

I will be thankfull if someone would be able to help me!

EDIT:

I modified the command for this:

sudo umask 77 ; sudo /usr/bin/openssl genrsa -aes128 2048 > server.key

It still gives me the same Permission denied output

  • probably you will need to add sudo before the openssl command as it doesn't pass for the first command to the second one. – admstg Jun 06 '23 at 09:46
  • Your 2nd command (sudo chmod...; sudo ...) need privileges too. – K-attila- Jun 06 '23 at 09:47
  • please refrain from pasting your input/output as screenshots - they are hard to read, cannot be copied nor searched. Kindly copy and format using the proper tools of U&L. see here – FelixJN Jun 06 '23 at 09:49
  • @admstg @K-att- I modified the command for this: sudo umask 77 ; sudo /usr/bin/openssl genrsa -aes128 2048 > server.key It still gives me the same Permission denied output – Wilson Lima Jun 06 '23 at 10:01
  • @FelixJN I'm sorry, i will modify next time! Thanks for tip! – Wilson Lima Jun 06 '23 at 10:03

1 Answers1

0

TL;DR

Use sudo -i to become root. You may also ommit sudo in front of commands now.

Long story

The redirection does not take sudo as you would expect. You would need tee or something to work around the issue. You effectively try to write with > server.key which will never work in restricted directory.