Replication steps:
1. Get an fresh FreeBSD jail instalation with
2. Ran
4. Set the
5. Run
6. run
7. run
8. Try to mount your NFS share with
9. Go tho the Linux machine and try the same mount and get
[/cmd]
1. Get an fresh FreeBSD jail instalation with
bsdinstall jail at /jails/nfs.2. Ran
jail -crm -f jail.conf, where the file content is
Code:
nfs {
exec.clean;
#exec.start = "zfs mount zroot/jroh/nfs-jailed";
exec.start += "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown jail";
exec.consolelog = "/var/log/jail_console_${name}.log";
allow.raw_sockets;
allow.nfsd;
allow.mount;
allow.mount.devfs;
allow.mount.zfs;
mount.devfs;
enforce_statfs = 1;
devfs_ruleset = 5;
path = "/jails/${name}";
host.hostname = "${name}";
$id = "6";
$ip = "192.168.0.${id}/24";
$gateway = "192.168.0.1";
$bridge = "bridge0";
$epair = "epair${id}";
vnet;
vnet.interface = "${epair}b";
exec.created += "zfs jail nfs zroot/jroh/nfs-jailed";
exec.prestart = "/sbin/ifconfig ${epair} create up";
exec.prestart += "/sbin/ifconfig ${epair}a up descr jail:${name}";
exec.prestart += "/sbin/ifconfig ${bridge} addm ${epair}a up";
exec.start += "/sbin/ifconfig ${epair}b ${ip} up";
exec.start += "/sbin/route add default ${gateway}";
exec.poststop = "/sbin/ifconfig ${bridge} deletem ${epair}a";
exec.poststop += "/sbin/ifconfig ${epair}a destroy";
#exec.release += "zfs unjail nfs zroot/codata/nfs";
}
/etc/rc.conf of the jail to
Code:
moused_nondefault_enable="NO"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
# dumpdev="NO"
nfs_server_enable="YES"
nfsv4_server_enable="YES"
nfsuserd_enable="YES"
nfs_server_flags="-t -n 4"
rpcbind_enable="YES"
mountd_flags="-r"
mountd_enable="YES"
rpc_lockd_enable="YES"
Code:
cat | jexec nfs tee /etc/exports <<EOF
V4: /jroh/nfs-jailed/
/jroh/nfs-jailed/probe1 -mapall=root -sec=krb5p
# Some comment
/jroh/nfs-jailed/probe2 -mapall=root 192.168.0.201 # IP of the linux machine
/jroh/nfs-jailed/probe2 -mapall=root 192.168.0.226 # IP of the bridge
/jroh/nfs-jailed/probe3 10.10.10.10
EOF
Code:
jexec nfs service rpcbind enable
jexec nfs service nfsd enable
jexec nfs service mountd enable
jexec nfs service rpcbind status || jexec nfs service rpcbind start
jexec nfs service nfsd status || jexec nfs service nfsd start
jexec nfs service mountd status || jexec nfs service mountd start
jexec nfs showmount -e and get
Code:
Exports list on localhost:
/jroh/nfs-jailed/probe3 10.10.10.10
/jroh/nfs-jailed/probe2 192.168.0.201 192.168.0.226
/jroh/nfs-jailed/probe1 Everyone
mount -t nfs nfs.my.domain:/jroh/nfs-jailed/probe2 /mnt and get
Code:
mount_nfs: nmount: /mnt: Permission denied
Code:
mount.nfs: mounting nfs.my.domain:/jroh/nfs-jailed/probe2 failed, reason given by server: No such file or directory
Last edited: